Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Avoid::Router Class Reference

The Router class represents a libavoid router instance. More...

#include <router.h>

Public Member Functions

 Router (const unsigned int flags)
 Constructor for router instance.
 
virtual ~Router ()
 Destructor for router instance.
 
void setTransactionUse (const bool transactions)
 Allows setting of the behaviour of the router in regard to transactions.
 
bool transactionUse (void) const
 Reports whether the router groups actions into transactions.
 
bool processTransaction (void)
 Finishes the current transaction and processes all the queued object changes efficiently.
 
void deleteShape (ShapeRef *shape)
 Delete a shape from the router scene.
 
void moveShape (ShapeRef *shape, const Polygon &newPoly, const bool first_move=false)
 Move or resize an existing shape within the router scene.
 
void moveShape (ShapeRef *shape, const double xDiff, const double yDiff)
 Move an existing shape within the router scene by a relative distance.
 
void deleteJunction (JunctionRef *junction)
 Remove a junction from the router scene.
 
void deleteConnector (ConnRef *connector)
 Remove a connector from the router scene.
 
void moveJunction (JunctionRef *junction, const Point &newPosition)
 Move an existing junction within the router scene.
 
void moveJunction (JunctionRef *junction, const double xDiff, const double yDiff)
 Move an existing junction within the router scene by a relative distance.
 
void setRoutingParameter (const RoutingParameter parameter, const double value=chooseSensibleParamValue)
 Sets values for routing parameters, including routing penalties.
 
double routingParameter (const RoutingParameter parameter) const
 Returns the current value for a particular routing parameter of a given type.
 
void setRoutingOption (const RoutingOption option, const bool value)
 Turn specific routing options on or off.
 
bool routingOption (const RoutingOption option) const
 Returns the current state for a specific routing option.
 
void setRoutingPenalty (const RoutingParameter penType, const double penVal=chooseSensibleParamValue)
 Sets or removes penalty values that are applied during connector routing.
 
HyperedgeRerouterhyperedgeRerouter (void)
 Returns a pointer to the hyperedge rerouter for the router.
 
void outputInstanceToSVG (std::string filename=std::string())
 Generates an SVG file containing debug output and code that can be used to regenerate the instance.
 
virtual unsigned int newObjectId (void) const
 Returns the object ID used for automatically generated objects, such as during hyperedge routing.
 
bool objectIdIsUnused (const unsigned int id) const
 Returns whether or not the given ID is already used.
 
virtual bool shouldContinueTransactionWithProgress (unsigned int elapsedTime, unsigned int phaseNumber, unsigned int totalPhases, double proportion)
 A method called at regular intervals during transaction processing to report progress and ask if the Router should continue the transaction.
 
HyperedgeNewAndDeletedObjectLists newAndDeletedObjectListsFromHyperedgeImprovement (void) const
 Returns a HyperedgeNewAndDeletedObjectLists detailing the lists of junctions and connectors created and deleted during hyperedge improvement.
 
void setDebugHandler (DebugHandler *handler)
 
DebugHandlerdebugHandler (void) const
 
void processActions (void)
 
void deleteCluster (ClusterRef *cluster)
 
void attachedShapes (IntList &shapes, const unsigned int shapeId, const unsigned int type)
 
void attachedConns (IntList &conns, const unsigned int shapeId, const unsigned int type)
 
void markPolylineConnectorsNeedingReroutingForDeletedObstacle (Obstacle *obstacle)
 
void generateContains (VertInf *pt)
 
void printInfo (void)
 
void regenerateStaticBuiltGraph (void)
 
void destroyOrthogonalVisGraph (void)
 
void setStaticGraphInvalidated (const bool invalidated)
 
ConnType validConnType (const ConnType select=ConnType_None) const
 
bool isInCrossingPenaltyReroutingStage (void) const
 
void markAllObstaclesAsMoved (void)
 
ShapeRefshapeContainingPoint (const Point &point)
 
void performContinuationCheck (unsigned int phaseNumber, size_t stepNumber, size_t totalSteps)
 
void registerSettingsChange (void)
 
void setTopologyAddon (TopologyAddonInterface *topologyAddon)
 Set an addon for doing orthogonal topology improvement.
 
void improveOrthogonalTopology (void)
 
bool existsOrthogonalSegmentOverlap (const bool atEnds=false)
 
bool existsOrthogonalFixedSegmentOverlap (const bool atEnds=false)
 
bool existsOrthogonalTouchingPaths (void)
 
int existsCrossings (const bool optimisedForConnectorType=false)
 
bool existsInvalidOrthogonalPaths (void)
 
