29 #ifndef AVOID_CONNECTOR_H 30 #define AVOID_CONNECTOR_H 36 #include "libavoid/dllexport.h" 37 #include "libavoid/vertices.h" 38 #include "libavoid/geometry.h" 97 arrivalDirections(ad),
98 departureDirections(dd)
176 const unsigned int id = 0);
189 void setEndpoints(
const ConnEnd& srcPoint,
const ConnEnd& dstPoint);
207 void setSourceEndpoint(
const ConnEnd& srcPoint);
216 void setDestEndpoint(
const ConnEnd& dstPoint);
220 unsigned int id(
void)
const;
224 Router *router(
void)
const;
235 bool needsRepaint(
void)
const;
271 void setCallback(
void (*cb)(
void *),
void *ptr);
301 std::pair<JunctionRef *, ConnRef *> splitAtSegment(
302 const size_t segmentN);
315 void setRoutingCheckpoints(
const std::vector<Checkpoint>& checkpoints);
321 std::vector<Checkpoint> routingCheckpoints(
void)
const;
340 std::pair<ConnEnd, ConnEnd> endpointConnEnds(
void)
const;
344 VertInf *src(
void)
const;
348 VertInf *dst(
void)
const;
368 void setFixedRoute(
const PolyLine& route);
384 void setFixedExistingRoute(
void);
390 bool hasFixedRoute(
void)
const;
397 void clearFixedRoute(
void);
399 void set_route(
const PolyLine& route);
400 void calcRouteDist(
void);
401 void makeActive(
void);
402 void makeInactive(
void);
403 VertInf *start(
void);
404 void removeFromGraph(
void);
405 bool isInitialised(
void)
const;
406 void makePathInvalid(
void);
407 void setHateCrossings(
bool value);
408 bool doesHateCrossings(
void)
const;
409 void setEndpoint(
const unsigned int type,
const ConnEnd& connEnd);
410 bool setEndpoint(
const unsigned int type,
const VertID& pointID,
411 Point *pointSuggestion =
nullptr);
412 std::vector<Point> possibleDstPinPoints(
void)
const;
418 friend class ConnRerouteFlagDelegate;
419 friend class HyperedgeImprover;
420 friend struct HyperedgeTreeEdge;
421 friend struct HyperedgeTreeNode;
425 void freeRoutes(
void);
426 void performCallback(
void);
427 bool generatePath(
void);
428 void generateCheckpointsPath(std::vector<Point>& path,
429 std::vector<VertInf *>& vertices);
430 void generateStandardPath(std::vector<Point>& path,
431 std::vector<VertInf *>& vertices);
432 void unInitialise(
void);
433 void updateEndPoint(
const unsigned int type,
const ConnEnd& connEnd);
434 void common_updateEndPoint(
const unsigned int type,
ConnEnd connEnd);
435 void freeActivePins(
void);
436 bool getConnEndForEndpointVertex(VertInf *vertex,
ConnEnd& connEnd)
438 std::pair<Obstacle *, Obstacle *> endpointAnchors(
void)
const;
439 void outputCode(FILE *fp)
const;
440 std::pair<bool, bool> assignConnectionPinVisibility(
const bool connect);
446 bool *m_reroute_flag_ptr;
447 bool m_needs_reroute_flag:1;
449 bool m_needs_repaint:1;
451 bool m_initialised:1;
452 bool m_hate_crossings:1;
453 bool m_has_fixed_route:1;
457 ConnRefList::iterator m_connrefs_pos;
460 VertInf *m_start_vert;
461 void (*m_callback_func)(
void *);
465 std::vector<Checkpoint> m_checkpoints;
466 std::vector<VertInf *> m_checkpoint_vertices;
470 typedef std::pair<Point *, ConnRef *> PtConnPtrPair;
472 typedef std::vector< PtConnPtrPair > PointRepVector;
473 typedef std::list<std::pair<size_t, size_t> > NodeIndexPairLinkList;
480 void addPoints(
const size_t dim,
const PtConnPtrPair& arg1,
481 const PtConnPtrPair& arg2);
482 void addOrderedPoints(
const size_t dim,
const PtConnPtrPair& innerArg,
483 const PtConnPtrPair& outerArg,
bool swapped);
484 int positionFor(
const size_t dim,
const ConnRef *conn);
485 PointRepVector sortedPoints(
const size_t dim);
487 size_t insertPoint(
const size_t dim,
const PtConnPtrPair& point);
488 void sort(
const size_t dim);
492 PointRepVector nodes[2];
493 NodeIndexPairLinkList links[2];
494 PointRepVector sortedConnVector[2];
497 typedef std::map<Avoid::Point,PtOrder> PtOrderMap;
498 typedef std::set<Avoid::Point> PointSet;
501 const unsigned int CROSSING_NONE = 0;
502 const unsigned int CROSSING_TOUCHES = 1;
503 const unsigned int CROSSING_SHARES_PATH = 2;
504 const unsigned int CROSSING_SHARES_PATH_AT_END = 4;
505 const unsigned int CROSSING_SHARES_FIXED_SEGMENT = 8;
508 typedef std::pair<int, unsigned int> CrossingsInfoPair;
509 typedef std::vector<Avoid::Point> PointList;
510 typedef std::vector<PointList> SharedPathList;
512 class ConnectorCrossings
517 ConnRef *connConnRef =
nullptr);
519 void countForSegment(
size_t cIndex,
const bool finalSegment);
524 bool checkForBranchingSegments;
525 ConnRef *polyConnRef;
526 ConnRef *connConnRef;
528 unsigned int crossingCount;
529 unsigned int crossingFlags;
530 PointSet *crossingPoints;
531 PtOrderMap *pointOrders;
532 SharedPathList *sharedPaths;
534 double firstSharedPathAtEndLength;
535 double secondSharedPathAtEndLength;
538 extern void splitBranchingSegments(
Avoid::Polygon& poly,
bool polyIsConn,
540 extern bool validateBendPoint(VertInf *aInf, VertInf *bInf, VertInf *cInf);
The ConnEnd class represents different possible endpoints for connectors.
Definition: connend.h:110
Checkpoint(const Point &p, ConnDirFlags ad, ConnDirFlags dd)
A point that a route must visit.
Definition: connector.h:95
unsigned int ConnDirFlags
One or more Avoid::ConnDirFlag options.
Definition: connend.h:83
The ConnRef class represents a connector object.
Definition: connector.h:131
A dynamic Polygon, to which points can be easily added and removed.
Definition: geomtypes.h:207
This option, provided for convenience, specifies the point should be given visibility to all four sid...
Definition: connend.h:79
A checkpoint is a point that the route for a particular connector must visit. They may optionally be ...
Definition: connector.h:68
std::list< ConnRef * > ConnRefList
A list of ConnRef objects.
Definition: connector.h:47
The connector path will be a shortest-path orthogonal poly-line (only vertical and horizontal line se...
Definition: connector.h:61
The HyperedgeRerouter class is a convenience object that can be used to register hyperedges to be rer...
Definition: hyperedge.h:129
Checkpoint(const Point &p)
A point that a route must visit.
Definition: connector.h:77
ConnType
Describes the type of routing that is performed for each connector.
Definition: connector.h:53
Contains the interface for the ConnEnd class.
The connector path will be a shortest-path poly-line that routes around obstacles.
Definition: connector.h:57
The Point class defines a point in the plane.
Definition: geomtypes.h:52
libavoid: Object-avoiding orthogonal and polyline connector routing library.
Definition: actioninfo.cpp:33
The Router class represents a libavoid router instance.
Definition: router.h:386
The ShapeRef class represents a shape object.
Definition: shape.h:81
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to...
Definition: junction.h:57