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 |
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 44 of file bezier_geom_manager.h.
Definition at line 49 of file bezier_geom_manager.h.
|
inline |
Definition at line 47 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 29 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 61 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::acceptPoint(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_lastPoint, KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::performStep(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::setGeometryChanged().
Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().
|
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 KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_changed.
VECTOR2I BEZIER_GEOM_MANAGER::GetControlC1 | ( | ) | const |
Definition at line 49 of file bezier_geom_manager.cpp.
References m_controlC1.
Referenced by updateBezierFromConstructionMgr(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
VECTOR2I BEZIER_GEOM_MANAGER::GetControlC2 | ( | ) | const |
Get the coordinates of the arc end point.
Definition at line 59 of file bezier_geom_manager.cpp.
References m_controlC2, and m_end.
Referenced by updateBezierFromConstructionMgr(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
VECTOR2I BEZIER_GEOM_MANAGER::GetEnd | ( | ) | const |
Definition at line 54 of file bezier_geom_manager.cpp.
References m_end.
Referenced by updateBezierFromConstructionMgr(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
|
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 KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_lastPoint.
Referenced by KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::RemoveLastPoint(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
|
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 58 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 44 of file bezier_geom_manager.cpp.
References m_start.
Referenced by updateBezierFromConstructionMgr(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
|
inline |
Get the current step the manager is on (useful when drawing something depends on the current state)
Definition at line 64 of file bezier_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getStep().
Referenced by DRAWING_TOOL::drawOneBezier(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
|
inlineprotectedinherited |
Definition at line 151 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_step.
Referenced by KIGFX::PREVIEW::ARC_GEOM_MANAGER::acceptPoint(), acceptPoint(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStep(), and GetStep().
|
inlineinherited |
Definition at line 128 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_changed.
Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().
|
inlineinherited |
Definition at line 109 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getMaxStep(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_step.
Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().
|
inlineinherited |
Definition at line 92 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_step.
Referenced by KIGFX::PREVIEW::ARC_ASSISTANT::ViewBBox(), KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewBBox(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().
|
inlineprivateinherited |
Has the geometry changed such that a client should redraw?
Definition at line 169 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getMaxStep(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_step.
Referenced by KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::AddPoint(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::RemoveLastPoint().
|
inlineinherited |
Undo the last point, and move the manager back to the previous step.
Definition at line 79 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::acceptPoint(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::GetLastPoint(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::performStep(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::setGeometryChanged().
Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().
|
inlineinherited |
Reset the manager to the initial state.
Definition at line 100 of file multistep_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_step, and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::setGeometryChanged().
|
private |
Definition at line 77 of file bezier_geom_manager.cpp.
References m_controlC1, m_controlC2, and m_end.
Referenced by acceptPoint().
|
private |
Definition at line 93 of file bezier_geom_manager.cpp.
References m_controlC2.
Referenced by acceptPoint().
|
private |
Definition at line 86 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 KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_changed.
Referenced by KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::AddPoint(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::RemoveLastPoint(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::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 KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::ClearGeometryChanged(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::HasGeometryChanged(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::setGeometryChanged().
|
private |
Definition at line 97 of file bezier_geom_manager.h.
Referenced by GetControlC1(), setControlC1(), and setStart().
|
private |
Definition at line 99 of file bezier_geom_manager.h.
Referenced by GetControlC2(), setControlC1(), setControlC2(), setEnd(), and setStart().
|
private |
Definition at line 98 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 KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::AddPoint(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::GetLastPoint().
|
private |
Definition at line 96 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 KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getStep(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::IsComplete(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::IsReset(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::performStep(), and KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::Reset().