casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casa::DSText Class Reference

Implementation of text. More...

#include <DSText.h>

Inheritance diagram for casa::DSText:
casa::DisplayShape casa::DSPixelText casa::DSScreenText casa::DSWorldText

Public Member Functions

 DSText ()
 Constructors and destructors. More...
 
 DSText (const DSText &other)
 
 DSText (const casacore::Float &xPos, const casacore::Float &yPos, const casacore::String &text="Label", const casacore::Bool &hasHandles=true, const casacore::Bool &drawHandles=true)
 
virtual ~DSText ()
 
virtual void draw (PixelCanvas *pix)
 Functions to ensure consistancy with the "DisplayShape" interface. More...
 
virtual void move (const casacore::Float &dX, const casacore::Float &dY)
 
virtual void rotate (const casacore::Float &angle)
 Rotate the shape about its center by a set angle (angle in degrees). More...
 
virtual casacore::Bool inObject (const casacore::Float &xPos, const casacore::Float &yPos)
 Is the supplied point within the DisplayShape? More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &newPos)
 Changes the closest point to the supplied location to that location. More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &newPos, const casacore::Int nPoint)
 Changes the nth point making up the DisplayShape ot the specified location. More...
 
virtual void scale (const casacore::Float &scaleFactor)
 Scale the shape about its center by the scaleFactor. More...
 
virtual void setCenter (const casacore::Float &xPos, const casacore::Float &yPos)
 Sets the center of the DisplayShape. More...
 
virtual casacore::Vector
< casacore::Float
getCenter ()
 Returns the center of the DisplayShape (x,y). More...
 
virtual casacore::Record getOptions ()
 Get and set options. More...
 
virtual casacore::Bool setOptions (const casacore::Record &settings)
 
- Public Member Functions inherited from casa::DisplayShape
 DisplayShape ()
 Default constructor. More...
 
 DisplayShape (const DisplayShape &other)
 Copy constructor. More...
 
virtual ~DisplayShape ()
 Destructor. More...
 
