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

Control class for a collection of DisplayShapeInterfaces. More...

#include <Annotations.h>

Inheritance diagram for casa::Annotations:
casa::PCPositionEH casa::PCMotionEH casa::PCRefreshEH casa::WCRefreshEH casa::DisplayEH

Public Types

enum  State {
  Nothing,
  Creation,
  WcCreation,
  Handle,
  OtherHandle,
  Move,
  OtherMove
}
 Used to determine the state of the class. More...
 
enum  CreationType {
  Normal,
  Arrow,
  Polygon,
  PolyLine,
  Marker
}
 This is used to handle the creation of shapes by mouse events. More...
 

Public Member Functions

 Annotations (PanelDisplay *panDisp, const Display::KeySym &keysym=Display::K_Pointer_Button1, const casacore::Bool useEH=true)
 Destructor, and constructor, taking the panelDisplay to which the Annotator will attach itself to, and which mouse button to listen to. More...
 
virtual ~Annotations ()
 
virtual void operator() (const PCPositionEvent &ev)
 The event handlers. More...
 
virtual void operator() (const PCMotionEvent &ev)
 Default just prints the event to cout. More...
 
virtual void operator() (const PCRefreshEvent &ev)
 Default just prints the event to cout. More...
 
virtual void operator() (const WCRefreshEvent &ev)
 original handler interface (still used for WCRefreshEvents) More...
 
virtual void draw (PixelCanvas *pc, const casacore::Bool noHandles=false)
 Redraw all the shapes. More...
 
virtual void newShape (casacore::Record &settings, const casacore::Bool &refresh=true)
 Instantly creates a shape on screen, and hence requires certain information in its record such as the center of the new object on screen. More...
 
virtual void setKey (const Display::KeySym &newKey)
 Set the key assigned to control shapes. More...
 
virtual void createShape (casacore::Record &settings)
 Create a shape, based on the information contained in the record. More...
 
virtual void enable ()
 Disable event handling (with the exception of refresh calls). More...
 
virtual void disable ()
 
virtual void cancelShapes ()
 Cancels creation of any pending shapes, unselects all shapes and turns off drawing of all handles. More...
 
virtual casacore::Bool deleteShape (const casacore::uInt &toDel)
 Delete the shape at the specified point in the collection of shapes The current (selected) shape can be determined by using the activeShape() function. More...
 
virtual void removeLockedFromCurrent (const casacore::uInt &removeMe)
 These allow shapes to be "locked" together. More...
 
virtual void addLockedToCurrent (const casacore::uInt &addMe)
 
virtual casacore::Int activeShape ()
 Return the currently selected shapes' index. More...
 
virtual casacore::Record shapesSummary ()
 Return a brief summary of all current shapes. More...
 
virtual void setShapeOptions (const casacore::uInt &whichShape, const casacore::Record &newOptions)
 Set the options for the specified shape. More...
 
virtual casacore::Record getShapeOptions (const casacore::uInt &whichShape)
 Returns a record containing the options for the specified shape. More...
 
virtual casacore::Record getAllOptions ()
 Returns a record which contains a sub record (containing options) for each shape. More...
 
virtual void setAllOptions (const casacore::Record &newSettings)
 Deletes all existing shapes, and rebuilds new shapes based on records in sub records of the supplied record. More...
 
virtual void update (PixelCanvas *pc)
 Called when a refresh is required. More...
 
virtual void annotEvent (const casacore::String &)
 Overwrite this to fire glish events. More...
 
virtual casacore::Bool revertToPix (const casacore::Int &whichOne)
 Functions for changing the co-ords system of a shape. More...
 
virtual casacore::Bool revertToFrac (const casacore::Int &whichOne)
 
virtual casacore::Bool lockToWC (const casacore::Int &whichOne)
 
virtual casacore::Record availableShapes ()
 Returns a list of shapes annotations knows about. More...
 
- Public Member Functions inherited from casa::PCPositionEH
 PCPositionEH ()
 Default Constructor Required. More...
 
virtual ~PCPositionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::PCMotionEH
 PCMotionEH ()
 Default Constructor Required. More...
 
