Adaptagrams
Public Member Functions | List of all members
Avoid::JunctionRef Class Reference

The JunctionRef class represents a fixed or free-floating point that connectors can be attached to. More...

#include <junction.h>

Inherits Avoid::Obstacle.

Collaboration diagram for Avoid::JunctionRef:
Collaboration graph

Public Member Functions

 JunctionRef (Router *router, Point position, const unsigned int id=0)
 Junction reference constructor. More...
 
virtual ~JunctionRef ()
 Junction reference destructor. More...
 
ConnRefremoveJunctionAndMergeConnectors (void)
 Removes a junction that has only two connectors attached to it and merges them into a single connector. More...
 
Point position (void) const
 Returns the position of this junction. More...
 
void setPositionFixed (bool fixed)
 Sets whether the junction has a fixed position and therefore can't be moved by the Router during routing. More...
 
bool positionFixed (void) const
 Returns whether this junction has a fixed position (that can't be moved by the Router during routing). More...
 
Point recommendedPosition (void) const
 Returns a recommended position for the junction based on improving hyperedge routes. This value will be set during routing when the improveHyperedgeRoutesMovingJunctions router option is set (the default). More...
 

Detailed Description

The JunctionRef class represents a fixed or free-floating point that connectors can be attached to.

A JunctionRef represents a junction between multiple connectors, or could be used to specify an intermediate point that a single connector must route through.

Constructor & Destructor Documentation

◆ JunctionRef()

Avoid::JunctionRef::JunctionRef ( Router router,
Point  position,
const unsigned int  id = 0 
)

Junction reference constructor.

Creates a junction object reference, and adds it to the router scene. This junction will be considered to be an obstacle. This will cause connectors intersecting the newly added junction to be marked as needing to be rerouted.

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

The junction can be moved with Router::moveJunction() and removed from the scene and freed with Router::deleteJunction().

libavoid expects junctions to have sensible positions (i.e., for junctions to be positioned outside of shapes). When routing it will simplify hyperedges by moving junctions while preserving hyperedge topology, i.e., not altering the sides of shapes the hyperedge routes around.

If you don't have sensible positions for junctions or want to disregard the junction position and reroute the entire hyperedge considering only the endpoints, then this can be achieved by registering the hyperedge with the HyperedgeRerouter class obtained by calling the Router::hyperedgeRerouter() method.

When the improveHyperedgeRoutesMovingJunctions router option is set (the default) the junction position is a suggestion used for initial routing, but subsequent hyperedge path improvement may suggest new junction positions for the updated routings. This position can be accessed via the recommendedPosition() method.

When the improveHyperedgeRoutesMovingAddingAndDeletingJunctions router option is set (not the default) junctions and connectors can be added or removed to further improve hyperedges, see also Router::newAndDeletedObjectListsFromHyperedgeImprovement().

Note
Regarding IDs: You can let libavoid manually handle IDs by not specifying them. Alternatively, you can specify all IDs yourself, but you must be careful to makes sure that each object in the scene (shape, connector, cluster, etc.) is given a unique, positive ID. This uniqueness is checked if assertions are enabled, but if not and there are clashes then strange things can happen.
Parameters
[in]routerThe router scene to place the junction into.
[in]positionA Point representing the position of the junction.
[in]idOptionally, a positive integer ID unique among all objects.

References Avoid::ConnDirAll, and Avoid::ShapeConnectionPin::setExclusive().

Here is the call graph for this function:

◆ ~JunctionRef()

Avoid::JunctionRef::~JunctionRef ( )
virtual

Junction reference destructor.

Do not call this yourself, instead call Router::deleteJunction(). Ownership of this object belongs to the router scene.

Member Function Documentation

◆ position()

Point Avoid::JunctionRef::position ( void  ) const

Returns the position of this junction.

Returns
A point representing the position of this junction.

Referenced by Avoid::Router::moveJunction(), Avoid::ShapeConnectionPin::position(), and Avoid::ShapeConnectionPin::ShapeConnectionPin().

Here is the caller graph for this function:

◆ positionFixed()

bool Avoid::JunctionRef::positionFixed ( void  ) const

Returns whether this junction has a fixed position (that can't be moved by the Router during routing).

Returns
A point representing the position of this junction.

◆ recommendedPosition()

Point Avoid::JunctionRef::recommendedPosition ( void  ) const

Returns a recommended position for the junction based on improving hyperedge routes. This value will be set during routing when the improveHyperedgeRoutesMovingJunctions router option is set (the default).

Returns
A point indicating the ideal position for this junction.

Referenced by Avoid::Router::outputInstanceToSVG().

Here is the caller graph for this function:

◆ removeJunctionAndMergeConnectors()

ConnRef * Avoid::JunctionRef::removeJunctionAndMergeConnectors ( void  )

Removes a junction that has only two connectors attached to it and merges them into a single connector.

The junction and one of the connectors will be removed from the router scene and the connector deleted. A pointer to the remaining (merged) connector will be returned by this method.

Currently this method does not delete and free the Junction itself. The user needs to do this after the transaction has been processed by the router.

If there are more than two connectors attached to the junction then nothing will be changed and this method will return nullptr.

Returns
The merged connector, or nullptr if the junction was not removed.

◆ setPositionFixed()

void Avoid::JunctionRef::setPositionFixed ( bool  fixed)

Sets whether the junction has a fixed position and therefore can't be moved by the Router during routing.

This property is ignored for hyperedge improvement if the option improveHyperedgeRoutesMovingAddingAndDeletingJunctions is set and when it would lead to confusing hyperedge topology, such as two overlapping junctions with a zero length connector between them or an unnecessary junction bridging two connectors.

Parameters
[in]fixedBoolean indicating whether the junction position should be marked as fixed.

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