|
KiCad PCB EDA Suite
|
A geometry manager that works by accepting a sequence of points and advancing though stages of geometric construction with each point "locked in". More...
#include <multistep_geom_manager.h>
Public Member Functions | |
| virtual | ~MULTISTEP_GEOM_MANAGER () |
| 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 |
| Get the current stage of the manager. | |
Private Member Functions | |
| virtual bool | acceptPoint (const VECTOR2I &aPt)=0 |
| Function that accepts a point for a stage, or rejects it to return to the previous stage. | |
| virtual bool | rejectRegresses () const |
| virtual int | getMaxStep () const =0 |
| The highest step this manager has - used to recognize completion and to clamp the step as it advances. | |
| void | performStep (bool aForward) |
| Moves the manager forward or backward through the stages. | |
Private Attributes | |
| bool | m_changed = false |
| Has the geometry changed such that a client should redraw? | |
| VECTOR2I | m_lastPoint |
| The last (raw) point added, which is usually the cursor position. | |
| int | m_step = 0 |
| The current manager step, from 0 to some highest number that depends on the manager. | |
A geometry manager that works by accepting a sequence of points and advancing though stages of geometric construction with each point "locked in".
For example, constructing an arc might go:
The exact steps and how the points translate to geometry depends on the subclass.
Definition at line 43 of file multistep_geom_manager.h.
|
inlinevirtual |
Definition at line 46 of file multistep_geom_manager.h.
|
privatepure virtual |
Function that accepts a point for a stage, or rejects it to return to the previous stage.
Implemented in KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, and KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER.
Referenced by AddPoint(), and RemoveLastPoint().
|
inline |
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(), rejectRegresses(), and setGeometryChanged().
Referenced by KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetMode().
|
inline |
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.
|
inline |
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(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetMode(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::ToggleClockwise().
|
privatepure virtual |
The highest step this manager has - used to recognize completion and to clamp the step as it advances.
Implemented in KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, and KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER.
Referenced by IsComplete(), and performStep().
|
inlineprotected |
Get the current stage of the manager.
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::GetPointIndex(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStep(), KIGFX::PREVIEW::BEZIER_GEOM_MANAGER::GetStep(), KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER::GetStep(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::ToggleClockwise().
|
inline |
Definition at line 128 of file multistep_geom_manager.h.
References m_changed.
|
inline |
Definition at line 109 of file multistep_geom_manager.h.
References getMaxStep(), and m_step.
Referenced by KIGFX::PREVIEW::ARC_GEOM_MANAGER::acceptExactPoint(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStep().
|
inline |
Definition at line 88 of file multistep_geom_manager.h.
References m_step.
Referenced by KIGFX::PREVIEW::ARC_GEOM_MANAGER::HasPreview(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetMode(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetTangentSeed().
|
inlineprivate |
Moves the manager forward or backward through the stages.
Definition at line 175 of file multistep_geom_manager.h.
References getMaxStep(), and m_step.
Referenced by AddPoint(), and RemoveLastPoint().
|
inlineprivatevirtual |
Reimplemented in KIGFX::PREVIEW::ARC_GEOM_MANAGER.
Definition at line 166 of file multistep_geom_manager.h.
Referenced by AddPoint().
|
inline |
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().
|
inlinevirtual |
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().
|
inlineprotected |
Mark the geometry as changed for clients to notice.
Definition at line 145 of file multistep_geom_manager.h.
References m_changed.
Referenced by AddPoint(), RemoveLastPoint(), Reset(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetMode(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetTangentSeed(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::ToggleClockwise().
|
private |
Has the geometry changed such that a client should redraw?
Definition at line 184 of file multistep_geom_manager.h.
Referenced by ClearGeometryChanged(), HasGeometryChanged(), and setGeometryChanged().
|
private |
The last (raw) point added, which is usually the cursor position.
Definition at line 187 of file multistep_geom_manager.h.
Referenced by AddPoint(), GetLastPoint(), and Reset().
|
private |
The current manager step, from 0 to some highest number that depends on the manager.
Definition at line 192 of file multistep_geom_manager.h.
Referenced by getStep(), IsComplete(), IsReset(), performStep(), and Reset().