The Grid describes how a 2D Grid should look and behave like. More...
#include "Grid.h"
Public Types | |
| enum | GridFlag { NoGridFlags = 0x0000 , ShowNormalLines = 0x0001 , ShowWideLines = 0x0002 , ShowCenterCross = 0x0004 , NoGridLineMask = 0xFFF0 , AutoScaleGrid = 0x0010 } |
| A GridFlag describe the grid appearance. More... | |
| enum | GridSnapMode { NoGridSnap , SnapTopLeft , SnapCenter } |
| The GridSnapMode describe if and how the grid snapping should be performed. More... | |
| typedef Flags< GridFlag > | GridFlags |
| GridFlags are use describe the grid appearance. | |
Public Member Functions | |
| Grid () | |
| Grid (double _defaultGridLineWidth, const GridFlags &_flags, GridSnapMode _snapMode) | |
| Grid (const Point2D &_gridStep, const Point2D &_gridWideEvery, const OutlineF &_gridLineStyle, const GridFlags &_flags, GridSnapMode _snapMode) | |
| Grid (const Grid &_other) | |
| virtual | ~Grid () |
| Grid & | operator= (const Grid &_other) |
| virtual void | addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override |
| Add the object contents to the provided JSON object. | |
| virtual void | setFromJsonObject (const ot::ConstJsonObject &_object) override |
| Set the object contents from the provided JSON object. | |
| Point2D | snapToGrid (const Point2D &_pt) const |
| Snaps the provided point to the grid if snapping is enabled. | |
| Point2DF | snapToGrid (const Point2DF &_pt) const |
| Snaps the provided point to the grid if snapping is enabled. | |
| Point2DD | snapToGrid (const Point2DD &_pt) const |
| Snaps the provided point to the grid if snapping is enabled. | |
| void | setGridFlag (GridFlag _flag, bool _active=true) |
| Sets/Unsets the provided flag. | |
| void | setGridFlags (const GridFlags &_flags) |
| Sets the current GridFlags. | |
| const GridFlags & | getGridFlags (void) const |
| Returns the current GridFlags. | |
| void | setGridStep (int _step) |
| Sets the current grid step size. | |
| void | setGridStep (const Point2D &_step) |
| Sets the current grid step size. | |
| const Point2D & | getGridStep (void) const |
| Returns the current grid step size. The current step is the distance between every grid line on the X and Y axis. | |
| void | setWideGridLineCounter (int _stepCount) |
| Set the wide grid line counter. | |
| void | setWideGridLineCounter (const Point2D &_stepCount) |
| Set the wide grid line counter. | |
| const Point2D & | getWideGridLineCounter (void) const |
| Returns the counter limit for wide grid lines. The counter must be greater than 1 to be valid. For a counter of (2, 5) every 2nd vertical (-x to +x) and every 5th horizontal (-y to +y) grid line will be wide. | |
| void | setGridSnapMode (GridSnapMode _mode) |
| Sets the current GridSnapMode. | |
| GridSnapMode | getGridSnapMode (void) const |
| Returns the current GridSnapMode. | |
| void | setGridLineColor (int _r, int _g, int _b, int _a=255) |
| void | setGridLineColor (const Color &_color) |
| void | setGridLineStyle (const OutlineF &_style) |
| const OutlineF & | getGridLineStyle (void) const |
| bool | isGridLinesValid (void) const |
| Returns true if at least one type of grid should be drawn according to the current flags. | |
| bool | isGridSnapValid (void) const |
| Returns true if the grid snap is enabled and the grid step is greater than 0 for at least one axis. | |
Public Member Functions inherited from ot::Serializable | |
| Serializable () | |
| virtual | ~Serializable () |
Static Public Member Functions | |
| static std::string | toString (GridFlag _flag) |
| static GridFlag | stringToGridFlag (const std::string &_flag) |
| static std::list< std::string > | toStringList (const GridFlags &_flags) |
| static GridFlags | stringListToGridFlags (const std::list< std::string > &_flags) |
| static std::string | toString (GridSnapMode _snapMode) |
| static GridSnapMode | stringToGridSnapMode (const std::string &_snapMode) |
| static Point2D | snapToGrid (const Point2D &_pt, const Point2D &_gridStep) |
| Snaps the provided point to the specified grid. | |
| static Point2DF | snapToGrid (const Point2DF &_pt, const Point2D &_gridStep) |
| Snaps the provided point to the specified grid. | |
| static Point2DD | snapToGrid (const Point2DD &_pt, const Point2D &_gridStep) |
| Snaps the provided point to the specified grid. | |
| Grid< T >::GridFlags |
GridFlags are use describe the grid appearance.
| enum ot::Grid::GridFlag |
A GridFlag describe the grid appearance.
The GridSnapMode describe if and how the grid snapping should be performed.
| Grid< T >::Grid | ( | double | _defaultGridLineWidth, |
| const GridFlags & | _flags, | ||
| GridSnapMode | _snapMode ) |
| Grid< T >::Grid | ( | const Point2D & | _gridStep, |
| const Point2D & | _gridWideEvery, | ||
| const OutlineF & | _gridLineStyle, | ||
| const GridFlags & | _flags, | ||
| GridSnapMode | _snapMode ) |
|
overridevirtual |
Add the object contents to the provided JSON object.
| _object | Json object reference to write the data to. |
| _allocator | Allocator. |
Implements ot::Serializable.
|
inline |
Returns the current GridFlags.
|
inline |
|
inline |
Returns the current GridSnapMode.
|
inline |
Returns the current grid step size. The current step is the distance between every grid line on the X and Y axis.
|
inline |
Returns the counter limit for wide grid lines. The counter must be greater than 1 to be valid. For a counter of (2, 5) every 2nd vertical (-x to +x) and every 5th horizontal (-y to +y) grid line will be wide.
|
inline |
Returns true if at least one type of grid should be drawn according to the current flags.
|
inline |
Returns true if the grid snap is enabled and the grid step is greater than 0 for at least one axis.
|
overridevirtual |
Set the object contents from the provided JSON object.
| _object | The JSON object containing the information. |
| May | throw an exception if the provided object is not valid (members missing or invalid types). |
Implements ot::Serializable.
|
inline |
Sets/Unsets the provided flag.
| _flag | Flag to set/unset. |
| _active | If true the flag will be set, otherwise unset. |
|
inline |
Sets the current GridFlags.
|
inline |
|
inline |
|
inline |
|
inline |
Sets the current GridSnapMode.
|
inline |
Sets the current grid step size.
|
inline |
Sets the current grid step size.
| _step | The step distance that will be set for X and Y. |
|
inline |
Set the wide grid line counter.
|
inline |
Set the wide grid line counter.
| _stepCount | The step count for the X and Y axis. |
| ot::Point2D Grid< T >::snapToGrid | ( | const Point2D & | _pt | ) | const |
Snaps the provided point to the grid if snapping is enabled.
|
static |
Snaps the provided point to the specified grid.
| ot::Point2DD Grid< T >::snapToGrid | ( | const Point2DD & | _pt | ) | const |
Snaps the provided point to the grid if snapping is enabled.
|
static |
Snaps the provided point to the specified grid.
| ot::Point2DF Grid< T >::snapToGrid | ( | const Point2DF & | _pt | ) | const |
Snaps the provided point to the grid if snapping is enabled.
|
static |
Snaps the provided point to the specified grid.
|
static |
|
static |
|
static |
|
static |