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... | |
unsigned int | id (void) const |
Returns the ID of this shape. More... | |
const Polygon & | polygon (void) const |
Returns a reference to the polygon boundary of this shape. More... | |
Router * | router (void) const |
Returns a pointer to the router scene this shape is in. 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 obect reference, but does not yet place it into the Router scene. You can add or remove the junction to/from the scene with Router::addJunction() and Router::removeJunction(). The junction can be moved with Router::moveJunction().
If an ID is not specified, then one will be assigned to the junction. If assigning an ID yourself, note that it should be a unique positive integer. Also, IDs are given to all objects in a scene, so the same ID cannot be given to a shape and a connector for example.
[in] | router | The router scene to place the junction into. |
[in] | position | A Point representing the position of the junction. |
[in] | id | A unique positive integer ID for the junction. |
|
virtual |
Junction reference destructor.
This will call Router::removeJunction() for this shape, if this has not already be called.
|
inherited |
Returns the ID of this shape.
|
inherited |
Returns a reference to the polygon boundary of this shape.
Point Avoid::JunctionRef::position | ( | void | ) | const |
Returns the position of this junction.
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 connecor 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 NULL.
|
inherited |
Returns a pointer to the router scene this shape is in.