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::DisplayShapeInterface Class Reference

class PixelCanvas; class WorldCanvas; More...

#include <DisplayShapeInterface.h>

List of all members.

Public Types

enum  Coord {
  Pixels,
  Relative,
  World
}

Public Member Functions

 DisplayShapeInterface (const Record &shapeInfo)
 Constructor for a standard shape.
 DisplayShapeInterface (const Record &shapeInfo, const PixelCanvas *pc, const Bool scale=True)
 Constructor for shape based on relative screen positions.
 DisplayShapeInterface (const Record shapeInfo, const WorldCanvas *wc)
 Constructor for shape based on world co-ordinates (NYI)
 DisplayShapeInterface (const DisplayShapeInterface &other)
 Copy cons.
virtual ~DisplayShapeInterface ()
virtual Bool inObject (const Float xPos, const Float yPos)
 DisplayShape functionality.
virtual Bool onHandles (const Float xPos, const Float yPos)
virtual Vector< FloatgetCenter () const
virtual void setCenter (const Float xPos, const Float yPos)
virtual Bool whichHandle (const Float xPos, const Float yPos, Int &out)
virtual void changePoint (const Vector< Float > &newPos)
virtual void changePoint (const Vector< Float > &newPoint, const Int nPoint)
virtual void addPoint (const Vector< Float > &newPoint)
virtual void rotate (const Float angle)
virtual void scale (const Float angle)
virtual void draw (PixelCanvas *toDrawTo)
virtual void move (const Float dX, const Float dY)
virtual void addLocked (DisplayShapeInterface *toLock)
virtual void removeLocked (DisplayShapeInterface *removeLock)
virtual void setDrawHandles (const Bool &draw)
virtual Bool setOptions (const Record &newOptions)
virtual Record getOptions ()
virtual Bool updatePixelPosition ()
 Update the pixel location of this shape, based on the stored information on its location.
virtual Bool updateNonPixelPosition ()
 If the shape is being used in absolute pixel co-ordinates, this will do nothing.
virtual DisplayShapegetObject ()
 Returns the pointer to the underlying object.
virtual void toPolygon ()
 If the shape is a PolyLine, this function will change it to a polygon.

Private Member Functions

Record toPixOpts (const Record &notPix)
Record fromPixOpts (const Record &pix)
 Will return an option set with whatever the current coords method is.
Record pixToRelOpts (const Record &pixel)
Record relToPixOpts (const Record &relative)
Record pixToWorldOpts (const Record &pix)
Record worldToPixOpts (const Record &world)
Vector< FloatpixToRel (const Vector< Float > &pix)
Vector< FloatrelToPix (const Vector< Float > &rel)
Float relToPixWidth (const Float rel)
Float relToPixHeight (const Float rel)
Float pixToRelWidth (const Float pix)
Float pixToRelHeight (const Float pix)
void makeShape (const Record &shapeInfo)

Private Attributes

DisplayShapeitsShape
DisplayShapeInterface::Coord itsCoords
const PixelCanvasitsPc
const WorldCanvasitsWc
Bool itsScale
 Scale widths and heights in relative mode?
Record altCoords
 Copy of shape, however in its alternate coord form.

Detailed Description

class PixelCanvas; class WorldCanvas;

Wrapper for DisplayShapes;provides easier/unified constr. of DisplayShapes

Prerequisite

Etymology

DisplayShapeInterface makes it easier to work with DisplayShapes.

Synopsis

DisplayShapeInterface simply contains a pointer to a DisplayShape object. It allows all DisplayShapes to be constructed via a single constructor. i.e. the DisplayShapeInterface constructor actually decides which shape to create based on the information in the Record passed to it. It makes creating new shapes look a little nice, since:

    record1.define("type", "square");
    and
    record2.define("type", "circle");

can both be simply made into a new DisplayShapeInterface, e.g.

    DisplayShapeInterface* myShape = new DisplayShapeInterface(record1);
    or
    DisplayShapeInterface* myShape = new DisplayShapeInterface(record2);

It also guarantees consistant interfaces between shapes.

Motivation

The creation of an interface to DisplayShapes makes use of the simpler.

Example

