KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PNS::TRACKS_SPREADER Class Reference

#include <pns_tracks_spreader.h>

Inheritance diagram for PNS::TRACKS_SPREADER:
PNS::PLACEMENT_ALGO PNS::ALGO_BASE

Classes

struct  SPREADABLE_LINE
 

Public Member Functions

 TRACKS_SPREADER (ROUTER *aRouter)
 
virtual ~TRACKS_SPREADER ()
 
virtual bool Start (const VECTOR2I &aP, ITEM *aStartItem) override
 Start placement/drag operation at point aP, taking item aStartItem as anchor (unless NULL).
 
virtual bool Move (const VECTOR2I &aP, ITEM *aEndItem) override
 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) override
 Commit the currently routed items to the parent node, taking aP as the final end point and aEndItem as the final anchor (if provided).
 
bool CommitPlacement () override
 
bool AbortPlacement () override
 
bool HasPlacedAnything () const override
 
NODE * CurrentNode (bool aLoopsRemoved=false) const override
 Return the most recent board state.
 
const ITEM_SET Traces () override
 Return all routed/tuned traces.
 
const VECTOR2I & CurrentStart () const override
 Return the current start of the line(s) being placed/tuned.
 
const VECTOR2I & CurrentEnd () const override
 Return the current end of the line(s) being placed/tuned.
 
const std::vector< NET_HANDLE > CurrentNets () const override
 Returns the net(s) of currently routed track(s).
 
int CurrentLayer () const override
 Return the layer of currently routed track.
 
void SetSpreadableItems (const ITEM_SET &aAuxItems)
 
const ITEM_SET & GetSpreadableItems () const
 
virtual std::optional< VECTOR2I > UnfixRoute ()
 
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 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
 

Private Member Functions

bool prepareSpreadableLines ()
 
void determineWalkOrder ()
 
const std::vector< SEG > findNoOptSegments (const LINE &aClippedHead, const TRACKS_SPREADER::SPREADABLE_LINE &aEntry) const
 

Static Private Member Functions

static std::optional< LINE > breakAndReassemble (NODE *aNode, LINE *aOrigLine, const VECTOR2I &aP1, const VECTOR2I &aP2)
 

Private Attributes

LINKED_ITEM * m_startItem
 
VECTOR2I m_startAnchor
 
VECTOR2I m_endAnchor
 
ITEM_SET m_auxItems
 
NODE * m_currentNode
 
NODE * m_preSpreadNode
 
LINE m_rootLine
 
std::vector< SPREADABLE_LINE > m_lines
 
std::unordered_set< const LINKED_ITEM * > m_spreadableItems
 

Detailed Description

Definition at line 41 of file pns_tracks_spreader.h.

Constructor & Destructor Documentation

◆ TRACKS_SPREADER()

PNS::TRACKS_SPREADER::TRACKS_SPREADER ( ROUTER * aRouter)

◆ ~TRACKS_SPREADER()

PNS::TRACKS_SPREADER::~TRACKS_SPREADER ( )
virtual

Definition at line 46 of file pns_tracks_spreader.cpp.

Member Function Documentation

◆ AbortPlacement()

bool PNS::TRACKS_SPREADER::AbortPlacement ( )
overridevirtual

◆ breakAndReassemble()

std::optional< LINE > PNS::TRACKS_SPREADER::breakAndReassemble ( NODE * aNode,
LINE * aOrigLine,
const VECTOR2I & aP1,
const VECTOR2I & aP2 )
staticprivate

◆ CommitPlacement()

bool PNS::TRACKS_SPREADER::CommitPlacement ( )
overridevirtual

◆ CurrentEnd()

const VECTOR2I & PNS::TRACKS_SPREADER::CurrentEnd ( ) const
overridevirtual

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

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

Implements PNS::PLACEMENT_ALGO.

Definition at line 409 of file pns_tracks_spreader.cpp.

References m_endAnchor.

◆ CurrentLayer()

int PNS::TRACKS_SPREADER::CurrentLayer ( ) const
overridevirtual

Return the layer of currently routed track.

Implements PNS::PLACEMENT_ALGO.

Definition at line 421 of file pns_tracks_spreader.cpp.

◆ CurrentNets()

const std::vector< NET_HANDLE > PNS::TRACKS_SPREADER::CurrentNets ( ) const
overridevirtual