void outputDiagramSVG (std::string instanceName=std::string(), LineReps *lineReps=nullptr)
 
void outputDiagramText (std::string instanceName=std::string())
 
void outputDiagram (std::string instanceName=std::string())
 

Public Attributes

ObstacleList m_obstacles
 
ConnRefList connRefs
 
ClusterRefList clusterRefs
 
EdgeList visGraph
 
EdgeList invisGraph
 
EdgeList visOrthogGraph
 
ContainsMap contains
 
VertInfList vertices
 
ContainsMap enclosingClusters
 
bool PartialTime
 
bool SimpleRouting
 
bool ClusteredRouting
 
bool IgnoreRegions
 
bool UseLeesAlgorithm
 
bool InvisibilityGrph
 
bool SelectiveReroute
 
bool PartialFeedback
 
bool RubberBandRouting
 
Timer timers
 
int st_checked_edges
 

Private Member Functions

unsigned int assignId (const unsigned int suggestedId)
 
void addShape (ShapeRef *shape)
 
void addJunction (JunctionRef *junction)
 
void addCluster (ClusterRef *cluster)
 
void modifyConnector (ConnRef *conn)
 
void modifyConnector (ConnRef *conn, unsigned int type, const ConnEnd &connEnd, bool connPinUpdate=false)
 
void modifyConnectionPin (ShapeConnectionPin *pin)
 
void removeObjectFromQueuedActions (const void *object)
 
void newBlockingShape (const Polygon &poly, int pid)
 
void checkAllBlockedEdges (int pid)
 
void checkAllMissingEdges (void)
 
void adjustContainsWithAdd (const Polygon &poly, const int p_shape)
 
void adjustContainsWithDel (const int p_shape)
 
void adjustClustersWithAdd (const PolygonInterface &poly, const int p_cluster)
 
void adjustClustersWithDel (const int p_cluster)
 
void rerouteAndCallbackConnectors (void)
 
void improveCrossings (void)
 

Private Attributes

ActionInfoList actionList
 
unsigned int m_largest_assigned_id
 
bool m_consolidate_actions
 
bool m_currently_calling_destructors
 
double m_routing_parameters [lastRoutingParameterMarker]
 
bool m_routing_options [lastRoutingOptionMarker]
 
ConnRerouteFlagDelegate m_conn_reroute_flags
 
HyperedgeRerouter m_hyperedge_rerouter
 
clock_t m_transaction_start_time
 
bool m_abort_transaction
 
TopologyAddonInterfacem_topology_addon
 
bool m_allows_polyline_routing
 
bool m_allows_orthogonal_routing
 
bool m_static_orthogonal_graph_invalidated
 
bool m_in_crossing_rerouting_stage
 
bool m_settings_changes
 
HyperedgeImprover m_hyperedge_improver
 
DebugHandlerm_debug_handler
 

Friends

class ShapeRef
 
class ConnRef
 
class JunctionRef
 
class Obstacle
 
class ClusterRef
 
class ShapeConnectionPin
 
class MinimumTerminalSpanningTree
 
class ConnEnd
 
struct HyperedgeTreeNode
 
class HyperedgeRerouter
 
class HyperedgeImprover
 

Detailed Description

The Router class represents a libavoid router instance.

Usually you would keep a separate Router instance for each diagram or layout you have open in your application.

Definition at line 386 of file router.h.

Constructor & Destructor Documentation

◆ Router()

◆ ~Router()

Avoid::Router::~Router ( )
virtual

Destructor for router instance.

Note
Destroying a router instance will delete all remaining shapes and connectors, thereby invalidating any existing pointers to them.

Definition at line 107 of file router.cpp.

References connRefs, Avoid::db_printf(), destroyOrthogonalVisGraph(), Avoid::Obstacle::id(), Avoid::Obstacle::isActive(), m_currently_calling_destructors, m_obstacles, m_topology_addon, Avoid::Obstacle::makeInactive(), Avoid::Obstacle::removeFromGraph(), Avoid::EdgeList::size(), and visGraph.

Member Function Documentation

◆ addCluster()

void Avoid::Router::addCluster ( ClusterRef cluster)
private

◆ addJunction()

void Avoid::Router::addJunction ( JunctionRef junction)
private

◆ addShape()

void Avoid::Router::addShape ( ShapeRef shape)
private

◆ adjustClustersWithAdd()

void Avoid::Router::adjustClustersWithAdd ( const PolygonInterface poly,
const int  p_cluster 
)
private

◆ adjustClustersWithDel()

void Avoid::Router::adjustClustersWithDel ( const int  p_cluster)
private

Definition at line 1718 of file router.cpp.

References enclosingClusters.

