Public Member Functions | List of all members
Avoid::ShapeRef Class Reference

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 Polygonpolygon (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...
 
Routerrouter (void) const
 Returns a pointer to the router scene this shape is in. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

Avoid::ShapeRef::ShapeRef ( Router router,
Polygon poly,
const unsigned int  id = 0 
)

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.

Parameters
[in]routerThe router scene to place the shape into.
[in]polyA Polygon representing the boundary of the shape.
[in]idA unique positive integer ID for the shape.
Avoid::ShapeRef::~ShapeRef ( )
virtual

Shape reference destructor.

This will call Router::removeShape() 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::ShapeRef::polygon ( void  ) const

Returns a reference to the polygon boundary of this shape.

Returns
A reference to the polygon boundary of the shape.
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.
void Avoid::ShapeRef::transformConnectionPinPositions ( ShapeTransformationType  transform)

Adjusts all of the shape's connection pin positions and visibility directions for a given transformation type.

Parameters
[in]transformA ShapeTransformationType specifing the type of transform to be applied to all connection pins for the shape.

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