Definition at line 86 of file DisplayShapeInterface.h.


Member Enumeration Documentation

Enumerator:
Pixels 
Relative 
World 

Definition at line 89 of file DisplayShapeInterface.h.


Constructor & Destructor Documentation

Constructor for a standard shape.

The shape will be totally based on pixel sizes, both for it's position and sizes.

casa::DisplayShapeInterface::DisplayShapeInterface ( const Record shapeInfo,
const PixelCanvas pc,
const Bool  scale = True 
)

Constructor for shape based on relative screen positions.

if scaled is true, relative screen positions will be used for height etc also. If not, positions only will be based on relative screen pos, heights will be based on an absolute pixel value.

Constructor for shape based on world co-ordinates (NYI)

Copy cons.


Member Function Documentation

virtual void casa::DisplayShapeInterface::addLocked ( DisplayShapeInterface toLock) [virtual]
virtual void casa::DisplayShapeInterface::addPoint ( const Vector< Float > &  newPoint) [virtual]
virtual void casa::DisplayShapeInterface::changePoint ( const Vector< Float > &  newPos) [virtual]
virtual void casa::DisplayShapeInterface::changePoint ( const Vector< Float > &  newPoint,
const Int  nPoint 
) [virtual]
virtual void casa::DisplayShapeInterface::draw ( PixelCanvas toDrawTo) [virtual]

Will return an option set with whatever the current coords method is.

virtual Vector<Float> casa::DisplayShapeInterface::getCenter ( ) const [virtual]

Returns the pointer to the underlying object.

virtual Bool casa::DisplayShapeInterface::inObject ( const Float  xPos,
const Float  yPos 
) [virtual]

DisplayShape functionality.

All of these functions simply wrap those of the underlying DisplayShape (and add conversion functionality). Please see DisplayShape for a full description of these functions.

void casa::DisplayShapeInterface::makeShape ( const Record shapeInfo) [private]
virtual void casa::DisplayShapeInterface::move ( const Float  dX,
const Float  dY 
) [virtual]
virtual Bool casa::DisplayShapeInterface::onHandles ( const Float  xPos,
const Float  yPos 
) [virtual]
Record casa::DisplayShapeInterface::relToPixOpts ( const Record relative) [private]
virtual void casa::DisplayShapeInterface::removeLocked ( DisplayShapeInterface removeLock) [virtual]
virtual void casa::DisplayShapeInterface::rotate ( const Float  angle) [virtual]
virtual void casa::DisplayShapeInterface::scale ( const Float  angle) [virtual]
virtual void casa::DisplayShapeInterface::setCenter ( const Float  xPos,
const Float  yPos 
) [virtual]
virtual void casa::DisplayShapeInterface::setDrawHandles ( const Bool draw) [virtual]
virtual Bool casa::DisplayShapeInterface::setOptions ( const Record newOptions) [virtual]
Record casa::DisplayShapeInterface::toPixOpts ( const Record notPix) [private]
virtual void casa::DisplayShapeInterface::toPolygon ( ) [virtual]

If the shape is a PolyLine, this function will change it to a polygon.

This is designed for use in the creation of polygon by the user clicking out a polyline, for example.

If the shape is being used in absolute pixel co-ordinates, this will do nothing.

If being used in relative screen or WC mode, this will update the position based on its current pixel location. Returns false if the conversion to the other co-ord type fails.

Update the pixel location of this shape, based on the stored information on its location.

If the shape is being used in pixel mode this will do nothing. If being used in relative screen mode or WC mode, this will update its location. Returns false if a conversion to pixels fail.

virtual Bool casa::DisplayShapeInterface::whichHandle ( const Float  xPos,
const Float  yPos,
Int out 
) [virtual]

Member Data Documentation

Copy of shape, however in its alternate coord form.

Definition at line 186 of file DisplayShapeInterface.h.

Definition at line 176 of file DisplayShapeInterface.h.

Definition at line 177 of file DisplayShapeInterface.h.

Scale widths and heights in relative mode?

Definition at line 183 of file DisplayShapeInterface.h.

Definition at line 175 of file DisplayShapeInterface.h.

Definition at line 178 of file DisplayShapeInterface.h.


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