KiCad PCB EDA Suite
SHAPE_COMPOUND Class Reference

#include <shape_compound.h>

Inheritance diagram for SHAPE_COMPOUND:
SHAPE SHAPE_BASE

Public Member Functions

 SHAPE_COMPOUND ()
 
 SHAPE_COMPOUND (const std::vector< SHAPE * > &aShapes)
 
 SHAPE_COMPOUND (const SHAPE_COMPOUND &aOther)
 
 ~SHAPE_COMPOUND ()
 
SHAPE_COMPOUNDClone () const override
 Function Clone() More...
 
const std::string Format () const override
 
bool Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
 Function Collide() More...
 
bool Collide (const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override
 Function Collide() More...
 
bool Collide (const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
 
const std::vector< SHAPE * > & Shapes () const
 
const BOX2I BBox (int aClearance=0) const override
 Function BBox() More...
 
int Distance (const SEG &aSeg) const
 
void Move (const VECTOR2I &aVector) override
 
void AddShape (SHAPE *aShape)
 
bool Empty () const
 
int Size () const
 
void Rotate (double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
 Function Rotate. More...
 
bool IsSolid () const override
 
SHAPEUniqueSubshape () const
 
virtual bool HasIndexableSubshapes () const override
 
virtual size_t GetIndexableSubshapeCount () const override
 
virtual void GetIndexableSubshapes (std::vector< SHAPE * > &aSubshapes) override
 
bool ConvertToSimplePolygon (SHAPE_SIMPLE *aOut) const
 
bool IsNull () const
 Function IsNull() More...
 
virtual bool Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
 Function Collide() More...
 
virtual VECTOR2I Centre () const
 Function Centre() More...
 
virtual bool Parse (std::stringstream &aStream)
 
FACETNewFacet ()
 
SGNODECalcShape (SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false)
 
SHAPE_TYPE Type () const
 Function Type() More...
 

Protected Types

typedef VECTOR2I::extended_type ecoord
 

Protected Attributes

SHAPE_TYPE m_type
 

type of our shape

More...
 

Private Attributes

BOX2I m_cachedBBox
 
bool m_dirty
 
std::vector< SHAPE * > m_shapes
 

Detailed Description

Definition at line 35 of file shape_compound.h.

Member Typedef Documentation

◆ ecoord

typedef VECTOR2I::extended_type SHAPE::ecoord
protectedinherited

Definition at line 125 of file shape.h.

Constructor & Destructor Documentation

◆ SHAPE_COMPOUND() [1/3]

SHAPE_COMPOUND::SHAPE_COMPOUND ( )
inline

Definition at line 38 of file shape_compound.h.

38  :
39  SHAPE( SH_COMPOUND ),
40  m_dirty( true )
41  {
42  }
set of polygons (with holes, etc.)
Definition: shape.h:49
SHAPE(SHAPE_TYPE aType)
Constructor.
Definition: shape.h:134

Referenced by Clone().

◆ SHAPE_COMPOUND() [2/3]

SHAPE_COMPOUND::SHAPE_COMPOUND ( const std::vector< SHAPE * > &  aShapes)

Definition at line 42 of file shape_compound.cpp.

42  :
43  SHAPE( SH_COMPOUND ),
44  m_dirty( true ),
45  m_shapes( aShapes )
46 {
47 
48 }
set of polygons (with holes, etc.)
Definition: shape.h:49
SHAPE(SHAPE_TYPE aType)
Constructor.
Definition: shape.h:134
std::vector< SHAPE * > m_shapes

◆ SHAPE_COMPOUND() [3/3]

SHAPE_COMPOUND::SHAPE_COMPOUND ( const SHAPE_COMPOUND aOther)

Definition at line 51 of file shape_compound.cpp.

52  : SHAPE( SH_COMPOUND )
53 {
54  for ( auto shape : aOther.Shapes() )
55  m_shapes.push_back( shape->Clone() );
56 
57  m_dirty = true;
58 }
set of polygons (with holes, etc.)
Definition: shape.h:49
SHAPE(SHAPE_TYPE aType)
Constructor.
Definition: shape.h:134
const std::vector< SHAPE * > & Shapes() const
std::vector< SHAPE * > m_shapes

References m_dirty, m_shapes, and Shapes().

◆ ~SHAPE_COMPOUND()

SHAPE_COMPOUND::~SHAPE_COMPOUND ( )

Definition at line 63 of file shape_compound.cpp.

64 {
65  for( auto shape : m_shapes )
66  delete shape;
67 }
std::vector< SHAPE * > m_shapes

References m_shapes.

Member Function Documentation

◆ AddShape()

void SHAPE_COMPOUND::AddShape ( SHAPE aShape)
inline

Definition at line 78 of file shape_compound.h.

79  {
80  // Don't make clients deal with nested SHAPE_COMPOUNDs
81  if( aShape->HasIndexableSubshapes() )
82  {
83  std::vector<SHAPE*> subshapes;
84  aShape->GetIndexableSubshapes( subshapes );
85 
86  for( SHAPE* subshape : subshapes )
87  m_shapes.push_back( subshape->Clone() );
88 
89  delete aShape;
90  }
91  else
92  {
93  m_shapes.push_back( aShape );
94  }
95 
96  m_dirty = true;
97  }
SHAPE.
Definition: shape.h:122
virtual void GetIndexableSubshapes(std::vector< SHAPE * > &aSubshapes)
Definition: shape.h:110
std::vector< SHAPE * > m_shapes
virtual bool HasIndexableSubshapes() const
Definition: shape.h:103

References SHAPE_BASE::GetIndexableSubshapes(), SHAPE_BASE::HasIndexableSubshapes(), m_dirty, and m_shapes.

◆ BBox()

const BOX2I SHAPE_COMPOUND::BBox ( int  aClearance = 0) const
overridevirtual

Function BBox()

Computes a bounding box of the shape, with a margin of aClearance a collision.

Parameters
aClearancehow much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape.
Returns
the bounding box.

Implements SHAPE.

Definition at line 76 of file shape_compound.cpp.

77 {
78  BOX2I bb;
79 
80  if ( m_shapes.size() < 1 )
81  return bb;
82 
83  bb = m_shapes[0]->BBox();
84 
85  for( int i = 1; i < m_shapes.size(); i++ )
86  bb.Merge( m_shapes[i]->BBox() );
87 
88  return bb;
89 }
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: box2.h:386
std::vector< SHAPE * > m_shapes

References m_shapes, and BOX2< Vec >::Merge().

◆ CalcShape()

SGNODE * SHAPE::CalcShape ( SGNODE aParent,
SGNODE aColor,
WRL1_ORDER  aVertexOrder,
float  aCreaseLimit = 0.74317,
bool  isVRML2 = false 
)
inherited

Definition at line 713 of file wrlfacet.cpp.

715 {
716  if( facets.empty() || !facets.front()->HasMinPoints() )
717  return NULL;
718 
719  std::vector< std::list< FACET* > > flist;
720 
721  // determine the max. index and size flist as appropriate
722  std::list< FACET* >::iterator sF = facets.begin();
723  std::list< FACET* >::iterator eF = facets.end();
724 
725  int maxIdx = 0;
726  int tmi;
727  float maxV = 0.0;
728  float tV = 0.0;
729 
730  while( sF != eF )
731  {
732  tV = ( *sF )->CalcFaceNormal();
733  tmi = ( *sF )->GetMaxIndex();
734 
735  if( tmi > maxIdx )
736  maxIdx = tmi;
737 
738  if( tV > maxV )
739  maxV = tV;
740 
741  ++sF;
742  }
743 
744  ++maxIdx;
745 
746  if( maxIdx < 3 )
747  return NULL;
748 
749  flist.resize( maxIdx );
750 
751  // create the lists of facets common to indices
752  sF = facets.begin();
753 
754  while( sF != eF )
755  {
756  ( *sF )->Renormalize( tV );
757  ( *sF )->CollectVertices( flist );
758  ++sF;
759  }
760 
761  // calculate the normals
762  size_t vs = flist.size();
763 
764  for( size_t i = 0; i < vs; ++i )
765  {
766  sF = flist[i].begin();
767  eF = flist[i].end();
768 
769  while( sF != eF )
770  {
771  ( *sF )->CalcVertexNormal( static_cast<int>( i ), flist[i], aCreaseLimit );
772  ++sF;
773  }
774  }
775 
776  std::vector< WRLVEC3F > vertices;
777  std::vector< WRLVEC3F > normals;
778  std::vector< SGCOLOR > colors;
779 
780  // push the facet data to the final output list
781  sF = facets.begin();
782  eF = facets.end();
783 
784  while( sF != eF )
785  {
786  ( *sF )->GetData( vertices, normals, colors, aVertexOrder );
787  ++sF;
788  }
789 
790  flist.clear();
791 
792  if( vertices.size() < 3 )
793  return NULL;
794 
795  IFSG_SHAPE shapeNode( false );
796 
797  if( !isVRML2 )
798  {
799  shapeNode.NewNode( aParent );
800 
801  if( aColor )
802  {
803  if( NULL == S3D::GetSGNodeParent( aColor ) )
804  shapeNode.AddChildNode( aColor );
805  else
806  shapeNode.AddRefNode( aColor );
807  }
808  }
809 
810  std::vector< SGPOINT > lCPts; // vertex points in SGPOINT (double) format
811  std::vector< SGVECTOR > lCNorm; // per-vertex normals
812  vs = vertices.size();
813 
814  for( size_t i = 0; i < vs; ++i )
815  {
816  SGPOINT pt;
817  pt.x = vertices[i].x;
818  pt.y = vertices[i].y;
819  pt.z = vertices[i].z;
820  lCPts.push_back( pt );
821  lCNorm.emplace_back( normals[i].x, normals[i].y, normals[i].z );
822  }
823 
824  vertices.clear();
825  normals.clear();
826 
827  IFSG_FACESET fsNode( false );
828 
829  if( !isVRML2 )
830  fsNode.NewNode( shapeNode );
831  else
832  fsNode.NewNode( aParent );
833 
834  IFSG_COORDS cpNode( fsNode );
835  cpNode.SetCoordsList( lCPts.size(), &lCPts[0] );
836  IFSG_COORDINDEX ciNode( fsNode );
837 
838  for( int i = 0; i < (int)lCPts.size(); ++i )
839  ciNode.AddIndex( i );
840 
841  IFSG_NORMALS nmNode( fsNode );
842  nmNode.SetNormalList( lCNorm.size(), &lCNorm[0] );
843 
844  if( !colors.empty() )
845  {
846  IFSG_COLORS nmColor( fsNode );
847  nmColor.SetColorList( colors.size(), &colors[0] );
848  colors.clear();
849  }
850 
851  if( !isVRML2 )
852  return shapeNode.GetRawPtr();
853 
854  return fsNode.GetRawPtr();
855 }
double x
Definition: sg_base.h:70
IFSG_COORDS is the wrapper for SGCOORDS.
Definition: ifsg_coords.h:40
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
IFSG_COLORS is the wrapper for SGCOLORS.
Definition: ifsg_colors.h:41
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:636
double y
Definition: sg_base.h:71
IFSG_NORMALS is the wrapper for the SGNORMALS class.
Definition: ifsg_normals.h:40
#define NULL
std::list< FACET * > facets
Definition: wrlfacet.h:143
IFSG_FACESET is the wrapper for the SGFACESET class.
Definition: ifsg_faceset.h:40
double z
Definition: sg_base.h:72
static VRML_COLOR colors[VRML_COLOR_LAST]
IFSG_SHAPE is the wrapper for the SGSHAPE class.
Definition: ifsg_shape.h:40

References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), colors, SHAPE::facets, IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), NULL, IFSG_COLORS::SetColorList(), IFSG_COORDS::SetCoordsList(), IFSG_NORMALS::SetNormalList(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.

Referenced by WRL1FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL2FACESET::TranslateToSG().

◆ Centre()

virtual VECTOR2I SHAPE::Centre ( ) const
inlinevirtualinherited

Function Centre()

Computes a center-of-mass of the shape

Returns
the center-of-mass point

Definition at line 232 of file shape.h.

233  {
234  return BBox( 0 ).Centre(); // if nothing better is available....
235  }
virtual const BOX2I BBox(int aClearance=0) const =0
Function BBox()
Vec Centre() const
Definition: box2.h:79

References SHAPE::BBox(), and BOX2< Vec >::Centre().

Referenced by Collide(), and PNS_PCBNEW_RULE_RESOLVER::CollideHoles().

◆ Clone()

SHAPE_COMPOUND * SHAPE_COMPOUND::Clone ( ) const
overridevirtual

Function Clone()

Returns a dynamically allocated copy of the shape

Return values
copyof the shape

Reimplemented from SHAPE.

Definition at line 70 of file shape_compound.cpp.

71 {
72  return new SHAPE_COMPOUND( *this );
73 }

References SHAPE_COMPOUND().

◆ Collide() [1/4]

bool SHAPE_COMPOUND::Collide ( const SEG aSeg,
int  aClearance = 0,
int *  aActual = nullptr,
VECTOR2I aLocation = nullptr 
) const
overridevirtual

Function Collide()

Checks if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision.

Parameters
aActual[out] an optional pointer to an int to be updated with the actual distance int the event of a collision.
aLocation[out] an option pointer to a point to store a nearby location in the event of a collision.
Returns
true, if there is a collision.

Implements SHAPE.

Definition at line 117 of file shape_compound.cpp.

119 {
120  int closest_dist = std::numeric_limits<int>::max();
121  VECTOR2I nearest;
122 
123  for( SHAPE* item : m_shapes )
124  {
125  int actual = 0;
126  VECTOR2I pn;
127 
128  if( item->Collide( aSeg, aClearance,
129  aActual || aLocation ? &actual : nullptr,
130  aLocation ? &pn : nullptr ) )
131  {
132  if( actual < closest_dist )
133  {
134  nearest = pn;
135  closest_dist = actual;
136 
137  if( closest_dist == 0 || !aActual )
138  break;
139  }
140  }
141  }
142 
143  if( closest_dist == 0 || closest_dist < aClearance )
144  {
145  if( aLocation )
146  *aLocation = nearest;
147 
148  if( aActual )
149  *aActual = closest_dist;
150 
151  return true;
152  }
153 
154  return false;
155 }
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
SHAPE.
Definition: shape.h:122
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ Collide() [2/4]

bool SHAPE_COMPOUND::Collide ( const SHAPE aShape,
int  aClearance,
VECTOR2I aMTV 
) const
inlineoverridevirtual

Function Collide()

Checks if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.

Parameters
aShapeshape to check collision against
aClearanceminimum clearance
aMTVminimum translation vector
aActual[out] an optional pointer to an int to store the actual distance in the event of a collision.
aLocation[out] an option pointer to a point to store a nearby location in the event of a collision.
Returns
true, if there is a collision.

Reimplemented from SHAPE.

Definition at line 56 of file shape_compound.h.

57  {
58  return SHAPE::Collide( aShape, aClearance, aMTV );
59  }
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Function Collide()
Definition: shape.h:176

References SHAPE::Collide().

◆ Collide() [3/4]

bool SHAPE_COMPOUND::Collide ( const SHAPE aShape,
int  aClearance = 0,
int *  aActual = nullptr,
VECTOR2I aLocation = nullptr 
) const
inlineoverridevirtual

Reimplemented from SHAPE.

Definition at line 61 of file shape_compound.h.

63  {
64  return SHAPE::Collide( aShape, aClearance, aActual, aLocation );
65  }
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Function Collide()
Definition: shape.h:176

References SHAPE::Collide().

◆ Collide() [4/4]

virtual bool SHAPE::Collide ( const VECTOR2I aP,
int  aClearance = 0,
int *  aActual = nullptr,
VECTOR2I aLocation = nullptr 
) const
inlinevirtualinherited

Function Collide()

Checks if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.

Parameters
aActual[out] an optional pointer to an int to store the actual distance in the event of a collision.
aLocation[out] an option pointer to a point to store a nearby location in the event of a collision.
Returns
true, if there is a collision.

Reimplemented in SHAPE_POLY_SET, SHAPE_LINE_CHAIN_BASE, SHAPE_ARC, and SHAPE_SEGMENT.

Definition at line 176 of file shape.h.

178  {
179  return Collide( SEG( aP, aP ), aClearance, aActual, aLocation );
180  }
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Function Collide()
Definition: shape.h:176
Definition: seg.h:39

Referenced by DRC_RTREE::CheckColliding(), Collide(), SHAPE_SEGMENT::Collide(), collide(), SHAPE_RECT::Collide(), SHAPE_POLY_SET::Collide(), PNS::ITEM::collideSimple(), PNS::SHOVE::onCollidingVia(), PNS::HIT_VISITOR::operator()(), DRC_RTREE::QueryColliding(), PNS::OPTIMIZER::smartPadsSingle(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem().

◆ ConvertToSimplePolygon()

bool SHAPE_COMPOUND::ConvertToSimplePolygon ( SHAPE_SIMPLE aOut) const

Definition at line 158 of file shape_compound.cpp.

159 {
160  return false;
161 }

◆ Distance()

int SHAPE_COMPOUND::Distance ( const SEG aSeg) const

Definition at line 98 of file shape_compound.cpp.

99 {
100  assert(false);
101  return 0; // Make compiler happy
102 }

◆ Empty()

bool SHAPE_COMPOUND::Empty ( ) const
inline

Definition at line 99 of file shape_compound.h.

100  {
101  return m_shapes.empty();
102  }
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ Format()

const std::string SHAPE_COMPOUND::Format ( ) const
overridevirtual

Reimplemented from SHAPE.

Definition at line 30 of file shape_compound.cpp.

31 {
32  std::stringstream ss;
33 
34  ss << "compound( ";
35 
36  for( auto shape : m_shapes )
37  ss << shape->Format() << " ";
38 
39  return ss.str();
40 }
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ GetIndexableSubshapeCount()

virtual size_t SHAPE_COMPOUND::GetIndexableSubshapeCount ( ) const
inlineoverridevirtual

Reimplemented from SHAPE_BASE.

Definition at line 123 of file shape_compound.h.

124  {
125  return m_shapes.size();
126  }
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ GetIndexableSubshapes()

virtual void SHAPE_COMPOUND::GetIndexableSubshapes ( std::vector< SHAPE * > &  aSubshapes)
inlineoverridevirtual

Reimplemented from SHAPE_BASE.

Definition at line 128 of file shape_compound.h.

129  {
130  aSubshapes = m_shapes;
131  }
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ HasIndexableSubshapes()

virtual bool SHAPE_COMPOUND::HasIndexableSubshapes ( ) const
inlineoverridevirtual

Reimplemented from SHAPE_BASE.

Definition at line 118 of file shape_compound.h.

119  {
120  return true;
121  }

◆ IsNull()

bool SHAPE::IsNull ( ) const
inlineinherited

Function IsNull()

Returns true if the shape is a null shape.

Return values
trueif null :-)

Definition at line 160 of file shape.h.

161  {
162  return m_type == SH_NULL;
163  }
SHAPE_TYPE m_type
type of our shape
Definition: shape.h:114
circular arc
Definition: shape.h:51

References SHAPE_BASE::m_type, and SH_NULL.

◆ IsSolid()

bool SHAPE_COMPOUND::IsSolid ( ) const
overridevirtual

Implements SHAPE.

Definition at line 111 of file shape_compound.cpp.

112 {
113  return true;
114 }

◆ Move()

void SHAPE_COMPOUND::Move ( const VECTOR2I aVector)
overridevirtual

Implements SHAPE.

Definition at line 91 of file shape_compound.cpp.

92 {
93  for( auto& item : m_shapes )
94  item->Move( aVector );
95 }
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ NewFacet()

FACET * SHAPE::NewFacet ( )
inherited

Definition at line 705 of file wrlfacet.cpp.

706 {
707  FACET* fp = new FACET;
708  facets.push_back( fp );
709  return fp;
710 }
Definition: wrlfacet.h:41
std::list< FACET * > facets
Definition: wrlfacet.h:143

References SHAPE::facets.

Referenced by WRL1FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL2FACESET::TranslateToSG().

◆ Parse()

bool SHAPE::Parse ( std::stringstream &  aStream)
virtualinherited

Reimplemented in SHAPE_POLY_SET, and SHAPE_LINE_CHAIN.

Definition at line 28 of file shape.cpp.

29 {
30  assert( false );
31  return false;
32 }

◆ Rotate()

void SHAPE_COMPOUND::Rotate ( double  aAngle,
const VECTOR2I aCenter = { 0, 0 } 
)
overridevirtual

Function Rotate.

Parameters
aCenteris the rotation center
aAnglerotation angle in radians

Implements SHAPE.

Definition at line 105 of file shape_compound.cpp.

106 {
107  assert( false );
108 }

◆ Shapes()

const std::vector<SHAPE*>& SHAPE_COMPOUND::Shapes ( ) const
inline

Definition at line 67 of file shape_compound.h.

68  {
69  return m_shapes;
70  }
std::vector< SHAPE * > m_shapes

References m_shapes.

Referenced by collideShapes(), and SHAPE_COMPOUND().

◆ Size()

int SHAPE_COMPOUND::Size ( ) const
inline

Definition at line 104 of file shape_compound.h.

105  {
106  return m_shapes.size();
107  }
std::vector< SHAPE * > m_shapes

References m_shapes.

◆ Type()

SHAPE_TYPE SHAPE_BASE::Type ( ) const
inlineinherited

Function Type()

Returns the type of the shape.

Return values
thetype

Definition at line 98 of file shape.h.

99  {
100  return m_type;
101  }
SHAPE_TYPE m_type
type of our shape
Definition: shape.h:114

References SHAPE_BASE::m_type.

Referenced by PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::buildHullForPrimitiveShape(), SHAPE_POLY_SET::Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS::SOLID::Hull(), and SHAPE_FILE_IO::Write().

◆ UniqueSubshape()

SHAPE* SHAPE_COMPOUND::UniqueSubshape ( ) const
inline

Definition at line 113 of file shape_compound.h.

114  {
115  return m_shapes.size() != 1 ? nullptr : m_shapes[0];
116  }
std::vector< SHAPE * > m_shapes

References m_shapes.

Member Data Documentation

◆ m_cachedBBox

BOX2I SHAPE_COMPOUND::m_cachedBBox
private

Definition at line 136 of file shape_compound.h.

◆ m_dirty

bool SHAPE_COMPOUND::m_dirty
private

Definition at line 137 of file shape_compound.h.

Referenced by AddShape(), and SHAPE_COMPOUND().

◆ m_shapes

std::vector<SHAPE*> SHAPE_COMPOUND::m_shapes
private

◆ m_type

SHAPE_TYPE SHAPE_BASE::m_type
protectedinherited

type of our shape

Definition at line 114 of file shape.h.

Referenced by SHAPE::IsNull(), and SHAPE_BASE::Type().


The documentation for this class was generated from the following files: