#include <ShapeItem.hpp>
Public Member Functions | |
virtual void | paint () |
![]() | |
Item (const Item &)=delete | |
virtual | ~Item () |
void | addChild (Item *child) |
const vector< Item * > & | children () const |
virtual void | clearItemListProperty (const PropertyDef *property) |
void | destroyChild (Item *child) |
virtual bool | getBoolProperty (const PropertyDef *property) const |
virtual vector< double > | getDoubleListProperty (const PropertyDef *property) const |
virtual double | getDoubleProperty (const PropertyDef *property) const |
virtual string | getEnumProperty (const PropertyDef *property) const |
virtual int | getIntProperty (const PropertyDef *property) const |
virtual vector< Item * > | getItemListProperty (const PropertyDef *property) const |
virtual Item * | getItemProperty (const PropertyDef *property) const |
virtual string | getStringProperty (const PropertyDef *property) const |
int | getUtilityProperty (string name) const |
virtual void | insertIntoItemListProperty (const PropertyDef *property, int index, Item *item) |
Item & | operator= (const Item &)=delete |
Item * | parent () const |
virtual void | removeFromItemListProperty (const PropertyDef *property, int index) |
virtual void | setBoolProperty (const PropertyDef *property, bool value) |
virtual void | setDoubleListProperty (const PropertyDef *property, vector< double > value) |
virtual void | setDoubleProperty (const PropertyDef *property, double value) |
virtual void | setEnumProperty (const PropertyDef *property, string value) |
virtual void | setIntProperty (const PropertyDef *property, int value) |
virtual void | setItemProperty (const PropertyDef *property, Item *item) |
virtual void | setStringProperty (const PropertyDef *property, string value) |
void | setUtilityProperty (string name, int value) |
virtual string | type () const |
Protected Member Functions | |
ShapeItem () | |
virtual void | drawLine (double x1, double y1, double x2, double y2) |
virtual void | paintSelf () |
virtual void | popState () |
virtual void | pushState () |
virtual void | setColor (double r, double g, double b) |
virtual void | setWidth (double w) |
![]() | |
Item () | |
Private Types | |
using | BaseType = Item |
using | ItemType = ShapeItem |
Friends | |
class | ItemRegistry |
The ShapeItem class is the abstract base class for all items in the 'shapes' program. It inherits from the Item class to offer discovery and resurrection capabilities. In addition, it offers facilities to handle drawing of shapes in coordination with its subclasses. The root of a run-time shape hierarchy must be an instance of the ShapeCanvas class, which inherits ShapeItem.
|
inlineprotected |
|
protectedvirtual |
This function can be invoked from a subclass to draw a line on the canvas held by the root of the run-time shape hierarchy. The line is drawn using the current graphics state color and width from the point (x1,y1) to the point (x2,y2). The coordinates are specified in in a frame where the lower left corner of the canvas is at (0 m, 0 m) and the upper right corner of the canvas is at (1 m, 1 m). Segments of the line lying outside of the canvas are clipped away. The implementation in this base class forwards the message to its parent in the run-time hierarchy until the root shape has been reached.
Reimplemented in ShapeCanvas.
|
virtual |
This function causes the receiving shape and its children to be painted on the canvas held by the root of the run-time shape hierarchy. Specifically, the function calls the pushState() function to save the graphics state, calls its own paintSelf() function, forwards the paint() message to all its children (recursively) and finally calls the popState() function to restore the graphics state.
|
protectedvirtual |
This function must be implemented by Shape subclasses to paint the appropriate marks for the shape on the canvas held by the root of the run-time shape hierarchy. This can be accomplished by calling one or more of the drawing functions offered by this class. The implementation in this base class does nothing, which may be appropriate for subclasses such as transparent groups.
Reimplemented in ColorDecorator, PolygonShape, RectangleShape, and WidthDecorator.
|
protectedvirtual |
This function is invoked by the paint() function to restore the graphics state of the canvas held by the root of the run-time shape hierarchy to the most recently saved state. The implementation in this base class forwards the message to its parent in the run-time hierarchy until the root shape has been reached.
Reimplemented in ShapeCanvas.
|
protectedvirtual |
This function is invoked by the paint() function to save the graphics state of the canvas held by the root of the run-time shape hierarchy. The implementation in this base class forwards the message to its parent in the run-time hierarchy until the root shape has been reached.
Reimplemented in ShapeCanvas.
|
protectedvirtual |
This function can be invoked from a subclass to set the color in the graphics state. The color is specified as three RGB components ranging from 0 (no intensity) to 1 (maximum intensity). If a component value is out of range, the result is undefined. The implementation in this base class forwards the message to its parent in the run-time hierarchy until the root shape has been reached.
Reimplemented in ShapeCanvas.
|
protectedvirtual |
This function can be invoked from a subclass to set the line width in the graphics state. The line width is specified in units where the canvas size equals 1, and should be greater than 0 and smaller than 1. If the value is out of range, the result is undefined. The implementation in this base class forwards the message to its parent in the run-time hierarchy until the root shape has been reached.
Reimplemented in ShapeCanvas.