Referenced by deleteCluster().

◆ adjustContainsWithAdd()

void Avoid::Router::adjustContainsWithAdd ( const Polygon poly,
const int  p_shape 
)
private

◆ adjustContainsWithDel()

void Avoid::Router::adjustContainsWithDel ( const int  p_shape)
private

Definition at line 1744 of file router.cpp.

References contains.

Referenced by processActions().

◆ assignId()

unsigned int Avoid::Router::assignId ( const unsigned int  suggestedId)
private

◆ attachedConns()

void Avoid::Router::attachedConns ( IntList conns,
const unsigned int  shapeId,
const unsigned int  type 
)

Definition at line 867 of file router.cpp.

References connRefs, Avoid::runningFrom, and Avoid::runningTo.

Referenced by SPAvoidRef::getAttachedConnectors().

◆ attachedShapes()

void Avoid::Router::attachedShapes ( IntList shapes,
const unsigned int  shapeId,
const unsigned int  type 
)

Definition at line 891 of file router.cpp.

References connRefs, Avoid::runningFrom, and Avoid::runningTo.

Referenced by SPAvoidRef::getAttachedShapes().

◆ checkAllBlockedEdges()

void Avoid::Router::checkAllBlockedEdges ( int  pid)
private

◆ checkAllMissingEdges()

◆ debugHandler()

◆ deleteCluster()

void Avoid::Router::deleteCluster ( ClusterRef cluster)

◆ deleteConnector()

void Avoid::Router::deleteConnector ( ConnRef connector)

Remove a connector from the router scene.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

You should not use the connector reference again after this call. The router will handle freeing of the connector's memory.

Parameters
[in]connectorPointer reference to the connector being removed.

Definition at line 312 of file router.cpp.

References m_currently_calling_destructors.

Referenced by Avoid::HyperedgeImprover::execute(), main(), Avoid::HyperedgeRerouter::performRerouting(), SPConnEndPair::release(), Avoid::JunctionRef::removeJunctionAndMergeConnectors(), SPConnEndPair::setAttr(), and test().

◆ deleteJunction()

void Avoid::Router::deleteJunction ( JunctionRef junction)

Remove a junction from the router scene.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

You should not use the junction reference again after this call. The router will handle freeing of the junction's memory.

Parameters
[in]junctionPointer reference to the junction being removed.

Definition at line 685 of file router.cpp.

References actionList, Avoid::JunctionAdd, Avoid::JunctionMove, Avoid::JunctionRemove, m_consolidate_actions, and processTransaction().

Referenced by Avoid::HyperedgeImprover::execute(), Avoid::HyperedgeRerouter::performRerouting(), Avoid::JunctionRef::removeJunctionAndMergeConnectors(), and test().

◆ deleteShape()

void Avoid::Router::deleteShape ( ShapeRef shape)

Delete a shape from the router scene.

Connectors that could have a better (usually shorter) path after the removal of this shape will be marked as needing to be rerouted.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

You should not use the shape reference again after this call. The router will handle freeing of the shape's memory.

Parameters
[in]shapePointer reference to the shape being removed.

Definition at line 281 of file router.cpp.

References actionList, m_consolidate_actions, processTransaction(), Avoid::ShapeAdd, Avoid::ShapeMove, and Avoid::ShapeRemove.

Referenced by SPAvoidRef::handleSettingChange(), main(), test(), and SPAvoidRef::~SPAvoidRef().

◆ destroyOrthogonalVisGraph()

◆ existsCrossings()

int Avoid::Router::existsCrossings ( const bool  optimisedForConnectorType = false)

Definition at line 2277 of file router.cpp.

References connRefs, and Avoid::Polygon::size().

Referenced by main().

◆ existsInvalidOrthogonalPaths()

bool Avoid::Router::existsInvalidOrthogonalPaths ( void  )

◆ existsOrthogonalFixedSegmentOverlap()

bool Avoid::Router::existsOrthogonalFixedSegmentOverlap ( const bool  atEnds = false)

◆ existsOrthogonalSegmentOverlap()

bool Avoid::Router::existsOrthogonalSegmentOverlap ( const bool  atEnds = false)

◆ existsOrthogonalTouchingPaths()

bool Avoid::Router::existsOrthogonalTouchingPaths ( void  )

Definition at line 2241 of file router.cpp.

References connRefs, Avoid::CROSSING_TOUCHES, and Avoid::Polygon::size().

Referenced by main().

◆ generateContains()

void Avoid::Router::generateContains ( VertInf pt)

◆ hyperedgeRerouter()

HyperedgeRerouter * Avoid::Router::hyperedgeRerouter ( void  )

