KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PNS::PLACEMENT_ALGO Class Referenceabstract

Abstract class for a P&S placement/dragging algorithm. More...

#include <pns_placement_algo.h>

Inheritance diagram for PNS::PLACEMENT_ALGO:
PNS::ALGO_BASE PNS::DIFF_PAIR_PLACER PNS::LINE_PLACER PNS::MEANDER_PLACER_BASE PNS::DP_MEANDER_PLACER PNS::MEANDER_PLACER PNS::MEANDER_SKEW_PLACER

Public Member Functions

 PLACEMENT_ALGO (ROUTER *aRouter)
 
virtual ~PLACEMENT_ALGO ()
 
virtual bool Start (const VECTOR2I &aP, ITEM *aStartItem)=0
 Start placement/drag operation at point aP, taking item aStartItem as anchor (unless NULL).
 
virtual bool Move (const VECTOR2I &aP, ITEM *aEndItem)=0
 Move the end of the currently routed primtive(s) to the point aP, taking aEndItem as the anchor (if not NULL).
 
virtual bool FixRoute (const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false)=0
 Commit the currently routed items to the parent node, taking aP as the final end point and aEndItem as the final anchor (if provided).
 
virtual std::optional< VECTOR2I > UnfixRoute ()
 
virtual bool CommitPlacement ()
 
virtual bool AbortPlacement ()
 
virtual bool HasPlacedAnything () const
 
virtual bool ToggleVia (bool aEnabled)
 Enable/disable a via at the end of currently routed trace.
 
virtual bool IsPlacingVia () const
 Return true if the placer is placing a via (or more vias).
 
virtual bool SetLayer (int aLayer)
 Set the current routing layer.
 
virtual const ITEM_SET Traces ()=0
 Return all routed/tuned traces.
 
virtual const VECTOR2I & CurrentStart () const =0
 Return the current start of the line(s) being placed/tuned.
 
virtual const VECTOR2I & CurrentEnd () const =0
 Return the current end of the line(s) being placed/tuned.
 
virtual const std::vector< NET_HANDLE > CurrentNets () const =0
 Returns the net(s) of currently routed track(s).
 
virtual int CurrentLayer () const =0
 Return the layer of currently routed track.
 
virtual NODE * CurrentNode (bool aLoopsRemoved=false) const =0
 Return the most recent board state.
 
virtual void FlipPosture ()
 Toggle the current posture (straight/diagonal) of the trace head.
 
virtual void UpdateSizes (const SIZES_SETTINGS &aSizes)
 Perform on-the-fly update of the width, via diameter & drill size from a settings class.
 
virtual void SetOrthoMode (bool aOrthoMode)
 Force the router to place a straight 90/45 degree trace (with the end as near to the cursor as possible) instead of a standard 135 degree two-segment bend.
 
virtual void GetModifiedNets (std::vector< NET_HANDLE > &aNets) const
 Return the nets of all currently routed trace(s)
 
ROUTER * Router () const
 Return the instance of our router.
 
ROUTING_SETTINGS & Settings () const
 Return current router settings.
 
virtual LOGGER * Logger ()
 Return the logger object, allowing to dump geometry to a file.
 
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 Member Functions

virtual bool removeLoops (NODE *aNode, LINE &aLatest)
 
virtual bool simplifyNewLine (NODE *aNode, LINKED_ITEM *aLatest)
 Assemble a line starting from segment or arc aLatest, removes collinear segments and redundant vertices.
 

Protected Attributes

DEBUG_DECORATOR * m_debugDecorator
 
ROUTER * m_router
 
LOGGER * m_logger
 

Detailed Description

Abstract class for a P&S placement/dragging algorithm.

All subtools (drag, single/diff pair routing and meandering) are derived from it.

Definition at line 43 of file pns_placement_algo.h.

Constructor & Destructor Documentation

◆ PLACEMENT_ALGO()

PNS::PLACEMENT_ALGO::PLACEMENT_ALGO ( ROUTER * aRouter)
inline

◆ ~PLACEMENT_ALGO()

virtual PNS::PLACEMENT_ALGO::~PLACEMENT_ALGO ( )
inlinevirtual

Definition at line 49 of file pns_placement_algo.h.

Member Function Documentation

◆ AbortPlacement()

virtual bool PNS::PLACEMENT_ALGO::AbortPlacement ( )
inlinevirtual

◆ CommitPlacement()

virtual bool PNS::PLACEMENT_ALGO::CommitPlacement ( )
inlinevirtual

◆ CurrentEnd()

virtual const VECTOR2I & PNS::PLACEMENT_ALGO::CurrentEnd ( ) const
pure virtual

Return the current end of the line(s) being placed/tuned.

It may not be equal to the cursor position due to collisions.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by PNS::ROUTER::ContinueFromEnd(), and PNS::ROUTER::Finish().

◆ CurrentLayer()

