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

BLOCK_DRAGGER. More...

#include <pns_block_dragger.h>

Inheritance diagram for PNS::BLOCK_DRAGGER:
PNS::DRAG_ALGO PNS::ALGO_BASE

Classes

struct  DRAGGED_CONNECTION
 

Public Member Functions

 BLOCK_DRAGGER (ROUTER *aRouter)
 
 ~BLOCK_DRAGGER ()
 
bool Start (const VECTOR2I &aP, ITEM_SET &aPrimitives) override
 Sort the selection and the unselected copper touching it.
 
bool Drag (const VECTOR2I &aP) override
 Rebuild the block at aP: displace rigid and bridge items, reroute connections.
 
bool FixRoute (bool aForceCommit) override
 Commit the current branch if it is collision free or aForceCommit is set.
 
NODE * CurrentNode () const override
 The current branch, or the world before the first Drag().
 
const std::vector< NET_HANDLE > CurrentNets () const override
 Unused for block dragging.
 
virtual int CurrentLayer () const override
 Unused for block dragging.
 
const ITEM_SET Traces () override
 Everything displaced or rerouted by the last Drag().
 
const std::vector< LINE > & AnchoredLines () const
 Selected arcs held at both ends, which cannot move.
 
void SetMode (PNS::DRAG_MODE aDragMode) override
 
virtual PNS::DRAG_MODE Mode () const override
 
bool GetForceMarkObstaclesMode (bool *aDragStatus) const override
 
virtual void SetWorld (NODE *aWorld)
 Function SetWorld()
 
virtual std::vector< PNS::ITEM * > GetLastCommittedLeaderSegments ()
 
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 Attributes

NODE * m_world
 
DEBUG_DECORATOR * m_debugDecorator
 
ROUTER * m_router
 
LOGGER * m_logger
 

Private Member Functions

bool isFixedByLock (ITEM *aItem) const
 Unselected and locked, so it neither moves nor is rerouted.
 
bool isPinned (const JOINT *aJoint, const LINE &aOwnLine) const
 Held in place by something outside the block. Links of aOwnLine do not count.
 
bool isHeldByBlock (const JOINT *aJoint) const
 A selected pad or via sits on this joint.
 
bool coveredBySolid (const JOINT *aJoint, bool aSelected) const
 A pad covers more than its anchor, so ask what really sits on the joint.
 
bool isBlockBoundary (const JOINT *aJoint) const
 Copper at this joint is already sorted, so a walk stops here.
 
void classifySelectedLink (LINKED_ITEM *aLink)
 Sort a selected segment or arc by what holds its ends.
 
void clipToBlock (LINE &aLine, const VECTOR2I &aEntry, LINKED_ITEM *aLink) const
 Cut an assembled line back to the stretch between aEntry and the first block joint.
 
void classifyNeighbour (const JOINT *aJoint, LINKED_ITEM *aLink)
 Sort unselected copper that touches the block at aJoint.
 
void scanJoint (const JOINT *aJoint)
 Sort every unselected segment and arc on a joint.
 
void scanRigidItem (ITEM *aItem)
 Sort the copper touching a selected pad or via.
 
void displaceItem (ITEM *aItem, const VECTOR2I &aDelta)
 Replace aItem in the current branch with a copy moved by aDelta.
 

Static Private Member Functions

static LINE wrapLink (LINKED_ITEM *aLink)
 A one link line, so no unselected copper is assembled into a selected segment.
 

Private Attributes

std::set< ITEM * > m_rigidItems
 Selected pads and vias.
 
std::set< ITEM * > m_bridgeItems
 Copper displaced whole with the block.
 
std::vector< DRAGGED_CONNECTION > m_conns
 Copper rerouted to follow the block.
 
std::vector< LINE > m_anchoredLines
 Selected arcs that cannot move.
 
std::unordered_set< ITEM * > m_selectedLinks
 Selected segments and arcs.
 