Returns a pointer to the hyperedge rerouter for the router.

Returns
A HyperedgeRerouter object that can be used to register hyperedges for rerouting.

Definition at line 2071 of file router.cpp.

References m_hyperedge_rerouter.

Referenced by main(), and test().

◆ improveCrossings()

◆ improveOrthogonalTopology()

void Avoid::Router::improveOrthogonalTopology ( void  )

◆ isInCrossingPenaltyReroutingStage()

bool Avoid::Router::isInCrossingPenaltyReroutingStage ( void  ) const

Definition at line 2077 of file router.cpp.

References m_in_crossing_rerouting_stage.

Referenced by Avoid::cost().

◆ markAllObstaclesAsMoved()

void Avoid::Router::markAllObstaclesAsMoved ( void  )

Definition at line 342 of file router.cpp.

References m_obstacles, moveJunction(), and moveShape().

◆ markPolylineConnectorsNeedingReroutingForDeletedObstacle()

◆ modifyConnectionPin()

◆ modifyConnector() [1/2]

◆ modifyConnector() [2/2]

void Avoid::Router::modifyConnector ( ConnRef conn,
unsigned int  type,
const ConnEnd connEnd,
bool  connPinUpdate = false 
)
private

◆ moveJunction() [1/2]

void Avoid::Router::moveJunction ( JunctionRef junction,
const double  xDiff,
const double  yDiff 
)

Move an existing junction within the router scene by a relative distance.

Connectors that are attached to this junction will be rerouted as a result of the move.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

Parameters
[in]junctionPointer reference to the junction being moved.
[in]xDiffThe distance to move the junction in the x dimension.
[in]yDiffThe distance to move the junction in the y dimension.

Definition at line 716 of file router.cpp.

References actionList, Avoid::JunctionMove, moveJunction(), Avoid::JunctionRef::position(), Avoid::Point::x, and Avoid::Point::y.

◆ moveJunction() [2/2]

void Avoid::Router::moveJunction ( JunctionRef junction,
const Point newPosition 
)

Move an existing junction within the router scene.

Connectors that are attached to this junction will be rerouted as a result of the move.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

Parameters
[in]junctionPointer reference to the junction being moved.
[in]newPositionThe new position for the junction.

Definition at line 741 of file router.cpp.

References actionList, Avoid::JunctionAdd, Avoid::JunctionMove, Avoid::JunctionRemove, m_consolidate_actions, and processTransaction().

Referenced by main(), markAllObstaclesAsMoved(), and moveJunction().

◆ moveShape() [1/2]

void Avoid::Router::moveShape ( ShapeRef shape,
const double  xDiff,
const double  yDiff 
)

Move an existing shape within the router scene by a relative distance.

Connectors that intersect the shape's new position, or that could have a better (usually shorter) path after the change, will be marked as needing to be rerouted.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

Parameters
[in]shapePointer reference to the shape being moved.
[in]xDiffThe distance to move the shape in the x dimension.
[in]yDiffThe distance to move the shape in the y dimension.

Definition at line 319 of file router.cpp.

References actionList, moveShape(), Avoid::ShapeRef::polygon(), Avoid::ShapeMove, and Avoid::Polygon::translate().

◆ moveShape() [2/2]

void Avoid::Router::moveShape ( ShapeRef shape,
const Polygon newPoly,
const bool  first_move = false 
)

Move or resize an existing shape within the router scene.

A new polygon for the shape can be given to effectively move or resize the shape with the scene. Connectors that intersect the new shape polygon, or that could have a better (usually shorter) path after the change, will be marked as needing to be rerouted.

If the router is using transactions, then this action will occur the next time Router::processTransaction() is called. See Router::setTransactionUse() for more information.

Parameters
[in]shapePointer reference to the shape being moved/resized.
[in]newPolyThe new polygon boundary for the shape.
[in]first_moveThis option is used for some advanced (currently undocumented) behaviour and it should be ignored for the moment.

Definition at line 360 of file router.cpp.

References actionList, m_consolidate_actions, processTransaction(), Avoid::ShapeAdd, Avoid::ShapeMove, and Avoid::ShapeRemove.

Referenced by avoid_item_move(), main(), markAllObstaclesAsMoved(), moveShape(), and test().

◆ newAndDeletedObjectListsFromHyperedgeImprovement()

HyperedgeNewAndDeletedObjectLists Avoid::Router::newAndDeletedObjectListsFromHyperedgeImprovement ( void  ) const

Returns a HyperedgeNewAndDeletedObjectLists detailing the lists of junctions and connectors created and deleted during hyperedge improvement.

