#include <ShapeCanvas.hpp>
Public Member Functions | |
void | paintAndSave (string outPath) |
string | savePath () const |
Shape * | shape () const |
![]() | |
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 | |
ShapeCanvas () | |
void | drawLine (double x1, double y1, double x2, double y2) override |
void | popState () override |
void | pushState () override |
void | setColor (double r, double g, double b) override |
void | setWidth (double w) override |
![]() | |
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 = ShapeItem |
using | ItemType = ShapeCanvas |
Private Attributes | |
GraphicsStateCanvas * | _canvas |
string | _savePath |
Shape * | _shape |
Friends | |
class | ItemRegistry |
The ShapeCanvas class is a shape item that manages a canvas on which the shapes in a hierarchy can be drawn, and provides facilities to perform such drawing. The root of a run-time shape hierarchy must be an instance of the ShapeCanvas class.
|
inlineprotected |
Default constructor for concrete Item subclass ShapeCanvas : "the root of a shape hierarchy, managing the canvas" .
|
overrideprotectedvirtual |
This function draws a line on the canvas. 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.
Reimplemented from ShapeItem.
void ShapeCanvas::paintAndSave | ( | string | outPath | ) |
This function paints the shape hierarchy held by the receiving item onto its canvas, and then saves the result to the specified output file. Call the paintAndSave() function of a shape canvas rather than the paint() function inherited from the Shape class.
|
overrideprotectedvirtual |
This function pops the graphics state of the canvas from the graphics state stack, restoring the most recently pushed state.
Reimplemented from ShapeItem.
|
overrideprotectedvirtual |
This function pushes the graphics state of the canvas on the graphics state stack.
Reimplemented from ShapeItem.
|
inline |
This function returns the value of the discoverable string property savePath : "the path of the output file when saving this canvas" .
This property is required only if the Boolean expression "false" evaluates to true after replacing the names by true or false depending on their presence.
This property is displayed only if the Boolean expression "false" evaluates to true after replacing the names by true or false depending on their presence.
|
overrideprotectedvirtual |
This function sets 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.
Reimplemented from ShapeItem.
|
overrideprotectedvirtual |
This function sets 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.
Reimplemented from ShapeItem.
|
inline |
This function returns the value of the discoverable item property shape : "the top-level shape in this hierarchy" .
The default value for this property is given by the conditional value expression "ShapeGroup" .