casa
$Rev:20696$
|
class PixelCanvas; class WorldCanvas; More...
#include <DisplayShapeInterface.h>
Public Types | |
enum | Coord { Pixels, Relative, World } |
Public Member Functions | |
DisplayShapeInterface (const Record &shapeInfo) | |
Constructor for a standard shape. | |
DisplayShapeInterface (const Record &shapeInfo, const PixelCanvas *pc, const Bool scale=True) | |
Constructor for shape based on relative screen positions. | |
DisplayShapeInterface (const Record shapeInfo, const WorldCanvas *wc) | |
Constructor for shape based on world co-ordinates (NYI) | |
DisplayShapeInterface (const DisplayShapeInterface &other) | |
Copy cons. | |
virtual | ~DisplayShapeInterface () |
virtual Bool | inObject (const Float xPos, const Float yPos) |
DisplayShape functionality. | |
virtual Bool | onHandles (const Float xPos, const Float yPos) |
virtual Vector< Float > | getCenter () const |
virtual void | setCenter (const Float xPos, const Float yPos) |
virtual Bool | whichHandle (const Float xPos, const Float yPos, Int &out) |
virtual void | changePoint (const Vector< Float > &newPos) |
virtual void | changePoint (const Vector< Float > &newPoint, const Int nPoint) |
virtual void | addPoint (const Vector< Float > &newPoint) |
virtual void | rotate (const Float angle) |
virtual void | scale (const Float angle) |
virtual void | draw (PixelCanvas *toDrawTo) |
virtual void | move (const Float dX, const Float dY) |
virtual void | addLocked (DisplayShapeInterface *toLock) |
virtual void | removeLocked (DisplayShapeInterface *removeLock) |
virtual void | setDrawHandles (const Bool &draw) |
virtual Bool | setOptions (const Record &newOptions) |
virtual Record | getOptions () |
virtual Bool | updatePixelPosition () |
Update the pixel location of this shape, based on the stored information on its location. | |
virtual Bool | updateNonPixelPosition () |
If the shape is being used in absolute pixel co-ordinates, this will do nothing. | |
virtual DisplayShape * | getObject () |
Returns the pointer to the underlying object. | |
virtual void | toPolygon () |
If the shape is a PolyLine, this function will change it to a polygon. | |
Private Member Functions | |
Record | toPixOpts (const Record ¬Pix) |
Record | fromPixOpts (const Record &pix) |
Will return an option set with whatever the current coords method is. | |
Record | pixToRelOpts (const Record &pixel) |
Record | relToPixOpts (const Record &relative) |
Record | pixToWorldOpts (const Record &pix) |
Record | worldToPixOpts (const Record &world) |
Vector< Float > | pixToRel (const Vector< Float > &pix) |
Vector< Float > | relToPix (const Vector< Float > &rel) |
Float | relToPixWidth (const Float rel) |
Float | relToPixHeight (const Float rel) |
Float | pixToRelWidth (const Float pix) |
Float | pixToRelHeight (const Float pix) |
void | makeShape (const Record &shapeInfo) |
Private Attributes | |
DisplayShape * | itsShape |
DisplayShapeInterface::Coord | itsCoords |
const PixelCanvas * | itsPc |
const WorldCanvas * | itsWc |
Bool | itsScale |
Scale widths and heights in relative mode? | |
Record | altCoords |
Copy of shape, however in its alternate coord form. |
class PixelCanvas; class WorldCanvas;
Wrapper for DisplayShapes;provides easier/unified constr. of DisplayShapes
DisplayShapeInterface makes it easier to work with DisplayShapes.
DisplayShapeInterface simply contains a pointer to a DisplayShape object. It allows all DisplayShapes to be constructed via a single constructor. i.e. the DisplayShapeInterface constructor actually decides which shape to create based on the information in the Record passed to it. It makes creating new shapes look a little nice, since:
record1.define("type", "square"); and record2.define("type", "circle");
can both be simply made into a new DisplayShapeInterface, e.g.
DisplayShapeInterface* myShape = new DisplayShapeInterface(record1); or DisplayShapeInterface* myShape = new DisplayShapeInterface(record2);
It also guarantees consistant interfaces between shapes.
The creation of an interface to DisplayShapes makes use of the simpler.
Definition at line 86 of file DisplayShapeInterface.h.
Definition at line 89 of file DisplayShapeInterface.h.
casa::DisplayShapeInterface::DisplayShapeInterface | ( | const Record & | shapeInfo | ) |
Constructor for a standard shape.
The shape will be totally based on pixel sizes, both for it's position and sizes.
casa::DisplayShapeInterface::DisplayShapeInterface | ( | const Record & | shapeInfo, |
const PixelCanvas * | pc, | ||
const Bool | scale = True |
||
) |
Constructor for shape based on relative screen positions.
if scaled is true, relative screen positions will be used for height etc also. If not, positions only will be based on relative screen pos, heights will be based on an absolute pixel value.
casa::DisplayShapeInterface::DisplayShapeInterface | ( | const Record | shapeInfo, |
const WorldCanvas * | wc | ||
) |
Constructor for shape based on world co-ordinates (NYI)
casa::DisplayShapeInterface::DisplayShapeInterface | ( | const DisplayShapeInterface & | other | ) |
Copy cons.
virtual casa::DisplayShapeInterface::~DisplayShapeInterface | ( | ) | [virtual] |
virtual void casa::DisplayShapeInterface::addLocked | ( | DisplayShapeInterface * | toLock | ) | [virtual] |
virtual void casa::DisplayShapeInterface::addPoint | ( | const Vector< Float > & | newPoint | ) | [virtual] |
virtual void casa::DisplayShapeInterface::changePoint | ( | const Vector< Float > & | newPos | ) | [virtual] |
virtual void casa::DisplayShapeInterface::changePoint | ( | const Vector< Float > & | newPoint, |
const Int | nPoint | ||
) | [virtual] |
virtual void casa::DisplayShapeInterface::draw | ( | PixelCanvas * | toDrawTo | ) | [virtual] |
Record casa::DisplayShapeInterface::fromPixOpts | ( | const Record & | pix | ) | [private] |
Will return an option set with whatever the current coords method is.
virtual Vector<Float> casa::DisplayShapeInterface::getCenter | ( | ) | const [virtual] |
virtual DisplayShape* casa::DisplayShapeInterface::getObject | ( | ) | [virtual] |
Returns the pointer to the underlying object.
virtual Record casa::DisplayShapeInterface::getOptions | ( | ) | [virtual] |
virtual Bool casa::DisplayShapeInterface::inObject | ( | const Float | xPos, |
const Float | yPos | ||
) | [virtual] |
DisplayShape functionality.
All of these functions simply wrap those of the underlying DisplayShape (and add conversion functionality). Please see DisplayShape for a full description of these functions.
void casa::DisplayShapeInterface::makeShape | ( | const Record & | shapeInfo | ) | [private] |
virtual void casa::DisplayShapeInterface::move | ( | const Float | dX, |
const Float | dY | ||
) | [virtual] |
virtual Bool casa::DisplayShapeInterface::onHandles | ( | const Float | xPos, |
const Float | yPos | ||
) | [virtual] |
Vector<Float> casa::DisplayShapeInterface::pixToRel | ( | const Vector< Float > & | pix | ) | [private] |
Float casa::DisplayShapeInterface::pixToRelHeight | ( | const Float | pix | ) | [private] |
Record casa::DisplayShapeInterface::pixToRelOpts | ( | const Record & | pixel | ) | [private] |
Float casa::DisplayShapeInterface::pixToRelWidth | ( | const Float | pix | ) | [private] |
Record casa::DisplayShapeInterface::pixToWorldOpts | ( | const Record & | pix | ) | [private] |
Vector<Float> casa::DisplayShapeInterface::relToPix | ( | const Vector< Float > & | rel | ) | [private] |
Float casa::DisplayShapeInterface::relToPixHeight | ( | const Float | rel | ) | [private] |
Record casa::DisplayShapeInterface::relToPixOpts | ( | const Record & | relative | ) | [private] |
Float casa::DisplayShapeInterface::relToPixWidth | ( | const Float | rel | ) | [private] |
virtual void casa::DisplayShapeInterface::removeLocked | ( | DisplayShapeInterface * | removeLock | ) | [virtual] |
virtual void casa::DisplayShapeInterface::rotate | ( | const Float | angle | ) | [virtual] |
virtual void casa::DisplayShapeInterface::scale | ( | const Float | angle | ) | [virtual] |
virtual void casa::DisplayShapeInterface::setCenter | ( | const Float | xPos, |
const Float | yPos | ||
) | [virtual] |
virtual void casa::DisplayShapeInterface::setDrawHandles | ( | const Bool & | draw | ) | [virtual] |
virtual Bool casa::DisplayShapeInterface::setOptions | ( | const Record & | newOptions | ) | [virtual] |
Record casa::DisplayShapeInterface::toPixOpts | ( | const Record & | notPix | ) | [private] |
virtual void casa::DisplayShapeInterface::toPolygon | ( | ) | [virtual] |
If the shape is a PolyLine, this function will change it to a polygon.
This is designed for use in the creation of polygon by the user clicking out a polyline, for example.
virtual Bool casa::DisplayShapeInterface::updateNonPixelPosition | ( | ) | [virtual] |
If the shape is being used in absolute pixel co-ordinates, this will do nothing.
If being used in relative screen or WC mode, this will update the position based on its current pixel location. Returns false if the conversion to the other co-ord type fails.
virtual Bool casa::DisplayShapeInterface::updatePixelPosition | ( | ) | [virtual] |
Update the pixel location of this shape, based on the stored information on its location.
If the shape is being used in pixel mode this will do nothing. If being used in relative screen mode or WC mode, this will update its location. Returns false if a conversion to pixels fail.
virtual Bool casa::DisplayShapeInterface::whichHandle | ( | const Float | xPos, |
const Float | yPos, | ||
Int & | out | ||
) | [virtual] |
Record casa::DisplayShapeInterface::worldToPixOpts | ( | const Record & | world | ) | [private] |
Record casa::DisplayShapeInterface::altCoords [private] |
Copy of shape, however in its alternate coord form.
Definition at line 186 of file DisplayShapeInterface.h.
Definition at line 176 of file DisplayShapeInterface.h.
const PixelCanvas* casa::DisplayShapeInterface::itsPc [private] |
Definition at line 177 of file DisplayShapeInterface.h.
Bool casa::DisplayShapeInterface::itsScale [private] |
Scale widths and heights in relative mode?
Definition at line 183 of file DisplayShapeInterface.h.
Definition at line 175 of file DisplayShapeInterface.h.
const WorldCanvas* casa::DisplayShapeInterface::itsWc [private] |
Definition at line 178 of file DisplayShapeInterface.h.