Adaptagrams
Classes | Typedefs | Enumerations
Avoid Namespace Reference

libavoid: Object-avoiding orthogonal and polyline connector routing library. More...

Classes

class  Box
 A bounding box, represented by the top-left and bottom-right corners. More...
 
class  Checkpoint
 A checkpoint is a point that the route for a particular connector must visit. They may optionally be given an arrival/departure direction. More...
 
class  ClusterRef
 The ClusterRef class represents a cluster object. More...
 
class  ConnEnd
 The ConnEnd class represents different possible endpoints for connectors. More...
 
class  ConnRef
 The ConnRef class represents a connector object. More...
 
class  Edge
 A line between two points. More...
 
struct  HyperedgeNewAndDeletedObjectLists
 The HyperedgeNewAndDeletedObjectLists class stores lists of objects created and deleted during hyperedge improvement. More...
 
class  HyperedgeRerouter
 The HyperedgeRerouter class is a convenience object that can be used to register hyperedges to be rerouted, improving the placement of their junctions and connector paths. More...
 
class  JunctionRef
 The JunctionRef class represents a fixed or free-floating point that connectors can be attached to. More...
 
class  Point
 The Point class defines a point in the plane. More...
 
class  Polygon
 A dynamic Polygon, to which points can be easily added and removed. More...
 
class  PolygonInterface
 A common interface used by the Polygon classes. More...
 
class  Rectangle
 A Rectangle, a simpler way to define the polygon for square or rectangular shapes. More...
 
class  ReferencingPolygon
 A Polygon which just references its points from other Polygons. More...
 
class  Router
 The Router class represents a libavoid router instance. More...
 
class  ShapeConnectionPin
 The ShapeConnectionPin class represents a fixed point or "pin" on a shape that can be connected to. More...
 
class  ShapeRef
 The ShapeRef class represents a shape object. More...
 

Typedefs

typedef std::list< ConnRef * > ConnRefList
 A list of ConnRef objects.
 
typedef unsigned int ConnDirFlags
 One or more Avoid::ConnDirFlag options.
 
typedef Point Vector
 A vector, represented by the Point class.
 
typedef Polygon PolyLine
 A multi-segment line, represented with the Polygon class.
 
typedef std::list< ConnEndConnEndList
 A list of ConnEnd objects.
 
typedef std::list< JunctionRef * > JunctionRefList
 A list of JunctionRef objects.
 

Enumerations

enum  ConnType { , ConnType_PolyLine = 1, ConnType_Orthogonal = 2 }
 Describes the type of routing that is performed for each connector. More...
 
enum  ConnDirFlag { ,
  ConnDirUp = 1, ConnDirDown = 2, ConnDirLeft = 4, ConnDirRight = 8,
  ConnDirAll = 15
}
 Flags that can be passed to the ConnEnd constructor to specify which sides of a shape this point should have visibility to if it is located within the shape's area. More...
 
enum  ConnEndType { ConnEndPoint, ConnEndShapePin, ConnEndJunction, ConnEndEmpty }
 Types that describe the kind a connection that a ConnEnd represents. More...
 
enum  RouterFlag { PolyLineRouting = 1, OrthogonalRouting = 2 }
 Flags that can be passed to the router during initialisation to specify options. More...
 
enum  RoutingParameter {
  segmentPenalty = 0, anglePenalty, crossingPenalty, clusterCrossingPenalty,
  fixedSharedPathPenalty, portDirectionPenalty, shapeBufferDistance, idealNudgingDistance,
  reverseDirectionPenalty
}
 Types of routing parameters and penalties that can be used to tailor the style and improve the quality of the connector routes produced. More...
 
enum  RoutingOption {
  nudgeOrthogonalSegmentsConnectedToShapes = 0, improveHyperedgeRoutesMovingJunctions, penaliseOrthogonalSharedPathsAtConnEnds, nudgeOrthogonalTouchingColinearSegments,
  performUnifyingNudgingPreprocessingStep, improveHyperedgeRoutesMovingAddingAndDeletingJunctions, nudgeSharedPathsWithCommonEndPoint
}
 Types of routing options that can be enabled. More...
 
enum  TransactionPhases {
  TransactionPhaseOrthogonalVisibilityGraphScanX = 1, TransactionPhaseOrthogonalVisibilityGraphScanY, TransactionPhaseRouteSearch, TransactionPhaseCrossingDetection,
  TransactionPhaseRerouteSearch, TransactionPhaseOrthogonalNudgingX, TransactionPhaseOrthogonalNudgingY, TransactionPhaseCompleted
}
 Types of routing phases reported by Router::shouldContinueTransactionWithProgress(). More...
 