Returns the net(s) of currently routed track(s).

Implements PNS::PLACEMENT_ALGO.

Definition at line 415 of file pns_tracks_spreader.cpp.

◆ CurrentNode()

NODE * PNS::TRACKS_SPREADER::CurrentNode ( bool aLoopsRemoved = false) const
overridevirtual

Return the most recent board state.

Implements PNS::PLACEMENT_ALGO.

Definition at line 391 of file pns_tracks_spreader.cpp.

References PNS::ROUTER::GetWorld(), m_currentNode, and PNS::ALGO_BASE::Router().

◆ CurrentStart()

const VECTOR2I & PNS::TRACKS_SPREADER::CurrentStart ( ) const
overridevirtual

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

Implements PNS::PLACEMENT_ALGO.

Definition at line 403 of file pns_tracks_spreader.cpp.

References m_startAnchor.

◆ 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::BLOCK_DRAGGER::Drag(), PNS::COMPONENT_DRAGGER::Drag(), PNS::MULTI_DRAGGER::Drag(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dragWalkaround(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), PNS::MULTI_DRAGGER::findNewLeaderSegment(), PNS::TRACKS_SPREADER::findNoOptSegments(), 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::TRACKS_SPREADER::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::TRACKS_SPREADER::prepareSpreadableLines(), 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().

◆ determineWalkOrder()

void PNS::TRACKS_SPREADER::determineWalkOrder ( )
private

Definition at line 573 of file pns_tracks_spreader.cpp.

References m_lines.

Referenced by prepareSpreadableLines().

◆ findNoOptSegments()

◆ FixRoute()

bool PNS::TRACKS_SPREADER::FixRoute ( const VECTOR2I & aP,
ITEM * aEndItem,
bool aForceFinish = false )
overridevirtual

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.

Implements PNS::PLACEMENT_ALGO.

Definition at line 356 of file pns_tracks_spreader.cpp.

References m_currentNode.

◆ FlipPosture()

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

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
inlinevirtualinherited

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.

◆ GetSpreadableItems()

const ITEM_SET & PNS::TRACKS_SPREADER::GetSpreadableItems ( ) const
inline

Definition at line 84 of file pns_tracks_spreader.h.

References m_auxItems.

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

◆ HasPlacedAnything()

bool PNS::TRACKS_SPREADER::HasPlacedAnything ( ) const
overridevirtual

Reimplemented from PNS::PLACEMENT_ALGO.

Definition at line 385 of file pns_tracks_spreader.cpp.

◆ IsPlacingVia()

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

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()

◆ prepareSpreadableLines()

◆ removeLoops()

◆ Router()

ROUTER * PNS::ALGO_BASE::Router ( ) const
inlineinherited

Return the instance of our router.

Definition at line 54 of file pns_algo_base.h.

References m_router.

Referenced by PNS::TRACKS_SPREADER::AbortPlacement(), PNS::DIFF_PAIR_PLACER::attemptWalk(), PNS::MEANDER_PLACER_BASE::chainNarrowingOffset(), PNS::MEANDER_PLACER_BASE::Clearance(), PNS::DIFF_PAIR_PLACER::CommitPlacement(), PNS::DP_MEANDER_PLACER::CommitPlacement(), PNS::LINE_PLACER::CommitPlacement(), PNS::MEANDER_PLACER::CommitPlacement(), PNS::TRACKS_SPREADER::CommitPlacement(), PNS::TRACKS_SPREADER::CurrentNode(), PNS::BLOCK_DRAGGER::FixRoute(), PNS::COMPONENT_DRAGGER::FixRoute(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::DRAGGER::FixRoute(), PNS::MULTI_DRAGGER::FixRoute(), PNS::MEANDER_PLACER_BASE::initChainExtras(), PNS::DIFF_PAIR_PLACER::initPlacement(), PNS::LINE_PLACER::initPlacement(), PNS::MEANDER_PLACER_BASE::lineDelay(), PNS::MEANDER_PLACER_BASE::lineLength(), PNS::DIFF_PAIR_PLACER::makeVia(), PNS::LINE_PLACER::makeVia(), PNS::TRACKS_SPREADER::Move(), PNS::MULTI_DRAGGER::multidragShove(), PNS::SHOVE::onCollidingSolid(), PNS::TRACKS_SPREADER::prepareSpreadableLines(), PNS::SHOVE::reconstructHeads(), PNS::MULTI_DRAGGER::reconstructOriginalDpCoupling(), PNS::LINE_PLACER::removeAntennas(), PNS::LINE_PLACER::rhWalkBase(), PNS::DIFF_PAIR_PLACER::routeHead(), PNS::SHOVE::Run(), PNS::SHOVE::shoveIteration(), PNS::DIFF_PAIR_PLACER::Start(), PNS::DP_MEANDER_PLACER::Start(), PNS::DRAGGER::Start(), PNS::LINE_PLACER::Start(), PNS::MEANDER_PLACER::Start(), PNS::MEANDER_SKEW_PLACER::Start(), PNS::MULTI_DRAGGER::Start(), PNS::DRAGGER::startDragArc(), PNS::MULTI_DRAGGER::tryAssembleDiffPair(), PNS::DRAGGER::tryWalkaround(), and PNS::MULTI_DRAGGER::tryWalkaround().

◆ 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::TRACKS_SPREADER::Move(), 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)
inlinevirtualinherited

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)
inlinevirtualinherited

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.

