Annotations.h
Classes
- Annotations -- Control class for a collection of DisplayShapeInterfaces. (full description)
Types
- Nothing
-
- Creation
-
- WcCreation
-
- Handle
-
- OtherHandle
-
- Move
-
- OtherMove
-
- Normal
-
- Arrow
-
- Polygon
-
- PolyLine
-
- Marker
-
Interface
- Public Members
- Annotations(PanelDisplay* panDisp, const Display::KeySym& keysym = Display::K_Pointer_Button1, const Bool useEH = True)
- virtual ~Annotations()
- virtual void operator()(const PCPositionEvent& ev)
- virtual void operator()(const PCMotionEvent& ev)
- virtual void operator()(const PCRefreshEvent& ev)
- virtual void operator()(const WCRefreshEvent& ev)
- virtual void draw(PixelCanvas* pc, const Bool noHandles = False)
- virtual void newShape(Record& settings, const Bool& refresh = True)
- virtual void setKey(const Display::KeySym& newKey)
- virtual void createShape(Record& settings)
- virtual void enable()
- virtual void disable()
- virtual void cancelShapes()
- virtual Bool deleteShape(const uInt& toDel)
- virtual void removeLockedFromCurrent(const uInt& removeMe)
- virtual void addLockedToCurrent(const uInt& addMe)
- virtual Int activeShape()
- virtual Record shapesSummary()
- virtual void setShapeOptions(const uInt& whichShape, const Record& newOptions)
- virtual Record getShapeOptions(const uInt& whichShape)
- virtual Record getAllOptions()
- virtual void setAllOptions(const Record& newSettings)
- virtual void update(PixelCanvas* pc)
- virtual void annotEvent(const String& event)
- virtual Bool revertToPix(const Int& whichOne)
- virtual Bool revertToFrac(const Int& whichOne)
- virtual Bool lockToWC(const Int& whichOne)
- virtual Record availableShapes()
- Private Members
- Bool changeCoordSys(const Int shapeIndex, const String& type, const String& currentCoords, const String& toCoords)
- DisplayShape* constructShape(const Record& settings)
- void handleKeyUp()
- void handleCreation(const PCPositionEvent& ev)
- void handleNormalCreation(const Vector<Float>& createPix)
- void handleMarkerCreation(const Vector<Float>& createPix)
- void handlePolyLineCreation(const Vector<Float>& createPix)
- void handlePolygonCreation(const Vector<Float>& createPix)
- void handleArrowCreation(const Vector<Float>& createPix)
- void select(const Int i)
- Bool determineState(const PCPositionEvent& ev)
- void registerToWCs()
- Bool validateWCs()
- void changedWC()
- Bool validShape(const Record& shape)
- void polyLineToPolygon(const Int whichShape)
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 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
Member Description
Used to determine the state of the class. The state may change due
to mouse events, or function calls.
This is used to handle the creation of shapes by mouse events. Some
types of shapes require special treatment when constructed with
the mouse.
Destructor, and constructor, taking the panelDisplay to which the
Annotator will attach itself to, and which mouse button to listen to.
The event handlers.
virtual void draw(PixelCanvas* pc, const Bool noHandles = False)
Redraw all the shapes. Turns all handles off if noHandles is True
virtual void newShape(Record& settings, const 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. Refresh == False can be used to surpress a
refresh.
virtual void setKey(const Display::KeySym& newKey)
Set the key assigned to control shapes.
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 void enable()
virtual void disable()
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).
Cancels creation of any pending shapes, unselects all shapes and
turns off drawing of all handles.
virtual Bool deleteShape(const 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.
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.
Return the currently selected shapes' index
Return a brief summary of all current shapes
virtual void setShapeOptions(const uInt& whichShape, const Record& newOptions)
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.
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.
Returns a record which contains a sub record (containing options) for
each shape. e.g. To obtain options for the first shape:
Record all = myAnnotator.getAllOptions();
Record shape = all.subRecord(0);
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.
Called when a refresh is required. It copies back to front buffer,
then causes a refresh with reason = backCopiedToFront.
Overwrite this to fire glish events.
virtual Bool revertToPix(const Int& whichOne)
virtual Bool revertToFrac(const Int& whichOne)
virtual Bool lockToWC(const Int& whichOne)
Functions for changing the co-ords system of a shape
Returns a list of shapes annotations knows about
Internal functions