enum  ShapeTransformationType {
  TransformationType_CW90 = 0, TransformationType_CW180 = 1, TransformationType_CW270 = 2, TransformationType_FlipX = 3,
  TransformationType_FlipY = 4
}
 Describes the type of transformation that has been applied to a shape having its transformConnectionPinPositions() method called. More...
 

Detailed Description

libavoid: Object-avoiding orthogonal and polyline connector routing library.

You should use libavoid via an instance of the Router class.

Enumeration Type Documentation

◆ ConnDirFlag

Flags that can be passed to the ConnEnd constructor to specify which sides of a shape this point should have visibility to if it is located within the shape's area.

Like SVG, libavoid considers the Y-axis to point downwards, that is, like screen coordinates the coordinates increase from left-to-right and also from top-to-bottom.

Enumerator
ConnDirUp 

This option specifies the point should be given visibility to the top of the shape that it is located within.

ConnDirDown 

This option specifies the point should be given visibility to the bottom of the shape that it is located within.

ConnDirLeft 

This option specifies the point should be given visibility to the left side of the shape that it is located within.

ConnDirRight 

This option specifies the point should be given visibility to the right side of the shape that it is located within.

ConnDirAll 

This option, provided for convenience, specifies the point should be given visibility to all four sides of the shape that it is located within.

◆ ConnEndType

Types that describe the kind a connection that a ConnEnd represents.

Enumerator
ConnEndPoint 

The ConnEnd represents a free-floating point that may or may not have visibility in specific directions.

ConnEndShapePin 

The ConnEnd attaches to a specific ShapeConnectionPin on a shape.

ConnEndJunction 

The ConnEnd attaches to a junction.

ConnEndEmpty 

The ConnEnd is empty and doesn't have any information set.

◆ ConnType

Describes the type of routing that is performed for each connector.

Enumerator
ConnType_PolyLine 

The connector path will be a shortest-path poly-line that routes around obstacles.

ConnType_Orthogonal 

The connector path will be a shortest-path orthogonal poly-line (only vertical and horizontal line segments) that routes around obstacles.

◆ RouterFlag

Flags that can be passed to the router during initialisation to specify options.

Enumerator
PolyLineRouting 

This option specifies that the router should maintain the structures necessary to allow poly-line connector routing.

OrthogonalRouting 

This option specifies that the router should maintain the structures necessary to allow orthogonal connector routing.

◆ RoutingOption

Types of routing options that can be enabled.

Enumerator
nudgeOrthogonalSegmentsConnectedToShapes 

This option causes the final segments of connectors, which are attached to shapes, to be nudged apart. Usually these segments are fixed, since they are considered to be attached to ports.

Defaults to false.

This option also causes routes running through the same checkpoint to be nudged apart.

This option has no effect if nudgeSharedPathsWithCommonEndPoint is set to false,

Note
This will allow routes to be nudged up to the bounds of shapes.
improveHyperedgeRoutesMovingJunctions 

This option causes hyperedge routes to be locally improved fixing obviously bad paths. As part of this process libavoid will effectively move junctions, setting new ideal positions which can be accessed via JunctionRef::recommendedPosition() for each junction.

Defaults to true.

This will not add or remove junctions, so will keep the hyperedge topology the same. Better routes can be achieved by enabling the improveHyperedgeRoutesMovingAddingAndDeletingJunctions option.

If initial sensible positions for junctions in hyperedges are not known you can register those hyperedges with the HyperedgeRerouter class for complete rerouting.

See also
improveHyperedgeRoutesMovingAddingAndDeletingJunctions
Router::hyperedgeRerouter()
penaliseOrthogonalSharedPathsAtConnEnds 

This option penalises and attempts to reroute orthogonal shared connector paths terminating at a common junction or shape connection pin. When multiple connector paths enter or leave the same side of a junction (or shape pin), the router will attempt to reroute these to different sides of the junction or different shape pins.

Defaults to false.

This option depends on the fixedSharedPathPenalty penalty having been set.

See also
fixedSharedPathPenalty
Note
This option is still experimental! It is not recommended for normal use.
nudgeOrthogonalTouchingColinearSegments 

This option can be used to control whether collinear line segments that touch just at their ends will be nudged apart. The overlap will usually be resolved in the other dimension, so this is not usually required.

Defaults to false.

performUnifyingNudgingPreprocessingStep 

This option can be used to control whether the router performs a preprocessing step before orthogonal nudging where is tries to unify segments and centre them in free space. This generally results in better quality ordering and nudging.

Defaults to true.

You may wish to turn this off for large examples where it can be very slow and will make little difference.

improveHyperedgeRoutesMovingAddingAndDeletingJunctions 

This option causes hyperedge routes to be locally improved fixing obviously bad paths.

It can cause junctions and connectors to be added or removed from hyperedges. To get details of these changes for each connector you can call Router::newAndDeletedObjectListsFromHyperedgeImprovement().

