The ShapeRef class represents a shape object. More...
#include <shape.h>
Inherits Avoid::Obstacle.
Public Member Functions | |
ShapeRef (Router *router, Polygon &poly, const unsigned int id=0) | |
Shape reference constructor. More... | |
virtual | ~ShapeRef () |
Shape reference destructor. More... | |
const Polygon & | polygon (void) const |
Returns a reference to the polygon boundary of this shape. More... | |
void | transformConnectionPinPositions (ShapeTransformationType transform) |
Adjusts all of the shape's connection pin positions and visibility directions for a given transformation type. More... | |
unsigned int | id (void) const |
Returns the ID of this shape. More... | |
Router * | router (void) const |
Returns a pointer to the router scene this shape is in. More... | |
The ShapeRef class represents a shape object.
Shapes are obstacles that connectors must be routed around. They can be placed into a Router scene and can be repositioned or resized (via Router::moveShape()).
Usually, it is expected that you would create a ShapeRef for each shape in your diagram and keep that reference in your own shape class.
Shape reference constructor.
Creates a shape obect reference, but does not yet place it into the Router scene. You can add or remove the shape to/from the scene with Router::addJunction() and Router::removeJunction(). The junction can be moved with Router::moveJunction().
The poly argument will usually be the boundary of the shape in your application with additional buffer of several pixels on each side. Specifying such a buffer results in connectors leaving a small amount of space around shapes, rather than touching them on the corners or edges.
If an ID is not specified, then one will be assigned to the shape. 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 shape into. |
[in] | poly | A Polygon representing the boundary of the shape. |
[in] | id | A unique positive integer ID for the shape. |
|
virtual |
Shape reference destructor.
This will call Router::removeShape() for this shape, if this has not already be called.
|
inherited |
Returns the ID of this shape.
const Polygon & Avoid::ShapeRef::polygon | ( | void | ) | const |
Returns a reference to the polygon boundary of this shape.
|
inherited |
Returns a pointer to the router scene this shape is in.
void Avoid::ShapeRef::transformConnectionPinPositions | ( | ShapeTransformationType | transform | ) |
Adjusts all of the shape's connection pin positions and visibility directions for a given transformation type.
[in] | transform | A ShapeTransformationType specifing the type of transform to be applied to all connection pins for the shape. |