29 #ifndef AVOID_ROUTER_H 30 #define AVOID_ROUTER_H 37 #include "libavoid/dllexport.h" 39 #include "libavoid/vertices.h" 40 #include "libavoid/graph.h" 41 #include "libavoid/timer.h" 43 #include "libavoid/actioninfo.h" 44 #include "libavoid/hyperedgeimprover.h" 55 typedef std::list<LineRep> LineReps;
58 typedef std::list<unsigned int> IntList;
63 typedef std::list<ClusterRef *> ClusterRefList;
65 typedef std::list<Obstacle *> ObstacleList;
81 static const unsigned int runningTo = 1;
82 static const unsigned int runningFrom = 2;
83 static const unsigned int runningToAndFrom = runningTo | runningFrom;
166 lastRoutingParameterMarker
290 lastRoutingOptionMarker
332 class ConnRerouteFlagDelegate {
334 ConnRerouteFlagDelegate();
335 ~ConnRerouteFlagDelegate();
336 bool *addConn(ConnRef *conn);
337 void removeConn(ConnRef *conn);
338 void alertConns(
void);
340 std::list<std::pair<ConnRef *, bool> > m_mapping;
343 static const double zeroParamValue = 0;
344 static const double chooseSensibleParamValue = -1;
350 class TopologyAddonInterface
353 TopologyAddonInterface()
356 virtual ~TopologyAddonInterface()
359 virtual TopologyAddonInterface *clone(
void)
const 361 return new TopologyAddonInterface(*
this);
364 virtual void improveOrthogonalTopology(Router *router)
368 virtual bool outputCode(FILE *fp)
const 373 virtual bool outputDeletionCode(FILE *fp)
const 392 Router(
const unsigned int flags);
401 ObstacleList m_obstacles;
403 ClusterRefList clusterRefs;
406 EdgeList visOrthogGraph;
407 ContainsMap contains;
408 VertInfList vertices;
409 ContainsMap enclosingClusters;
413 bool ClusteredRouting;
417 bool UseLeesAlgorithm;
418 bool InvisibilityGrph;
421 bool SelectiveReroute;
423 bool PartialFeedback;
424 bool RubberBandRouting;
431 int st_checked_edges;
453 void setTransactionUse(
const bool transactions);
462 bool transactionUse(
void)
const;
479 bool processTransaction(
void);
516 const bool first_move =
false);
535 void moveShape(
ShapeRef *shape,
const double xDiff,
const double yDiff);
563 void deleteConnector(
ConnRef *connector);
597 void moveJunction(
JunctionRef *junction,
const double xDiff,
627 const double value = chooseSensibleParamValue);
642 void setRoutingOption(
const RoutingOption option,
const bool value);
662 const double penVal = chooseSensibleParamValue);
682 void outputInstanceToSVG(std::string filename = std::string());
694 virtual unsigned int newObjectId(
void)
const;
703 bool objectIdIsUnused(
const unsigned int id)
const;
743 virtual bool shouldContinueTransactionWithProgress(
744 unsigned int elapsedTime,
unsigned int phaseNumber,
745 unsigned int totalPhases,
double proportion);
763 newAndDeletedObjectListsFromHyperedgeImprovement(
void)
const;
765 void setDebugHandler(DebugHandler *handler);
766 DebugHandler *debugHandler(
void)
const;
770 void processActions(
void);
773 void attachedShapes(IntList &shapes,
const unsigned int shapeId,
774 const unsigned int type);
775 void attachedConns(IntList &conns,
const unsigned int shapeId,
776 const unsigned int type);
777 void markPolylineConnectorsNeedingReroutingForDeletedObstacle(
779 void generateContains(VertInf *pt);
780 void printInfo(
void);
781 void regenerateStaticBuiltGraph(
void);
782 void destroyOrthogonalVisGraph(
void);
783 void setStaticGraphInvalidated(
const bool invalidated);
785 bool isInCrossingPenaltyReroutingStage(
void)
const;
786 void markAllObstaclesAsMoved(
void);
788 void performContinuationCheck(
unsigned int phaseNumber,
789 size_t stepNumber,
size_t totalSteps);
790 void registerSettingsChange(
void);
799 void setTopologyAddon(TopologyAddonInterface *topologyAddon);
800 void improveOrthogonalTopology(
void);
803 bool existsOrthogonalSegmentOverlap(
const bool atEnds =
false);
804 bool existsOrthogonalFixedSegmentOverlap(
const bool atEnds =
false);
805 bool existsOrthogonalTouchingPaths(
void);
806 int existsCrossings(
const bool optimisedForConnectorType =
false);
807 bool existsInvalidOrthogonalPaths(
void);
813 void outputDiagramSVG(std::string instanceName = std::string(),
814 LineReps *lineReps =
nullptr);
816 void outputDiagramText(std::string instanceName = std::string());
817 void outputDiagram(std::string instanceName = std::string());
823 friend class Obstacle;
826 friend class MinimumTerminalSpanningTree;
828 friend struct HyperedgeTreeNode;
830 friend class HyperedgeImprover;
832 unsigned int assignId(
const unsigned int suggestedId);
836 void modifyConnector(
ConnRef *conn);
837 void modifyConnector(
ConnRef *conn,
unsigned int type,
838 const ConnEnd &connEnd,
bool connPinUpdate =
false);
841 void removeObjectFromQueuedActions(
const void *
object);
842 void newBlockingShape(
const Polygon& poly,
int pid);
843 void checkAllBlockedEdges(
int pid);
844 void checkAllMissingEdges(
void);
845 void adjustContainsWithAdd(
const Polygon& poly,
const int p_shape);
846 void adjustContainsWithDel(
const int p_shape);
848 const int p_cluster);
849 void adjustClustersWithDel(
const int p_cluster);
850 void rerouteAndCallbackConnectors(
void);
851 void improveCrossings(
void);
853 ActionInfoList actionList;
854 unsigned int m_largest_assigned_id;
855 bool m_consolidate_actions;
856 bool m_currently_calling_destructors;
857 double m_routing_parameters[lastRoutingParameterMarker];
858 bool m_routing_options[lastRoutingOptionMarker];
860 ConnRerouteFlagDelegate m_conn_reroute_flags;
864 clock_t m_transaction_start_time;
865 bool m_abort_transaction;
867 TopologyAddonInterface *m_topology_addon;
870 bool m_allows_polyline_routing;
871 bool m_allows_orthogonal_routing;
873 bool m_static_orthogonal_graph_invalidated;
874 bool m_in_crossing_rerouting_stage;
876 bool m_settings_changes;
878 HyperedgeImprover m_hyperedge_improver;
880 DebugHandler *m_debug_handler;
Orthogonal edge segments are nudged apart in the x-dimension.
Definition: router.h:315
This option specifies that the router should maintain the structures necessary to allow orthogonal co...
Definition: router.h:77
The ConnEnd class represents different possible endpoints for connectors.
Definition: connend.h:110
This option specifies that the router should maintain the structures necessary to allow poly-line con...
Definition: router.h:74
The ConnRef class represents a connector object.
Definition: connector.h:131
This parameter defines the spacing distance that will be used for nudging apart overlapping corners a...
Definition: router.h:154
Initial routes are searched for in the visibility graph.
Definition: router.h:308
Contains the interface for the HyperedgeRerouter class.
The ClusterRef class represents a cluster object.
Definition: viscluster.h:55
This penalty is applied whenever a connector path travels in the direction opposite of the destinatio...
Definition: router.h:162
A dynamic Polygon, to which points can be easily added and removed.
Definition: geomtypes.h:207
This parameter defines the spacing distance that will be added to the sides of each shape when determ...
Definition: router.h:149
With crossing penalties enabled, crossing detection is performed to find all crossings.
Definition: router.h:311
This penalty is applied for each segment in the connector path beyond the first. This should always n...
Definition: router.h:97
This penalty is applied to port selection choice when the other end of the connector being routed doe...
Definition: router.h:142
The HyperedgeNewAndDeletedObjectLists class stores lists of objects created and deleted during hypere...
Definition: hyperedge.h:79
Orthogonal edge segments are nudged apart in the y-dimension.
Definition: router.h:317
std::list< ConnRef * > ConnRefList
A list of ConnRef objects.
Definition: connector.h:47
The orthogonal visibility graph is built by conducting a scan in each dimension. This is the y-dimens...
Definition: router.h:306
The HyperedgeRerouter class is a convenience object that can be used to register hyperedges to be rer...
Definition: hyperedge.h:129
The orthogonal visibility graph is built by conducting a scan in each dimension. This is the x-dimens...
Definition: router.h:303
This penalty is applied whenever a connector path crosses another connector path. It takes shared pat...
Definition: router.h:114
ConnType
Describes the type of routing that is performed for each connector.
Definition: connector.h:53
The ShapeConnectionPin class represents a fixed point or "pin" on a shape that can be connected to...
Definition: connectionpin.h:96
RouterFlag
Flags that can be passed to the router during initialisation to specify options.
Definition: router.h:70
This penalty is applied whenever a connector path shares some segments with an immovable portion of a...
Definition: router.h:131
The Point class defines a point in the plane.
Definition: geomtypes.h:52
TransactionPhases
Types of routing phases reported by Router::shouldContinueTransactionWithProgress().
Definition: router.h:299
Not a real phase, but represents the router is finished (or has aborted) the transaction and you may ...
Definition: router.h:320
libavoid: Object-avoiding orthogonal and polyline connector routing library.
Definition: actioninfo.cpp:33
RoutingOption
Types of routing options that can be enabled.
Definition: router.h:174
This penalty is applied whenever a connector path crosses a cluster boundary.
Definition: router.h:123
This penalty is applied in its full amount to tight acute bends in the connector path. A smaller portion of the penalty is applied for slight bends, i.e., where the bend is close to 180 degrees. This is useful for polyline routing where there is some evidence that tighter corners are worse for readability, but that slight bends might not be so bad, especially when smoothed by curves.
Definition: router.h:106
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
Crossing connectors are rerouted to search for better routes.
Definition: router.h:313
Contains the interface for the ConnRef class.
RoutingParameter
Types of routing parameters and penalties that can be used to tailor the style and improve the qualit...
Definition: router.h:88
A common interface used by the Polygon classes.
Definition: geomtypes.h:150