virtual ~PCMotionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::PCRefreshEH
 PCRefreshEH ()
 Default Constructor Required. More...
 
 PCRefreshEH (const PCRefreshEH &other)
 
virtual ~PCRefreshEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCRefreshEH
 WCRefreshEH ()
 Default Constructor Required. More...
 
virtual ~WCRefreshEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::DisplayEH
virtual void handleEvent (DisplayEvent &)
 Classes that contain this interface (i.e., derive from it) can override this method to implement actions for whatever types of DisplayEvent they're interested in. More...
 
virtual ~DisplayEH ()
 

Private Member Functions

casacore::Bool changeCoordSys (const casacore::Int shapeIndex, const casacore::String &type, const casacore::String &currentCoords, const casacore::String &toCoords)
 Internal functions. More...
 
DisplayShapeconstructShape (const casacore::Record &settings)
 
void handleKeyUp ()
 
void handleCreation (const PCPositionEvent &ev)
 
void handleNormalCreation (const casacore::Vector< casacore::Float > &createPix)
 
void handleMarkerCreation (const casacore::Vector< casacore::Float > &createPix)
 
void handlePolyLineCreation (const casacore::Vector< casacore::Float > &createPix)
 
void handlePolygonCreation (const casacore::Vector< casacore::Float > &createPix)
 
void handleArrowCreation (const casacore::Vector< casacore::Float > &createPix)
 
void select (const casacore::Int i)
 
casacore::Bool determineState (const PCPositionEvent &ev)
 
void registerToWCs ()
 
casacore::Bool validateWCs ()
 
void changedWC ()
 
casacore::Bool validShape (const casacore::Record &shape)
 
void polyLineToPolygon (const casacore::Int whichShape)
 

Private Attributes

PanelDisplayitsPanelDisplay
 My private variables... More...
 
PixelCanvasitsPC
 
std::list< WorldCanvas * > itsWCs
 My copy of the list of Worldcanvases. More...
 
casacore::PtrBlock
< DisplayShape * > 
itsShapes
 casacore::List of shapes More...
 
Display::KeySym itsKey
 Some overall settings. More...
 
casacore::Bool itsUseEH
 
Annotations::State itsState
 Stuff to remember my current state: More...
 
Annotations::CreationType itsCreation
 
casacore::Bool itsShapeMoved
 
casacore::Int itsActiveShape
 
casacore::Int itsActiveHandle
 
casacore::uInt itsX
 
casacore::uInt itsY
 
casacore::Bool itsEnabled
 
casacore::Bool itsRefreshedYet
 

Detailed Description

Control class for a collection of DisplayShapeInterfaces.

Prerequisite

Etymology

Annotations is a method by which a collection of shapes can be managed on a pixel canvas.

Synopsis

Annotations registers itself as an event handler on whichever pixelcanvas it is supplied. It can then add, delete or modify shapes based on function calls and user mouse input.

The class is essentially a casacore::PtrBlock of DisplayShapeInterfaces, with pixelcanvas event handling to control them.

Motivation

To allow a collection of shapes to be displayed and cotrolled by one class.

Example

Definition at line 84 of file Annotations.h.

Member Enumeration Documentation

This is used to handle the creation of shapes by mouse events.

Some types of shapes require special treatment when constructed with the mouse.

Enumerator
Normal 
Arrow 
Polygon 
PolyLine 
Marker 

Definition at line 99 of file Annotations.h.

Used to determine the state of the class.

The state may change due to mouse events, or function calls.

Enumerator
Nothing 
Creation 
WcCreation 
Handle 
OtherHandle 
Move 
OtherMove 

Definition at line 92 of file Annotations.h.

Constructor & Destructor Documentation

casa::Annotations::Annotations ( PanelDisplay panDisp,
const Display::KeySym keysym = Display::K_Pointer_Button1,
const casacore::Bool  useEH = true 
)

Destructor, and constructor, taking the panelDisplay to which the Annotator will attach itself to, and which mouse button to listen to.

virtual casa::Annotations::~Annotations ( )
virtual