This method will only return information once the router has processed the transaction. You should read and act on this information before processTransaction() is called again.

After calling this you should no longer refer to any of the objects in the "deleted" lists — the router will delete these and free their memory at its convenience.

Returns
A HyperedgeNewAndDeletedObjectLists containing lists of junctions and connectors created and deleted.

Definition at line 3083 of file router.cpp.

References m_hyperedge_improver, and Avoid::HyperedgeImprover::newAndDeletedObjectLists().

Referenced by test().

◆ newBlockingShape()

◆ newObjectId()

unsigned int Avoid::Router::newObjectId ( void  ) const
virtual

Returns the object ID used for automatically generated objects, such as during hyperedge routing.

Reimplement this in a subclass to set specific IDs for new objects.

Note
Your implementation should return a value that does not fail objectIdIsUnused().
Returns
The ID for a new object.

Definition at line 801 of file router.cpp.

References m_largest_assigned_id.

Referenced by assignId().

◆ objectIdIsUnused()

bool Avoid::Router::objectIdIsUnused ( const unsigned int  id) const

Returns whether or not the given ID is already used.

You should only need this if you reimplement newObjectId().

Parameters
[in]idAn ID to test.
Returns
A boolean denoting that the given ID is unused.

Definition at line 827 of file router.cpp.

References clusterRefs, connRefs, and m_obstacles.

Referenced by assignId().

◆ outputDiagram()

void Avoid::Router::outputDiagram ( std::string  instanceName = std::string())

Definition at line 3003 of file router.cpp.

References outputDiagramText(), and outputInstanceToSVG().

Referenced by main(), outputDiagram(), and test().

◆ outputDiagramSVG()

◆ outputDiagramText()

◆ outputInstanceToSVG()

void Avoid::Router::outputInstanceToSVG ( std::string  filename = std::string())

Generates an SVG file containing debug output and code that can be used to regenerate the instance.

If transactions are being used, then this method should be called after processTransaction() has been called, so that it includes any changes being queued by the router.

Parameters
[in]filenameA string indicating the filename (without extension) for the output file. Defaults to "libavoid-debug.svg" if no filename is given.

Definition at line 2358 of file router.cpp.

References Avoid::Polygon::at(), Avoid::ReferencingPolygon::at(), Avoid::EdgeList::begin(), clusterRefs, connRefs, Avoid::VertInfList::connsBegin(), Avoid::Polygon::curvedPolyline(), Avoid::ConnRef::displayRoute(), Avoid::ConnRef::dst(), Avoid::Polygon::empty(), Avoid::EdgeList::end(), Avoid::ConnRef::id(), Avoid::Obstacle::id(), Avoid::ClusterRef::id(), Avoid::EdgeInf::ids(), Avoid::lastRoutingOptionMarker, Avoid::lastRoutingParameterMarker, Avoid::LIMIT, Avoid::EdgeInf::lstNext, Avoid::VertInf::lstNext, m_allows_orthogonal_routing, m_allows_polyline_routing, Avoid::ConnRef::m_checkpoints, m_obstacles, m_routing_options, m_routing_parameters, m_topology_addon, Avoid::Box::max, Avoid::Box::min, Avoid::ConnRef::outputCode(), Avoid::TopologyAddonInterface::outputCode(), Avoid::Obstacle::outputCode(), Avoid::TopologyAddonInterface::outputDeletionCode(), Avoid::VertInf::point, Avoid::EdgeInf::points(), Avoid::ClusterRef::polygon(), Avoid::Obstacle::polygon(), Avoid::Polygon::ps, Avoid::JunctionRef::recommendedPosition(), Avoid::ClusterRef::rectangularPolygon(), Avoid::reduceRange(), Avoid::ConnRef::route(), Avoid::Obstacle::routingBox(), Avoid::Obstacle::routingPolygon(), Avoid::Polygon::size(), Avoid::ReferencingPolygon::size(), size, Avoid::ConnRef::src(), Avoid::Polygon::ts, vertices, Avoid::VertInf::visDirections, visGraph, visOrthogGraph, Avoid::Point::x, and Avoid::Point::y.

Referenced by outputDiagram().

◆ performContinuationCheck()

void Avoid::Router::performContinuationCheck ( unsigned int  phaseNumber,
size_t  stepNumber,
size_t  totalSteps 
)

◆ printInfo()

◆ processActions()

◆ processTransaction()

bool Avoid::Router::processTransaction ( void  )

Finishes the current transaction and processes all the queued object changes efficiently.

This method will efficiently process all moves, additions and deletions that have occurred since processTransaction() was last called.

If transactionUse() is false, then all actions will have been processed immediately and this method will do nothing.