virtual void rotateAbout (const casacore::Float &relAngle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 
virtual casacore::Matrix
< casacore::Float
rotatePolygon (const casacore::Matrix< casacore::Float > &toRotate, const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 Rotate the supplied polygon (column 1 - x values, column 2 - y values) about the supplied point by the supplied angle. More...
 
virtual casacore::Vector
< casacore::Float
rotatePoint (const casacore::Vector< casacore::Float > &toRotate, const casacore::Float &angle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 Rotates a point around the point specified. More...
 
virtual casacore::Matrix
< casacore::Float
translateMatrix (const casacore::Matrix< casacore::Float > &points, const casacore::Float &dx, const casacore::Float &dy)
 Translate an entire matrix by the specified dx / dy amounts. More...
 
virtual casacore::Bool inPolygon (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos)
 Is xPos, YPos inside the supplied points (column 1 - x values, clolumn 2 - y values) More...
 
virtual casacore::Bool closestLine (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &firstVert, casacore::Int &secondVert, const casacore::Bool &closedPoly=true)
 Determine the two vertices (firstVert, secondVert) which join the line closest to the xPos, yPos point supplied. More...
 
virtual casacore::Bool closestPoint (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &out)
 For a specified set of points, find the closest to xPos,YPos. More...
 
virtual casacore::Bool closestPoints (const casacore::Matrix< casacore::Float > &points, const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &outClosest, casacore::Int &outSecond)
 Find the closest two Points from a casacore::Matrix to the specified point. More...
 
virtual casacore::Float toRadians (const casacore::Float &degrees)
 Convert degrees to radians. More...
 
virtual casacore::Float toDegrees (const casacore::Float &radians)
 Conver radians to degree. More...
 
virtual void addPoint (const casacore::Vector< casacore::Float > &)
 If applicable, this function will add a point to the shape in the most meaningful location. More...
 
virtual void addLocked (DisplayShape *toLock)
 Allow locking of other shapes onto this one. More...
 
virtual void removeLocked (DisplayShape *removeLock)
 Removes a lock from the specified shape. More...
 
virtual void buildHandles (const casacore::Matrix< casacore::Float > &startPoints)
 Handle management. More...
 
virtual casacore::Matrix
< casacore::Float
getHandleLocations ()
 
virtual void setHandlePositions (const casacore::Matrix< casacore::Float > &newPoints)
 
virtual DSClosedmakeHandle (const casacore::Vector< casacore::Float > &newHandlePos)
 
virtual void addHandle (const casacore::Vector< casacore::Float > &newHandlePos, const casacore::Bool &atEnd=true, const casacore::Int position=0)
 
virtual casacore::Bool removeHandle (const casacore::Vector< casacore::Float > &getRidOf)
 
virtual casacore::Bool removeHandle (const casacore::Int nHandle)
 
virtual casacore::Bool onHandles (const casacore::Float &xPos, const casacore::Float &yPos)
 
virtual casacore::Bool whichHandle (const casacore::Float &xPos, const casacore::Float &yPos, casacore::Int &out)
 
virtual void setDrawHandles (const casacore::Bool &shouldIDraw)
 
virtual casacore::Bool drawingHandles ()
 
virtual void setHasHandles (const casacore::Bool &hasHandles)
 
virtual void setHandleShape (const DisplayShape::HandleShape &shape)
 
virtual void setHandleSize (const casacore::Int pixelSize)
 
virtual void setHandleColor (const casacore::String &handleColor)
 
virtual casacore::uInt nHandles ()
 
virtual void setColor (const casacore::String &newColor)
 Manage the color of object. More...
 
virtual casacore::String getColor ()
 
virtual void recalculateScreenPosition ()
 

Private Member Functions

void makeAlignmentChoice ()
 This is a bit messy, so seperate it out. More...
 
virtual void calculateHandlePositions ()
 Update handle positions. More...
 
Display::TextAlign toEnum (const casacore::Int fromInt)
 Cast from int to enum. More...
 
virtual void setDefaultOptions ()
 Set default options. More...
 

Private Attributes

DParameterStringitsString
 Text Parameter. More...
 
DParameterRange
< casacore::Float > * 
itsAngle
 Angle Param. More...
 
DParameterMapKeyChoiceitsAlignment
 
DParameterFontChoiceitsFont
 
DParameterRange< casacore::Int > * itsFontSize
 
casacore::Vector< casacore::FloatitsCenter
 Rotate about a point. More...
 
casacore::Int itsPixHeight
 
casacore::Int itsPixWidth
 
casacore::Bool itsValid
 
casacore::Bool itsHandlesMade
 
casacore::Bool itsValidPositions
 
casacore::Float itsStringLength
 
casacore::Float itsStringHeight
 
casacore::Matrix< casacore::FloatitsHandleLocation
 
Display::TextAlign itsAlign
 

Additional Inherited Members

- Public Types inherited from casa::DisplayShape
enum  HandleShape {
  Filled_Square,
  Open_Square,
  Filled_Circle,
  Open_Circle,
  Filled_Triangle,
  Open_Triangle
}
 Handle style. More...
 

Detailed Description

Implementation of text.

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

Definition at line 82 of file DSText.h.

Constructor & Destructor Documentation

casa::DSText::DSText ( )

Constructors and destructors.

casa::DSText::DSText ( const DSText other)
casa::DSText::DSText ( const casacore::Float xPos,
const casacore::Float yPos,
const casacore::String text = "Label",
const casacore::Bool hasHandles = true,
const casacore::Bool drawHandles = true 
)
virtual casa::DSText::~DSText ( )
virtual

Member Function Documentation

virtual void casa::DSText::calculateHandlePositions ( )
privatevirtual

Update handle positions.

virtual void casa::DSText::changePoint ( const casacore::Vector< casacore::Float > &  newPos)
virtual

Changes the closest point to the supplied location to that location.

Implements casa::DisplayShape.

virtual void casa::DSText::changePoint ( const casacore::Vector< casacore::Float > &  newPoint,
const casacore::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 casacore::Vector<casacore::Float> casa::DSText::getCenter ( )
virtual

Returns the center of the DisplayShape (x,y).

Implements casa::DisplayShape.

virtual casacore::Record casa::DSText::getOptions ( )
virtual
virtual casacore::Bool casa::DSText::inObject ( const casacore::Float xPos,
const casacore::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 casacore::Float dX,
const casacore::Float dY 
)
virtual

Reimplemented from casa::DisplayShape.

Reimplemented in casa::DSScreenText, and casa::DSWorldText.

virtual void casa::DSText::rotate ( const casacore::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 casacore::Float scaleFactor)
virtual

Scale the shape about its center by the scaleFactor.

Implements casa::DisplayShape.

virtual void casa::DSText::setCenter ( const casacore::Float xPos,
const casacore::Float yPos 
)
virtual

Sets the center of the DisplayShape.

Implements casa::DisplayShape.

Reimplemented in casa::DSScreenText, and casa::DSWorldText.

virtual void casa::DSText::setDefaultOptions ( )
privatevirtual

Set default options.

Reimplemented from casa::DisplayShape.

virtual casacore::Bool casa::DSText::setOptions ( const casacore::Record settings)
virtual

Reimplemented from casa::DisplayShape.

Reimplemented in casa::DSWorldText, casa::DSScreenText, and casa::DSPixelText.

Display::TextAlign casa::DSText::toEnum ( const casacore::Int  fromInt)
private

Cast from int to enum.

Member Data Documentation

Display::TextAlign casa::DSText::itsAlign
private

Definition at line 143 of file DSText.h.

DParameterMapKeyChoice* casa::DSText::itsAlignment
private

Definition at line 131 of file DSText.h.

DParameterRange<casacore::Float>* casa::DSText::itsAngle
private

Angle Param.

Definition at line 130 of file DSText.h.

casacore::Vector<casacore::Float> casa::DSText::itsCenter
private

Rotate about a point.

. overloaded but not used

Definition at line 136 of file DSText.h.

DParameterFontChoice* casa::DSText::itsFont
private

Definition at line 132 of file DSText.h.

DParameterRange<casacore::Int>* casa::DSText::itsFontSize
private

Definition at line 133 of file DSText.h.

casacore::Matrix<casacore::Float> casa::DSText::itsHandleLocation
private

Definition at line 142 of file DSText.h.

casacore::Bool casa::DSText::itsHandlesMade
private

Definition at line 139 of file DSText.h.

casacore::Int casa::DSText::itsPixHeight
private

Definition at line 137 of file DSText.h.

casacore::Int casa::DSText::itsPixWidth
private

Definition at line 137 of file DSText.h.

DParameterString* casa::DSText::itsString
private

Text Parameter.

Definition at line 127 of file DSText.h.

casacore::Float casa::DSText::itsStringHeight
private

Definition at line 141 of file DSText.h.

casacore::Float casa::DSText::itsStringLength
private

Definition at line 140 of file DSText.h.

casacore::Bool casa::DSText::itsValid
private

Definition at line 138 of file DSText.h.

casacore::Bool casa::DSText::itsValidPositions
private

Definition at line 139 of file DSText.h.


The documentation for this class was generated from the following file: