casa
$Rev:20696$
|
The abstract base class for all "DisplayShapes". More...
#include <DisplayShape.h>
Public Types | |
enum | HandleShape { Filled_Square, Open_Square, Filled_Circle, Open_Circle, Filled_Triangle, Open_Triangle } |
Handle style. More... | |
Public Member Functions | |
DisplayShape () | |
Default constructor. | |
DisplayShape (const DisplayShape &other) | |
Copy constructor. | |
virtual | ~DisplayShape () |
Destructor. | |
virtual void | draw (PixelCanvas *pc) |
These functions contol behaviour of handles during a call to the display shape object. | |
virtual void | rotateAbout (const Float &relAngle, const Float &aboutX, const Float &aboutY) |
virtual void | move (const Float &dX, const Float &dY) |
virtual Matrix< Float > | rotatePolygon (const Matrix< Float > &toRotate, const Float &angle, const Float &aboutX, const Float &aboutY) |
Rotate the supplied polygon (column 1 - x values, column 2 - y values) about the supplied point by the supplied angle. | |
virtual Vector< Float > | rotatePoint (const Vector< Float > &toRotate, const Float &angle, const Float &aboutX, const Float &aboutY) |
Rotates a point around the point specified. | |
virtual Matrix< Float > | translateMatrix (const Matrix< Float > &points, const Float &dx, const Float &dy) |
Translate an entire matrix by the specified dx / dy amounts. | |
virtual Bool | inPolygon (const Matrix< Float > &points, const Float &xPos, const Float &yPos) |
Is xPos, YPos inside the supplied points (column 1 - x values, clolumn 2 - y values) | |
virtual Bool | closestLine (const Matrix< Float > &points, const Float &xPos, const Float &yPos, Int &firstVert, Int &secondVert, const Bool &closedPoly=True) |
Determine the two vertices (firstVert, secondVert) which join the line closest to the xPos, yPos point supplied. | |
virtual Bool | closestPoint (const Matrix< Float > &points, const Float &xPos, const Float &yPos, Int &out) |
For a specified set of points, find the closest to xPos,YPos. | |
virtual Bool | closestPoints (const Matrix< Float > &points, const Float &xPos, const Float &yPos, Int &outClosest, Int &outSecond) |
Find the closest two Points from a Matrix to the specified point. | |
virtual Bool | inObject (const Float &xPos, const Float &yPos)=0 |
Is the supplied point within the DisplayShape? | |
virtual Float | toRadians (const Float °rees) |
Convert degrees to radians. | |
virtual Float | toDegrees (const Float &radians) |
Conver radians to degree. | |
virtual void | setCenter (const Float &xPos, const Float &yPos)=0 |
Sets the center of the DisplayShape. | |
virtual Vector< Float > | getCenter ()=0 |
Returns the center of the DisplayShape (x,y). | |
virtual void | changePoint (const Vector< Float > &newPos)=0 |
Changes the closest point to the supplied location to that location. | |
virtual void | changePoint (const Vector< Float > &newPoint, const Int nPoint)=0 |
Changes the nth point making up the DisplayShape ot the specified location. | |
virtual void | addPoint (const Vector< Float > &) |
If applicable, this function will add a point to the shape in the most meaningful location. | |
virtual void | rotate (const Float &angle)=0 |
Rotate the shape about its center by a set angle (angle in degrees). | |
virtual void | scale (const Float &scaleFactor)=0 |
Scale the shape about its center by the scaleFactor. | |
virtual void | addLocked (DisplayShape *toLock) |
Allow locking of other shapes onto this one. | |
virtual void | removeLocked (DisplayShape *removeLock) |
Removes a lock from the specified shape. | |
virtual void | buildHandles (const Matrix< Float > &startPoints) |
Handle management. | |
virtual Matrix< Float > | getHandleLocations () |
virtual void | setHandlePositions (const Matrix< Float > &newPoints) |
virtual DSClosed * | makeHandle (const Vector< Float > &newHandlePos) |
virtual void | addHandle (const Vector< Float > &newHandlePos, const Bool &atEnd=True, const Int position=0) |
virtual Bool | removeHandle (const Vector< Float > &getRidOf) |
virtual Bool | removeHandle (const Int nHandle) |
virtual Bool | onHandles (const Float &xPos, const Float &yPos) |
virtual Bool | whichHandle (const Float &xPos, const Float &yPos, Int &out) |
virtual void | setDrawHandles (const Bool &shouldIDraw) |
virtual Bool | drawingHandles () |
virtual void | setHasHandles (const Bool &hasHandles) |
virtual void | setHandleShape (const DisplayShape::HandleShape &shape) |
virtual void | setHandleSize (const Int pixelSize) |
virtual void | setHandleColor (const String &handleColor) |
virtual uInt | nHandles () |
virtual void | setColor (const String &newColor) |
Manage the color of object. | |
virtual String | getColor () |
virtual Record | getOptions () |
Settings. | |
virtual Bool | setOptions (const Record &settings) |
virtual void | recalculateScreenPosition () |
Private Member Functions | |
virtual void | setDefaultOptions () |
Set default options. | |
Private Attributes | |
DParameterColorChoice * | itsColor |
Object. | |
PtrBlock< DSClosed * > | itsHandles |
Handles. | |
PtrBlock< DisplayShape * > | itsLocks |
Locks. | |
Bool | itsHasHandles |
Do I have handles / can a user resize me? i.e. | |
Bool | itsDrawHandles |
Should handles be shown if they exist. | |
Bool | itsValidHandles |
Have valid handles been made/supplied yet? | |
String | itsHandleColor |
Handle settings. | |
DisplayShape::HandleShape | itsHandleShape |
Int | itsHandleSize |
The abstract base class for all "DisplayShapes".
DisplayShape is a way of providing a consistant interface to a large number of different shapes.
DisplayShape provides a framework from which a large number of different shapes can be made, all with the same interface. Any new DisplayShape should inherit from this class, or higher level classes (see DSPoly etc).
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 .
A common interface to a large number of shapes was desired.
Definition at line 77 of file DisplayShape.h.
Handle style.
Definition at line 81 of file DisplayShape.h.
Default constructor.
Creates shape with default options set
casa::DisplayShape::DisplayShape | ( | const DisplayShape & | other | ) |
Copy constructor.
virtual casa::DisplayShape::~DisplayShape | ( | ) | [virtual] |
Destructor.
virtual void casa::DisplayShape::addHandle | ( | const Vector< Float > & | newHandlePos, |
const Bool & | atEnd = True , |
||
const Int | position = 0 |
||
) | [virtual] |
virtual void casa::DisplayShape::addLocked | ( | DisplayShape * | toLock | ) | [virtual] |
Allow locking of other shapes onto this one.
When a shape is locked, if the current shape is moved, so to will the locked shape.
virtual void casa::DisplayShape::addPoint | ( | const Vector< Float > & | ) | [inline, virtual] |
If applicable, this function will add a point to the shape in the most meaningful location.
Reimplemented in casa::DSPoly, casa::DSPolyLine, casa::DSRectangle, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSScreenPolyLine, and casa::DSWorldPolyLine.
Definition at line 169 of file DisplayShape.h.
virtual void casa::DisplayShape::buildHandles | ( | const Matrix< Float > & | startPoints | ) | [virtual] |
Handle management.
virtual void casa::DisplayShape::changePoint | ( | const Vector< Float > & | newPos | ) | [pure virtual] |
Changes the closest point to the supplied location to that location.
Implemented in casa::DSArrow, casa::DSMarker, casa::DSPolyLine, casa::DSText, casa::DSRectangle, casa::DSSquare, casa::DSEllipse, casa::DSCircle, casa::DSPoly, casa::DSWorldPoly, casa::DSWorldPolyLine, casa::DSScreenArrow, casa::DSWorldArrow, casa::DSScreenPoly, casa::DSScreenPolyLine, casa::DSWorldEllipse, casa::DSWorldRectangle, casa::DSScreenEllipse, and casa::DSScreenRectangle.
virtual void casa::DisplayShape::changePoint | ( | const Vector< Float > & | newPoint, |
const Int | nPoint | ||
) | [pure virtual] |
Changes the nth point making up the DisplayShape ot the specified location.
Implemented in casa::DSArrow, casa::DSMarker, casa::DSPolyLine, casa::DSText, casa::DSRectangle, casa::DSSquare, casa::DSEllipse, casa::DSCircle, casa::DSPoly, casa::DSWorldPoly, casa::DSWorldPolyLine, casa::DSScreenArrow, casa::DSWorldArrow, casa::DSScreenPoly, casa::DSScreenPolyLine, casa::DSWorldEllipse, casa::DSWorldRectangle, casa::DSScreenEllipse, and casa::DSScreenRectangle.
virtual Bool casa::DisplayShape::closestLine | ( | const Matrix< Float > & | points, |
const Float & | xPos, | ||
const Float & | yPos, | ||
Int & | firstVert, | ||
Int & | secondVert, | ||
const Bool & | closedPoly = True |
||
) | [virtual] |
Determine the two vertices (firstVert, secondVert) which join the line closest to the xPos, yPos point supplied.
If closedPoly is left as true, the points supplied are treated as a polygon, if not as a poly line.
virtual Bool casa::DisplayShape::closestPoint | ( | const Matrix< Float > & | points, |
const Float & | xPos, | ||
const Float & | yPos, | ||
Int & | out | ||
) | [virtual] |
For a specified set of points, find the closest to xPos,YPos.
out relates the matrix index (row number) of the closest point.
virtual Bool casa::DisplayShape::closestPoints | ( | const Matrix< Float > & | points, |
const Float & | xPos, | ||
const Float & | yPos, | ||
Int & | outClosest, | ||
Int & | outSecond | ||
) | [virtual] |
Find the closest two Points from a Matrix to the specified point.
virtual void casa::DisplayShape::draw | ( | PixelCanvas * | pc | ) | [virtual] |
These functions contol behaviour of handles during a call to the display shape object.
(These calls should be propogated up through the class tree).
Reimplemented in casa::DSArrow, casa::DSMarker, casa::DSText, casa::DSClosed, casa::DSPolyLine, casa::DSBasic, casa::DSPoly, casa::DSEllipse, casa::DSWorldPoly, casa::DSWorldPolyLine, casa::DSWorldArrow, casa::DSWorldEllipse, casa::DSWorldRectangle, casa::DSWorldMarker, and casa::DSWorldText.
virtual Bool casa::DisplayShape::drawingHandles | ( | ) | [inline, virtual] |
Definition at line 200 of file DisplayShape.h.
References itsDrawHandles.
virtual Vector<Float> casa::DisplayShape::getCenter | ( | ) | [pure virtual] |
Returns the center of the DisplayShape (x,y).
Implemented in casa::DSMarker, casa::DSText, casa::DSPoly, casa::DSEllipse, and casa::DSPolyLine.
virtual String casa::DisplayShape::getColor | ( | ) | [virtual] |
virtual Matrix<Float> casa::DisplayShape::getHandleLocations | ( | ) | [virtual] |
virtual Record casa::DisplayShape::getOptions | ( | ) | [virtual] |
Settings.
Reimplemented in casa::DSArrow, casa::DSMarker, casa::DSLine, casa::DSRectangle, casa::DSPolyLine, casa::DSPoly, casa::DSEllipse, casa::DSText, casa::DSCircle, casa::DSSquare, casa::DSClosed, casa::DSBasic, casa::DSWorldPoly, casa::DSWorldPolyLine, casa::DSScreenArrow, casa::DSWorldArrow, casa::DSWorldEllipse, casa::DSScreenPoly, casa::DSWorldRectangle, casa::DSScreenPolyLine, casa::DSWorldMarker, casa::DSWorldText, casa::DSPixelPoly, casa::DSPixelEllipse, casa::DSScreenMarker, casa::DSScreenText, casa::DSPixelArrow, casa::DSPixelPolyLine, casa::DSScreenEllipse, casa::DSScreenRectangle, casa::DSPixelRectangle, casa::DSPixelMarker, and casa::DSPixelText.
virtual Bool casa::DisplayShape::inObject | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [pure virtual] |
Is the supplied point within the DisplayShape?
Implemented in casa::DSMarker, casa::DSText, casa::DSCircle, casa::DSPolyLine, casa::DSPoly, and casa::DSEllipse.
virtual Bool casa::DisplayShape::inPolygon | ( | const Matrix< Float > & | points, |
const Float & | xPos, | ||
const Float & | yPos | ||
) | [virtual] |
Is xPos, YPos inside the supplied points (column 1 - x values, clolumn 2 - y values)
virtual DSClosed* casa::DisplayShape::makeHandle | ( | const Vector< Float > & | newHandlePos | ) | [virtual] |
virtual void casa::DisplayShape::move | ( | const Float & | dX, |
const Float & | dY | ||
) | [virtual] |
Reimplemented in casa::DSArrow, casa::DSMarker, casa::DSText, casa::DSRectangle, casa::DSClosed, casa::DSPoly, casa::DSPolyLine, casa::DSBasic, casa::DSEllipse, casa::DSWorldPoly, casa::DSScreenArrow, casa::DSScreenPoly, casa::DSWorldEllipse, casa::DSWorldPolyLine, casa::DSScreenMarker, casa::DSScreenPolyLine, casa::DSScreenText, casa::DSWorldArrow, casa::DSWorldRectangle, casa::DSWorldMarker, casa::DSWorldText, casa::DSScreenEllipse, and casa::DSScreenRectangle.
virtual uInt casa::DisplayShape::nHandles | ( | ) | [virtual] |
virtual Bool casa::DisplayShape::onHandles | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [virtual] |
virtual void casa::DisplayShape::recalculateScreenPosition | ( | ) | [inline, virtual] |
Reimplemented in casa::DSPixelMarker, casa::DSWorldPoly, casa::DSPixelText, casa::DSScreenArrow, casa::DSScreenPoly, casa::DSScreenPolyLine, casa::DSWorldEllipse, casa::DSWorldMarker, casa::DSWorldPolyLine, casa::DSWorldText, casa::DSWorldArrow, casa::DSWorldRectangle, casa::DSScreenMarker, casa::DSScreenText, casa::DSScreenEllipse, and casa::DSScreenRectangle.
Definition at line 222 of file DisplayShape.h.
virtual Bool casa::DisplayShape::removeHandle | ( | const Vector< Float > & | getRidOf | ) | [virtual] |
virtual Bool casa::DisplayShape::removeHandle | ( | const Int | nHandle | ) | [virtual] |
virtual void casa::DisplayShape::removeLocked | ( | DisplayShape * | removeLock | ) | [virtual] |
Removes a lock from the specified shape.
virtual void casa::DisplayShape::rotate | ( | const Float & | angle | ) | [pure virtual] |
Rotate the shape about its center by a set angle (angle in degrees).
Implemented in casa::DSMarker, casa::DSArrow, casa::DSText, casa::DSPolyLine, casa::DSRectangle, casa::DSCircle, casa::DSEllipse, casa::DSPoly, casa::DSWorldPoly, casa::DSScreenArrow, casa::DSScreenPoly, casa::DSWorldEllipse, casa::DSWorldPolyLine, casa::DSScreenPolyLine, casa::DSWorldArrow, casa::DSWorldRectangle, casa::DSScreenEllipse, and casa::DSScreenRectangle.
virtual void casa::DisplayShape::rotateAbout | ( | const Float & | relAngle, |
const Float & | aboutX, | ||
const Float & | aboutY | ||
) | [virtual] |
Reimplemented in casa::DSArrow, casa::DSPoly, casa::DSPolyLine, casa::DSRectangle, casa::DSClosed, casa::DSEllipse, and casa::DSBasic.
virtual Vector<Float> casa::DisplayShape::rotatePoint | ( | const Vector< Float > & | toRotate, |
const Float & | angle, | ||
const Float & | aboutX, | ||
const Float & | aboutY | ||
) | [virtual] |
Rotates a point around the point specified.
NB Angle in radians.
virtual Matrix<Float> casa::DisplayShape::rotatePolygon | ( | const Matrix< Float > & | toRotate, |
const Float & | angle, | ||
const Float & | aboutX, | ||
const Float & | aboutY | ||
) | [virtual] |
Rotate the supplied polygon (column 1 - x values, column 2 - y values) about the supplied point by the supplied angle.
NB Angle in radians
virtual void casa::DisplayShape::scale | ( | const Float & | scaleFactor | ) | [pure virtual] |
Scale the shape about its center by the scaleFactor.
Implemented in casa::DSArrow, casa::DSMarker, casa::DSText, casa::DSEllipse, casa::DSPolyLine, casa::DSPoly, casa::DSWorldPoly, casa::DSScreenArrow, casa::DSWorldPolyLine, casa::DSWorldArrow, casa::DSScreenPoly, and casa::DSScreenPolyLine.
virtual void casa::DisplayShape::setCenter | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [pure virtual] |
Sets the center of the DisplayShape.
Implemented in casa::DSArrow, casa::DSMarker, casa::DSLine, casa::DSText, casa::DSRectangle, casa::DSPoly, casa::DSPolyLine, casa::DSEllipse, casa::DSCircle, casa::DSWorldPoly, casa::DSScreenArrow, casa::DSWorldEllipse, casa::DSWorldPolyLine, casa::DSScreenMarker, casa::DSScreenText, casa::DSWorldArrow, casa::DSWorldRectangle, casa::DSScreenPoly, casa::DSWorldMarker, casa::DSWorldText, casa::DSScreenPolyLine, casa::DSScreenEllipse, and casa::DSScreenRectangle.
virtual void casa::DisplayShape::setColor | ( | const String & | newColor | ) | [virtual] |
Manage the color of object.
(Does not include handles)
virtual void casa::DisplayShape::setDefaultOptions | ( | ) | [private, virtual] |
Set default options.
Reimplemented in casa::DSArrow, casa::DSMarker, casa::DSText, casa::DSRectangle, casa::DSEllipse, casa::DSPolyLine, casa::DSPoly, casa::DSCircle, and casa::DSClosed.
virtual void casa::DisplayShape::setDrawHandles | ( | const Bool & | shouldIDraw | ) | [virtual] |
virtual void casa::DisplayShape::setHandleColor | ( | const String & | handleColor | ) | [virtual] |
virtual void casa::DisplayShape::setHandlePositions | ( | const Matrix< Float > & | newPoints | ) | [virtual] |
virtual void casa::DisplayShape::setHandleShape | ( | const DisplayShape::HandleShape & | shape | ) | [virtual] |
virtual void casa::DisplayShape::setHandleSize | ( | const Int | pixelSize | ) | [virtual] |
virtual void casa::DisplayShape::setHasHandles | ( | const Bool & | hasHandles | ) | [virtual] |
virtual Bool casa::DisplayShape::setOptions | ( | const Record & | settings | ) | [virtual] |
Reimplemented in casa::DSArrow, casa::DSMarker, casa::DSLine, casa::DSPoly, casa::DSRectangle, casa::DSPolyLine, casa::DSEllipse, casa::DSText, casa::DSCircle, casa::DSSquare, casa::DSClosed, casa::DSBasic, casa::DSWorldPoly, casa::DSWorldPolyLine, casa::DSScreenArrow, casa::DSWorldArrow, casa::DSWorldEllipse, casa::DSScreenPoly, casa::DSWorldRectangle, casa::DSScreenPolyLine, casa::DSWorldMarker, casa::DSWorldText, casa::DSPixelPoly, casa::DSPixelEllipse, casa::DSScreenMarker, casa::DSScreenText, casa::DSPixelArrow, casa::DSPixelMarker, casa::DSPixelPolyLine, casa::DSScreenEllipse, casa::DSScreenRectangle, casa::DSPixelRectangle, and casa::DSPixelText.
virtual Float casa::DisplayShape::toDegrees | ( | const Float & | radians | ) | [virtual] |
Conver radians to degree.
virtual Float casa::DisplayShape::toRadians | ( | const Float & | degrees | ) | [virtual] |
Convert degrees to radians.
virtual Matrix<Float> casa::DisplayShape::translateMatrix | ( | const Matrix< Float > & | points, |
const Float & | dx, | ||
const Float & | dy | ||
) | [virtual] |
Translate an entire matrix by the specified dx / dy amounts.
virtual Bool casa::DisplayShape::whichHandle | ( | const Float & | xPos, |
const Float & | yPos, | ||
Int & | out | ||
) | [virtual] |
Reimplemented in casa::DSMarker.
Object.
Definition at line 230 of file DisplayShape.h.
Bool casa::DisplayShape::itsDrawHandles [private] |
Should handles be shown if they exist.
Definition at line 244 of file DisplayShape.h.
Referenced by drawingHandles().
String casa::DisplayShape::itsHandleColor [private] |
Handle settings.
Definition at line 251 of file DisplayShape.h.
PtrBlock<DSClosed*> casa::DisplayShape::itsHandles [private] |
Handles.
Definition at line 233 of file DisplayShape.h.
Definition at line 252 of file DisplayShape.h.
Int casa::DisplayShape::itsHandleSize [private] |
Definition at line 253 of file DisplayShape.h.
Bool casa::DisplayShape::itsHasHandles [private] |
Do I have handles / can a user resize me? i.e.
Do I ever want to draw handles (e.g. will be false for an object which IS a handle!)
Definition at line 241 of file DisplayShape.h.
PtrBlock<DisplayShape*> casa::DisplayShape::itsLocks [private] |
Locks.
Definition at line 236 of file DisplayShape.h.
Bool casa::DisplayShape::itsValidHandles [private] |
Have valid handles been made/supplied yet?
Definition at line 247 of file DisplayShape.h.