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

The actual Push and Shove algorithm. More...

#include <pns_shove.h>

Inheritance diagram for PNS::SHOVE:
PNS::ALGO_BASE

Classes

struct  SPRINGBACK_TAG
 

Public Types

enum  SHOVE_STATUS {
  SH_OK = 0 , SH_NULL , SH_INCOMPLETE , SH_HEAD_MODIFIED ,
  SH_TRY_WALK
}
 

Public Member Functions

 SHOVE (NODE *aWorld, ROUTER *aRouter)
 
 ~SHOVE ()
 
SHOVE_STATUS ShoveLines (const LINE &aCurrentHead)
 
SHOVE_STATUS ShoveMultiLines (const ITEM_SET &aHeadSet)
 
SHOVE_STATUS ShoveDraggingVia (const VIA_HANDLE aOldVia, const VECTOR2I &aWhere, VIA_HANDLE &aNewVia)
 
SHOVE_STATUS ShoveObstacleLine (const LINE &aCurLine, const LINE &aObstacleLine, LINE &aResultLine)
 
void ForceClearance (bool aEnabled, int aClearance)
 
NODECurrentNode ()
 
const LINE NewHead () const
 
void SetInitialLine (LINE &aInitial)
 
bool AddLockedSpringbackNode (NODE *aNode)
 
void UnlockSpringbackNode (NODE *aNode)
 
bool RewindSpringbackTo (NODE *aNode)
 
bool RewindToLastLockedNode ()
 
void DisablePostShoveOptimizations (int aMask)
 
void SetSpringbackDoNotTouchNode (const NODE *aNode)
 
ROUTERRouter () const
 Return current router settings.
 
ROUTING_SETTINGSSettings () const
 Return the logger object, allowing to dump geometry to a file.
 
virtual LOGGERLogger ()
 
void SetLogger (LOGGER *aLogger)
 
void SetDebugDecorator (DEBUG_DECORATOR *aDecorator)
 Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.
 
DEBUG_DECORATORDbg () const
 
const BOX2IVisibleViewArea () const
 

Protected Attributes

DEBUG_DECORATORm_debugDecorator
 
ROUTERm_router
 
LOGGERm_logger
 

Private Types

typedef std::vector< SHAPE_LINE_CHAINHULL_SET
 
typedef std::optional< LINEOPT_LINE
 
typedef std::pair< LINE, LINELINE_PAIR
 
typedef std::vector< LINE_PAIRLINE_PAIR_VEC
 

Private Member Functions

SHOVE_STATUS shoveLineToHullSet (const LINE &aCurLine, const LINE &aObstacleLine, LINE &aResultLine, const HULL_SET &aHulls)
 
NODEreduceSpringback (const ITEM_SET &aHeadSet, VIA_HANDLE &aDraggedVia)
 
bool pushSpringback (NODE *aNode, const OPT_BOX2I &aAffectedArea, VIA *aDraggedVia)
 
SHOVE_STATUS shoveLineFromLoneVia (const LINE &aCurLine, const LINE &aObstacleLine, LINE &aResultLine)
 
bool checkShoveDirection (const LINE &aCurLine, const LINE &aObstacleLine, const LINE &aShovedLine) const
 
SHOVE_STATUS onCollidingArc (LINE &aCurrent, ARC *aObstacleArc)
 
SHOVE_STATUS onCollidingLine (LINE &aCurrent, LINE &aObstacle)
 
SHOVE_STATUS onCollidingSegment (LINE &aCurrent, SEGMENT *aObstacleSeg)
 
SHOVE_STATUS onCollidingSolid (LINE &aCurrent, ITEM *aObstacle, OBSTACLE &aObstacleInfo)
 
SHOVE_STATUS onCollidingVia (ITEM *aCurrent, VIA *aObstacleVia, OBSTACLE &aObstacleInfo)
 
SHOVE_STATUS onReverseCollidingVia (LINE &aCurrent, VIA *aObstacleVia)
 
SHOVE_STATUS pushOrShoveVia (VIA *aVia, const VECTOR2I &aForce, int aCurrentRank)
 
OPT_BOX2I totalAffectedArea () const
 
void unwindLineStack (const LINKED_ITEM *aSeg)
 
void unwindLineStack (const ITEM *aItem)
 
void runOptimizer (NODE *aNode)
 
bool pushLineStack (const LINE &aL, bool aKeepCurrentOnTop=false)
 
void popLineStack ()
 
LINE assembleLine (const LINKED_ITEM *aSeg, int *aIndex=nullptr)
 
void replaceItems (ITEM *aOld, std::unique_ptr< ITEM > aNew)
 
void replaceLine (LINE &aOld, LINE &aNew, bool aIncludeInChangedArea=true, NODE *aNode=nullptr)
 
LINEfindRootLine (LINE *aLine)
 
SHOVE_STATUS shoveIteration (int aIter)
 
SHOVE_STATUS shoveMainLoop ()
 
int getClearance (const ITEM *aA, const ITEM *aB) const
 
