casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Private Attributes
casa::DisplayShape Class Reference

The abstract base class for all "DisplayShapes". More...

#include <DisplayShape.h>

Inheritance diagram for casa::DisplayShape:
casa::DSBasic casa::DSText casa::DSClosed casa::DSMarker casa::DSPolyLine casa::DSPixelText casa::DSScreenText casa::DSWorldText casa::DSEllipse casa::DSPoly casa::DSPixelMarker casa::DSScreenMarker casa::DSWorldMarker casa::DSLine casa::DSPixelPolyLine casa::DSScreenPolyLine casa::DSWorldPolyLine

List of all members.

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< FloatrotatePolygon (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< FloatrotatePoint (const Vector< Float > &toRotate, const Float &angle, const Float &aboutX, const Float &aboutY)
 Rotates a point around the point specified.
virtual Matrix< FloattranslateMatrix (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 &degrees)
 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< FloatgetCenter ()=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< FloatgetHandleLocations ()
virtual void setHandlePositions (const Matrix< Float > &newPoints)
virtual DSClosedmakeHandle (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

DParameterColorChoiceitsColor
 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

Detailed Description

The abstract base class for all "DisplayShapes".

Etymology

DisplayShape is a way of providing a consistant interface to a large number of different shapes.

Synopsis

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 .

Motivation

A common interface to a large number of shapes was desired.

Example

Definition at line 77 of file DisplayShape.h.


Member Enumeration Documentation

Handle style.

Enumerator:
Filled_Square 
Open_Square 
Filled_Circle 
Open_Circle 
Filled_Triangle 
Open_Triangle 

Definition at line 81 of file DisplayShape.h.


Constructor & Destructor Documentation

Default constructor.

Creates shape with default options set

Copy constructor.

virtual casa::DisplayShape::~DisplayShape ( ) [virtual]

Destructor.


Member Function Documentation

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]
virtual void casa::DisplayShape::changePoint ( const Vector< Float > &  newPoint,
const Int  nPoint 
) [pure virtual]
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 Record casa::DisplayShape::getOptions ( ) [virtual]
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]
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]
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]
virtual void casa::DisplayShape::rotateAbout ( const Float relAngle,
const Float aboutX,
const Float aboutY 
) [virtual]
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]
virtual void casa::DisplayShape::setCenter ( const Float xPos,
const Float yPos 
) [pure virtual]
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]
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]
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.


Member Data Documentation

Object.

Definition at line 230 of file DisplayShape.h.

Should handles be shown if they exist.

Definition at line 244 of file DisplayShape.h.

Referenced by drawingHandles().

Handle settings.

Definition at line 251 of file DisplayShape.h.

Handles.

Definition at line 233 of file DisplayShape.h.

Definition at line 252 of file DisplayShape.h.

Definition at line 253 of file DisplayShape.h.

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.

Locks.

Definition at line 236 of file DisplayShape.h.

Have valid handles been made/supplied yet?

Definition at line 247 of file DisplayShape.h.


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