Adaptagrams
|
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to. More...
#include <junction.h>
Inherits Avoid::Obstacle.
Public Member Functions | |
JunctionRef (Router *router, Point position, const unsigned int id=0) | |
Junction reference constructor. More... | |
virtual | ~JunctionRef () |
Junction reference destructor. More... | |
ConnRef * | removeJunctionAndMergeConnectors (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... | |
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.
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().
[in] | router | The router scene to place the junction into. |
[in] | position | A Point representing the position of the junction. |
[in] | id | Optionally, a positive integer ID unique among all objects. |
References Avoid::ConnDirAll, and Avoid::ShapeConnectionPin::setExclusive().
|
virtual |
Junction reference destructor.
Do not call this yourself, instead call Router::deleteJunction(). Ownership of this object belongs to the router scene.
Point Avoid::JunctionRef::position | ( | void | ) | const |
Returns the position of this junction.
Referenced by Avoid::Router::moveJunction(), Avoid::ShapeConnectionPin::position(), and Avoid::ShapeConnectionPin::ShapeConnectionPin().
bool Avoid::JunctionRef::positionFixed | ( | void | ) | const |
Returns whether this junction has a fixed position (that can't be moved by the Router during routing).
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).
Referenced by Avoid::Router::outputInstanceToSVG().
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.
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.
[in] | fixed | Boolean indicating whether the junction position should be marked as fixed. |