bool fixupViaCollisions (const LINE *aCurrent, OBSTACLE &obs)
 
void sanityCheck (LINE *aOld, LINE *aNew)
 

Private Attributes

OPT_BOX2I m_affectedArea
 
std::vector< SPRINGBACK_TAGm_nodeStack
 
std::vector< LINEm_lineStack
 
std::vector< LINEm_optimizerQueue
 
std::unordered_map< const LINKED_ITEM *, LINE * > m_rootLineHistory
 
NODEm_root
 
NODEm_currentNode
 
const NODEm_springbackDoNotTouchNode
 
int m_restrictSpringbackTagId
 
OPT_LINE m_newHead
 
VIAm_draggedVia
 
int m_iter
 
int m_forceClearance
 
bool m_multiLineMode
 
int m_optFlagDisableMask
 

Detailed Description

The actual Push and Shove algorithm.

Definition at line 45 of file pns_shove.h.

Member Typedef Documentation

◆ HULL_SET

typedef std::vector<SHAPE_LINE_CHAIN> PNS::SHOVE::HULL_SET
private

Definition at line 91 of file pns_shove.h.

◆ LINE_PAIR

typedef std::pair<LINE, LINE> PNS::SHOVE::LINE_PAIR
private

Definition at line 93 of file pns_shove.h.

◆ LINE_PAIR_VEC

typedef std::vector<LINE_PAIR> PNS::SHOVE::LINE_PAIR_VEC
private

Definition at line 94 of file pns_shove.h.

◆ OPT_LINE

typedef std::optional<LINE> PNS::SHOVE::OPT_LINE
private

Definition at line 92 of file pns_shove.h.

Member Enumeration Documentation

◆ SHOVE_STATUS

Enumerator
SH_OK 
SH_NULL 
SH_INCOMPLETE 
SH_HEAD_MODIFIED 
SH_TRY_WALK 

Definition at line 49 of file pns_shove.h.

Constructor & Destructor Documentation

◆ SHOVE()

◆ ~SHOVE()

PNS::SHOVE::~SHOVE ( )

Definition at line 164 of file pns_shove.cpp.

References m_rootLineHistory.

Member Function Documentation

◆ AddLockedSpringbackNode()

bool PNS::SHOVE::AddLockedSpringbackNode ( NODE aNode)

◆ assembleLine()

LINE PNS::SHOVE::assembleLine ( const LINKED_ITEM aSeg,
int *  aIndex = nullptr 
)
private

◆ checkShoveDirection()

bool PNS::SHOVE::checkShoveDirection ( const LINE aCurLine,
const LINE aObstacleLine,
const LINE aShovedLine 
) const
private

◆ CurrentNode()

NODE * PNS::SHOVE::CurrentNode ( )

Definition at line 1944 of file pns_shove.cpp.

References m_nodeStack, and m_root.

◆ Dbg()

◆ DisablePostShoveOptimizations()

void PNS::SHOVE::DisablePostShoveOptimizations ( int  aMask)

Definition at line 2034 of file pns_shove.cpp.

References m_optFlagDisableMask.

◆ findRootLine()

LINE * PNS::SHOVE::findRootLine ( LINE aLine)
private

Definition at line 1829 of file pns_shove.cpp.

References PNS::LINK_HOLDER::Links(), and m_rootLineHistory.

Referenced by runOptimizer().

◆ fixupViaCollisions()

◆ ForceClearance()

void PNS::SHOVE::ForceClearance ( bool  aEnabled,
int  aClearance 
)
inline

Definition at line 69 of file pns_shove.h.

References m_forceClearance.

Referenced by PNS::DIFF_PAIR_PLACER::attemptWalk().

◆ getClearance()

int PNS::SHOVE::getClearance ( const ITEM aA,
const ITEM aB 
) const
private

◆ Logger()

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

◆ NewHead()

const LINE PNS::SHOVE::NewHead ( ) const

Definition at line 1950 of file pns_shove.cpp.

References m_newHead.

◆ onCollidingArc()

◆ onCollidingLine()

◆ onCollidingSegment()

◆ onCollidingSolid()

◆ onCollidingVia()

◆ onReverseCollidingVia()

◆ popLineStack()

void PNS::SHOVE::popLineStack ( )
private

Definition at line 1194 of file pns_shove.cpp.

References PNS::LINK_HOLDER::Links(), m_lineStack, and m_optimizerQueue.

Referenced by onCollidingSolid(), and shoveIteration().

◆ pushLineStack()

◆ pushOrShoveVia()

◆ pushSpringback()

◆ reduceSpringback()

◆ replaceItems()

void PNS::SHOVE::replaceItems ( ITEM aOld,
std::unique_ptr< ITEM aNew 
)
private

Definition at line 49 of file pns_shove.cpp.

References PNS::ChangedArea(), m_affectedArea, m_currentNode, and PNS::NODE::Replace().

Referenced by pushOrShoveVia().

◆ replaceLine()

void PNS::SHOVE::replaceLine ( LINE aOld,
LINE aNew,
bool  aIncludeInChangedArea = true,
NODE aNode = nullptr 
)
private

