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

class PixelCanvas; class WorldCanvas; More...

#include <DisplayShapeInterface.h>

Public Types

enum  Coord {
  Pixels,
  Relative,
  World
}
 

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

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 casacore::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.

or

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

casa::DisplayShapeInterface::DisplayShapeInterface ( const casacore::Record shapeInfo)

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 casacore::Record shapeInfo,
const PixelCanvas pc,
const casacore::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.

casa::DisplayShapeInterface::DisplayShapeInterface ( const casacore::Record  shapeInfo,
const WorldCanvas wc 
)

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

casa::DisplayShapeInterface::DisplayShapeInterface ( const DisplayShapeInterface other)

Copy cons.

virtual casa::DisplayShapeInterface::~DisplayShapeInterface ( )
virtual

Member Function Documentation

virtual void casa::DisplayShapeInterface::addLocked ( DisplayShapeInterface toLock)
virtual
virtual void casa::DisplayShapeInterface::addPoint ( const casacore::Vector< casacore::Float > &  newPoint)
virtual
virtual void casa::DisplayShapeInterface::changePoint ( const casacore::Vector< casacore::Float > &  newPos)
virtual
virtual void casa::DisplayShapeInterface::changePoint ( const casacore::Vector< casacore::Float > &  newPoint,
const casacore::Int  nPoint 
)
virtual
virtual void casa::DisplayShapeInterface::draw ( PixelCanvas toDrawTo)
virtual
casacore::Record casa::DisplayShapeInterface::fromPixOpts ( const casacore::Record pix)
private

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

virtual casacore::Vector<casacore::Float> casa::DisplayShapeInterface::getCenter ( ) const
virtual
virtual DisplayShape* casa::DisplayShapeInterface::getObject ( )
virtual

Returns the pointer to the underlying object.

virtual casacore::Record casa::DisplayShapeInterface::getOptions ( )
virtual
virtual casacore::Bool casa::DisplayShapeInterface::inObject ( const casacore::Float  xPos,
const casacore::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 casacore::Record shapeInfo)
private
virtual void casa::DisplayShapeInterface::move ( const casacore::Float  dX,
const casacore::Float  dY 
)
virtual
virtual casacore::Bool casa::DisplayShapeInterface::onHandles ( const casacore::Float  xPos,
const casacore::Float  yPos 
)
virtual
casacore::Vector<casacore::Float> casa::DisplayShapeInterface::pixToRel ( const casacore::Vector< casacore::Float > &  pix)
private
casacore::Float casa::DisplayShapeInterface::pixToRelHeight ( const casacore::Float  pix)
private
casacore::Record casa::DisplayShapeInterface::pixToRelOpts ( const casacore::Record pixel)
private
casacore::Float casa::DisplayShapeInterface::pixToRelWidth ( const casacore::Float  pix)
private
casacore::Record casa::DisplayShapeInterface::pixToWorldOpts ( const casacore::Record pix)
private
casacore::Vector<casacore::Float> casa::DisplayShapeInterface::relToPix ( const casacore::Vector< casacore::Float > &  rel)
private
casacore::Float casa::DisplayShapeInterface::relToPixHeight ( const casacore::Float  rel)
private
casacore::Record casa::DisplayShapeInterface::relToPixOpts ( const casacore::Record relative)
private
casacore::Float casa::DisplayShapeInterface::relToPixWidth ( const casacore::Float  rel)
private
virtual void casa::DisplayShapeInterface::removeLocked ( DisplayShapeInterface removeLock)
virtual
virtual void casa::DisplayShapeInterface::rotate ( const casacore::Float  angle)
virtual
virtual void casa::DisplayShapeInterface::scale ( const casacore::Float  angle)
virtual
virtual void casa::DisplayShapeInterface::setCenter ( const casacore::Float  xPos,
const casacore::Float  yPos 
)
virtual
virtual void casa::DisplayShapeInterface::setDrawHandles ( const casacore::Bool draw)
virtual
virtual casacore::Bool casa::DisplayShapeInterface::setOptions ( const casacore::Record newOptions)
virtual
casacore::Record casa::DisplayShapeInterface::toPixOpts ( const casacore::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.

virtual casacore::Bool casa::DisplayShapeInterface::updateNonPixelPosition ( )
virtual

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.

virtual casacore::Bool casa::DisplayShapeInterface::updatePixelPosition ( )
virtual

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 casacore::Bool casa::DisplayShapeInterface::whichHandle ( const casacore::Float  xPos,
const casacore::Float  yPos,
casacore::Int out 
)
virtual
casacore::Record casa::DisplayShapeInterface::worldToPixOpts ( const casacore::Record world)
private

Member Data Documentation

casacore::Record casa::DisplayShapeInterface::altCoords
private

Copy of shape, however in its alternate coord form.

Definition at line 186 of file DisplayShapeInterface.h.

DisplayShapeInterface::Coord casa::DisplayShapeInterface::itsCoords
private

Definition at line 176 of file DisplayShapeInterface.h.

const PixelCanvas* casa::DisplayShapeInterface::itsPc
private

Definition at line 177 of file DisplayShapeInterface.h.

casacore::Bool casa::DisplayShapeInterface::itsScale
private

Scale widths and heights in relative mode?

Definition at line 183 of file DisplayShapeInterface.h.

DisplayShape* casa::DisplayShapeInterface::itsShape
private

Definition at line 175 of file DisplayShapeInterface.h.

const WorldCanvas* casa::DisplayShapeInterface::itsWc
private

Definition at line 178 of file DisplayShapeInterface.h.


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