std::unordered_set< LINKED_ITEM * > m_seenLinks
 Already sorted.
 
std::set< const JOINT * > m_carriedJoints
 Ends of selected copper that travel.
 
bool m_dragStatus
 
ITEM_SET m_draggedItems
 
NODE * m_currentNode
 
VECTOR2I m_p0
 
PNS::DRAG_MODE m_mode
 

Detailed Description

BLOCK_DRAGGER.

Drags a mixed selection of pads, vias, segments and arcs as one block.

Start() sorts everything into four groups:

  • rigid: selected pads and vias, displaced as they are
  • bridge: copper whose both ends travel with the block, displaced as it is
  • connection: copper with one end on the block and the other held outside, rerouted
  • anchored: selected arcs held at both ends, which cannot move

A joint is held when an unselected pad, via or locked item sits on it. Unselected copper at a block joint is followed to its far end and sorted the same way.

Drag() rebuilds a fresh branch each call. A block marks collisions, it never shoves.

Definition at line 51 of file pns_block_dragger.h.

Constructor & Destructor Documentation

◆ BLOCK_DRAGGER()

PNS::BLOCK_DRAGGER::BLOCK_DRAGGER ( ROUTER * aRouter)

◆ ~BLOCK_DRAGGER()

PNS::BLOCK_DRAGGER::~BLOCK_DRAGGER ( )

Definition at line 46 of file pns_block_dragger.cpp.

Member Function Documentation

◆ AnchoredLines()

const std::vector< LINE > & PNS::BLOCK_DRAGGER::AnchoredLines ( ) const
inline

Selected arcs held at both ends, which cannot move.

Definition at line 93 of file pns_block_dragger.h.

References m_anchoredLines.

Referenced by BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and BOOST_FIXTURE_TEST_CASE().

◆ classifyNeighbour()

void PNS::BLOCK_DRAGGER::classifyNeighbour ( const JOINT * aJoint,
LINKED_ITEM * aLink )
private

◆ classifySelectedLink()

void PNS::BLOCK_DRAGGER::classifySelectedLink ( LINKED_ITEM * aLink)
private

◆ clipToBlock()

void PNS::BLOCK_DRAGGER::clipToBlock ( LINE & aLine,
const VECTOR2I & aEntry,
LINKED_ITEM * aLink ) const
private

Cut an assembled line back to the stretch between aEntry and the first block joint.

Definition at line 231 of file pns_block_dragger.cpp.

References PNS::ITEM::Anchor(), chain, PNS::LINE::CLine(), PNS::LINE::ClipVertexRange(), isBlockBoundary(), PNS::DRAG_ALGO::m_world, and PNS::LINE::Reverse().

Referenced by classifyNeighbour().

◆ coveredBySolid()

bool PNS::BLOCK_DRAGGER::coveredBySolid ( const JOINT * aJoint,
bool aSelected ) const
private

A pad covers more than its anchor, so ask what really sits on the joint.

aSelected picks between a solid the block carries and one it does not.

Definition at line 121 of file pns_block_dragger.cpp.

References PNS::ITEM_SET::CItems(), PNS::ITEM::Layers(), m_rigidItems, PNS::DRAG_ALGO::m_world, PNS::JOINT::Net(), PNS::JOINT::Pos(), PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by isHeldByBlock(), and isPinned().

◆ CurrentLayer()

virtual int PNS::BLOCK_DRAGGER::CurrentLayer ( ) const
inlineoverridevirtual

Unused for block dragging.

Implements PNS::DRAG_ALGO.

Definition at line 87 of file pns_block_dragger.h.

References UNDEFINED_LAYER.

◆ CurrentNets()

const std::vector< NET_HANDLE > PNS::BLOCK_DRAGGER::CurrentNets ( ) const
inlineoverridevirtual

Unused for block dragging.

Implements PNS::DRAG_ALGO.