virtual int PNS::PLACEMENT_ALGO::CurrentLayer ( ) const
pure virtual

◆ CurrentNets()

virtual const std::vector< NET_HANDLE > PNS::PLACEMENT_ALGO::CurrentNets ( ) const
pure virtual

◆ CurrentNode()

virtual NODE * PNS::PLACEMENT_ALGO::CurrentNode ( bool aLoopsRemoved = false) const
pure virtual

Return the most recent board state.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by PNS::ROUTER::GetNearestRatnestAnchor().

◆ CurrentStart()

virtual const VECTOR2I & PNS::PLACEMENT_ALGO::CurrentStart ( ) const
pure virtual

Return the current start of the line(s) being placed/tuned.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

Referenced by PNS::ROUTER::GetNearestRatnestAnchor().

◆ Dbg()

DEBUG_DECORATOR * PNS::ALGO_BASE::Dbg ( ) const
inlineinherited

Definition at line 78 of file pns_algo_base.h.

References m_debugDecorator.

Referenced by PNS::SHOVE::AddLockedSpringbackNode(), PNS::DIFF_PAIR_PLACER::attemptWalk(), PNS::DRAGGER::bestAnchorForPoint(), PNS::LINE_PLACER::buildInitialLine(), PNS::SHOVE::checkShoveDirection(), PNS::LINE_PLACER::clipAndCheckCollisions(), PNS::MEANDER_PLACER::doMove(), PNS::COMPONENT_DRAGGER::Drag(), PNS::MULTI_DRAGGER::Drag(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dragWalkaround(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::MULTI_DRAGGER::findNewLeaderSegment(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::SHOVE::fixupViaCollisions(), PNS::LINE_PLACER::handlePullback(), PNS::DIFF_PAIR_PLACER::initPlacement(), PNS::LINE_PLACER::mergeHead(), PNS::DIFF_PAIR_PLACER::Move(), PNS::DP_MEANDER_PLACER::Move(), PNS::MEANDER_SKEW_PLACER::Move(), PNS::MULTI_DRAGGER::multidragShove(), PNS::MULTI_DRAGGER::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::pruneLineFromOptimizerQueue(), PNS::SHOVE::pruneRootLines(), PNS::SHOVE::pushLineStack(), PNS::SHOVE::pushOrShoveVia(), PNS::SHOVE::pushSpringback(), PNS::SHOVE::reconstructHeads(), PNS::MULTI_DRAGGER::reconstructOriginalDpCoupling(), PNS::SHOVE::reduceSpringback(), PNS::LINE_PLACER::reduceTail(), PNS::PLACEMENT_ALGO::removeLoops(), PNS::SHOVE::replaceItems(), PNS::SHOVE::replaceLine(), PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::LINE_PLACER::rhWalkOnly(), PNS::WALKAROUND::Route(), PNS::DIFF_PAIR_PLACER::routeHead(), PNS::LINE_PLACER::routeStep(), PNS::SHOVE::Run(), PNS::SHOVE::runOptimizer(), PNS::SHOVE::shoveIteration(), PNS::SHOVE::shoveLineToHullSet(), PNS::SHOVE::shoveMainLoop(), PNS::SHOVE::ShoveObstacleLine(), PNS::PLACEMENT_ALGO::simplifyNewLine(), PNS::WALKAROUND::singleStep(), PNS::LINE_PLACER::splitHeadTail(), PNS::DRAGGER::Start(), PNS::LINE_PLACER::Start(), PNS::MULTI_DRAGGER::Start(), PNS::SHOVE::touchRootLine(), PNS::SHOVE::touchRootLine(), PNS::LINE_PLACER::Trace(), PNS::MULTI_DRAGGER::tryAssembleDiffPair(), PNS::DRAGGER::tryWalkaround(), and PNS::MULTI_DRAGGER::tryWalkaround().

◆ FixRoute()

virtual bool PNS::PLACEMENT_ALGO::FixRoute ( const VECTOR2I & aP,
ITEM * aEndItem,
bool aForceFinish = false )
pure virtual

Commit the currently routed items to the parent node, taking aP as the final end point and aEndItem as the final anchor (if provided).

Returns
true, if route has been committed. May return false if the routing result is violating design rules - in such case, the track is only committed if ROUTING_SETTINGS::AllowDRCViolations() is on.

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, and PNS::MEANDER_PLACER.

◆ FlipPosture()

virtual void PNS::PLACEMENT_ALGO::FlipPosture ( )
inlinevirtual

Toggle the current posture (straight/diagonal) of the trace head.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 139 of file pns_placement_algo.h.

◆ GetModifiedNets()

virtual void PNS::PLACEMENT_ALGO::GetModifiedNets ( std::vector< NET_HANDLE > & aNets) const
inlinevirtual

Return the nets of all currently routed trace(s)

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 164 of file pns_placement_algo.h.

◆ HasPlacedAnything()

virtual bool PNS::PLACEMENT_ALGO::HasPlacedAnything ( ) const
inlinevirtual

◆ IsPlacingVia()

virtual bool PNS::PLACEMENT_ALGO::IsPlacingVia ( ) const
inlinevirtual

Return true if the placer is placing a via (or more vias).

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 92 of file pns_placement_algo.h.

◆ Logger()

LOGGER * PNS::ALGO_BASE::Logger ( )
virtualinherited

Return the logger object, allowing to dump geometry to a file.

Definition at line 34 of file pns_algo_base.cpp.

References m_logger.

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkBase(), PNS::DRAGGER::Start(), PNS::MULTI_DRAGGER::Start(), PNS::DRAGGER::tryWalkaround(), and PNS::MULTI_DRAGGER::tryWalkaround().

◆ Move()

virtual bool PNS::PLACEMENT_ALGO::Move ( const VECTOR2I & aP,
ITEM * aEndItem )
pure virtual

Move the end of the currently routed primtive(s) to the point aP, taking aEndItem as the anchor (if not NULL).

(unless NULL).

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, PNS::MEANDER_PLACER, and PNS::MEANDER_SKEW_PLACER.

◆ removeLoops()

◆ Router()

◆ SetDebugDecorator()

void PNS::ALGO_BASE::SetDebugDecorator ( DEBUG_DECORATOR * aDecorator)
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 m_debugDecorator.

Referenced by PNS::DIFF_PAIR_PLACER::attemptWalk(), PNS::SHOVE::onCollidingSolid(), PNS::LINE_PLACER::rhWalkBase(), PNS::SHOVE::SHOVE(), PNS::DRAGGER::tryWalkaround(), and PNS::MULTI_DRAGGER::tryWalkaround().

◆ SetLayer()

virtual bool PNS::PLACEMENT_ALGO::SetLayer ( int aLayer)
inlinevirtual

Set the current routing layer.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 100 of file pns_placement_algo.h.

◆ SetLogger()

void PNS::ALGO_BASE::SetLogger ( LOGGER * aLogger)
inlineinherited

◆ SetOrthoMode()

virtual void PNS::PLACEMENT_ALGO::SetOrthoMode ( bool aOrthoMode)
inlinevirtual

Force the router to place a straight 90/45 degree trace (with the end as near to the cursor as possible) instead of a standard 135 degree two-segment bend.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 157 of file pns_placement_algo.h.

◆ Settings()

◆ simplifyNewLine()

bool PNS::PLACEMENT_ALGO::simplifyNewLine ( NODE * aNode,
LINKED_ITEM * aLatest )
protectedvirtual

◆ Start()

virtual bool PNS::PLACEMENT_ALGO::Start ( const VECTOR2I & aP,
ITEM * aStartItem )
pure virtual

Start placement/drag operation at point aP, taking item aStartItem as anchor (unless NULL).

Implemented in PNS::DIFF_PAIR_PLACER, PNS::DP_MEANDER_PLACER, PNS::LINE_PLACER, PNS::MEANDER_PLACER, and PNS::MEANDER_SKEW_PLACER.

◆ ToggleVia()

virtual bool PNS::PLACEMENT_ALGO::ToggleVia ( bool aEnabled)
inlinevirtual

Enable/disable a via at the end of currently routed trace.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 84 of file pns_placement_algo.h.

◆ Traces()

◆ UnfixRoute()

virtual std::optional< VECTOR2I > PNS::PLACEMENT_ALGO::UnfixRoute ( )
inlinevirtual

Reimplemented in PNS::LINE_PLACER.

Definition at line 73 of file pns_placement_algo.h.

◆ UpdateSizes()

virtual void PNS::PLACEMENT_ALGO::UpdateSizes ( const SIZES_SETTINGS & aSizes)
inlinevirtual

Perform on-the-fly update of the width, via diameter & drill size from a settings class.

Used to dynamically change these parameters as the track is routed.

Reimplemented in PNS::DIFF_PAIR_PLACER, and PNS::LINE_PLACER.

Definition at line 148 of file pns_placement_algo.h.

◆ VisibleViewArea()

const BOX2I & PNS::ALGO_BASE::VisibleViewArea ( ) const
inherited

Definition at line 40 of file pns_algo_base.cpp.

References m_router.

Referenced by PNS::SHOVE::runOptimizer().

Member Data Documentation

◆ m_debugDecorator

DEBUG_DECORATOR* PNS::ALGO_BASE::m_debugDecorator
protectedinherited

Definition at line 86 of file pns_algo_base.h.

Referenced by ALGO_BASE(), Dbg(), and SetDebugDecorator().

◆ m_logger

LOGGER* PNS::ALGO_BASE::m_logger
protectedinherited

Definition at line 88 of file pns_algo_base.h.

Referenced by ALGO_BASE(), Logger(), and SetLogger().

◆ m_router


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