Returns
A boolean value describing whether there were any actions to process.
See also
setTransactionUse

Definition at line 640 of file router.cpp.

References actionList, Avoid::HyperedgeRerouter::count(), m_hyperedge_rerouter, m_settings_changes, m_static_orthogonal_graph_invalidated, processActions(), rerouteAndCallbackConnectors(), and SimpleRouting.

Referenced by addJunction(), addShape(), deleteJunction(), deleteShape(), main(), makeFeasible(), modifyConnectionPin(), modifyConnector(), modifyConnector(), moveJunction(), moveShape(), Avoid::ConnRef::setEndpoint(), SPConnEndPair::tellLibavoidNewEndpoints(), and test().

◆ regenerateStaticBuiltGraph()

void Avoid::Router::regenerateStaticBuiltGraph ( void  )

◆ registerSettingsChange()

◆ removeObjectFromQueuedActions()

void Avoid::Router::removeObjectFromQueuedActions ( const void *  object)
private

◆ rerouteAndCallbackConnectors()

◆ routingOption()

bool Avoid::Router::routingOption ( const RoutingOption  option) const

Returns the current state for a specific routing option.

Parameters
[in]optionThe type of routing option, a RoutingOption.
Returns
A boolean representing the option state.

Definition at line 2053 of file router.cpp.

References Avoid::lastRoutingOptionMarker, m_routing_options, and option.

Referenced by Avoid::cost(), and rerouteAndCallbackConnectors().

◆ routingParameter()

double Avoid::Router::routingParameter ( const RoutingParameter  parameter) const

Returns the current value for a particular routing parameter of a given type.

Parameters
[in]parameterThe type of parameter, a RoutingParameter.
Returns
The value for the specified routing parameter.

Definition at line 2038 of file router.cpp.

References Avoid::lastRoutingParameterMarker, and m_routing_parameters.

Referenced by Avoid::ConnEnd::assignPinVisibilityTo(), Avoid::cost(), Avoid::estimatedCostSpecific(), improveCrossings(), Avoid::JunctionRef::makeRectangle(), Avoid::Obstacle::routingBox(), and Avoid::Obstacle::routingPolygon().

◆ setDebugHandler()

void Avoid::Router::setDebugHandler ( DebugHandler handler)

Definition at line 148 of file router.cpp.

References m_debug_handler.

◆ setRoutingOption()

void Avoid::Router::setRoutingOption ( const RoutingOption  option,
const bool  value 
)

Turn specific routing options on or off.

Parameters
[in]optionThe type of routing option, a RoutingOption.
[in]valueA boolean representing the option state.

Definition at line 2045 of file router.cpp.

References Avoid::lastRoutingOptionMarker, m_routing_options, m_settings_changes, and option.

Referenced by main(), and test().

◆ setRoutingParameter()

void Avoid::Router::setRoutingParameter ( const RoutingParameter  parameter,
const double  value = chooseSensibleParamValue 
)

Sets values for routing parameters, including routing penalties.

libavoid uses a set of parameters to allow the user more control over routing style and quality. These different parameters are described and explained by the RoutingParameter enum. All parameters have sensible defaults.

Regarding routing penalties, libavoid will by default produce shortest path routes between the source and destination points for each connector. There are several penalties that can be applied during this stage to penalise certain conditions and thus improve the aesthetics of the routes generated.

If a value of zero or Avoid::zeroParamValue is given then the particular parameter value or penalty will be removed. If no parameter value argument (or a negative value) is specified when calling this method, then a sensible penalty value will be automatically chosen.

This method does not re-trigger processing of connectors. The new parameter value will be used the next time rerouting is performed.

Parameters
[in]parameterThe type of penalty, a RoutingParameter.
[in]valueThe value to be set for that parameter.

Definition at line 1995 of file router.cpp.

References Avoid::anglePenalty, Avoid::clusterCrossingPenalty, Avoid::crossingPenalty, Avoid::fixedSharedPathPenalty, Avoid::idealNudgingDistance, Avoid::lastRoutingParameterMarker, m_routing_parameters, m_settings_changes, Avoid::portDirectionPenalty, and Avoid::segmentPenalty.

Referenced by main(), setRoutingPenalty(), and test().

◆ setRoutingPenalty()

void Avoid::Router::setRoutingPenalty ( const RoutingParameter  penType,
const double  penVal = chooseSensibleParamValue 
)

Sets or removes penalty values that are applied during connector routing.

Note
This is a convenience wrapper for the setRoutingParameter()
Parameters
[in]penTypeThe type of penalty, a RoutingParameter.
[in]penValThe value to be applied for each occurrence of the penalty case.