Member Function Documentation

virtual casacore::Int casa::Annotations::activeShape ( )
virtual

Return the currently selected shapes' index.

virtual void casa::Annotations::addLockedToCurrent ( const casacore::uInt addMe)
virtual
virtual void casa::Annotations::annotEvent ( const casacore::String )
inlinevirtual

Overwrite this to fire glish events.

Definition at line 202 of file Annotations.h.

virtual casacore::Record casa::Annotations::availableShapes ( )
virtual

Returns a list of shapes annotations knows about.

virtual void casa::Annotations::cancelShapes ( )
virtual

Cancels creation of any pending shapes, unselects all shapes and turns off drawing of all handles.

casacore::Bool casa::Annotations::changeCoordSys ( const casacore::Int  shapeIndex,
const casacore::String type,
const casacore::String currentCoords,
const casacore::String toCoords 
)
private

Internal functions.

void casa::Annotations::changedWC ( )
private
DisplayShape* casa::Annotations::constructShape ( const casacore::Record settings)
private
virtual void casa::Annotations::createShape ( casacore::Record settings)
virtual

Create a shape, based on the information contained in the record.

This function does not require the center to be specified, as once createShape is called, the user can "drag" out the shape required. If createShape is called, and the shape is no longer required, the function 'cancelShapes' can be used to reset the state of the annotator.

virtual casacore::Bool casa::Annotations::deleteShape ( const casacore::uInt toDel)
virtual

Delete the shape at the specified point in the collection of shapes The current (selected) shape can be determined by using the activeShape() function.

casacore::Bool casa::Annotations::determineState ( const PCPositionEvent ev)
private
virtual void casa::Annotations::disable ( )
virtual
virtual void casa::Annotations::draw ( PixelCanvas pc,
const casacore::Bool  noHandles = false 
)
virtual

Redraw all the shapes.

Turns all handles off if noHandles is true

virtual void casa::Annotations::enable ( )
virtual

Disable event handling (with the exception of refresh calls).

This stops the user from moving shapes etc via the mouse motion / position event handlers. These do not recognize nested calls (e.g. two disables, followed by an enable will enable the handlers).

virtual casacore::Record casa::Annotations::getAllOptions ( )
virtual

Returns a record which contains a sub record (containing options) for each shape.

e.g. To obtain options for the first shape:

casacore::Record all = myAnnotator.getAllOptions();
virtual casacore::Record casa::Annotations::getShapeOptions ( const casacore::uInt whichShape)
virtual

Returns a record containing the options for the specified shape.

The user selected shape can be determined by calling the 'activeShape' method. To see a list of the options returned by shapes / objects, see their individual documentation.

void casa::Annotations::handleArrowCreation ( const casacore::Vector< casacore::Float > &  createPix)
private
void casa::Annotations::handleCreation ( const PCPositionEvent ev)
private
void casa::Annotations::handleKeyUp ( )
private
void casa::Annotations::handleMarkerCreation ( const casacore::Vector< casacore::Float > &  createPix)
private
void casa::Annotations::handleNormalCreation ( const casacore::Vector< casacore::Float > &  createPix)
private
void casa::Annotations::handlePolygonCreation ( const casacore::Vector< casacore::Float > &  createPix)
private
void casa::Annotations::handlePolyLineCreation ( const casacore::Vector< casacore::Float > &  createPix)
private
virtual casacore::Bool casa::Annotations::lockToWC ( const casacore::Int whichOne)
virtual
virtual void casa::Annotations::newShape ( casacore::Record settings,
const casacore::Bool refresh = true 
)
virtual

Instantly creates a shape on screen, and hence requires certain information in its record such as the center of the new object on screen.

Refresh == false can be used to surpress a refresh.

virtual void casa::Annotations::operator() ( const PCPositionEvent ev)
virtual

The event handlers.

Reimplemented from casa::PCPositionEH.

virtual void casa::Annotations::operator() ( const PCMotionEvent eh)
virtual

Default just prints the event to cout.

Reimplemented from casa::PCMotionEH.

virtual void casa::Annotations::operator() ( const PCRefreshEvent eh)
virtual