◆ SetSpreadableItems()

void PNS::TRACKS_SPREADER::SetSpreadableItems ( const ITEM_SET & aAuxItems)

Definition at line 617 of file pns_tracks_spreader.cpp.

References m_auxItems.

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

◆ Settings()

◆ simplifyNewLine()

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

◆ Start()

bool PNS::TRACKS_SPREADER::Start ( const VECTOR2I & aP,
ITEM * aStartItem )
overridevirtual

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

Implements PNS::PLACEMENT_ALGO.

Definition at line 51 of file pns_tracks_spreader.cpp.

References PNS::ITEM::ARC_T, m_auxItems, m_currentNode, m_startAnchor, m_startItem, PNS::ITEM::OfKind(), prepareSpreadableLines(), and PNS::ITEM::SEGMENT_T.

◆ ToggleVia()

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

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()

const ITEM_SET PNS::TRACKS_SPREADER::Traces ( )
overridevirtual

Return all routed/tuned traces.

Implements PNS::PLACEMENT_ALGO.

Definition at line 397 of file pns_tracks_spreader.cpp.

◆ UnfixRoute()

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

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)
inlinevirtualinherited

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_auxItems

ITEM_SET PNS::TRACKS_SPREADER::m_auxItems
private

◆ m_currentNode

NODE* PNS::TRACKS_SPREADER::m_currentNode
private

◆ 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_endAnchor

VECTOR2I PNS::TRACKS_SPREADER::m_endAnchor
private

Definition at line 107 of file pns_tracks_spreader.h.

Referenced by CurrentEnd().

◆ m_lines

std::vector<SPREADABLE_LINE> PNS::TRACKS_SPREADER::m_lines
private

Definition at line 113 of file pns_tracks_spreader.h.

Referenced by determineWalkOrder(), Move(), and prepareSpreadableLines().

◆ 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_preSpreadNode

NODE* PNS::TRACKS_SPREADER::m_preSpreadNode
private

Definition at line 110 of file pns_tracks_spreader.h.

Referenced by Move(), and prepareSpreadableLines().

◆ m_rootLine

LINE PNS::TRACKS_SPREADER::m_rootLine
private

Definition at line 112 of file pns_tracks_spreader.h.

Referenced by Move(), and prepareSpreadableLines().

◆ m_router

◆ m_spreadableItems

std::unordered_set<const LINKED_ITEM*> PNS::TRACKS_SPREADER::m_spreadableItems
private

Definition at line 114 of file pns_tracks_spreader.h.

Referenced by Move(), and prepareSpreadableLines().

◆ m_startAnchor

VECTOR2I PNS::TRACKS_SPREADER::m_startAnchor
private

Definition at line 107 of file pns_tracks_spreader.h.

Referenced by CurrentStart(), Move(), and Start().

◆ m_startItem

LINKED_ITEM* PNS::TRACKS_SPREADER::m_startItem
private

Definition at line 106 of file pns_tracks_spreader.h.

Referenced by prepareSpreadableLines(), Start(), and TRACKS_SPREADER().


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