Definition at line 2060 of file router.cpp.

References setRoutingParameter().

Referenced by main(), and test().

◆ setStaticGraphInvalidated()

void Avoid::Router::setStaticGraphInvalidated ( const bool  invalidated)

Definition at line 403 of file router.cpp.

References m_static_orthogonal_graph_invalidated.

Referenced by Avoid::ConnRef::common_updateEndPoint().

◆ setTopologyAddon()

void Avoid::Router::setTopologyAddon ( TopologyAddonInterface topologyAddon)

Set an addon for doing orthogonal topology improvement.

It is expected that you would use the topology::AvoidTopologyAddon() from libtopology rather than write your own. This is done so that libavoid does not have to depend on libtopology.

Definition at line 2337 of file router.cpp.

References Avoid::TopologyAddonInterface::clone(), m_topology_addon, and registerSettingsChange().

◆ setTransactionUse()

void Avoid::Router::setTransactionUse ( const bool  transactions)

Allows setting of the behaviour of the router in regard to transactions.

This controls whether transactions are used to queue changes and process them efficiently at once or they are instead processed immediately.

It is more efficient to perform actions like shape movement, addition or deletion as batch tasks, and reroute the necessary connectors just once after these actions have been performed. For this reason, libavoid allows you to group such actions into "transactions" that are processed efficiently when the processTransaction() method is called.

By default, the router will process all actions as transactions. If transactionUse() is set to false, then all actions will get processed immediately, and cause immediate routing callbacks to all affected connectors after each action.

Parameters
[in]transactionsA boolean value specifying whether to use transactions.

Definition at line 457 of file router.cpp.

References m_consolidate_actions.

Referenced by main(), and test().

◆ shapeContainingPoint()

ShapeRef * Avoid::Router::shapeContainingPoint ( const Point point)

Definition at line 158 of file router.cpp.

References Avoid::inPoly(), m_obstacles, and Avoid::Obstacle::routingPolygon().

◆ shouldContinueTransactionWithProgress()

bool Avoid::Router::shouldContinueTransactionWithProgress ( unsigned int  elapsedTime,
unsigned int  phaseNumber,
unsigned int  totalPhases,
double  proportion 
)
virtual

A method called at regular intervals during transaction processing to report progress and ask if the Router should continue the transaction.

You can subclass the Avoid::Router class to implement your own behaviour, such as to show a progress bar or cancel the transaction at the user's request.

Note that you can get a sense of progress by looking at the phaseNumber divided by the totalPhases and the progress in the current phase, but be aware that phases and the intervals and proportions at which this method is called will vary, sometime unpredictably.

You can return false to request that the Router abort the current transaction. Be aware that it may not abort in some phases. For others it may need to clean up some state before it is safe for you to interact with it again. Hence you should wait for a final call to this method with the phase Avoid::TransactionPhaseCompleted before continuing.

Note
Your implementation of this method should be very fast as it will be called many times. Also, you should not change or interact with the Router instance at all during these calls. Wait till you have received a call with the Avoid::TransactionPhaseCompleted phase.
Parameters
elapsedTimeThe number of msec spent on the transaction since it began.
phaseNumberA Router::TransactionPhases representing the current phase of the transaction.
totalPhasesThe total number of phases to be performed during the transaction.
proportionA double representing the progress in the current phase. Value will be between 0–1.
Returns
Whether the router should continue the transaction. This is true in the default (empty) implementation.

Definition at line 1375 of file router.cpp.

Referenced by performContinuationCheck().

◆ transactionUse()

bool Avoid::Router::transactionUse ( void  ) const

Reports whether the router groups actions into transactions.

Returns
A boolean value describing whether transactions are in use.
See also
setTransactionUse
processTransaction

Definition at line 451 of file router.cpp.

References m_consolidate_actions.

◆ validConnType()

Friends And Related Symbol Documentation

◆ ClusterRef

friend class ClusterRef
friend

Definition at line 824 of file router.h.

◆ ConnEnd

friend class ConnEnd
friend

Definition at line 827 of file router.h.

◆ ConnRef

friend class ConnRef
friend

Definition at line 821 of file router.h.

◆ HyperedgeImprover

friend class HyperedgeImprover
friend

Definition at line 830 of file router.h.

◆ HyperedgeRerouter

friend class HyperedgeRerouter
friend

Definition at line 829 of file router.h.

◆ HyperedgeTreeNode

friend struct HyperedgeTreeNode
friend

Definition at line 828 of file router.h.

◆ JunctionRef

friend class JunctionRef
friend

Definition at line 822 of file router.h.