Definition at line 84 of file pns_block_dragger.h.

◆ CurrentNode()

◆ 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::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().

◆ displaceItem()

void PNS::BLOCK_DRAGGER::displaceItem ( ITEM * aItem,
const VECTOR2I & aDelta )
private

◆ Drag()

◆ FixRoute()

bool PNS::BLOCK_DRAGGER::FixRoute ( bool aForceCommit)
overridevirtual

Commit the current branch if it is collision free or aForceCommit is set.

Returns
true if committed.

Implements PNS::DRAG_ALGO.

Definition at line 479 of file pns_block_dragger.cpp.

References PNS::NODE::CheckColliding(), PNS::ROUTER::CommitRouting(), CurrentNode(), m_draggedItems, PNS::ALGO_BASE::Router(), and PNS::ALGO_BASE::Settings().

◆ GetForceMarkObstaclesMode()

bool PNS::BLOCK_DRAGGER::GetForceMarkObstaclesMode ( bool * aDragStatus) const
inlineoverridevirtual

Implements PNS::DRAG_ALGO.

Definition at line 99 of file pns_block_dragger.h.

References m_dragStatus.

◆ GetLastCommittedLeaderSegments()

virtual std::vector< PNS::ITEM * > PNS::DRAG_ALGO::GetLastCommittedLeaderSegments ( )
inlinevirtualinherited

Reimplemented in PNS::MULTI_DRAGGER.

Definition at line 125 of file pns_drag_algo.h.

◆ isBlockBoundary()

bool PNS::BLOCK_DRAGGER::isBlockBoundary ( const JOINT * aJoint) const
private

Copper at this joint is already sorted, so a walk stops here.

Definition at line 153 of file pns_block_dragger.cpp.

References link, PNS::JOINT::LinkList(), m_carriedJoints, m_rigidItems, and m_selectedLinks.

Referenced by clipToBlock().

◆ isFixedByLock()

bool PNS::BLOCK_DRAGGER::isFixedByLock ( ITEM * aItem) const
private

Unselected and locked, so it neither moves nor is rerouted.

Definition at line 92 of file pns_block_dragger.cpp.

References PNS::ITEM::IsLocked(), m_rigidItems, and m_selectedLinks.

Referenced by classifyNeighbour(), and isPinned().

◆ isHeldByBlock()

bool PNS::BLOCK_DRAGGER::isHeldByBlock ( const JOINT * aJoint) const
private

A selected pad or via sits on this joint.

Definition at line 141 of file pns_block_dragger.cpp.

References coveredBySolid(), link, PNS::JOINT::LinkList(), and m_rigidItems.

Referenced by classifyNeighbour().

◆ isPinned()

bool PNS::BLOCK_DRAGGER::isPinned ( const JOINT * aJoint,
const LINE & aOwnLine ) const
private

Held in place by something outside the block. Links of aOwnLine do not count.

Definition at line 99 of file pns_block_dragger.cpp.

References PNS::ITEM::ARC_T, PNS::LINK_HOLDER::ContainsLink(), coveredBySolid(), isFixedByLock(), link, PNS::JOINT::LinkList(), m_rigidItems, PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by classifyNeighbour(), and classifySelectedLink().

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

◆ Mode()

virtual PNS::DRAG_MODE PNS::BLOCK_DRAGGER::Mode ( ) const
inlineoverridevirtual

Implements PNS::DRAG_ALGO.

Definition at line 97 of file pns_block_dragger.h.

References m_mode.

◆ Router()

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

◆ scanJoint()

void PNS::BLOCK_DRAGGER::scanJoint ( const JOINT * aJoint)
private

Sort every unselected segment and arc on a joint.

Definition at line 320 of file pns_block_dragger.cpp.

References PNS::ITEM::ARC_T, classifyNeighbour(), link, PNS::JOINT::LinkList(), and PNS::ITEM::SEGMENT_T.

