|
KiCad PCB EDA Suite
|
Manage the construction of a bezier through a series of steps. More...
#include <bezier_geom_manager.h>
Public Types | |
| enum | BEZIER_STEPS { SET_START = 0 , SET_CONTROL1 , SET_END , SET_CONTROL2 , COMPLETE } |
Public Member Functions | |
| BEZIER_GEOM_MANAGER () | |
| int | getMaxStep () const override |
| The highest step this manager has - used to recognize completion and to clamp the step as it advances. | |
| BEZIER_STEPS | GetStep () const |
| Get the current step the manager is on (useful when drawing something depends on the current state) | |
| bool | acceptPoint (const VECTOR2I &aPt) override |
| < Function that accepts a point for a stage, or rejects it to return to the previous stage | |
| VECTOR2I | GetStart () const |
| < Get the center point of the arc (valid when state > SET_ORIGIN) | |
| VECTOR2I | GetControlC1 () const |
| VECTOR2I | GetControlC2 () const |
| Get the coordinates of the arc end point. | |
| VECTOR2I | GetEnd () const |
| void | AddPoint (const VECTOR2I &aPt, bool aLockIn) |
| Add a point to the construction manager. | |
| void | RemoveLastPoint () |
| Undo the last point, and move the manager back to the previous step. | |
| bool | IsReset () const |
| virtual void | Reset () |
| Reset the manager to the initial state. | |
| bool | IsComplete () const |
| VECTOR2I | GetLastPoint () const |
| Get the last point added (locked in or not). | |
| bool | HasGeometryChanged () const |
| void | ClearGeometryChanged () |
| Clear the geometry changed flag, call after the client code has updated everything as needed. | |
Protected Member Functions | |
| void | setGeometryChanged () |
| < Mark the geometry as changed for clients to notice | |
| int | getStep () const |
Private Member Functions | |
| bool | setStart (const VECTOR2I &aOrigin) |
| < Set the center point of the arc | |
| bool | setControlC1 (const VECTOR2I &aControl) |
| bool | setEnd (const VECTOR2I &aCursor) |
| bool | setControlC2 (const VECTOR2I &aControl) |
| void | performStep (bool aForward) |
| Has the geometry changed such that a client should redraw? | |
Private Attributes | |
| VECTOR2I | m_start |
| VECTOR2I | m_controlC1 |
| VECTOR2I | m_end |
| VECTOR2I | m_controlC2 |
| bool | m_changed = false |
| The last (raw) point added, which is usually the cursor position. | |
| VECTOR2I | m_lastPoint |
| int | m_step = 0 |
| The current manager step, from 0 to some highest number that depends on the manager. | |
Manage the construction of a bezier through a series of steps.
See also KIGFX::PREVIEW::ARC_GEOM_MANAGER.
Interfaces are provided to return both arc geometry (can be used to set up real beziers on PCBs, for example) as well as important control points for informational overlays.
Definition at line 39 of file bezier_geom_manager.h.
Definition at line 44 of file bezier_geom_manager.h.
|
inline |
Definition at line 42 of file bezier_geom_manager.h.
|
overridevirtual |
< Function that accepts a point for a stage, or rejects it to return to the previous stage
Implements KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER.
Definition at line 25 of file bezier_geom_manager.cpp.
References COMPLETE, KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getStep(), SET_CONTROL1, SET_CONTROL2, SET_END, SET_START, setControlC1(), setControlC2(), setEnd(), and setStart().
|
inlineinherited |
Add a point to the construction manager.
| aPt | the new point |
| aLockIn | whether to "lock in" the point, and move the geometry manager to the next (or previous) step. False to update geometry and not affect manager state. |
Definition at line 57 of file multistep_geom_manager.h.
References acceptPoint(), m_lastPoint, performStep(), and setGeometryChanged().
|
inlineinherited |
Clear the geometry changed flag, call after the client code has updated everything as needed.
Definition at line 137 of file multistep_geom_manager.h.
References m_changed.
| VECTOR2I BEZIER_GEOM_MANAGER::GetControlC1 | ( | ) | const |
Definition at line 46 of file bezier_geom_manager.cpp.
References m_controlC1.
| VECTOR2I BEZIER_GEOM_MANAGER::GetControlC2 | ( | ) | const |
Get the coordinates of the arc end point.
Definition at line 58 of file bezier_geom_manager.cpp.
References m_controlC2, and m_end.
| VECTOR2I BEZIER_GEOM_MANAGER::GetEnd | ( | ) | const |
Definition at line 52 of file bezier_geom_manager.cpp.
References m_end.
|
inlineinherited |
Get the last point added (locked in or not).
This can* be useful when drawing previews, as the point given isn't always what gets locked into the geometry, if that step doesn't have full degrees of freedom.
Definition at line 120 of file multistep_geom_manager.h.
References m_lastPoint.
Referenced by RemoveLastPoint().
|
inlineoverridevirtual |
The highest step this manager has - used to recognize completion and to clamp the step as it advances.
Moves the manager forward or backward through the stages
Implements KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER.
Definition at line 53 of file bezier_geom_manager.h.
References COMPLETE.
| VECTOR2I BEZIER_GEOM_MANAGER::GetStart | ( | ) | const |
< Get the center point of the arc (valid when state > SET_ORIGIN)
Get the coordinates of the arc start
Definition at line 40 of file bezier_geom_manager.cpp.
References m_start.
|
inline |
Get the current step the manager is on (useful when drawing something depends on the current state)
Definition at line 59 of file bezier_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getStep().
|
inlineprotectedinherited |
Definition at line 151 of file multistep_geom_manager.h.
References m_step.
Referenced by KIGFX::PREVIEW::ARC_GEOM_MANAGER::acceptPoint(), KIGFX::PREVIEW::BEZIER_GEOM_MANAGER::acceptPoint(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStep(), KIGFX::PREVIEW::BEZIER_GEOM_MANAGER::GetStep(), and KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER::GetStep().
|
inlineinherited |
Definition at line 128 of file multistep_geom_manager.h.
References m_changed.
|
inlineinherited |
Definition at line 109 of file multistep_geom_manager.h.
References getMaxStep(), and m_step.
|
inlineinherited |
Definition at line 88 of file multistep_geom_manager.h.
References m_step.
|
inlineprivateinherited |
Has the geometry changed such that a client should redraw?
Definition at line 169 of file multistep_geom_manager.h.
References getMaxStep(), and m_step.
Referenced by AddPoint(), and RemoveLastPoint().
|
inlineinherited |
Undo the last point, and move the manager back to the previous step.
Definition at line 75 of file multistep_geom_manager.h.
References acceptPoint(), GetLastPoint(), performStep(), and setGeometryChanged().
|
inlinevirtualinherited |
Reset the manager to the initial state.
Subclasses that hold construction state beyond the step counter must override this and clear that state too.
Reimplemented in KIGFX::PREVIEW::ARC_GEOM_MANAGER, and KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER.
Definition at line 99 of file multistep_geom_manager.h.
References m_lastPoint, m_step, and setGeometryChanged().
Referenced by KIGFX::PREVIEW::ARC_GEOM_MANAGER::Reset(), and KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER::Reset().
|
private |
Definition at line 78 of file bezier_geom_manager.cpp.
References m_controlC1, m_controlC2, and m_end.
Referenced by acceptPoint().
|
private |
Definition at line 96 of file bezier_geom_manager.cpp.
References m_controlC2.
Referenced by acceptPoint().
|
private |
Definition at line 88 of file bezier_geom_manager.cpp.
References m_controlC2, m_end, and m_start.
Referenced by acceptPoint().
|
inlineprotectedinherited |
< Mark the geometry as changed for clients to notice
Get the current stage of the manager
Definition at line 145 of file multistep_geom_manager.h.
References m_changed.
Referenced by AddPoint(), RemoveLastPoint(), Reset(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetClockwise(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::ToggleClockwise().
|
private |
< Set the center point of the arc
Definition at line 66 of file bezier_geom_manager.cpp.
References m_controlC1, m_controlC2, m_end, and m_start.
Referenced by acceptPoint().
|
privateinherited |
The last (raw) point added, which is usually the cursor position.
Definition at line 178 of file multistep_geom_manager.h.
Referenced by ClearGeometryChanged(), HasGeometryChanged(), and setGeometryChanged().
|
private |
Definition at line 92 of file bezier_geom_manager.h.
Referenced by GetControlC1(), setControlC1(), and setStart().
|
private |
Definition at line 94 of file bezier_geom_manager.h.
Referenced by GetControlC2(), setControlC1(), setControlC2(), setEnd(), and setStart().
|
private |
Definition at line 93 of file bezier_geom_manager.h.
Referenced by GetControlC2(), GetEnd(), setControlC1(), setEnd(), and setStart().
|
privateinherited |
Definition at line 181 of file multistep_geom_manager.h.
Referenced by AddPoint(), GetLastPoint(), and Reset().
|
private |
Definition at line 91 of file bezier_geom_manager.h.
Referenced by GetStart(), setEnd(), and setStart().
|
privateinherited |
The current manager step, from 0 to some highest number that depends on the manager.
Definition at line 186 of file multistep_geom_manager.h.
Referenced by getStep(), IsComplete(), IsReset(), performStep(), and Reset().