Module DisplayShapes
Changes made in the current development cycle can be
found in the changelog.
A module providing classes to draw general shapes onto a pixel canvas.
Review Status
- Reviewed By:
- None yet
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
Etymology
The module provides various classes that are responsible for
"drawing" "shapes"
Synopsis
Motivation
The motivation behind creation of a set of "DisplayShapes" was to enable
a convinient way to draw basic shapes which would be general enough
to use anywhere in AIPS++. The most obvious application is for use as
Annotations.
The shape objects themselves draw onto a pixelcanvas whenever it is
passed to them. The have no event handling facilites, this must be
handled by an outside class. Annotations
is an example of such a class. It adds mouse handling etc
and manages a list of shapes.
The DisplayShapes
DisplayShapes use PixelCanvas
primitives to draw themselves. They act as wrappers for primitives,
and allow every shape to have a common interface. All DisplayShapes,
for example have a "move" function. Such a function, when combined
with others such as "inObject", enable mouse interactions to be far
simpler than they would using pixelcanvas primitives. An interface
class is also provided, called
DisplayShapeInterface.
This class is another layer on top of the DisplayShapes which uses
records to further simplify the interface between many different types of
shapes. The overall aim of the DisplayShapes is to present all shapes
as a single "DisplayShapeInterface" object.
Adding a new shape
The first place a new shape must be added is as a class in the display
shapes directory. This class should inherit from the base class,
DisplayShape, or some other class
which in turn inherits from it. Examples of appropriate classes would
be DSBasic or
DSClosed.
DisplayShapeInterface
must also be made aware of the new shape, so it can properly construct
it if requested. If the shape is to be used for annotations, it must
be added, along with any special event handling requirements to the
Annotations class.
Using the DisplayShapeInterface
Regardless of how much functionality the shapes share, there will
always be a need to apply different options for different shapes. The
information below is intended to outline the options available for all
displayshapes.
The below listed options are passed via Records to various shapes. This
occurs either via get/set options, or via the constructor of
DisplayShapeInterface.
General Options :
Record Entry | Allowed Data | Desc. |
hashandles | Boolean | Will the object ever have
handles? No calculations will be done regarding handle position if this is
false - This is different to drawhandles. hashandles should only be set
under definate circumstances - i.e. when a shape is being used as a handle
or for a marker, which will never have a handle. |
drawhandles | Boolean | Should handles be drawn
currently? |
handlecolor | String | Specify the color of the
handles |
handlestyle | DisplayShape::HandleShape | The
of shape to use for the handles |
handlesize | Int | The size of the handles in
pixels (radius / height) |
color | String | The color of the displayshape
object |
Record fields specific to individual shapes should be documentented in
their respective header files.
To Do
- The "rotateAbout" functionality is currently not implemented
- Annotations -- Control class for a collection of DisplayShapeInterfaces. (full description)
- DSArrow -- Arrow implementation;adds a polygon to a DSLine to represent the arrow head (full description)
- DSBasic -- Base class for all "basic" shapes (full description)
- DSCircle -- Circle implementation;extends DSEllipse, adding general circle functions (full description)
- DSClosed -- DSClosed provides common functionality for all "closed" shapes. (full description)
- DSEllipse -- Implementation of a ellipse. (full description)
- DSLine -- Implementation of a line. (full description)
- DSMarker -- Implementation of a marker. (full description)
- DSPixelArrow -- Implementation of an absolute pixel DSArrow (full description)
- DSPixelEllipse -- Implementation of an absolute pixel DSEllipse (full description)
- DSPixelMarker -- Implementation of an absolute pixel DSMarker (full description)
- DSPixelPoly -- Implementation of an absolute pixel DSPoly (full description)
- DSPixelPolyLine -- Implementation of an absolute pixel DSPolyLine (full description)
- DSPixelRectangle -- Implementation of an absolute pixel DSRectangle (full description)
- DSPixelText -- Implementation of an absolute pixel DSText (full description)
- DSPoly -- Implementation of a Polygon. (full description)
- DSPolyLine -- Implementation of a polyline. (full description)
- DSRectangle -- Implementation of a rectangle. (full description)
- DSScreenArrow -- Implementation of a relative screen pos DSArrow (full description)
- DSScreenEllipse -- Implementation of a relative screen pos. DSEllipse (full description)
- DSScreenMarker -- Implementation of relative screen pos. DSMarker (full description)
- DSScreenPoly -- Implementation of a relative screen pos. DSPoly (full description)
- DSScreenPolyLine -- Implementation of a relative screen pos. DSPolyLine (full description)
- DSScreenRectangle -- Implementation of a relative screen pos. DSRectangle (full description)
- DSScreenText -- Implementation of a relative screen pos. DSText (full description)
- DSSquare -- Implementation of a square. (full description)
- DSText -- Implementation of text. (full description)
- DSWorldArrow -- Implementation of a world coords DSArrow (full description)
- DSWorldEllipse -- Implementation of a world coords DSEllipse (full description)
- DSWorldMarker -- Implementation of a world coords DSMarker (full description)
- DSWorldPoly -- Implementation of a world coords DSPoly (full description)
- DSWorldPolyLine -- Implementation of a world coords. DSPolyLine (full description)
- DSWorldRectangle -- Implementation of a world coords DSRectangle (full description)
- DSWorldText -- Implementation of a world coords. DSText (full description)
- DisplayShape -- The abstract base class for all "DisplayShapes". (full description)
- DisplayShapeInterface -- Wrapper for DisplayShapes;provides easier/unified constr. of DisplayShapes (full description)
- DisplayShapeWithCoords -- Base class for DisplayShapes with Coords (full description)