KiCad PCB EDA Suite
|
#include <shape_compound.h>
Public Member Functions | |
SHAPE_COMPOUND () | |
SHAPE_COMPOUND (const std::vector< SHAPE * > &aShapes) | |
SHAPE_COMPOUND (const SHAPE_COMPOUND &aOther) | |
~SHAPE_COMPOUND () | |
SHAPE_COMPOUND * | Clone () const override |
Return a dynamically allocated copy of the shape. More... | |
const std::string | Format (bool aCplusPlus=true) const override |
bool | Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision. More... | |
bool | Collide (const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision. 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 |
Compute a bounding box of the shape, with a margin of aClearance a collision. More... | |
int | Distance (const SEG &aSeg) const |
void | Move (const VECTOR2I &aVector) override |
void | AddShape (SHAPE *aShape) |
void | AddShape (std::shared_ptr< SHAPE > aShape) |
bool | Empty () const |
int | Size () const |
void | Rotate (const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override |
bool | IsSolid () const override |
SHAPE * | UniqueSubshape () const |
virtual bool | HasIndexableSubshapes () const override |
virtual size_t | GetIndexableSubshapeCount () const override |
virtual void | GetIndexableSubshapes (std::vector< const SHAPE * > &aSubshapes) const override |
void | TransformToPolygon (SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override |
Fills a SHAPE_POLY_SET with a polygon representation of this shape. More... | |
virtual int | Distance (const VECTOR2I &aP) const |
Returns the minimum distance from a given point to this shape. More... | |
int | GetClearance (const SHAPE *aOther) const |
Return the actual minimum distance between two shapes. More... | |
bool | IsNull () const |
Return true if the shape is a null shape. More... | |
virtual bool | Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const |
Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision. More... | |
virtual VECTOR2I | Centre () const |
Compute a center-of-mass of the shape. More... | |
virtual SEG::ecoord | SquaredDistance (const VECTOR2I &aP, bool aOutlineOnly=false) const |
virtual bool | PointInside (const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const |
Check if point aP lies inside a closed shape. More... | |
virtual bool | Parse (std::stringstream &aStream) |
FACET * | NewFacet () |
SGNODE * | CalcShape (SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false) |
SHAPE_TYPE | Type () const |
Return the type of the shape. More... | |
wxString | TypeName () const |
Static Public Attributes | |
static const int | MIN_PRECISION_IU = 4 |
This is the minimum precision for all the points in a shape. 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 |
std::list< FACET * > | facets |
Definition at line 38 of file shape_compound.h.
|
protectedinherited |
|
inline |
Definition at line 41 of file shape_compound.h.
Referenced by Clone().
SHAPE_COMPOUND::SHAPE_COMPOUND | ( | const std::vector< SHAPE * > & | aShapes | ) |
Definition at line 42 of file shape_compound.cpp.
SHAPE_COMPOUND::SHAPE_COMPOUND | ( | const SHAPE_COMPOUND & | aOther | ) |
Definition at line 51 of file shape_compound.cpp.
SHAPE_COMPOUND::~SHAPE_COMPOUND | ( | ) |
Definition at line 63 of file shape_compound.cpp.
References m_shapes.
|
inline |
Definition at line 83 of file shape_compound.h.
References SHAPE_BASE::GetIndexableSubshapes(), m_dirty, and m_shapes.
|
inline |
Definition at line 104 of file shape_compound.h.
|
overridevirtual |
Compute a bounding box of the shape, with a margin of aClearance a collision.
aClearance | how much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape. |
Implements SHAPE.
Definition at line 76 of file shape_compound.cpp.
References m_shapes, and BOX2< Vec >::Merge().
|
inherited |
Definition at line 703 of file wrlfacet.cpp.
References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), SHAPE::facets, IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COLORS::SetColorList(), IFSG_COORDS::SetCoordsList(), IFSG_NORMALS::SetNormalList(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by WRL2FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL1FACESET::TranslateToSG().
|
inlinevirtualinherited |
Compute a center-of-mass of the shape.
Definition at line 232 of file shape.h.
References SHAPE::BBox(), and BOX2< Vec >::Centre().
Referenced by Collide().
|
overridevirtual |
Return a dynamically allocated copy of the shape.
copy | of the shape |
Reimplemented from SHAPE.
Definition at line 70 of file shape_compound.cpp.
References SHAPE_COMPOUND().
|
overridevirtual |
Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision.
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. |
Implements SHAPE.
Definition at line 117 of file shape_compound.cpp.
References m_shapes.
|
inlineoverridevirtual |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
aShape | shape to check collision against |
aClearance | minimum clearance |
aMTV | [out] minimum 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. |
Reimplemented from SHAPE.
Definition at line 59 of file shape_compound.h.
References SHAPE::Collide().
|
inlineoverridevirtual |
Reimplemented from SHAPE.
Definition at line 64 of file shape_compound.h.
References SHAPE::Collide().
|
inlinevirtualinherited |
Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.
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. |
Reimplemented in SHAPE_LINE_CHAIN_BASE, SHAPE_ARC, SHAPE_LINE_CHAIN, SHAPE_POLY_SET, and SHAPE_SEGMENT.
Definition at line 181 of file shape.h.
References SHAPE::Collide().
Referenced by BOOST_AUTO_TEST_CASE(), DRC_RTREE::CheckColliding(), FOOTPRINT::CheckShortingPads(), Collide(), SHAPE_RECT::Collide(), SHAPE_SEGMENT::Collide(), SHAPE_ARC::Collide(), SHAPE_POLY_SET::Collide(), SHAPE::Collide(), CN_ZONE_LAYER::Collide(), collide(), PNS::ITEM::collideSimple(), PNS::SHOVE::onCollidingVia(), PNS::HIT_VISITOR::operator()(), RN_NET::OptimizeRNEdges(), PNS::VIA::PushoutForce(), DRC_RTREE::QueryColliding(), PNS::OPTIMIZER::smartPadsSingle(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testSingleLayerItemAgainstItem().
int SHAPE_COMPOUND::Distance | ( | const SEG & | aSeg | ) | const |
Definition at line 98 of file shape_compound.cpp.
|
virtual |
|
inline |
Definition at line 123 of file shape_compound.h.
References m_shapes.
|
overridevirtual |
|
inherited |
Return the actual minimum distance between two shapes.
distance | in IU |
Definition at line 54 of file shape.cpp.
References SHAPE_BASE::GetIndexableSubshapeCount(), and SHAPE_BASE::GetIndexableSubshapes().
|
inlineoverridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 147 of file shape_compound.h.
References m_shapes.
|
inlineoverridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 152 of file shape_compound.h.
References m_shapes.
|
inlineoverridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 142 of file shape_compound.h.
|
inlineinherited |
Return true if the shape is a null shape.
true | if null :-) |
Definition at line 166 of file shape.h.
References SHAPE_BASE::m_type, and SH_NULL.
|
overridevirtual |
Implements SHAPE.
Definition at line 111 of file shape_compound.cpp.
|
overridevirtual |
|
inherited |
Definition at line 695 of file wrlfacet.cpp.
References SHAPE::facets.
Referenced by WRL2FACESET::TranslateToSG(), X3DIFACESET::TranslateToSG(), and WRL1FACESET::TranslateToSG().
|
virtualinherited |
Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_POLY_SET.
|
virtualinherited |
Check if point aP lies inside a closed shape.
Always returns false if this shape is not closed.
aPt | point to check |
aUseBBoxCache | gives better performance if the bounding box caches have been generated. |
Reimplemented in SHAPE_LINE_CHAIN_BASE, and SHAPE_POLY_SET.
Definition at line 103 of file shape.cpp.
References SHAPE_POLY_SET::COutline(), ERROR_INSIDE, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN_BASE::PointInside(), and SHAPE::TransformToPolygon().
|
overridevirtual |
aCenter | is the rotation center. |
aAngle | rotation angle. |
Implements SHAPE.
Definition at line 105 of file shape_compound.cpp.
|
inline |
Definition at line 70 of file shape_compound.h.
References m_shapes.
Referenced by collideShapes(), PNS::HOLE::Hull(), PNS::SOLID::Hull(), and SHAPE_COMPOUND().
|
inline |
Definition at line 128 of file shape_compound.h.
References m_shapes.
|
virtualinherited |
Reimplemented in SHAPE_LINE_CHAIN_BASE, and SHAPE_POLY_SET.
Definition at line 91 of file shape.cpp.
References SHAPE_POLY_SET::COutline(), VECTOR2< int >::ECOORD_MAX, ERROR_INSIDE, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN_BASE::SquaredDistance(), and SHAPE::TransformToPolygon().
Referenced by SHAPE::Distance().
|
overridevirtual |
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
aBuffer | [out] will be filled with the polygonal representation of this shape. |
aError | controls the maximum allowed deviation when converting rounded shapes to segments |
aErrorLoc | controls where the error is placed when approximating rounded shapes |
Implements SHAPE.
Definition at line 158 of file shape_compound.cpp.
References m_shapes.
|
inlineinherited |
Return the type of the shape.
the | type |
Definition at line 98 of file shape.h.
References SHAPE_BASE::m_type.
Referenced by PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::BuildHullForPrimitiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), SHAPE_POLY_SET::Collide(), Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS_LOG_VIEWER_FRAME::drawSimpleShape(), PNS::HOLE::Hull(), PNS::SOLID::Hull(), PNS::HOLE::Radius(), PNS::HOLE::SetCenter(), PNS::HOLE::SetRadius(), STROKE_PARAMS::Stroke(), and SHAPE_FILE_IO::Write().
|
inlineinherited |
Definition at line 103 of file shape.h.
References SHAPE_BASE::m_type, and SHAPE_TYPE_asString().
Referenced by Collide().
|
inline |
Definition at line 137 of file shape_compound.h.
References m_shapes.
|
privateinherited |
Definition at line 143 of file wrlfacet.h.
Referenced by SHAPE::CalcShape(), and SHAPE::NewFacet().
|
private |
Definition at line 163 of file shape_compound.h.
|
private |
Definition at line 164 of file shape_compound.h.
Referenced by AddShape(), and SHAPE_COMPOUND().
|
private |
Definition at line 165 of file shape_compound.h.
Referenced by AddShape(), BBox(), Collide(), Empty(), Format(), GetIndexableSubshapeCount(), GetIndexableSubshapes(), Move(), SHAPE_COMPOUND(), Shapes(), Size(), TransformToPolygon(), UniqueSubshape(), and ~SHAPE_COMPOUND().
|
protectedinherited |
< type of our shape
Definition at line 119 of file shape.h.
Referenced by SHAPE::Format(), SHAPE::IsNull(), SHAPE_BASE::Type(), and SHAPE_BASE::TypeName().
|
staticinherited |
This is the minimum precision for all the points in a shape.
Definition at line 131 of file shape.h.
Referenced by BOOST_AUTO_TEST_CASE(), DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), CIRCLE::IntersectLine(), and LINE_FILLET_ROUTINE::ProcessLinePair().