◆ RewindSpringbackTo()

bool PNS::SHOVE::RewindSpringbackTo ( NODE aNode)

Definition at line 1976 of file pns_shove.cpp.

References PNS::NODE::KillChildren(), and m_nodeStack.

◆ RewindToLastLockedNode()

bool PNS::SHOVE::RewindToLastLockedNode ( )

Definition at line 2005 of file pns_shove.cpp.

References m_nodeStack.

◆ Router()

◆ runOptimizer()

◆ sanityCheck()

void PNS::SHOVE::sanityCheck ( LINE aOld,
LINE aNew 
)
private

◆ 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 PNS::ALGO_BASE::m_debugDecorator.

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

◆ SetInitialLine()

void PNS::SHOVE::SetInitialLine ( LINE aInitial)

Definition at line 1958 of file pns_shove.cpp.

References PNS::NODE::Branch(), m_root, and PNS::NODE::Remove().

◆ SetLogger()

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

◆ SetSpringbackDoNotTouchNode()

void PNS::SHOVE::SetSpringbackDoNotTouchNode ( const NODE aNode)

Definition at line 2040 of file pns_shove.cpp.

References m_springbackDoNotTouchNode.

◆ Settings()

◆ ShoveDraggingVia()

◆ shoveIteration()

◆ shoveLineFromLoneVia()

◆ ShoveLines()

◆ shoveLineToHullSet()

◆ shoveMainLoop()

◆ ShoveMultiLines()

◆ ShoveObstacleLine()

◆ totalAffectedArea()

OPT_BOX2I PNS::SHOVE::totalAffectedArea ( ) const
private

Definition at line 1535 of file pns_shove.cpp.

References m_affectedArea, and m_nodeStack.

Referenced by runOptimizer().

◆ UnlockSpringbackNode()

void PNS::SHOVE::UnlockSpringbackNode ( NODE aNode)

Definition at line 2017 of file pns_shove.cpp.

References m_nodeStack.

◆ unwindLineStack() [1/2]

void PNS::SHOVE::unwindLineStack ( const ITEM aItem)
private

◆ unwindLineStack() [2/2]

void PNS::SHOVE::unwindLineStack ( const LINKED_ITEM aSeg)
private

◆ VisibleViewArea()

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

Member Data Documentation

◆ m_affectedArea

OPT_BOX2I PNS::SHOVE::m_affectedArea
private

◆ m_currentNode

◆ m_debugDecorator

DEBUG_DECORATOR* PNS::ALGO_BASE::m_debugDecorator
protectedinherited

Definition at line 86 of file pns_algo_base.h.

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

◆ m_draggedVia

VIA* PNS::SHOVE::m_draggedVia
private

Definition at line 174 of file pns_shove.h.

Referenced by pushOrShoveVia(), SHOVE(), ShoveDraggingVia(), and shoveMainLoop().

◆ m_forceClearance

int PNS::SHOVE::m_forceClearance
private

Definition at line 177 of file pns_shove.h.

Referenced by ForceClearance(), getClearance(), and SHOVE().

◆ m_iter

int PNS::SHOVE::m_iter
private

Definition at line 176 of file pns_shove.h.

Referenced by onReverseCollidingVia(), SHOVE(), ShoveLines(), shoveMainLoop(), and ShoveMultiLines().

◆ m_lineStack

std::vector<LINE> PNS::SHOVE::m_lineStack
private

◆ m_logger

LOGGER* PNS::ALGO_BASE::m_logger
protectedinherited

Definition at line 88 of file pns_algo_base.h.

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

◆ m_multiLineMode

bool PNS::SHOVE::m_multiLineMode
private

◆ m_newHead

◆ m_nodeStack

◆ m_optFlagDisableMask

int PNS::SHOVE::m_optFlagDisableMask
private

Definition at line 180 of file pns_shove.h.

Referenced by DisablePostShoveOptimizations(), runOptimizer(), and SHOVE().

◆ m_optimizerQueue

std::vector<LINE> PNS::SHOVE::m_optimizerQueue
private

◆ m_restrictSpringbackTagId

int PNS::SHOVE::m_restrictSpringbackTagId
private

Definition at line 170 of file pns_shove.h.

Referenced by SHOVE().

◆ m_root

NODE* PNS::SHOVE::m_root
private

Definition at line 167 of file pns_shove.h.

Referenced by CurrentNode(), reduceSpringback(), SetInitialLine(), SHOVE(), and shoveMainLoop().

◆ m_rootLineHistory

std::unordered_map<const LINKED_ITEM*, LINE*> PNS::SHOVE::m_rootLineHistory
private

Definition at line 165 of file pns_shove.h.

Referenced by findRootLine(), replaceLine(), and ~SHOVE().

◆ m_router

◆ m_springbackDoNotTouchNode

const NODE* PNS::SHOVE::m_springbackDoNotTouchNode
private

Definition at line 169 of file pns_shove.h.

Referenced by reduceSpringback(), SetSpringbackDoNotTouchNode(), and SHOVE().


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