103 KEEP_TOPOLOGY = 0x10,
104 PRESERVE_VERTEX = 0x20,
105 RESTRICT_VERTEX_RANGE = 0x40,
107 RESTRICT_AREA = 0x100,
116 static bool Optimize(
LINE* aLine,
int aEffortLevel,
NODE* aWorld,
117 const VECTOR2I& aV = VECTOR2I(0, 0) );
119 bool Optimize(
LINE* aLine,
LINE* aResult =
nullptr,
LINE* aRoot =
nullptr );
123 void SetWorld(
NODE* aNode ) { m_world = aNode; }
124 void CacheRemove( ITEM* aItem );
125 void ClearCache(
bool aStaticOnly =
false );
127 void SetCollisionMask(
int aMask )
129 m_collisionKindMask = aMask;
132 void SetEffortLevel(
int aEffort )
134 m_effortLevel = aEffort;
137 void SetPreserveVertex(
const VECTOR2I& aV )
139 m_preservedVertex = aV;
140 m_effortLevel |= OPTIMIZER::PRESERVE_VERTEX;
143 void SetRestrictVertexRange(
int aStart,
int aEnd )
145 m_restrictedVertexRange.first = aStart;
146 m_restrictedVertexRange.second = aEnd;
147 m_effortLevel |= OPTIMIZER::RESTRICT_VERTEX_RANGE;
150 void SetRestrictArea(
const BOX2I& aArea,
bool aStrict =
true )
152 m_restrictArea = aArea;
153 m_restrictAreaIsStrict = aStrict;
156 void ClearConstraints();
157 void AddConstraint ( OPT_CONSTRAINT *aConstraint );
160 static const int MaxCachedItems = 256;
162 typedef std::vector<SHAPE_LINE_CHAIN> BREAKOUT_LIST;
172 bool mergeObtuse( LINE* aLine );
173 bool mergeFull( LINE* aLine );
174 bool mergeColinear( LINE* aLine );
175 bool runSmartPads( LINE* aLine );
176 bool mergeStep( LINE* aLine, SHAPE_LINE_CHAIN& aCurrentLine,
int step );
177 bool fanoutCleanup( LINE * aLine );
178 bool mergeDpSegments( DIFF_PAIR *aPair );
179 bool mergeDpStep( DIFF_PAIR *aPair,
bool aTryP,
int step );
181 bool checkColliding( ITEM* aItem,
bool aUpdateCache =
true );
182 bool checkColliding( LINE* aLine,
const SHAPE_LINE_CHAIN& aOptPath );
184 void cacheAdd( ITEM* aItem,
bool aIsStatic );
185 void removeCachedSegments( LINE* aLine,
int aStartVertex = 0,
int aEndVertex = -1 );
187 bool checkConstraints(
int aVertex1,
int aVertex2, LINE* aOriginLine,
188 const SHAPE_LINE_CHAIN& aCurrentPath,
189 const SHAPE_LINE_CHAIN& aReplacement );
191 BREAKOUT_LIST circleBreakouts(
int aWidth,
const SHAPE* aShape,
bool aPermitDiagonal )
const;
192 BREAKOUT_LIST rectBreakouts(
int aWidth,
const SHAPE* aShape,
bool aPermitDiagonal )
const;
193 BREAKOUT_LIST customBreakouts(
int aWidth,
const ITEM* aItem,
bool aPermitDiagonal )
const;
194 BREAKOUT_LIST computeBreakouts(
int aWidth,
const ITEM* aItem,
bool aPermitDiagonal )
const;
196 int smartPadsSingle( LINE* aLine, ITEM* aPad,
bool aEnd,
int aEndVertex );
198 ITEM* findPadOrVia(
int aLayer,
int aNet,
const VECTOR2I& aP )
const;
201 SHAPE_INDEX_LIST<ITEM*> m_cache;
202 std::vector<OPT_CONSTRAINT*> m_constraints;
203 std::unordered_map<ITEM*, CACHED_ITEM> m_cacheTags;
206 int m_collisionKindMask;
209 VECTOR2I m_preservedVertex;
210 std::pair<int, int> m_restrictedVertexRange;
211 BOX2I m_restrictArea;
212 bool m_restrictAreaIsStrict;
241class ANGLE_CONSTRAINT_45:
public OPT_CONSTRAINT
244 ANGLE_CONSTRAINT_45(
NODE* aWorld,
int aEntryDirectionMask = -1,
int aExitDirectionMask = -1 ) :
245 OPT_CONSTRAINT( aWorld ),
246 m_entryDirectionMask( aEntryDirectionMask ),
247 m_exitDirectionMask( aExitDirectionMask )
252 virtual ~ANGLE_CONSTRAINT_45() {};
254 virtual bool Check (
int aVertex1,
int aVertex2,
const LINE* aOriginLine,
259 int m_entryDirectionMask;
260 int m_exitDirectionMask;
333class CORNER_COUNT_LIMIT_CONSTRAINT:
public OPT_CONSTRAINT
336 CORNER_COUNT_LIMIT_CONSTRAINT(
NODE* aWorld,
int aMinCorners,
int aMaxCorners,
338 OPT_CONSTRAINT( aWorld ),
339 m_minCorners( aMinCorners ),
340 m_maxCorners( aMaxCorners ),
341 m_angleMask( aAngleMask )
345 virtual bool Check(
int aVertex1,
int aVertex2,
const LINE* aOriginLine,
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
Definition pns_joint.h:43
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition pns_line.h:61