Adaptagrams
|
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... | |
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 object reference, and adds it to the router scene. This shape will be considered to be an obstacle. This will cause connectors intersecting the newly added shape 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 shape can be moved with Router::moveShape() and removed from the scene and freed with Router::deleteShape().
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.
[in] | router | The router scene to place the shape into. |
[in] | poly | A Polygon representing the boundary of the shape. |
[in] | id | Optionally, a positive integer ID unique among all objects. |
|
virtual |
Shape reference destructor.
Do not call this yourself, instead call Router::deleteShape(). Ownership of this object belongs to the router scene.
const Polygon & Avoid::ShapeRef::polygon | ( | void | ) | const |
Returns a reference to the polygon boundary of this shape.
Referenced by Avoid::Router::moveShape(), Avoid::ShapeConnectionPin::position(), and transformConnectionPinPositions().
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 specifying the type of transform to be applied to all connection pins for the shape. |
References Avoid::ConnDirAll, Avoid::ConnDirDown, Avoid::ConnDirLeft, Avoid::ConnDirRight, Avoid::ConnDirUp, Avoid::PolygonInterface::offsetBoundingBox(), polygon(), Avoid::TransformationType_CW180, Avoid::TransformationType_CW270, Avoid::TransformationType_CW90, Avoid::TransformationType_FlipX, and Avoid::TransformationType_FlipY.