Referenced by scanRigidItem(), and Start().

◆ scanRigidItem()

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

◆ SetLogger()

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

◆ SetMode()

void PNS::BLOCK_DRAGGER::SetMode ( PNS::DRAG_MODE aDragMode)
inlineoverridevirtual

Reimplemented from PNS::DRAG_ALGO.

Definition at line 95 of file pns_block_dragger.h.

References m_mode.

◆ Settings()

◆ SetWorld()

◆ Start()

◆ Traces()

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

◆ wrapLink()

Member Data Documentation

◆ m_anchoredLines

std::vector<LINE> PNS::BLOCK_DRAGGER::m_anchoredLines
private

Selected arcs that cannot move.

Definition at line 153 of file pns_block_dragger.h.

Referenced by AnchoredLines(), classifySelectedLink(), and Start().

◆ m_bridgeItems

std::set<ITEM*> PNS::BLOCK_DRAGGER::m_bridgeItems
private

Copper displaced whole with the block.

Definition at line 151 of file pns_block_dragger.h.

Referenced by classifyNeighbour(), classifySelectedLink(), Drag(), and Start().

◆ m_carriedJoints

std::set<const JOINT*> PNS::BLOCK_DRAGGER::m_carriedJoints
private

Ends of selected copper that travel.

Definition at line 158 of file pns_block_dragger.h.

Referenced by classifyNeighbour(), classifySelectedLink(), isBlockBoundary(), and Start().

◆ m_conns

std::vector<DRAGGED_CONNECTION> PNS::BLOCK_DRAGGER::m_conns
private

Copper rerouted to follow the block.

Definition at line 152 of file pns_block_dragger.h.

Referenced by classifyNeighbour(), classifySelectedLink(), Drag(), and Start().

◆ m_currentNode

NODE* PNS::BLOCK_DRAGGER::m_currentNode
private

Definition at line 162 of file pns_block_dragger.h.

Referenced by BLOCK_DRAGGER(), CurrentNode(), displaceItem(), Drag(), and Start().

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

ITEM_SET PNS::BLOCK_DRAGGER::m_draggedItems
private

Definition at line 161 of file pns_block_dragger.h.

Referenced by displaceItem(), Drag(), FixRoute(), and Traces().

◆ m_dragStatus

bool PNS::BLOCK_DRAGGER::m_dragStatus
private

Definition at line 160 of file pns_block_dragger.h.

Referenced by BLOCK_DRAGGER(), Drag(), and GetForceMarkObstaclesMode().

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

PNS::DRAG_MODE PNS::BLOCK_DRAGGER::m_mode
private

Definition at line 164 of file pns_block_dragger.h.

Referenced by BLOCK_DRAGGER(), Drag(), Mode(), and SetMode().

◆ m_p0

VECTOR2I PNS::BLOCK_DRAGGER::m_p0
private

Definition at line 163 of file pns_block_dragger.h.

Referenced by Drag(), and Start().

◆ m_rigidItems

std::set<ITEM*> PNS::BLOCK_DRAGGER::m_rigidItems
private

Selected pads and vias.

Definition at line 150 of file pns_block_dragger.h.

Referenced by coveredBySolid(), Drag(), isBlockBoundary(), isFixedByLock(), isHeldByBlock(), isPinned(), and Start().

◆ m_router

◆ m_seenLinks

std::unordered_set<LINKED_ITEM*> PNS::BLOCK_DRAGGER::m_seenLinks
private

Already sorted.

Definition at line 157 of file pns_block_dragger.h.

Referenced by classifyNeighbour(), classifySelectedLink(), and Start().

◆ m_selectedLinks

std::unordered_set<ITEM*> PNS::BLOCK_DRAGGER::m_selectedLinks
private

Selected segments and arcs.

Definition at line 156 of file pns_block_dragger.h.

Referenced by isBlockBoundary(), isFixedByLock(), and Start().

◆ m_world


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