◆ MinimumTerminalSpanningTree

friend class MinimumTerminalSpanningTree
friend

Definition at line 826 of file router.h.

◆ Obstacle

friend class Obstacle
friend

Definition at line 823 of file router.h.

◆ ShapeConnectionPin

friend class ShapeConnectionPin
friend

Definition at line 825 of file router.h.

◆ ShapeRef

friend class ShapeRef
friend

Definition at line 820 of file router.h.

Member Data Documentation

◆ actionList

◆ ClusteredRouting

bool Avoid::Router::ClusteredRouting

Definition at line 413 of file router.h.

Referenced by Avoid::cost().

◆ clusterRefs

◆ connRefs

◆ contains

◆ enclosingClusters

ContainsMap Avoid::Router::enclosingClusters

Definition at line 409 of file router.h.

Referenced by adjustClustersWithAdd(), adjustClustersWithDel(), and generateContains().

◆ IgnoreRegions

bool Avoid::Router::IgnoreRegions

◆ invisGraph

EdgeList Avoid::Router::invisGraph

◆ InvisibilityGrph

◆ m_abort_transaction

bool Avoid::Router::m_abort_transaction
private

Definition at line 865 of file router.h.

Referenced by improveCrossings(), performContinuationCheck(), and processActions().

◆ m_allows_orthogonal_routing

bool Avoid::Router::m_allows_orthogonal_routing
private

◆ m_allows_polyline_routing

◆ m_conn_reroute_flags

ConnRerouteFlagDelegate Avoid::Router::m_conn_reroute_flags
private

◆ m_consolidate_actions

bool Avoid::Router::m_consolidate_actions
private

◆ m_currently_calling_destructors

bool Avoid::Router::m_currently_calling_destructors
private

◆ m_debug_handler

DebugHandler* Avoid::Router::m_debug_handler
private

Definition at line 880 of file router.h.

Referenced by debugHandler(), and setDebugHandler().

◆ m_hyperedge_improver

HyperedgeImprover Avoid::Router::m_hyperedge_improver
private

◆ m_hyperedge_rerouter

HyperedgeRerouter Avoid::Router::m_hyperedge_rerouter
private

◆ m_in_crossing_rerouting_stage

bool Avoid::Router::m_in_crossing_rerouting_stage
private

Definition at line 874 of file router.h.

Referenced by improveCrossings(), and isInCrossingPenaltyReroutingStage().

◆ m_largest_assigned_id

unsigned int Avoid::Router::m_largest_assigned_id
private

Definition at line 854 of file router.h.

Referenced by assignId(), and newObjectId().

◆ m_obstacles

◆ m_routing_options

bool Avoid::Router::m_routing_options[lastRoutingOptionMarker]
private

◆ m_routing_parameters

double Avoid::Router::m_routing_parameters[lastRoutingParameterMarker]
private

Definition at line 857 of file router.h.

Referenced by outputInstanceToSVG(), Router(), routingParameter(), and setRoutingParameter().

◆ m_settings_changes

bool Avoid::Router::m_settings_changes
private

◆ m_static_orthogonal_graph_invalidated

bool Avoid::Router::m_static_orthogonal_graph_invalidated
private

◆ m_topology_addon

TopologyAddonInterface* Avoid::Router::m_topology_addon
private

◆ m_transaction_start_time

clock_t Avoid::Router::m_transaction_start_time
private

Definition at line 864 of file router.h.

Referenced by performContinuationCheck(), and processActions().

◆ PartialFeedback

bool Avoid::Router::PartialFeedback

Definition at line 423 of file router.h.

Referenced by processActions().

◆ PartialTime

bool Avoid::Router::PartialTime

Definition at line 411 of file router.h.

Referenced by processActions().

◆ RubberBandRouting

bool Avoid::Router::RubberBandRouting

◆ SelectiveReroute

bool Avoid::Router::SelectiveReroute

◆ SimpleRouting

bool Avoid::Router::SimpleRouting

Definition at line 412 of file router.h.

Referenced by processTransaction().

◆ st_checked_edges

int Avoid::Router::st_checked_edges

Definition at line 431 of file router.h.

Referenced by Avoid::EdgeInf::checkVis(), and printInfo().

◆ timers

Timer Avoid::Router::timers

Definition at line 429 of file router.h.

Referenced by printInfo().

◆ UseLeesAlgorithm

bool Avoid::Router::UseLeesAlgorithm

Definition at line 417 of file router.h.

Referenced by makeFeasible(), processActions(), and Avoid::vertexVisibility().

◆ vertices

◆ visGraph

◆ visOrthogGraph


The documentation for this class was generated from the following files: