29 #ifndef AVOID_CONNECTOR_H
30 #define AVOID_CONNECTOR_H
35 #include "libavoid/vertices.h"
36 #include "libavoid/geometry.h"
46 typedef std::list<ConnRef *> ConnRefList;
108 const unsigned int id = 0);
143 unsigned int id(
void)
const;
226 const size_t segmentN);
255 void set_route(
const PolyLine& route);
256 void calcRouteDist(
void);
257 void makeActive(
void);
258 void makeInactive(
void);
259 VertInf *start(
void);
260 void removeFromGraph(
void);
261 bool isInitialised(
void);
262 void makePathInvalid(
void);
263 void setHateCrossings(
bool value);
264 bool doesHateCrossings(
void);
265 void setEndpoint(
const unsigned int type,
const ConnEnd& connEnd);
266 bool setEndpoint(
const unsigned int type,
const VertID& pointID,
267 Point *pointSuggestion = NULL);
268 std::vector<Point> possibleDstPinPoints(
void)
const;
276 void freeRoutes(
void);
277 void performCallback(
void);
278 bool generatePath(
void);
279 void generateCheckpointsPath(std::vector<Point>& path,
280 std::vector<VertInf *>& vertices);
281 void generateStandardPath(std::vector<Point>& path,
282 std::vector<VertInf *>& vertices);
283 void unInitialise(
void);
284 void updateEndPoint(
const unsigned int type,
const ConnEnd& connEnd);
285 void common_updateEndPoint(
const unsigned int type,
ConnEnd connEnd);
286 void freeActivePins(
void);
292 bool m_needs_reroute_flag;
294 bool m_needs_repaint;
299 ConnRefList::iterator m_connrefs_pos;
302 VertInf *m_start_vert;
304 void (*m_callback_func)(
void *);
306 bool m_hate_crossings;
309 std::vector<Point> m_checkpoints;
310 std::vector<VertInf *> m_checkpoint_vertices;
314 typedef std::pair<Point *, ConnRef *> PtConnPtrPair;
316 typedef std::vector< PtConnPtrPair > PointRepVector;
317 typedef std::list<std::pair<size_t, size_t> > NodeIndexPairLinkList;
324 void addPoints(
const size_t dim,
const PtConnPtrPair& arg1,
325 const PtConnPtrPair& arg2);
326 void addOrderedPoints(
const size_t dim,
const PtConnPtrPair& innerArg,
327 const PtConnPtrPair& outerArg,
bool swapped);
328 int positionFor(
const size_t dim,
const ConnRef *conn);
331 size_t insertPoint(
const size_t dim,
const PtConnPtrPair& point);
332 void sort(
const size_t dim);
336 PointRepVector nodes[2];
337 NodeIndexPairLinkList links[2];
338 PointRepVector sortedConnVector[2];
341 typedef std::map<Avoid::Point,PtOrder> PtOrderMap;
342 typedef std::set<Avoid::Point> PointSet;
345 const unsigned int CROSSING_NONE = 0;
346 const unsigned int CROSSING_TOUCHES = 1;
347 const unsigned int CROSSING_SHARES_PATH = 2;
348 const unsigned int CROSSING_SHARES_PATH_AT_END = 4;
349 const unsigned int CROSSING_SHARES_FIXED_SEGMENT = 8;
352 typedef std::pair<int, unsigned int> CrossingsInfoPair;
353 typedef std::vector<Avoid::Point> PointList;
354 typedef std::vector<PointList> SharedPathList;
356 class ConnectorCrossings
361 ConnRef *connConnRef = NULL);
363 void countForSegment(
size_t cIndex,
const bool finalSegment);
368 bool checkForBranchingSegments;
369 ConnRef *polyConnRef;
370 ConnRef *connConnRef;
372 unsigned int crossingCount;
373 unsigned int crossingFlags;
374 PointSet *crossingPoints;
375 PtOrderMap *pointOrders;
376 SharedPathList *sharedPaths;
379 extern void splitBranchingSegments(
Avoid::Polygon& poly,
bool polyIsConn,
381 extern bool validateBendPoint(VertInf *aInf, VertInf *bInf, VertInf *cInf);