KiCad PCB EDA Suite
|
#include <pns_multi_dragger.h>
Classes | |
struct | MDRAG_LINE |
Public Member Functions | |
MULTI_DRAGGER (ROUTER *aRouter) | |
~MULTI_DRAGGER () | |
virtual bool | Start (const VECTOR2I &aP, ITEM_SET &aPrimitives) override |
Function Start() | |
bool | Drag (const VECTOR2I &aP) override |
Function Drag() | |
bool | FixRoute (bool aForceCommit) override |
Function FixRoute() | |
NODE * | CurrentNode () const override |
Function CurrentNode() | |
const std::vector< NET_HANDLE > | CurrentNets () const override |
Function CurrentNets() | |
int | CurrentLayer () const override |
Function CurrentLayer() | |
const ITEM_SET | Traces () override |
Function Traces() | |
void | SetMode (PNS::DRAG_MODE aDragMode) override |
PNS::DRAG_MODE | Mode () const override |
virtual std::vector< PNS::ITEM * > | GetLastCommittedLeaderSegments () override |
virtual bool | GetForceMarkObstaclesMode (bool *aDragStatus) const override |
virtual void | SetWorld (NODE *aWorld) |
Function SetWorld() | |
ROUTER * | Router () const |
Return current router settings. | |
ROUTING_SETTINGS & | Settings () const |
Return the logger object, allowing to dump geometry to a file. | |
virtual LOGGER * | Logger () |
void | SetLogger (LOGGER *aLogger) |
void | SetDebugDecorator (DEBUG_DECORATOR *aDecorator) |
Assign a debug decorator allowing this algo to draw extra graphics for visual debugging. | |
DEBUG_DECORATOR * | Dbg () const |
const BOX2I & | VisibleViewArea () const |
Protected Attributes | |
NODE * | m_world |
DEBUG_DECORATOR * | m_debugDecorator |
ROUTER * | m_router |
LOGGER * | m_logger |
Private Member Functions | |
bool | multidragMarkObstacles (std::vector< MDRAG_LINE > &aCompletedLines) |
bool | multidragShove (std::vector< MDRAG_LINE > &aCompletedLines) |
bool | multidragWalkaround (std::vector< MDRAG_LINE > &aCompletedLines) |
void | restoreLeaderSegments (std::vector< MDRAG_LINE > &aCompletedLines) |
int | findNewLeaderSegment (const MDRAG_LINE &aLine) const |
bool | tryWalkaround (NODE *aNode, LINE &aOrig, LINE &aWalk) |
Private Attributes | |
int | m_mode |
bool | m_dragStatus |
PNS_MODE | m_currentMode |
DRAG_MODE | m_dragMode |
std::vector< MDRAG_LINE > | m_mdragLines |
std::vector< PNS::ITEM * > | m_leaderSegments |
NODE * | m_lastNode |
NODE * | m_preShoveNode |
ITEM_SET | m_origDraggedItems |
ITEM_SET | m_draggedItems |
VECTOR2I | m_dragStartPoint |
SEG | m_guide |
std::unique_ptr< SHOVE > | m_shove |
Dragging algorithm for multiple segments. Very trival version for demonstration purposes.
Definition at line 46 of file pns_multi_dragger.h.
PNS::MULTI_DRAGGER::MULTI_DRAGGER | ( | ROUTER * | aRouter | ) |
Definition at line 30 of file pns_multi_dragger.cpp.
References m_lastNode, and PNS::DRAG_ALGO::m_world.
PNS::MULTI_DRAGGER::~MULTI_DRAGGER | ( | ) |
Definition at line 37 of file pns_multi_dragger.cpp.
|
overridevirtual |
Function CurrentLayer()
Returns the layer of currently routed track.
Implements PNS::DRAG_ALGO.
Definition at line 938 of file pns_multi_dragger.cpp.
|
overridevirtual |
Function CurrentNets()
Returns the net code(s) of currently routed track(s).
Implements PNS::DRAG_ALGO.
Definition at line 329 of file pns_multi_dragger.cpp.
References m_mdragLines.
|
overridevirtual |
Function CurrentNode()
Returns the most recent world state, including all items changed due to dragging operation.
Implements PNS::DRAG_ALGO.
Definition at line 926 of file pns_multi_dragger.cpp.
References m_lastNode, and PNS::DRAG_ALGO::m_world.
Referenced by FixRoute().
|
inlineinherited |
Definition at line 78 of file pns_algo_base.h.
References PNS::ALGO_BASE::m_debugDecorator.
Referenced by PNS::SHOVE::AddLockedSpringbackNode(), PNS::LINE_PLACER::buildInitialLine(), PNS::LINE_PLACER::clipAndCheckCollisions(), PNS::MEANDER_PLACER::doMove(), PNS::COMPONENT_DRAGGER::Drag(), Drag(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dragWalkaround(), findNewLeaderSegment(), PNS::SHOVE::fixupViaCollisions(), PNS::LINE_PLACER::handlePullback(), PNS::LINE_PLACER::mergeHead(), PNS::DP_MEANDER_PLACER::Move(), PNS::MEANDER_SKEW_PLACER::Move(), multidragShove(), multidragWalkaround(), PNS::SHOVE::onCollidingArc(), PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onCollidingVia(), PNS::SHOVE::onReverseCollidingVia(), PNS::DRAGGER::optimizeAndUpdateDraggedLine(), PNS::LINE_PLACER::optimizeTailHeadTransition(), PNS::SHOVE::preShoveCleanup(), PNS::SHOVE::pruneRootLines(), PNS::SHOVE::pushLineStack(), PNS::SHOVE::pushOrShoveVia(), PNS::SHOVE::pushSpringback(), PNS::SHOVE::reconstructHeads(), PNS::SHOVE::reduceSpringback(), PNS::LINE_PLACER::reduceTail(), PNS::SHOVE::removeHeads(), PNS::LINE_PLACER::removeLoops(), PNS::SHOVE::replaceItems(), PNS::SHOVE::replaceLine(), PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::LINE_PLACER::rhWalkOnly(), PNS::WALKAROUND::Route(), PNS::LINE_PLACER::routeStep(), PNS::SHOVE::Run(), PNS::SHOVE::runOptimizer(), PNS::SHOVE::shoveIteration(), PNS::SHOVE::shoveLineToHullSet(), PNS::SHOVE::shoveMainLoop(), PNS::SHOVE::ShoveObstacleLine(), PNS::WALKAROUND::singleStep(), PNS::LINE_PLACER::splitHeadTail(), PNS::LINE_PLACER::Start(), PNS::DRAGGER::Start(), Start(), PNS::SHOVE::touchRootLine(), PNS::LINE_PLACER::Trace(), PNS::DRAGGER::tryWalkaround(), tryWalkaround(), and PNS::SHOVE::unwindLineStack().
|
overridevirtual |
Function Drag()
Drags the current segment/corner/via to the point aP.
Implements PNS::DRAG_ALGO.
Definition at line 652 of file pns_multi_dragger.cpp.
References SEG::A, PNS::ITEM_SET::Add(), DIRECTION_45::ANG_HALF_FULL, DIRECTION_45::ANG_OBTUSE, DIRECTION_45::ANG_STRAIGHT, DIRECTION_45::Angle(), SEG::B, PNS::ITEM_SET::CItems(), PNS::ITEM_SET::Clear(), PNS::LINK_HOLDER::ClearLinks(), PNS::ALGO_BASE::Dbg(), PNS::DM_CORNER, PNS::DM_SEGMENT, VECTOR2< T >::Dot(), PNS::LINE::DragCorner(), PNS::MULTI_DRAGGER::MDRAG_LINE::dragOK, VECTOR2< T >::EuclideanNorm(), PNS::MULTI_DRAGGER::MDRAG_LINE::leaderSegIndex, LIGHTBLUE, LIGHTGRAY, LIGHTRED, LIGHTYELLOW, PNS::LINE::Line(), SEG::LineDistance(), SEG::LineProject(), m_draggedItems, m_dragMode, m_dragStartPoint, m_dragStatus, m_guide, m_leaderSegments, m_mdragLines, m_origDraggedItems, PNS::MULTI_DRAGGER::MDRAG_LINE::midSeg, Mode(), multidragMarkObstacles(), multidragShove(), multidragWalkaround(), PNS_DBG, PNS::LINE::PointCount(), PNS::MULTI_DRAGGER::MDRAG_LINE::preDragLine, SHAPE_LINE_CHAIN::Remove(), res, VECTOR2< T >::Resize(), PNS::RM_MarkObstacles, PNS::RM_Shove, PNS::RM_Walkaround, PNS::ALGO_BASE::Settings(), sign(), and PNS::ROUTING_SETTINGS::SmoothDraggedSegments().
|
private |
Definition at line 386 of file pns_multi_dragger.cpp.
References SEG::Contains(), PNS::LINE::CSegment(), PNS::ALGO_BASE::Dbg(), PNS::MULTI_DRAGGER::MDRAG_LINE::draggedLine, DIRECTION_45::Format(), SEG::IntersectLines(), PNS::MULTI_DRAGGER::MDRAG_LINE::leaderSegIndex, m_guide, DIRECTION_45::Opposite(), PNS_DBG, PNS::MULTI_DRAGGER::MDRAG_LINE::preDragLine, and PNS::LINE::SegmentCount().
Referenced by restoreLeaderSegments().
|
overridevirtual |
Function FixRoute()
Checks if the result of current dragging operation is correct and eventually commits it to the world.
Implements PNS::DRAG_ALGO.
Definition at line 344 of file pns_multi_dragger.cpp.
References PNS::ROUTER::CommitRouting(), CurrentNode(), m_dragStatus, PNS::ALGO_BASE::Router(), and PNS::ALGO_BASE::Settings().
|
inlineoverridevirtual |
Implements PNS::DRAG_ALGO.
Definition at line 114 of file pns_multi_dragger.h.
References m_dragStatus.
|
inlineoverridevirtual |
Reimplemented from PNS::DRAG_ALGO.
Definition at line 112 of file pns_multi_dragger.h.
References m_leaderSegments.
|
virtualinherited |
Definition at line 34 of file pns_algo_base.cpp.
References PNS::ALGO_BASE::m_logger.
Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::DRAGGER::Start(), Start(), PNS::DRAGGER::tryWalkaround(), and tryWalkaround().
|
overridevirtual |
Implements PNS::DRAG_ALGO.
Definition at line 272 of file pns_multi_dragger.cpp.
References PNS::DM_CORNER.
|
private |
Definition at line 538 of file pns_multi_dragger.cpp.
References PNS::NODE::Add(), PNS::NODE::Branch(), PNS::clipToOtherLine(), m_lastNode, PNS::DRAG_ALGO::m_world, PNS::NODE::Remove(), and restoreLeaderSegments().
Referenced by Drag().
|
private |
Definition at line 582 of file pns_multi_dragger.cpp.
References PNS::NODE::Add(), PNS::ALGO_BASE::Dbg(), PNS::MULTI_DRAGGER::MDRAG_LINE::dragDist, PNS::MULTI_DRAGGER::MDRAG_LINE::draggedLine, PNS::ROUTER::GetInterface(), GREEN, m_lastNode, m_mdragLines, m_shove, PNS_DBG, restoreLeaderSegments(), PNS::ALGO_BASE::Router(), PNS::SHOVE::SH_OK, PNS::SHOVE::SHP_DONT_OPTIMIZE, and PNS::SHOVE::SHP_SHOVE.
Referenced by Drag().
|
private |
Definition at line 437 of file pns_multi_dragger.cpp.
References PNS::NODE::Add(), BLUE, PNS::NODE::Branch(), PNS::LINE::CLine(), PNS::ALGO_BASE::Dbg(), PNS::MULTI_DRAGGER::MDRAG_LINE::dragDist, PNS::MULTI_DRAGGER::MDRAG_LINE::draggedLine, PNS::MULTI_DRAGGER::MDRAG_LINE::isPrimaryLine, SHAPE_LINE_CHAIN::Length(), m_lastNode, PNS::DRAG_ALGO::m_world, PNS_DBG, PNS::NODE::Remove(), restoreLeaderSegments(), tryWalkaround(), and YELLOW.
Referenced by Drag().
|
private |
Definition at line 408 of file pns_multi_dragger.cpp.
References PNS::DM_CORNER, findNewLeaderSegment(), m_dragMode, and m_leaderSegments.
Referenced by multidragMarkObstacles(), multidragShove(), and multidragWalkaround().
|
inlineinherited |
Return current router settings.
Definition at line 54 of file pns_algo_base.h.
References PNS::ALGO_BASE::m_router.
Referenced by PNS::DIFF_PAIR_PLACER::attemptWalk(), PNS::MEANDER_PLACER_BASE::Clearance(), PNS::DIFF_PAIR_PLACER::CommitPlacement(), PNS::DP_MEANDER_PLACER::CommitPlacement(), PNS::LINE_PLACER::CommitPlacement(), PNS::MEANDER_PLACER::CommitPlacement(), PNS::COMPONENT_DRAGGER::FixRoute(), PNS::DRAGGER::FixRoute(), FixRoute(), PNS::DIFF_PAIR_PLACER::initPlacement(), PNS::LINE_PLACER::initPlacement(), PNS::LINE_PLACER::makeVia(), multidragShove(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::reconstructHeads(), PNS::SHOVE::removeHeads(), PNS::LINE_PLACER::rhWalkBase(), PNS::SHOVE::Run(), PNS::SHOVE::runOptimizer(), PNS::SHOVE::shoveIteration(), PNS::DIFF_PAIR_PLACER::Start(), PNS::DP_MEANDER_PLACER::Start(), PNS::LINE_PLACER::Start(), PNS::MEANDER_PLACER::Start(), PNS::MEANDER_SKEW_PLACER::Start(), PNS::DRAGGER::Start(), Start(), PNS::DRAGGER::tryWalkaround(), and tryWalkaround().
|
inlineinherited |
Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.
Definition at line 73 of file pns_algo_base.h.
References PNS::ALGO_BASE::m_debugDecorator.
Referenced by PNS::SHOVE::onCollidingSolid(), PNS::LINE_PLACER::rhWalkBase(), PNS::SHOVE::SHOVE(), PNS::DRAGGER::tryWalkaround(), and tryWalkaround().
|
inlineinherited |
Definition at line 65 of file pns_algo_base.h.
References PNS::ALGO_BASE::m_logger.
Referenced by PNS::LINE_PLACER::rhWalkBase(), PNS::DRAGGER::tryWalkaround(), and tryWalkaround().
|
overridevirtual |
Reimplemented from PNS::DRAG_ALGO.
Definition at line 267 of file pns_multi_dragger.cpp.
|
inherited |
Return the logger object, allowing to dump geometry to a file.
Definition at line 28 of file pns_algo_base.cpp.
References PNS::ALGO_BASE::m_router, and PNS::ROUTER::Settings().
Referenced by PNS::DIFF_PAIR_PLACER::attemptWalk(), PNS::LINE_PLACER::buildInitialLine(), PNS::LINE_PLACER::CommitPlacement(), Drag(), PNS::DRAGGER::dragMarkObstacles(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dragWalkaround(), PNS::COMPONENT_DRAGGER::FixRoute(), FixRoute(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::LINE_PLACER::FixRoute(), PNS::LINE_PLACER::Move(), PNS::SHOVE::onCollidingSolid(), PNS::DRAGGER::optimizeAndUpdateDraggedLine(), PNS::DIFF_PAIR_PLACER::propagateDpHeadForces(), PNS::DRAGGER::propagateViaForces(), PNS::SHOVE::pushOrShoveVia(), PNS::LINE_PLACER::rhMarkObstacles(), PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::LINE_PLACER::rhWalkOnly(), PNS::DIFF_PAIR_PLACER::route(), PNS::LINE_PLACER::routeHead(), PNS::LINE_PLACER::routeStep(), PNS::SHOVE::runOptimizer(), PNS::SHOVE::shoveMainLoop(), PNS::WALKAROUND::singleStep(), PNS::LINE_PLACER::Start(), PNS::DRAGGER::Start(), Start(), PNS::DRAGGER::tryWalkaround(), tryWalkaround(), PNS::LINE_PLACER::UnfixRoute(), and PNS::WALKAROUND::WALKAROUND().
|
inlinevirtualinherited |
Function SetWorld()
Sets the board to work on.
Definition at line 61 of file pns_drag_algo.h.
References PNS::DRAG_ALGO::m_world.
Function Start()
Starts routing a single track at point aP, taking item aStartItem as anchor (unless NULL). Returns true if a dragging operation has started.
Implements PNS::DRAG_ALGO.
Definition at line 42 of file pns_multi_dragger.cpp.
References PNS::NODE::AssembleLine(), PNS::NODE::Branch(), PNS::ITEM_SET::Contains(), PNS::MULTI_DRAGGER::MDRAG_LINE::cornerDistance, PNS::ALGO_BASE::Dbg(), PNS::DM_CORNER, PNS::DM_SEGMENT, PNS::ITEM_SET::Empty(), PNS::NODE::FindJoint(), PNS::ITEM_SET::FindVertex(), PNS::MULTI_DRAGGER::MDRAG_LINE::isDraggable, PNS::MULTI_DRAGGER::MDRAG_LINE::isPrimaryLine, PNS::JOINT::IsTrivialEndpoint(), PNS::ITEM_SET::Items(), PNS::MULTI_DRAGGER::MDRAG_LINE::leaderSegDistance, PNS::ALGO_BASE::Logger(), m_dragMode, m_dragStartPoint, m_dragStatus, m_lastNode, m_mdragLines, m_origDraggedItems, m_preShoveNode, m_shove, PNS::DRAG_ALGO::m_world, Mode(), PNS::MULTI_DRAGGER::MDRAG_LINE::originalLeaders, PNS::MULTI_DRAGGER::MDRAG_LINE::originalLine, PNS::NODE::Remove(), PNS::RM_Shove, PNS::ALGO_BASE::Router(), PNS::ALGO_BASE::Settings(), and PNS::SHOVE::SHP_SHOVE.
|
overridevirtual |
Function Traces()
Returns the set of dragged items.
Implements PNS::DRAG_ALGO.
Definition at line 932 of file pns_multi_dragger.cpp.
References m_draggedItems.
Definition at line 362 of file pns_multi_dragger.cpp.
References PNS::ALGO_BASE::Dbg(), PNS::WALKAROUND::RESULT::lines, PNS::ALGO_BASE::Logger(), PNS::WALKAROUND::Route(), PNS::ALGO_BASE::Router(), PNS::WALKAROUND::SetAllowedPolicies(), PNS::ALGO_BASE::SetDebugDecorator(), PNS::WALKAROUND::SetIterationLimit(), PNS::WALKAROUND::SetLengthLimit(), PNS::ALGO_BASE::SetLogger(), PNS::WALKAROUND::SetSolidsOnly(), PNS::ALGO_BASE::Settings(), PNS::WALKAROUND::ST_DONE, PNS::WALKAROUND::RESULT::status, and PNS::WALKAROUND::WP_SHORTEST.
Referenced by multidragWalkaround().
|
inherited |
Definition at line 40 of file pns_algo_base.cpp.
References PNS::ALGO_BASE::m_router, and PNS::ROUTER::VisibleViewArea().
Referenced by PNS::SHOVE::runOptimizer().
|
private |
Definition at line 166 of file pns_multi_dragger.h.
|
protectedinherited |
Definition at line 86 of file pns_algo_base.h.
Referenced by PNS::ALGO_BASE::Dbg(), and PNS::ALGO_BASE::SetDebugDecorator().
|
private |
Definition at line 173 of file pns_multi_dragger.h.
|
private |
Definition at line 167 of file pns_multi_dragger.h.
Referenced by Drag(), restoreLeaderSegments(), and Start().
|
private |
Definition at line 174 of file pns_multi_dragger.h.
|
private |
Definition at line 165 of file pns_multi_dragger.h.
Referenced by Drag(), FixRoute(), GetForceMarkObstaclesMode(), and Start().
|
private |
Definition at line 175 of file pns_multi_dragger.h.
Referenced by Drag(), and findNewLeaderSegment().
|
private |
Definition at line 170 of file pns_multi_dragger.h.
Referenced by CurrentNode(), MULTI_DRAGGER(), multidragMarkObstacles(), multidragShove(), multidragWalkaround(), and Start().
|
private |
Definition at line 169 of file pns_multi_dragger.h.
Referenced by Drag(), GetLastCommittedLeaderSegments(), and restoreLeaderSegments().
|
protectedinherited |
Definition at line 88 of file pns_algo_base.h.
Referenced by PNS::ALGO_BASE::Logger(), and PNS::ALGO_BASE::SetLogger().
|
private |
Definition at line 168 of file pns_multi_dragger.h.
Referenced by CurrentNets(), Drag(), multidragShove(), and Start().
|
private |
Definition at line 164 of file pns_multi_dragger.h.
|
private |
Definition at line 172 of file pns_multi_dragger.h.
|
private |
Definition at line 171 of file pns_multi_dragger.h.
Referenced by Start().
|
protectedinherited |
Definition at line 87 of file pns_algo_base.h.
Referenced by PNS::MEANDER_PLACER::doMove(), PNS::LINE_PLACER::FixRoute(), PNS::MEANDER_PLACER_BASE::lineLength(), PNS::DP_MEANDER_PLACER::Move(), PNS::MEANDER_SKEW_PLACER::Move(), PNS::ALGO_BASE::Router(), PNS::ALGO_BASE::Settings(), PNS::DIFF_PAIR_PLACER::updateLeadingRatLine(), PNS::LINE_PLACER::updateLeadingRatLine(), and PNS::ALGO_BASE::VisibleViewArea().
|
private |
Definition at line 176 of file pns_multi_dragger.h.
Referenced by multidragShove(), and Start().
|
protectedinherited |
Definition at line 128 of file pns_drag_algo.h.
Referenced by PNS::DRAGGER::checkVirtualVia(), PNS::COMPONENT_DRAGGER::CurrentNode(), PNS::DRAGGER::CurrentNode(), CurrentNode(), PNS::COMPONENT_DRAGGER::Drag(), PNS::DRAGGER::dragMarkObstacles(), PNS::DRAGGER::dragViaWalkaround(), PNS::DRAGGER::dragWalkaround(), MULTI_DRAGGER(), multidragMarkObstacles(), multidragWalkaround(), PNS::DRAG_ALGO::SetWorld(), PNS::COMPONENT_DRAGGER::Start(), PNS::DRAGGER::Start(), Start(), PNS::DRAGGER::startDragArc(), PNS::DRAGGER::startDragSegment(), and PNS::DRAGGER::startDragVia().