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

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

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. More...
 
 DisplayShape (const DisplayShape &other)
 Copy constructor. More...
 
virtual ~DisplayShape ()
 Destructor. More...
 
virtual void draw (PixelCanvas *pc)
 These functions contol behaviour of handles during a call to the display shape object. More...
 
virtual void rotateAbout (const casacore::Float &relAngle, const casacore::Float &aboutX, const casacore::Float &aboutY)
 
virtual void move (const casacore::Float &dX, const casacore::Float &dY)
 
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::Bool inObject (const casacore::Float &xPos, const casacore::Float &yPos)=0
 Is the supplied point within the DisplayShape? 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 setCenter (const casacore::Float &xPos, const casacore::Float &yPos)=0
 Sets the center of the DisplayShape. More...
 
virtual casacore::Vector
< casacore::Float
getCenter ()=0
 Returns the center of the DisplayShape (x,y). More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &newPos)=0
 Changes the closest point to the supplied location to that location. More...
 
virtual void changePoint (const casacore::Vector< casacore::Float > &newPoint, const casacore::Int nPoint)=0
 Changes the nth point making up the DisplayShape ot the specified location. 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 rotate (const casacore::Float &angle)=0
 Rotate the shape about its center by a set angle (angle in degrees). More...
 
virtual void scale (const casacore::Float &scaleFactor)=0
 Scale the shape about its center by the scaleFactor. 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 casacore::Record getOptions ()
 Settings. More...
 
virtual casacore::Bool setOptions (const casacore::Record &settings)
 
virtual void recalculateScreenPosition ()
 

Private Member Functions

virtual void setDefaultOptions ()
 Set default options. More...
 

Private Attributes

DParameterColorChoiceitsColor
 Object. More...
 
casacore::PtrBlock< DSClosed * > itsHandles
 Handles. More...
 
casacore::PtrBlock
< DisplayShape * > 
itsLocks
 Locks. More...
 
casacore::Bool itsHasHandles
 Do I have handles / can a user resize me? i.e. More...
 
casacore::Bool itsDrawHandles
 Should handles be shown if they exist. More...
 
casacore::Bool itsValidHandles
 Have valid handles been made/supplied yet? More...
 
casacore::String itsHandleColor
 Handle settings. More...
 
DisplayShape::HandleShape itsHandleShape
 
casacore::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

casa::DisplayShape::DisplayShape ( )

Default constructor.

Creates shape with default options set

casa::DisplayShape::DisplayShape ( const DisplayShape other)

Copy constructor.

virtual casa::DisplayShape::~DisplayShape ( )
virtual

Destructor.

Member Function Documentation

virtual void casa::DisplayShape::addHandle ( const casacore::Vector< casacore::Float > &  newHandlePos,
const casacore::Bool atEnd = true,
const casacore::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 casacore::Vector< casacore::Float > &  )
inlinevirtual

If applicable, this function will add a point to the shape in the most meaningful location.

Reimplemented in casa::DSPolyLine, casa::DSPoly, casa::DSRectangle, casa::DSWorldPoly, casa::DSScreenPoly, casa::DSWorldPolyLine, and casa::DSScreenPolyLine.

Definition at line 170 of file DisplayShape.h.

virtual void casa::DisplayShape::buildHandles ( const casacore::Matrix< casacore::Float > &  startPoints)
virtual

Handle management.

