29 #ifndef AVOID_ROUTER_H
30 #define AVOID_ROUTER_H
37 #include "libavoid/vertices.h"
38 #include "libavoid/graph.h"
39 #include "libavoid/timer.h"
41 #if defined(LINEDEBUG) || defined(ASTAR_DEBUG) || defined(LIBAVOID_SDL)
51 typedef std::list<unsigned int> IntList;
54 typedef std::list<ActionInfo> ActionInfoList;
58 typedef std::list<ClusterRef *> ClusterRefList;
60 typedef std::list<Obstacle *> ObstacleList;
75 static const unsigned int runningTo = 1;
76 static const unsigned int runningFrom = 2;
77 static const unsigned int runningToAndFrom = runningTo | runningFrom;
128 static const double noPenalty = 0;
129 static const double chooseSensiblePenalty = -1;
143 Router(
const unsigned int flags);
152 ObstacleList m_obstacles;
153 ConnRefList connRefs;
154 ClusterRefList clusterRefs;
157 EdgeList visOrthogGraph;
158 ContainsMap contains;
159 VertInfList vertices;
160 ContainsMap enclosingClusters;
164 bool ClusteredRouting;
168 bool UseLeesAlgorithm;
169 bool InvisibilityGrph;
172 bool SelectiveReroute;
174 bool PartialFeedback;
175 bool RubberBandRouting;
180 int st_checked_edges;
182 SDL_Surface *avoid_screen;
279 const bool first_move =
false);
394 const double penVal = chooseSensiblePenalty);
404 void addCluster(ClusterRef *cluster);
405 void delCluster(ClusterRef *cluster);
412 void attachedShapes(IntList &shapes,
const unsigned int shapeId,
413 const unsigned int type);
414 void attachedConns(IntList &conns,
const unsigned int shapeId,
415 const unsigned int type);
418 void markConnectors(Obstacle *obstacle);
419 void generateContains(VertInf *pt);
420 void printInfo(
void);
421 void outputInstanceToSVG(std::string filename = std::string());
422 unsigned int assignId(
const unsigned int suggestedId);
423 void regenerateStaticBuiltGraph(
void);
424 void destroyOrthogonalVisGraph(
void);
425 void setStaticGraphInvalidated(
const bool invalidated);
427 bool objectIsInQueuedActionList(
void *
object)
const;
429 bool existsOrthogonalPathOverlap(
void);
430 bool existsOrthogonalTouchingPaths(
void);
431 int existsOrthogonalCrossings(
void);
437 friend class Obstacle;
439 void modifyConnector(
ConnRef *conn);
440 void modifyConnector(
ConnRef *conn,
unsigned int type,
443 void removeQueuedConnectorActions(
ConnRef *conn);
444 void newBlockingShape(
const Polygon& poly,
int pid);
445 void checkAllBlockedEdges(
int pid);
446 void checkAllMissingEdges(
void);
447 void adjustContainsWithAdd(
const Polygon& poly,
const int p_shape);
448 void adjustContainsWithDel(
const int p_shape);
450 const int p_cluster);
451 void adjustClustersWithDel(
const int p_cluster);
452 void rerouteAndCallbackConnectors(
void);
453 bool idIsUnique(
const unsigned int id)
const;
454 void improveCrossings(
void);
456 ActionInfoList actionList;
457 unsigned int _largestAssignedId;
458 bool _consolidateActions;
459 double _orthogonalNudgeDistance;
460 double _routingPenalties[lastPenaltyMarker];
464 bool _polyLineRouting;
465 bool _orthogonalRouting;
467 bool _staticGraphInvalidated;
468 bool _inCrossingPenaltyReroutingStage;