As part of this process libavoid will effectively move junctions by setting new ideal positions for each remaining or added junction, which can be read from JunctionRef::recommendedPosition() for each junction.

Defaults to false.

If set, this option overrides the improveHyperedgeRoutesMovingJunctions option.

If initial sensible positions for junctions in hyperedges are not known you can register those hyperedges with the HyperedgeRerouter class for complete rerouting.

See also
improveHyperedgeRoutesMovingJunctions
Router::hyperedgeRerouter()
nudgeSharedPathsWithCommonEndPoint 

This option determines whether intermediate segments of connectors that are attached to common endpoints will be nudged apart. Usually these segments get nudged apart, but you may want to turn this off if you would prefer that entire shared paths terminating at a common end point should overlap.

Defaults to true.

◆ RoutingParameter

Types of routing parameters and penalties that can be used to tailor the style and improve the quality of the connector routes produced.

Enumerator
segmentPenalty 

This penalty is applied for each segment in the connector path beyond the first. This should always normally be set when doing orthogonal routing to prevent step-like connector paths.

Note
This penalty must be set (i.e., be greater than zero) in order for orthogonal connector nudging to be performed, since this requires reasonable initial routes.
anglePenalty 

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.

crossingPenalty 

This penalty is applied whenever a connector path crosses another connector path. It takes shared paths into consideration and the penalty is only applied if there is an actual crossing.

Note
This penalty is still experimental! It is not recommended for normal use.
clusterCrossingPenalty 

This penalty is applied whenever a connector path crosses a cluster boundary.

Note
This penalty is still experimental! It is not recommended for normal use.
This penalty is very slow. You can override the method Router::shouldContinueTransactionWithProgress() to check progress and possibly cancel overly slow transactions.
fixedSharedPathPenalty 

This penalty is applied whenever a connector path shares some segments with an immovable portion of an existing connector route (such as the first or last segment of a connector).

Note
This penalty is still experimental! It is not recommended for normal use.
portDirectionPenalty 

This penalty is applied to port selection choice when the other end of the connector being routed does not appear in any of the 90 degree visibility cones centered on the visibility directions for the port.

Note
This penalty is still experimental! It is not recommended for normal use.
This penalty is very slow. You can override the method Router::shouldContinueTransactionWithProgress() to check progress and possibly cancel overly slow transactions.
shapeBufferDistance 

This parameter defines the spacing distance that will be added to the sides of each shape when determining obstacle sizes for routing. This controls how closely connectors pass shapes, and can be used to prevent connectors overlapping with shape boundaries. By default, this distance is set to a value of 0.

idealNudgingDistance 

This parameter defines the spacing distance that will be used for nudging apart overlapping corners and line segments of connectors. By default, this distance is set to a value of 4.

reverseDirectionPenalty 

This penalty is applied whenever a connector path travels in the direction opposite of the destination from the source endpoint. By default this penalty is set to zero. This shouldn't be needed in most cases but can be useful if you use penalties such as crossingPenalty which cause connectors to loop around obstacles.

◆ ShapeTransformationType

Describes the type of transformation that has been applied to a shape having its transformConnectionPinPositions() method called.

Enumerator
TransformationType_CW90 

The shape has been rotated clockwise by 90 degrees.

TransformationType_CW180 

The shape has been rotated clockwise by 180 degrees.

TransformationType_CW270 

The shape has been rotated clockwise by 270 degrees.

TransformationType_FlipX 

The shape has been flipped horizontally in the X-dimension.

TransformationType_FlipY 

The shape has been flipped vertically in the Y-dimension.

◆ TransactionPhases

Types of routing phases reported by Router::shouldContinueTransactionWithProgress().

This phases will occur in the order given here, but each phase may take varying amounts of time.

Enumerator
TransactionPhaseOrthogonalVisibilityGraphScanX 

The orthogonal visibility graph is built by conducting a scan in each dimension. This is the x-dimension.

TransactionPhaseOrthogonalVisibilityGraphScanY 

The orthogonal visibility graph is built by conducting a scan in each dimension. This is the y-dimension.

TransactionPhaseRouteSearch 

Initial routes are searched for in the visibility graph.

TransactionPhaseCrossingDetection 

With crossing penalties enabled, crossing detection is performed to find all crossings.

TransactionPhaseRerouteSearch 

Crossing connectors are rerouted to search for better routes.

TransactionPhaseOrthogonalNudgingX 

Orthogonal edge segments are nudged apart in the x-dimension.

TransactionPhaseOrthogonalNudgingY 

Orthogonal edge segments are nudged apart in the y-dimension.

TransactionPhaseCompleted 

Not a real phase, but represents the router is finished (or has aborted) the transaction and you may interact with is again.