DSText.h

Classes

DSText -- Implementation of text. (full description)

class DSText : public DisplayShape

Interface

Public Members
DSText()
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)
virtual void move(const Float& dX, const Float& dY)
virtual void rotate(const Float& angle)
virtual Bool inObject(const Float& xPos, const Float& yPos)
virtual void changePoint(const Vector<Float>& newPos)
virtual void changePoint(const Vector<Float>& newPos, const Int nPoint)
virtual void scale(const Float& scaleFactor)
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual Vector<Float> getCenter()
virtual Record getOptions()
virtual Bool setOptions(const Record& settings)
Private Members
void makeAlignmentChoice()
virtual void calculateHandlePositions()
Display::TextAlign toEnum(const Int fromInt)
virtual void setDefaultOptions()

Description

Prerequisite

Etymology

DSText is a method of managing the drawing of text onto a PixelCanvas.

Synopsis

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.

Motivation

To create a text wrapper which behaved in the same was as any other DisplayShape

Example


 

Member Description

DSText()
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()

Constructors and destructors

virtual void draw(PixelCanvas* pix)
virtual void move(const Float& dX, const Float& dY)
virtual void rotate(const Float& angle)
virtual Bool inObject(const Float& xPos, const Float& yPos)
virtual void changePoint(const Vector<Float>& newPos)
virtual void changePoint(const Vector<Float>& newPos, const Int nPoint)
virtual void scale(const Float& scaleFactor)
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual Vector<Float> getCenter()

Functions to ensure consistancy with the "DisplayShape" interface.

virtual Record getOptions()
virtual Bool setOptions(const Record& settings)

Get and set options

void makeAlignmentChoice()

This is a bit messy, so seperate it out

virtual void calculateHandlePositions()

Update handle positions

Display::TextAlign toEnum(const Int fromInt)

Cast from int to enum

virtual void setDefaultOptions()