Default just prints the event to cout.

Reimplemented from casa::PCRefreshEH.

virtual void casa::Annotations::operator() ( const WCRefreshEvent ev)
virtual

original handler interface (still used for WCRefreshEvents)

Implements casa::WCRefreshEH.

void casa::Annotations::polyLineToPolygon ( const casacore::Int  whichShape)
private
void casa::Annotations::registerToWCs ( )
private
virtual void casa::Annotations::removeLockedFromCurrent ( const casacore::uInt removeMe)
virtual

These allow shapes to be "locked" together.

Adding a locked shape to the current shape means that whenever the current shape moves, so too will the specified shape. removeLockedFromCurrent can be used to remove this effect.

virtual casacore::Bool casa::Annotations::revertToFrac ( const casacore::Int whichOne)
virtual
virtual casacore::Bool casa::Annotations::revertToPix ( const casacore::Int whichOne)
virtual

Functions for changing the co-ords system of a shape.

void casa::Annotations::select ( const casacore::Int  i)
private
virtual void casa::Annotations::setAllOptions ( const casacore::Record newSettings)
virtual

Deletes all existing shapes, and rebuilds new shapes based on records in sub records of the supplied record.

A record returned from getAllOptions() can therefore be used to copy a set of shapes.

virtual void casa::Annotations::setKey ( const Display::KeySym newKey)
virtual

Set the key assigned to control shapes.

virtual void casa::Annotations::setShapeOptions ( const casacore::uInt whichShape,
const casacore::Record newOptions 
)
virtual

Set the options for the specified shape.

The user selected shape can be determined by call the 'activeShape' method. To see a list of available options for different types of shapes / objects, see their individual documentation.

virtual casacore::Record casa::Annotations::shapesSummary ( )
virtual

Return a brief summary of all current shapes.

virtual void casa::Annotations::update ( PixelCanvas pc)
virtual

Called when a refresh is required.

It copies back to front buffer, then causes a refresh with reason = backCopiedToFront.

casacore::Bool casa::Annotations::validateWCs ( )
private
casacore::Bool casa::Annotations::validShape ( const casacore::Record shape)
private

Member Data Documentation

casacore::Int casa::Annotations::itsActiveHandle
private

Definition at line 247 of file Annotations.h.

casacore::Int casa::Annotations::itsActiveShape
private

Definition at line 246 of file Annotations.h.

Annotations::CreationType casa::Annotations::itsCreation
private

Definition at line 244 of file Annotations.h.

casacore::Bool casa::Annotations::itsEnabled
private

Definition at line 249 of file Annotations.h.

Display::KeySym casa::Annotations::itsKey
private

Some overall settings.

Definition at line 237 of file Annotations.h.

PanelDisplay* casa::Annotations::itsPanelDisplay
private

My private variables...

The PanelDisplay I was given on construction and some stuff I got out of it

Definition at line 224 of file Annotations.h.

PixelCanvas* casa::Annotations::itsPC
private

Definition at line 225 of file Annotations.h.

casacore::Bool casa::Annotations::itsRefreshedYet
private

Definition at line 250 of file Annotations.h.

casacore::Bool casa::Annotations::itsShapeMoved
private

Definition at line 245 of file Annotations.h.

casacore::PtrBlock<DisplayShape*> casa::Annotations::itsShapes
private

casacore::List of shapes

Definition at line 233 of file Annotations.h.

Annotations::State casa::Annotations::itsState
private

Stuff to remember my current state:

Definition at line 243 of file Annotations.h.

casacore::Bool casa::Annotations::itsUseEH
private

Definition at line 238 of file Annotations.h.

std::list<WorldCanvas* > casa::Annotations::itsWCs
private

My copy of the list of Worldcanvases.

I can check this against itsPanelDisplay to see if anything has changed.

Definition at line 230 of file Annotations.h.

casacore::uInt casa::Annotations::itsX
private

Definition at line 248 of file Annotations.h.

casacore::uInt casa::Annotations::itsY
private

Definition at line 248 of file Annotations.h.


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