28 #include "pns_optimizer.h"
29 #include "pns_routing_settings.h"
30 #include "pns_algo_base.h"
31 #include "pns_logger.h"
46 class SHOVE :
public ALGO_BASE
59 SHOVE( NODE* aWorld, ROUTER* aRouter );
67 SHOVE_STATUS ShoveLines(
const LINE& aCurrentHead );
68 SHOVE_STATUS ShoveMultiLines(
const ITEM_SET& aHeadSet );
70 SHOVE_STATUS ShoveDraggingVia(
VIA* aVia,
const VECTOR2I& aWhere,
VIA** aNewVia );
71 SHOVE_STATUS ProcessSingleLine(
LINE& aCurrent,
LINE& aObstacle,
74 void ForceClearance (
bool aEnabled,
int aClearance )
77 m_forceClearance = aClearance;
79 m_forceClearance = -1;
84 const LINE NewHead()
const;
86 void SetInitialLine( LINE& aInitial );
89 typedef std::vector<SHAPE_LINE_CHAIN> HULL_SET;
90 typedef OPT<LINE> OPT_LINE;
91 typedef std::pair<LINE, LINE> LINE_PAIR;
92 typedef std::vector<LINE_PAIR> LINE_PAIR_VEC;
100 ITEM_SET m_headItems;
101 COST_ESTIMATOR m_cost;
102 OPT_BOX2I m_affectedArea;
105 SHOVE_STATUS processHullSet( LINE& aCurrent, LINE& aObstacle,
106 LINE& aShoved,
const HULL_SET& hulls );
108 bool reduceSpringback(
const ITEM_SET& aHeadItems );
109 bool pushSpringback( NODE* aNode,
const ITEM_SET& aHeadItems,
110 const COST_ESTIMATOR& aCost,
const OPT_BOX2I& aAffectedArea );
112 SHOVE_STATUS walkaroundLoneVia( LINE& aCurrent, LINE& aObstacle, LINE& aShoved );
113 bool checkBumpDirection(
const LINE& aCurrent,
const LINE& aShoved )
const;
115 SHOVE_STATUS onCollidingLine( LINE& aCurrent, LINE& aObstacle );
116 SHOVE_STATUS onCollidingSegment( LINE& aCurrent, SEGMENT* aObstacleSeg );
117 SHOVE_STATUS onCollidingSolid( LINE& aCurrent, ITEM* aObstacle );
118 SHOVE_STATUS onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia );
119 SHOVE_STATUS onReverseCollidingVia( LINE& aCurrent, VIA* aObstacleVia );
120 SHOVE_STATUS pushVia( VIA* aVia,
const VECTOR2I& aForce,
int aCurrentRank,
bool aDryRun =
false );
122 OPT_BOX2I totalAffectedArea()
const;
124 void unwindStack( SEGMENT* aSeg );
125 void unwindStack( ITEM* aItem );
127 void runOptimizer( NODE* aNode );
129 bool pushLine(
const LINE& aL,
bool aKeepCurrentOnTop =
false );
132 LINE assembleLine(
const SEGMENT* aSeg,
int* aIndex = NULL );
134 void replaceItems( ITEM* aOld, std::unique_ptr< ITEM > aNew );
135 void replaceLine( LINE& aOld, LINE& aNew );
137 OPT_BOX2I m_affectedAreaSum;
139 SHOVE_STATUS shoveIteration(
int aIter );
140 SHOVE_STATUS shoveMainLoop();
142 int getClearance(
const ITEM* aA,
const ITEM* aB )
const;
144 std::vector<SPRINGBACK_TAG> m_nodeStack;
145 std::vector<LINE> m_lineStack;
146 std::vector<LINE> m_optimizerQueue;
155 ITEM_SET m_draggedViaHeadSet;
158 int m_forceClearance;
159 bool m_multiLineMode;
160 void sanityCheck( LINE* aOld, LINE* aNew );
165 #endif // __PNS_SHOVE_H