Shape

The base class of all Shapes

All Lines, Rectangles, Circles, Ellipses, LineStrips, Polys and Points are different kind of Shapes. See the section Derived Classes, which lists all possible primitives you can create.

An important thing to note is that OpenLayer deviates from most libraries in the way that there's no primitive rendering functions (anymore). Instead, there's primitive classes with member functions to render them.

The idea is that, for example, a filled rectangle, an outline of a rectangle and a gradien filled rectangle can all use a common constructor because they all need to know the position and the size of the rectangle. Also this allows for more specialized constructors, for example rounded rectangles, while still allowing for the same drawing operations.

The idea is even clearer with Circles as they have quite a lot of different ways to render them, for example you might only want to draw a slice of the circle, or maybe a disk...

Note that many parameters are optional. Thus even if a function might seem complicated at first it's in fact simplier to use than it looks. The extra parameters are there just in case if you need them.

Member functions
Draw
Draws the shape filled with the specified color
DrawOutline
Draws the outline of the shape
RecordDraw
Records the results of Draw-function
MoveBy
Moves the shape
SetLineWidth
Sets the width of the outline of the shape
GetLineWidth
Returns the width of the outline of the shape
DrawRecord
Draws the latest record created by RecordDraw
RotateBy
Rotates the shape by the specified angle
TransformBy
Transforms the shape by a Placement

Derived Classes
Poly
Stores a polygon
Line
A single line between two points
Rect
Stores (and renders) a rectangle
Ellipse
Stores an ellipse (or a circle)
LineStrip
A series of lines glued together
Point
A single point


Questions about Shape? Click here.