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.

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...
 
unsigned int id (void) const
 Returns the ID of this shape. More...
 
const Polygonpolygon (void) const
 Returns a reference to the polygon boundary of this shape. More...
 
Routerrouter (void) const
 Returns a pointer to the router scene this shape is in. 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

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

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.

Parameters
[in]routerThe router scene to place the junction into.
[in]positionA Point representing the position of the junction.
[in]idA unique positive integer ID for the junction.
Avoid::JunctionRef::~JunctionRef ( )
virtual

Junction reference destructor.

This will call Router::removeJunction() for this shape, if this has not already be called.

Member Function Documentation

unsigned int Avoid::Obstacle::id ( void  ) const
inherited

Returns the ID of this shape.

Returns
The ID of the shape.
const Polygon & Avoid::Obstacle::polygon ( void  ) const
inherited

Returns a reference to the polygon boundary of this shape.

Returns
A reference to the polygon boundary of the shape.
Point Avoid::JunctionRef::position ( void  ) const

Returns the position of this junction.

Returns
A point representing 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.

Returns
The merged connector, or NULL if the junction was not removed.
Router * Avoid::Obstacle::router ( void  ) const
inherited

Returns a pointer to the router scene this shape is in.

Returns
A pointer to the router scene for this shape.

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