casa
$Rev:20696$
|
Implementation of a Polygon. More...
#include <DSPoly.h>
Public Member Functions | |
DSPoly () | |
Constructors and destructor. | |
DSPoly (const DSPoly &other) | |
DSPoly (const Matrix< Float > &points, const Bool &handles=False, const Bool &drawHandles=False) | |
virtual | ~DSPoly () |
virtual void | draw (PixelCanvas *pc) |
General DisplayShape functions. | |
virtual void | rotate (const Float &angle) |
Rotate the shape about its center by a set angle (angle in degrees). | |
virtual Bool | inObject (const Float &xPos, const Float &yPos) |
Is the supplied point within the DisplayShape? | |
virtual void | scale (const Float &scale) |
Scale the shape about its center by the scaleFactor. | |
virtual void | move (const Float &dX, const Float &dY) |
virtual void | changePoint (const Vector< Float > &newLocation) |
Changes the closest point to the supplied location to that location. | |
virtual void | changePoint (const Vector< Float > &newLocation, const Int point) |
Changes the nth point making up the DisplayShape ot the specified location. | |
virtual void | setCenter (const Float &xPos, const Float &yPos) |
Sets the center of the DisplayShape. | |
virtual Vector< Float > | getCenter () |
Returns the center of the DisplayShape (x,y). | |
virtual void | rotateAbout (const Float &angle, const Float &aboutX, const Float &aboutY) |
virtual void | addPoint (const Vector< Float > &newPoint) |
Polygon specific functions, add, delete and set points, all in pixels. | |
virtual void | deletePoint (const Vector< Float > &removePoint) |
virtual void | deletePoint (const Int nPoint) |
virtual void | setPoints (const Matrix< Float > &newPoints) |
virtual Record | getOptions () |
Get and set options. | |
virtual Bool | setOptions (const Record &settings) |
Protected Member Functions | |
virtual Matrix< Float > | getPoints () |
Private Member Functions | |
virtual void | setDefaultOptions () |
virtual Float | getArea () |
Private Attributes | |
Matrix< Float > | itsPoints |
Vector< Float > | itsPolyCenter |
Bool | itsValidPoints |
Bool | itsValidCenter |
Implementation of a Polygon.
DSPoly is a method of managing the drawing of a polygon onto a PixelCanvas.
DSPoly allows for the management of a polygon, including the addition and deletion of points.
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 .
To enable display of circles onto a pixel canvas.
Constructors and destructor.
casa::DSPoly::DSPoly | ( | const DSPoly & | other | ) |
casa::DSPoly::DSPoly | ( | const Matrix< Float > & | points, |
const Bool & | handles = False , |
||
const Bool & | drawHandles = False |
||
) |
virtual casa::DSPoly::~DSPoly | ( | ) | [virtual] |
virtual void casa::DSPoly::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::DisplayShape.
Reimplemented in casa::DSRectangle, casa::DSWorldPoly, and casa::DSScreenPoly.
virtual void casa::DSPoly::changePoint | ( | const Vector< Float > & | newPos | ) | [virtual] |
Changes the closest point to the supplied location to that location.
Implements casa::DisplayShape.
Reimplemented in casa::DSRectangle, casa::DSSquare, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSPoly::changePoint | ( | const Vector< Float > & | newPoint, |
const Int | nPoint | ||
) | [virtual] |
Changes the nth point making up the DisplayShape ot the specified location.
Implements casa::DisplayShape.
Reimplemented in casa::DSRectangle, casa::DSSquare, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSPoly::deletePoint | ( | const Vector< Float > & | removePoint | ) | [virtual] |
virtual void casa::DSPoly::deletePoint | ( | const Int | nPoint | ) | [virtual] |
virtual void casa::DSPoly::draw | ( | PixelCanvas * | pc | ) | [virtual] |
General DisplayShape functions.
Reimplemented from casa::DSClosed.
Reimplemented in casa::DSWorldPoly, and casa::DSWorldRectangle.
virtual Float casa::DSPoly::getArea | ( | ) | [private, virtual] |
virtual Vector<Float> casa::DSPoly::getCenter | ( | ) | [virtual] |
Returns the center of the DisplayShape (x,y).
Implements casa::DisplayShape.
virtual Record casa::DSPoly::getOptions | ( | ) | [virtual] |
Get and set options.
Reimplemented from casa::DSClosed.
Reimplemented in casa::DSRectangle, casa::DSSquare, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, casa::DSPixelPoly, casa::DSScreenRectangle, and casa::DSPixelRectangle.
virtual Matrix<Float> casa::DSPoly::getPoints | ( | ) | [protected, virtual] |
virtual Bool casa::DSPoly::inObject | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [virtual] |
Is the supplied point within the DisplayShape?
Implements casa::DisplayShape.
virtual void casa::DSPoly::move | ( | const Float & | dX, |
const Float & | dY | ||
) | [virtual] |
Reimplemented from casa::DSClosed.
Reimplemented in casa::DSRectangle, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSPoly::rotate | ( | const Float & | angle | ) | [virtual] |
Rotate the shape about its center by a set angle (angle in degrees).
Implements casa::DisplayShape.
Reimplemented in casa::DSRectangle, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, and casa::DSScreenRectangle.
virtual void casa::DSPoly::rotateAbout | ( | const Float & | angle, |
const Float & | aboutX, | ||
const Float & | aboutY | ||
) | [virtual] |
Reimplemented from casa::DSClosed.
Reimplemented in casa::DSRectangle.
virtual void casa::DSPoly::scale | ( | const Float & | scaleFactor | ) | [virtual] |
Scale the shape about its center by the scaleFactor.
Implements casa::DisplayShape.
Reimplemented in casa::DSWorldPoly, and casa::DSScreenPoly.
virtual void casa::DSPoly::setCenter | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [virtual] |
Sets the center of the DisplayShape.
Implements casa::DisplayShape.
Reimplemented in casa::DSRectangle, casa::DSWorldPoly, casa::DSWorldRectangle, casa::DSScreenPoly, and casa::DSScreenRectangle.
virtual void casa::DSPoly::setDefaultOptions | ( | ) | [private, virtual] |
Used to set up the class when default constructor called
Reimplemented from casa::DSClosed.
Reimplemented in casa::DSRectangle.
virtual Bool casa::DSPoly::setOptions | ( | const Record & | settings | ) | [virtual] |
Reimplemented from casa::DSClosed.
Reimplemented in casa::DSRectangle, casa::DSSquare, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldRectangle, casa::DSPixelPoly, casa::DSScreenRectangle, and casa::DSPixelRectangle.
virtual void casa::DSPoly::setPoints | ( | const Matrix< Float > & | newPoints | ) | [virtual] |
Reimplemented in casa::DSWorldPoly, and casa::DSScreenPoly.
Matrix<Float> casa::DSPoly::itsPoints [private] |
Vector<Float> casa::DSPoly::itsPolyCenter [private] |
Bool casa::DSPoly::itsValidCenter [private] |
Bool casa::DSPoly::itsValidPoints [private] |