casa
$Rev:20696$
|
Implementation of text. More...
#include <DSText.h>
Public Member Functions | |
DSText () | |
Constructors and destructors. | |
DSText (const DSText &other) | |
DSText (const Float &xPos, const Float &yPos, const String &text="Label", const Bool &hasHandles=True, const Bool &drawHandles=True) | |
virtual | ~DSText () |
virtual void | draw (PixelCanvas *pix) |
Functions to ensure consistancy with the "DisplayShape" interface. | |
virtual void | move (const Float &dX, const Float &dY) |
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 | changePoint (const Vector< Float > &newPos) |
Changes the closest point to the supplied location to that location. | |
virtual void | changePoint (const Vector< Float > &newPos, const Int nPoint) |
Changes the nth point making up the DisplayShape ot the specified location. | |
virtual void | scale (const Float &scaleFactor) |
Scale the shape about its center by the scaleFactor. | |
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 Record | getOptions () |
Get and set options. | |
virtual Bool | setOptions (const Record &settings) |
Private Member Functions | |
void | makeAlignmentChoice () |
virtual void | calculateHandlePositions () |
Update handle positions. | |
Display::TextAlign | toEnum (const Int fromInt) |
Cast from int to enum. | |
virtual void | setDefaultOptions () |
Set default options. | |
Private Attributes | |
DParameterString * | itsString |
Text Parameter. | |
DParameterRange< Float > * | itsAngle |
Angle Param. | |
DParameterMapKeyChoice * | itsAlignment |
DParameterFontChoice * | itsFont |
DParameterRange< Int > * | itsFontSize |
Vector< Float > | itsCenter |
Rotate about a point. | |
Int | itsPixHeight |
Int | itsPixWidth |
Bool | itsValid |
Bool | itsHandlesMade |
Bool | itsValidPositions |
Float | itsStringLength |
Float | itsStringHeight |
Matrix< Float > | itsHandleLocation |
Display::TextAlign | itsAlign |
Implementation of text.
DSText is a method of managing the drawing of text onto a PixelCanvas.
DSText is designed to have the same interface as any other 'shape' extending DisplayShape. Much of the functionality is exactly the same, and hence provides a usefull wrapper for text in an 'annotations' context.
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 create a text wrapper which behaved in the same was as any other DisplayShape
Constructors and destructors.
casa::DSText::DSText | ( | const DSText & | other | ) |
casa::DSText::DSText | ( | const Float & | xPos, |
const Float & | yPos, | ||
const String & | text = "Label" , |
||
const Bool & | hasHandles = True , |
||
const Bool & | drawHandles = True |
||
) |
virtual casa::DSText::~DSText | ( | ) | [virtual] |
virtual void casa::DSText::calculateHandlePositions | ( | ) | [private, virtual] |
Update handle positions.
virtual void casa::DSText::changePoint | ( | const Vector< Float > & | newPos | ) | [virtual] |
Changes the closest point to the supplied location to that location.
Implements casa::DisplayShape.
virtual void casa::DSText::changePoint | ( | const Vector< Float > & | newPoint, |
const Int | nPoint | ||
) | [virtual] |
Changes the nth point making up the DisplayShape ot the specified location.
Implements casa::DisplayShape.
virtual void casa::DSText::draw | ( | PixelCanvas * | pix | ) | [virtual] |
Functions to ensure consistancy with the "DisplayShape" interface.
Reimplemented from casa::DisplayShape.
Reimplemented in casa::DSWorldText.
virtual Vector<Float> casa::DSText::getCenter | ( | ) | [virtual] |
Returns the center of the DisplayShape (x,y).
Implements casa::DisplayShape.
virtual Record casa::DSText::getOptions | ( | ) | [virtual] |
Get and set options.
Reimplemented from casa::DisplayShape.
Reimplemented in casa::DSWorldText, casa::DSScreenText, and casa::DSPixelText.
virtual Bool casa::DSText::inObject | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [virtual] |
Is the supplied point within the DisplayShape?
Implements casa::DisplayShape.
void casa::DSText::makeAlignmentChoice | ( | ) | [private] |
This is a bit messy, so seperate it out
virtual void casa::DSText::move | ( | const Float & | dX, |
const Float & | dY | ||
) | [virtual] |
Reimplemented from casa::DisplayShape.
Reimplemented in casa::DSScreenText, and casa::DSWorldText.
virtual void casa::DSText::rotate | ( | const Float & | angle | ) | [virtual] |
Rotate the shape about its center by a set angle (angle in degrees).
Implements casa::DisplayShape.
virtual void casa::DSText::scale | ( | const Float & | scaleFactor | ) | [virtual] |
Scale the shape about its center by the scaleFactor.
Implements casa::DisplayShape.
virtual void casa::DSText::setCenter | ( | const Float & | xPos, |
const Float & | yPos | ||
) | [virtual] |
Sets the center of the DisplayShape.
Implements casa::DisplayShape.
Reimplemented in casa::DSScreenText, and casa::DSWorldText.
virtual void casa::DSText::setDefaultOptions | ( | ) | [private, virtual] |
Set default options.
Reimplemented from casa::DisplayShape.
virtual Bool casa::DSText::setOptions | ( | const Record & | settings | ) | [virtual] |
Reimplemented from casa::DisplayShape.
Reimplemented in casa::DSWorldText, casa::DSScreenText, and casa::DSPixelText.
Display::TextAlign casa::DSText::toEnum | ( | const Int | fromInt | ) | [private] |
Cast from int to enum.
Display::TextAlign casa::DSText::itsAlign [private] |
DParameterMapKeyChoice* casa::DSText::itsAlignment [private] |
DParameterRange<Float>* casa::DSText::itsAngle [private] |
Vector<Float> casa::DSText::itsCenter [private] |
DParameterFontChoice* casa::DSText::itsFont [private] |
DParameterRange<Int>* casa::DSText::itsFontSize [private] |
Matrix<Float> casa::DSText::itsHandleLocation [private] |
Bool casa::DSText::itsHandlesMade [private] |
Int casa::DSText::itsPixHeight [private] |
Int casa::DSText::itsPixWidth [private] |
DParameterString* casa::DSText::itsString [private] |
Float casa::DSText::itsStringHeight [private] |
Float casa::DSText::itsStringLength [private] |
Bool casa::DSText::itsValid [private] |
Bool casa::DSText::itsValidPositions [private] |