virtual void casa::DisplayShape::changePoint ( const casacore::Vector< casacore::Float > &  newPos)
pure virtual
virtual void casa::DisplayShape::changePoint ( const casacore::Vector< casacore::Float > &  newPoint,
const casacore::Int  nPoint 
)
pure virtual
virtual casacore::Bool casa::DisplayShape::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 
)
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 casacore::Bool casa::DisplayShape::closestPoint ( const casacore::Matrix< casacore::Float > &  points,
const casacore::Float xPos,
const casacore::Float yPos,
casacore::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 casacore::Bool casa::DisplayShape::closestPoints ( const casacore::Matrix< casacore::Float > &  points,
const casacore::Float xPos,
const casacore::Float yPos,
casacore::Int outClosest,
casacore::Int outSecond 
)
virtual

Find the closest two Points from a casacore::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 casacore::Bool casa::DisplayShape::drawingHandles ( )
inlinevirtual

Definition at line 201 of file DisplayShape.h.

References itsDrawHandles.

virtual casacore::Vector<casacore::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 casacore::String casa::DisplayShape::getColor ( )
virtual
virtual casacore::Matrix<casacore::Float> casa::DisplayShape::getHandleLocations ( )
virtual
virtual casacore::Record casa::DisplayShape::getOptions ( )
virtual
virtual casacore::Bool casa::DisplayShape::inObject ( const casacore::Float xPos,
const casacore::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 casacore::Bool casa::DisplayShape::inPolygon ( const casacore::Matrix< casacore::Float > &  points,
const casacore::Float xPos,
const casacore::Float yPos 
)
virtual

Is xPos, YPos inside the supplied points (column 1 - x values, clolumn 2 - y values)

virtual DSClosed* casa::DisplayShape::makeHandle ( const casacore::Vector< casacore::Float > &  newHandlePos)
virtual
virtual void casa::DisplayShape::move ( const casacore::Float dX,
const casacore::Float dY 
)
virtual
virtual casacore::uInt casa::DisplayShape::nHandles ( )
virtual
virtual casacore::Bool casa::DisplayShape::onHandles ( const casacore::Float xPos,
const casacore::Float yPos 
)
virtual
virtual void casa::DisplayShape::recalculateScreenPosition ( )
inlinevirtual
virtual casacore::Bool casa::DisplayShape::removeHandle ( const casacore::Vector< casacore::Float > &  getRidOf)
virtual
virtual casacore::Bool casa::DisplayShape::removeHandle ( const casacore::Int  nHandle)
virtual
virtual void casa::DisplayShape::removeLocked ( DisplayShape removeLock)
virtual

Removes a lock from the specified shape.

virtual void casa::DisplayShape::rotate ( const casacore::Float angle)
pure virtual
virtual void casa::DisplayShape::rotateAbout ( const casacore::Float relAngle,
const casacore::Float aboutX,
const casacore::Float aboutY 
)
virtual
virtual casacore::Vector<casacore::Float> casa::DisplayShape::rotatePoint ( const casacore::Vector< casacore::Float > &  toRotate,
const casacore::Float angle,
const casacore::Float aboutX,
const casacore::Float aboutY 
)
virtual

Rotates a point around the point specified.

NB Angle in radians.

virtual casacore::Matrix<casacore::Float> casa::DisplayShape::rotatePolygon ( const casacore::Matrix< casacore::Float > &  toRotate,
const casacore::Float angle,
const casacore::Float aboutX,
const casacore::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 casacore::Float scaleFactor)
pure virtual
virtual void casa::DisplayShape::setCenter ( const casacore::Float xPos,
const casacore::Float yPos 
)
pure virtual
virtual void casa::DisplayShape::setColor ( const casacore::String newColor)
virtual

Manage the color of object.

(Does not include handles)

virtual void casa::DisplayShape::setDefaultOptions ( )
privatevirtual
virtual void casa::DisplayShape::setDrawHandles ( const casacore::Bool shouldIDraw)
virtual
virtual void casa::DisplayShape::setHandleColor ( const casacore::String handleColor)
virtual
virtual void casa::DisplayShape::setHandlePositions ( const casacore::Matrix< casacore::Float > &  newPoints)
virtual
virtual void casa::DisplayShape::setHandleShape ( const DisplayShape::HandleShape shape)
virtual
virtual void casa::DisplayShape::setHandleSize ( const casacore::Int  pixelSize)
virtual
virtual void casa::DisplayShape::setHasHandles ( const casacore::Bool hasHandles)
virtual
virtual casacore::Bool casa::DisplayShape::setOptions ( const casacore::Record settings)
virtual
virtual casacore::Float casa::DisplayShape::toDegrees ( const casacore::Float radians)
virtual

Conver radians to degree.

virtual casacore::Float casa::DisplayShape::toRadians ( const casacore::Float degrees)
virtual

Convert degrees to radians.

virtual casacore::Matrix<casacore::Float> casa::DisplayShape::translateMatrix ( const casacore::Matrix< casacore::Float > &  points,
const casacore::Float dx,
const casacore::Float dy 
)
virtual

Translate an entire matrix by the specified dx / dy amounts.

virtual casacore::Bool casa::DisplayShape::whichHandle ( const casacore::Float xPos,
const casacore::Float yPos,
casacore::Int out 
)
virtual

Reimplemented in casa::DSMarker.

Member Data Documentation

DParameterColorChoice* casa::DisplayShape::itsColor
private

Object.

Definition at line 231 of file DisplayShape.h.

casacore::Bool casa::DisplayShape::itsDrawHandles
private

Should handles be shown if they exist.

Definition at line 245 of file DisplayShape.h.

Referenced by drawingHandles().

casacore::String casa::DisplayShape::itsHandleColor
private

Handle settings.

Definition at line 252 of file DisplayShape.h.

casacore::PtrBlock<DSClosed*> casa::DisplayShape::itsHandles
private

Handles.

Definition at line 234 of file DisplayShape.h.

DisplayShape::HandleShape casa::DisplayShape::itsHandleShape
private

Definition at line 253 of file DisplayShape.h.

casacore::Int casa::DisplayShape::itsHandleSize
private

Definition at line 254 of file DisplayShape.h.

casacore::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 242 of file DisplayShape.h.

casacore::PtrBlock<DisplayShape*> casa::DisplayShape::itsLocks
private

Locks.

Definition at line 237 of file DisplayShape.h.

casacore::Bool casa::DisplayShape::itsValidHandles
private

Have valid handles been made/supplied yet?

Definition at line 248 of file DisplayShape.h.


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