![]() |
KiCad PCB EDA Suite
|
Base class for PNS router board items. More...
#include <pns_item.h>
Public Types | |
enum | PnsKind { SOLID_T = 1, LINE_T = 2, JOINT_T = 4, SEGMENT_T = 8, ARC_T = 16, VIA_T = 32, DIFF_PAIR_T = 64, ANY_T = 0xff } |
Public Member Functions | |
ITEM (PnsKind aKind) | |
ITEM (const ITEM &aOther) | |
virtual | ~ITEM () |
virtual ITEM * | Clone () const =0 |
Return a deep copy of the item. More... | |
virtual const SHAPE_LINE_CHAIN | Hull (int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const |
virtual const SHAPE_LINE_CHAIN | HoleHull (int aClearance, int aWalkaroundThickness, int aLayer) const |
PnsKind | Kind () const |
Return the type (kind) of the item. More... | |
bool | OfKind (int aKindMask) const |
Return true if the item's type matches the mask aKindMask. More... | |
std::string | KindStr () const |
Returns the kind of the item, as string. More... | |
void | SetParent (BOARD_ITEM *aParent) |
BOARD_ITEM * | Parent () const |
void | SetNet (int aNet) |
int | Net () const |
const LAYER_RANGE & | Layers () const |
void | SetLayers (const LAYER_RANGE &aLayers) |
void | SetLayer (int aLayer) |
virtual int | Layer () const |
bool | LayersOverlap (const ITEM *aOther) const |
Return true if the set of layers spanned by aOther overlaps our layers. More... | |
NODE * | Owner () const |
Return the owner of this item, or NULL if there's none. More... | |
void | SetOwner (NODE *aOwner) |
Set the node that owns this item. More... | |
bool | BelongsTo (NODE *aNode) const |
bool | Collide (const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly=true) const |
Check for a collision (clearance violation) with between us and item aOther. More... | |
virtual const SHAPE * | Shape () const |
Return the geometrical shape of the item. More... | |
virtual const SHAPE * | Hole () const |
virtual void | Mark (int aMarker) const |
virtual void | Unmark (int aMarker=-1) const |
virtual int | Marker () const |
virtual void | SetRank (int aRank) |
virtual int | Rank () const |
virtual VECTOR2I | Anchor (int n) const |
virtual int | AnchorCount () const |
bool | IsLocked () const |
void | SetRoutable (bool aRoutable) |
bool | IsRoutable () const |
Static Public Attributes | |
static const int | UnusedNet = INT_MAX |
Supported item types. More... | |
Protected Attributes | |
PnsKind | m_kind |
BOARD_ITEM * | m_parent |
NODE * | m_owner |
LAYER_RANGE | m_layers |
bool | m_movable |
int | m_net |
int | m_marker |
int | m_rank |
bool | m_routable |
Private Member Functions | |
bool | collideSimple (const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly) const |
Base class for PNS router board items.
Implements the shared properties of all PCB items net, spanned layers, geometric shape and reference to owning model.
Definition at line 55 of file pns_item.h.
enum PNS::ITEM::PnsKind |
Enumerator | |
---|---|
SOLID_T | |
LINE_T | |
JOINT_T | |
SEGMENT_T | |
ARC_T | |
VIA_T | |
DIFF_PAIR_T | |
ANY_T |
Definition at line 61 of file pns_item.h.
|
inline |
|
inline |
|
virtual |
Definition at line 142 of file pns_item.cpp.
|
inlinevirtual |
Reimplemented in PNS::VIA, PNS::SEGMENT, PNS::SOLID, and PNS::ARC.
Definition at line 213 of file pns_item.h.
Referenced by PNS::DP_PRIMITIVE_PAIR::anchorDirection(), PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR(), PNS::NODE::followLine(), PNS::getDanglingAnchor(), PNS::ROUTER::isStartingPointRoutable(), PNS::TOOL_BASE::pickSingleItem(), and PNS::TOOL_BASE::snapToItem().
|
inlinevirtual |
Reimplemented in PNS::VIA, PNS::SEGMENT, PNS::SOLID, and PNS::ARC.
Definition at line 218 of file pns_item.h.
|
inline |
Definition at line 177 of file pns_item.h.
References m_owner.
Referenced by PNS::NODE::doRemove().
|
pure virtual |
Return a deep copy of the item.
Implemented in PNS::DIFF_PAIR, PNS::VIA, PNS::LINE, PNS::JOINT, PNS::SOLID, PNS::ARC, and PNS::SEGMENT.
Referenced by PNS::DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR(), PNS::ITEM_SET::ENTRY::ENTRY(), PNS::ITEM_SET::ENTRY::operator=(), and PNS::DP_PRIMITIVE_PAIR::operator=().
bool PNS::ITEM::Collide | ( | const ITEM * | aOther, |
const NODE * | aNode, | ||
bool | aDifferentNetsOnly = true |
||
) | const |
Check for a collision (clearance violation) with between us and item aOther.
Collision checking takes all PCB stuff into account (layers, nets, DRC rules). Optionally returns a minimum translation vector for force propagation algorithm.
aOther | is the item to check collision against. |
Definition at line 97 of file pns_item.cpp.
References collideSimple(), PNS::LINE::EndsWithVia(), LINE_T, m_kind, and PNS::LINE::Via().
Referenced by PNS::SHOVE::onCollidingSolid(), PNS::OPTIMIZER::CACHE_VISITOR::operator()(), PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()(), PNS::SHOVE::shoveLineFromLoneVia(), PNS::SHOVE::shoveLineToHullSet(), and PNS::COMPONENT_DRAGGER::Start().
|
private |
Definition at line 31 of file pns_item.cpp.
References SHAPE::Collide(), PNS::NODE::GetClearance(), PNS::NODE::GetHoleClearance(), PNS::NODE::GetHoleToHoleClearance(), PNS::ROUTER::GetInstance(), PNS::ROUTER::GetInterface(), Hole(), PNS::ROUTER_IFACE::IsFlashedOnLayer(), LAYER_RANGE::IsMultilayer(), Layer(), Layers(), LINE_T, m_kind, m_layers, m_net, Mark(), Marker(), PNS::MK_HOLE, LAYER_RANGE::Overlaps(), and Shape().
Referenced by Collide().
|
inlinevirtual |
Reimplemented in PNS::VIA, and PNS::SOLID.
Definition at line 201 of file pns_item.h.
Referenced by collideSimple().
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in PNS::VIA, PNS::SEGMENT, PNS::ARC, and PNS::SOLID.
Definition at line 111 of file pns_item.h.
|
inline |
Definition at line 223 of file pns_item.h.
References Marker(), and PNS::MK_LOCKED.
Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::performDragging(), and PNS::SHOVE::pushOrShoveVia().
|
inline |
Definition at line 229 of file pns_item.h.
References m_routable.
Referenced by PNS::NODE::addSolid(), and PNS::NODE::removeSolidIndex().
|
inline |
Return the type (kind) of the item.
Definition at line 126 of file pns_item.h.
References m_kind.
Referenced by PNS_KICAD_IFACE::AddItem(), PNS::NODE::AssembleLine(), PNS::OPTIMIZER::CacheRemove(), PNS::NODE::CheckColliding(), PNS::SEGMENT::ClassOf(), PNS::ARC::ClassOf(), PNS::SOLID::ClassOf(), PNS::VIA::ClassOf(), PNS::LINE::ClassOf(), PNS::DIFF_PAIR::ClassOf(), PNS::OPTIMIZER::computeBreakouts(), PNS::NODE::DEFAULT_OBSTACLE_VISITOR::DEFAULT_OBSTACLE_VISITOR(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::NODE::followLine(), PNS::getDanglingAnchor(), PNS::MEANDER_PLACER_BASE::getSnappedStartPoint(), PNS_PCBNEW_RULE_RESOLVER::holeRadius(), PNS_KICAD_IFACE_BASE::inheritTrackWidth(), PNS::OPTIMIZER::CACHE_VISITOR::operator()(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), PNS::NODE::Remove(), PNS::SHOVE::shoveIteration(), PNS::OPTIMIZER::smartPadsSingle(), PNS::TOOL_BASE::snapToItem(), PNS::DRAGGER::Start(), PNS::LINE_PLACER::Start(), ROUTER_PREVIEW_ITEM::Update(), and PNS_KICAD_IFACE::UpdateItem().
std::string PNS::ITEM::KindStr | ( | ) | const |
Returns the kind of the item, as string.
Definition at line 126 of file pns_item.cpp.
References ARC_T, DIFF_PAIR_T, JOINT_T, LINE_T, m_kind, SEGMENT_T, SOLID_T, and VIA_T.
Referenced by PNS::TOOL_BASE::pickSingleItem(), and PNS::TOOL_BASE::updateEndItem().
|
inlinevirtual |
Definition at line 154 of file pns_item.h.
References Layers(), and LAYER_RANGE::Start().
Referenced by PNS_PCBNEW_RULE_RESOLVER::Clearance(), collideSimple(), PNS::DRAGGER::CurrentLayer(), PNS::OPTIMIZER::fanoutCleanup(), PNS_PCBNEW_RULE_RESOLVER::HoleClearance(), PNS_PCBNEW_RULE_RESOLVER::HoleToHoleClearance(), PNS_KICAD_IFACE_BASE::ImportSizes(), PNS::ROUTER::markViolations(), PNS::NODE::NearestObstacle(), PNS::OPTIMIZER::runSmartPads(), PNS::SHOVE::shoveLineFromLoneVia(), and PNS::SHOVE::ShoveObstacleLine().
|
inline |
Definition at line 150 of file pns_item.h.
References m_layers.
Referenced by PNS::INDEX::Add(), PNS::NODE::Add(), PNS::NODE::addArc(), PNS_KICAD_IFACE::AddItem(), PNS::NODE::addSegment(), PNS::NODE::addSolid(), PNS::NODE::addVia(), PNS::ARC::ARC(), PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS_PCBNEW_RULE_RESOLVER::Clearance(), PNS::VIA::Clone(), collideSimple(), PNS::MEANDER_PLACER::CurrentLayer(), PNS::DP_MEANDER_PLACER::CurrentLayer(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::NODE::FindJoint(), PNS::NODE::FindLinesBetweenJoints(), PNS::NODE::findRedundantArc(), PNS::NODE::findRedundantSegment(), ROUTER_TOOL::getStartLayer(), PNS_PCBNEW_RULE_RESOLVER::HoleClearance(), PNS_PCBNEW_RULE_RESOLVER::HoleToHoleClearance(), PNS_KICAD_IFACE::IsFlashedOnLayer(), Layer(), LayersOverlap(), PNS::LINE::LINE(), PNS::NODE::LockJoint(), PNS::VIA::MakeHandle(), PNS::ROUTER::markViolations(), PNS::SHOVE::onCollidingSolid(), LENGTH_TUNER_TOOL::performTuning(), PNS::TOOL_BASE::pickSingleItem(), PNS::INDEX::Query(), PNS::INDEX::Remove(), PNS::NODE::removeArcIndex(), PNS::NODE::removeSegmentIndex(), PNS::NODE::removeSolidIndex(), PNS::NODE::removeViaIndex(), PNS_TEST_ENVIRONMENT::ReplayLog(), PNS::SEGMENT::SEGMENT(), PNS::LINE_PLACER::SetLayer(), ROUTER_PREVIEW_ITEM::Update(), PNS::TOOL_BASE::updateEndItem(), PNS_KICAD_IFACE::UpdateItem(), PNS::DIFF_PAIR::updateLine(), PNS::TOOL_BASE::updateStartItem(), and PNS::VIA::VIA().
|
inline |
Return true if the set of layers spanned by aOther overlaps our layers.
Definition at line 159 of file pns_item.h.
References Layers(), and LAYER_RANGE::Overlaps().
Referenced by PNS::SHOVE::onCollidingArc(), PNS::SHOVE::onCollidingSegment(), PNS::NODE::rebuildJoint(), and PNS::SHOVE::ShoveObstacleLine().
|
inlinevirtual |
Reimplemented in PNS::LINE.
Definition at line 206 of file pns_item.h.
References m_marker.
Referenced by collideSimple(), and PNS::SHOVE::ShoveDraggingVia().
|
inlinevirtual |
Reimplemented in PNS::LINE.
Definition at line 208 of file pns_item.h.
References m_marker.
Referenced by PNS::ARC::ARC(), collideSimple(), IsLocked(), PNS::SHOVE::pushOrShoveVia(), and ROUTER_PREVIEW_ITEM::Update().
|
inline |
Definition at line 148 of file pns_item.h.
References m_net.
Referenced by PNS::INDEX::Add(), PNS::NODE::Add(), PNS::NODE::addArc(), PNS_KICAD_IFACE::AddItem(), PNS::NODE::addSegment(), PNS::NODE::addSolid(), PNS::NODE::addVia(), PNS::ARC::ARC(), PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::LINE_PLACER::buildInitialLine(), PNS::KEEP_TOPOLOGY_CONSTRAINT::Check(), PNS::VIA::Clone(), PNS::MEANDER_PLACER::CurrentNets(), PNS::DRAGGER::CurrentNets(), PNS::DIFF_PAIR::DIFF_PAIR(), PNS::OPTIMIZER::fanoutCleanup(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::NODE::FindJoint(), PNS::NODE::findRedundantArc(), PNS::NODE::findRedundantSegment(), PNS::LINE_PLACER::FixRoute(), PNS_PCBNEW_RULE_RESOLVER::IsDiffPair(), PNS::ROUTER::isStartingPointRoutable(), PNS::LINE::LINE(), PNS::NODE::LockJoint(), PNS::VIA::MakeHandle(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), ROUTER_TOOL::prepareInteractive(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), PNS::NODE::rebuildJoint(), PNS::INDEX::Remove(), PNS::NODE::removeArcIndex(), PNS::NODE::removeSegmentIndex(), PNS::NODE::removeSolidIndex(), PNS::NODE::removeViaIndex(), PNS::OPTIMIZER::runSmartPads(), PNS::SEGMENT::SEGMENT(), PNS::SHOVE::ShoveObstacleLine(), PNS::MEANDER_SKEW_PLACER::Start(), PNS::DIFF_PAIR_PLACER::Start(), PNS::LINE_PLACER::Start(), PNS_KICAD_IFACE::UpdateItem(), and PNS::VIA::VIA().
|
inline |
Return true if the item's type matches the mask aKindMask.
Definition at line 134 of file pns_item.h.
References m_kind.
Referenced by PNS::DP_PRIMITIVE_PAIR::anchorDirection(), ROUTER_TOOL::breakTrack(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::ChangedArea(), PNS::TOOL_BASE::checkSnap(), PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::DP_PRIMITIVE_PAIR::Directional(), PNS::OPTIMIZER::fanoutCleanup(), PNS::ROUTER::isStartingPointRoutable(), PNS::SHOVE::onCollidingVia(), PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()(), PNS_KICAD_IFACE::RemoveItem(), PNS::LINE_PLACER::SetLayer(), PNS::SHOVE::shoveIteration(), PNS::LINE_PLACER::simplifyNewLine(), PNS::LINE_PLACER::SplitAdjacentSegments(), PNS::MEANDER_SKEW_PLACER::Start(), PNS::MEANDER_PLACER::Start(), PNS::DP_MEANDER_PLACER::Start(), PNS::SHOVE::unwindLineStack(), and ROUTER_PREVIEW_ITEM::Update().
|
inline |
Return the owner of this item, or NULL if there's none.
Definition at line 167 of file pns_item.h.
References m_owner.
Referenced by PNS_KICAD_IFACE_BASE::inheritTrackWidth(), and PNS::LINE_PLACER::Move().
|
inline |
Definition at line 145 of file pns_item.h.
References m_parent.
Referenced by PNS_KICAD_IFACE::AddItem(), PNS_PCBNEW_RULE_RESOLVER::DpNetPair(), PNS_KICAD_IFACE::HideItem(), PNS_PCBNEW_RULE_RESOLVER::holeRadius(), isCopper(), isEdge(), PNS_KICAD_IFACE::IsFlashedOnLayer(), PNS_KICAD_IFACE::IsItemVisible(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), PNS_KICAD_IFACE::RemoveItem(), and PNS_KICAD_IFACE::UpdateItem().
|
inlinevirtual |
Reimplemented in PNS::LINE.
Definition at line 211 of file pns_item.h.
References m_rank.
Referenced by PNS::ARC::ARC(), PNS::LINE::LINE(), PNS::SHOVE::onCollidingVia(), and PNS::SHOVE::shoveIteration().
|
inline |
Definition at line 153 of file pns_item.h.
References m_layers.
Referenced by PNS::LINE_PLACER::buildInitialLine(), PNS::LINE_PLACER::FixRoute(), PNS::LINE_PLACER::initPlacement(), PNS::ROUTER::isStartingPointRoutable(), PNS::DIFF_PAIR_PLACER::propagateDpHeadForces(), PNS::DIFF_PAIR_PLACER::routeHead(), PNS::LINE_PLACER::SetLayer(), PNS::LINE_PLACER::UnfixRoute(), and PNS::DIFF_PAIR::updateLine().
|
inline |
Definition at line 151 of file pns_item.h.
References m_layers.
Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::VIA::Clone(), and PNS::VIA::VIA().
|
inline |
Definition at line 147 of file pns_item.h.
References m_net.
Referenced by PNS::LINE::AppendVia(), PNS::NODE::AssembleLine(), PNS::LINE_PLACER::buildInitialLine(), PNS::VIA::Clone(), PNS::LINE_PLACER::FixRoute(), PNS::LINE_PLACER::initPlacement(), PNS::ROUTER::isStartingPointRoutable(), PNS::DIFF_PAIR_PLACER::makeVia(), PNS::DIFF_PAIR::updateLine(), and PNS::VIA::VIA().
|
inline |
Set the node that owns this item.
An item can belong to a single NODE or be unowned.
Definition at line 172 of file pns_item.h.
References m_owner.
Referenced by PNS::NODE::AssembleLine(), PNS::NODE::doRemove(), and PNS::NODE::Remove().
|
inline |
Definition at line 144 of file pns_item.h.
References m_parent.
Referenced by PNS_KICAD_IFACE::AddItem().
|
inlinevirtual |
Reimplemented in PNS::LINE.
Definition at line 210 of file pns_item.h.
References m_rank.
Referenced by PNS::NODE::Commit(), and PNS::SHOVE::ShoveDraggingVia().
|
inline |
|
inlinevirtual |
Return the geometrical shape of the item.
Used for collision detection and spatial indexing.
Reimplemented in PNS::LINE, PNS::VIA, PNS::SOLID, PNS::ARC, and PNS::SEGMENT.
Definition at line 196 of file pns_item.h.
Referenced by PNS::DP_GATEWAYS::BuildFromPrimitivePair(), collideSimple(), PNS::OPTIMIZER::computeBreakouts(), PNS::OPTIMIZER::customBreakouts(), PNS::SHOVE::onCollidingVia(), PNS::HIT_VISITOR::operator()(), PNS::INDEX::Query(), and ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM().
|
inlinevirtual |
Reimplemented in PNS::LINE.
Definition at line 207 of file pns_item.h.
References m_marker.
Referenced by PNS::NODE::Commit(), and PNS::DRAGGER::Start().
|
protected |
Definition at line 235 of file pns_item.h.
Referenced by Collide(), collideSimple(), ITEM(), Kind(), KindStr(), and OfKind().
|
protected |
Definition at line 239 of file pns_item.h.
Referenced by PNS::ARC::ARC(), PNS::SEGMENT::Clone(), PNS::ARC::Clone(), collideSimple(), PNS::JOINT::Dump(), ITEM(), PNS::JOINT::JOINT(), Layers(), PNS::LINE::LINE(), PNS::JOINT::Merge(), PNS::LINE::operator=(), PNS::JOINT::Overlaps(), PNS::SEGMENT::SEGMENT(), SetLayer(), and SetLayers().
|
mutableprotected |
Definition at line 243 of file pns_item.h.
Referenced by PNS::ARC::ARC(), PNS::SEGMENT::Clone(), PNS::ARC::Clone(), PNS::VIA::Clone(), ITEM(), PNS::LINE::LINE(), PNS::LINE::Mark(), Mark(), PNS::LINE::Marker(), Marker(), PNS::LINE::operator=(), PNS::SEGMENT::SEGMENT(), PNS::LINE::Unmark(), Unmark(), and PNS::VIA::VIA().
|
protected |
Definition at line 241 of file pns_item.h.
Referenced by ITEM(), PNS::LINE::LINE(), PNS::LINE::operator=(), and PNS::SOLID::SOLID().
|
protected |
Definition at line 242 of file pns_item.h.
Referenced by PNS::LINE::AppendVia(), PNS::ARC::ARC(), PNS::SEGMENT::Clone(), PNS::ARC::Clone(), collideSimple(), ITEM(), PNS::LINE::LINE(), Net(), PNS::LINE::operator=(), PNS::SEGMENT::SEGMENT(), and SetNet().
|
protected |
Definition at line 238 of file pns_item.h.
Referenced by BelongsTo(), ITEM(), PNS::LINE::operator=(), Owner(), and SetOwner().
|
protected |
Definition at line 237 of file pns_item.h.
Referenced by PNS::VIA::Clone(), ITEM(), Parent(), and SetParent().
|
protected |
Definition at line 244 of file pns_item.h.
Referenced by PNS::ARC::ARC(), PNS::SEGMENT::Clone(), PNS::ARC::Clone(), PNS::VIA::Clone(), ITEM(), PNS::LINE::LINE(), PNS::LINE::operator=(), Rank(), PNS::LINE::Rank(), PNS::SEGMENT::SEGMENT(), SetRank(), PNS::LINE::SetRank(), and PNS::VIA::VIA().
|
protected |
Definition at line 245 of file pns_item.h.
Referenced by IsRoutable(), ITEM(), and SetRoutable().
|
static |