casa
$Rev:20696$
|
Implementation of a rectangle. More...
#include <DSRectangle.h>
Public Member Functions | |
DSRectangle () | |
Constructors and Destructors. | |
DSRectangle (const Float &xPos, const Float &yPos, const Float &width, const Float &height, const Bool &handles=False, const Bool &drawHandles=False) | |
DSRectangle (const DSRectangle &other) | |
virtual | ~DSRectangle () |
virtual void | move (const Float &dX, const Float &dY) |
Standard DisplayShape functions. | |
virtual void | rotate (const Float &angle) |
Rotate the shape about its center by a set angle (angle in degrees). | |
virtual void | rotateAbout (const Float &angle, const Float &aboutX, const Float &aboutY) |
virtual void | setCenter (const Float &xPos, const Float &yPos) |
Sets the center of the DisplayShape. | |
virtual void | changePoint (const Vector< Float > &pos) |
Changes the closest point to the supplied location to that location. | |
virtual void | changePoint (const Vector< Float > &newPoints, const Int whichOne) |
Changes the nth point making up the DisplayShape ot the specified location. | |
virtual void | addPoint (const Vector< Float > &toAdd) |
Polygon specific functions, add, delete and set points, all in pixels. | |
virtual void | setHeight (const Float &height) |
Rectangle specific. | |
virtual void | setWidth (const Float &width) |
virtual Float | getHeight () |
virtual Float | getWidth () |
virtual Bool | setOptions (const Record &settings) |
Get and set options. | |
virtual Record | getOptions () |
Get and set options. | |
virtual Matrix< Float > | makeAsPoly (const Float &xPos, const Float &yPos, const Float &width, const Float &height) |
Using supplied parameters, make a polygon of four points representing the rectangle. | |
Protected Member Functions | |
virtual Float | getAngle () |
Private Member Functions | |
virtual void | setDefaultOptions () |
virtual void | setAngle (const Float &newAngle) |
Private Attributes | |
Float | itsAngle |
Always valid. | |
Bool | itsValid |
Float | itsCenter |
Ony used during the set-up period. | |
Float | itsWidth |
Float | itsHeight |
Implementation of a rectangle.
DSRectangle is a method of managing the drawing of a rectangle onto a PixelCanvas.
DSRectangle is simply a DSPoly with only four points. It has overloaded certain functions however, which cause it to behave as a rectangle when having its points moved etc. It calculates its width and height from points returned from DSPoly when needed.
There are generally two ways to make DisplayShape(s); To create them in "one hit" by providing arguments to the constructor, or by using the default constructor and then the "setOptions" method. A simple interface for all classes inheriting from the DisplayShape class is provided by DisplayShapeInterface .
The need to draw rectangles on screen.
Definition at line 80 of file DSRectangle.h.
Constructors and Destructors.
casa::DSRectangle::DSRectangle | ( | const Float & | xPos, |
const Float & | yPos, | ||
const Float & | width, | ||
const Float & | height, | ||
const Bool & | handles = False , |
||
const Bool & | drawHandles = False |
||
) |
casa::DSRectangle::DSRectangle | ( | const DSRectangle & | other | ) |
virtual casa::DSRectangle::~DSRectangle | ( | ) | [virtual] |
virtual void casa::DSRectangle::addPoint | ( | const Vector< Float > & | newPoint | ) | [virtual] |
Polygon specific functions, add, delete and set points, all in pixels.
Add point decides the best place in the array to insert the new point. Similarly, deletePoints(const Vector<Float>& remove) deletes the point closest to that provided.
Reimplemented from casa::DSPoly.
virtual void casa::DSRectangle::changePoint | ( | const Vector< Float > & | newPos | ) | [virtual] |
Changes the closest point to the supplied location to that location.
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSSquare, casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSRectangle::changePoint | ( | const Vector< Float > & | newPoint, |
const Int | nPoint | ||
) | [virtual] |
Changes the nth point making up the DisplayShape ot the specified location.
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSSquare, casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual Float casa::DSRectangle::getAngle | ( | ) | [protected, virtual] |
virtual Float casa::DSRectangle::getHeight | ( | ) | [virtual] |
virtual Record casa::DSRectangle::getOptions | ( | ) | [virtual] |
Get and set options.
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSSquare, casa::DSWorldRectangle, casa::DSScreenRectangle, and casa::DSPixelRectangle.
virtual Float casa::DSRectangle::getWidth | ( | ) | [virtual] |
virtual Matrix<Float> casa::DSRectangle::makeAsPoly | ( | const Float & | xPos, |
const Float & | yPos, | ||
const Float & | width, | ||
const Float & | height | ||
) | [virtual] |
Using supplied parameters, make a polygon of four points representing the rectangle.
This can then be used to create / alter a DSPoly.
virtual void casa::DSRectangle::move | ( | const Float & | dX, |
const Float & | dY | ||
) | [virtual] |
Standard DisplayShape functions.
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSRectangle::rotate | ( | const Float & | angle | ) | [virtual] |
Rotate the shape about its center by a set angle (angle in degrees).
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSRectangle::rotateAbout | ( | const Float & | angle, |
const Float & | aboutX, | ||
const Float & | aboutY | ||
) | [virtual] |
Reimplemented from casa::DSPoly.
virtual void casa::DSRectangle::setAngle | ( | const Float & | newAngle | ) | [private, virtual] |
virtual void casa::DSRectangle::setCenter | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [virtual] |
Sets the center of the DisplayShape.
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSRectangle::setDefaultOptions | ( | ) | [private, virtual] |
virtual void casa::DSRectangle::setHeight | ( | const Float & | height | ) | [virtual] |
Rectangle specific.
Get / set width and height in pixels.
virtual Bool casa::DSRectangle::setOptions | ( | const Record & | settings | ) | [virtual] |
Get and set options.
Reimplemented from casa::DSPoly.
Reimplemented in casa::DSSquare, casa::DSWorldRectangle, casa::DSScreenRectangle, and casa::DSPixelRectangle.
virtual void casa::DSRectangle::setWidth | ( | const Float & | width | ) | [virtual] |
Float casa::DSRectangle::itsAngle [private] |
Always valid.
Definition at line 129 of file DSRectangle.h.
Float casa::DSRectangle::itsCenter [private] |
Ony used during the set-up period.
Definition at line 133 of file DSRectangle.h.
Float casa::DSRectangle::itsHeight [private] |
Definition at line 133 of file DSRectangle.h.
Bool casa::DSRectangle::itsValid [private] |
Definition at line 130 of file DSRectangle.h.
Float casa::DSRectangle::itsWidth [private] |
Definition at line 133 of file DSRectangle.h.