|
KiCad PCB EDA Suite
|
Manage the construction of an elliptical arc through sequential setting of critical points: two bounding-box corners (to define the ellipse), then start and end angles on the ellipse. More...
#include <ellipse_geom_manager.h>
Public Types | |
| enum | ELLIPSE_STEPS { SET_BBOX_C1 = 0 , SET_BBOX_C2 , SET_START_ANGLE , SET_END_ANGLE , COMPLETE } |
Public Member Functions | |
| ELLIPSE_GEOM_MANAGER () | |
| int | getMaxStep () const override |
| The highest step this manager has - used to recognize completion and to clamp the step as it advances. | |
| ELLIPSE_STEPS | GetStep () const |
| ELLIPSE< int > | GetEllipse () const |
| Get the ellipse defined by the current geometry (valid after SET_BBOX_C2). | |
| EDA_ANGLE | GetStartAngle () const |
| Get the end angle (valid after SET_END_ANGLE). Always > startAngle. | |
| EDA_ANGLE | GetEndAngle () const |
| Get the first bbox corner (valid after SET_BBOX_C1). | |
| VECTOR2I | GetBboxCorner1 () const |
| Get the second bbox corner (valid after SET_BBOX_C2). | |
| VECTOR2I | GetBboxCorner2 () 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 | |
| bool | acceptPoint (const VECTOR2I &aPt) override |
| < Function that accepts a point for a stage, or rejects it to return to the previous stage | |
| void | setGeometryChanged () |
| < Mark the geometry as changed for clients to notice | |
| int | getStep () const |
Private Member Functions | |
| bool | setBboxCorner1 (const VECTOR2I &aPt) |
| bool | setBboxCorner2 (const VECTOR2I &aPt) |
| bool | setStartAngle (const VECTOR2I &aPt) |
| bool | setEndAngle (const VECTOR2I &aPt) |
| void | performStep (bool aForward) |
| Has the geometry changed such that a client should redraw? | |
Private Attributes | |
| VECTOR2I | m_bboxC1 |
| VECTOR2I | m_bboxC2 |
| VECTOR2I | m_center |
| double | m_majorRadius = 1.0 |
| double | m_minorRadius = 1.0 |
| EDA_ANGLE | m_rotation = ANGLE_0 |
| EDA_ANGLE | m_startAngle = ANGLE_0 |
| EDA_ANGLE | m_endAngle = ANGLE_360 |
| 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 an elliptical arc through sequential setting of critical points: two bounding-box corners (to define the ellipse), then start and end angles on the ellipse.
The manager is driven by setting cursor points, which update the geometry and optionally advance the manager state.
Definition at line 40 of file ellipse_geom_manager.h.
Definition at line 45 of file ellipse_geom_manager.h.
|
inline |
Definition at line 43 of file ellipse_geom_manager.h.
|
overrideprotectedvirtual |
< 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 28 of file ellipse_geom_manager.cpp.
References COMPLETE, GetStep(), SET_BBOX_C1, SET_BBOX_C2, SET_END_ANGLE, SET_START_ANGLE, setBboxCorner1(), setBboxCorner2(), setEndAngle(), and setStartAngle().
|
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 133 of file multistep_geom_manager.h.
References m_changed.
|
inline |
Get the second bbox corner (valid after SET_BBOX_C2).
Definition at line 77 of file ellipse_geom_manager.h.
References m_bboxC1.
|
inline |
Definition at line 80 of file ellipse_geom_manager.h.
References m_bboxC2.
| ELLIPSE< int > ELLIPSE_GEOM_MANAGER::GetEllipse | ( | ) | const |
Get the ellipse defined by the current geometry (valid after SET_BBOX_C2).
Until the angles are set, the ellipse is considered to be a full ellipse. After the angles are set, the ellipse is considered to be an arc segment. Get the start angle (valid after SET_START_ANGLE).
Definition at line 112 of file ellipse_geom_manager.cpp.
References m_center, m_endAngle, m_majorRadius, m_minorRadius, m_rotation, and m_startAngle.
|
inline |
Get the first bbox corner (valid after SET_BBOX_C1).
Definition at line 74 of file ellipse_geom_manager.h.
References m_endAngle.
|
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 116 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 54 of file ellipse_geom_manager.h.
References COMPLETE.
|
inline |
Get the end angle (valid after SET_END_ANGLE). Always > startAngle.
Definition at line 71 of file ellipse_geom_manager.h.
References m_startAngle.
|
inline |
Definition at line 56 of file ellipse_geom_manager.h.
References KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getStep().
Referenced by acceptPoint().
|
inlineprotectedinherited |
Definition at line 147 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 124 of file multistep_geom_manager.h.
References m_changed.
|
inlineinherited |
Definition at line 105 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 165 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().
|
inlineinherited |
Reset the manager to the initial state.
Definition at line 96 of file multistep_geom_manager.h.
References m_step, and setGeometryChanged().
|
private |
Definition at line 45 of file ellipse_geom_manager.cpp.
References m_bboxC1, and m_bboxC2.
Referenced by acceptPoint().
|
private |
Definition at line 53 of file ellipse_geom_manager.cpp.
References std::abs(), ANGLE_0, ANGLE_360, ANGLE_90, center, m_bboxC1, m_bboxC2, m_center, m_endAngle, m_majorRadius, m_minorRadius, m_rotation, m_startAngle, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by acceptPoint().
|
private |
Definition at line 97 of file ellipse_geom_manager.cpp.
References ANGLE_360, ELLIPSE< NumericType >::GetAngleAtPoint(), m_center, m_endAngle, m_majorRadius, m_minorRadius, m_rotation, and m_startAngle.
Referenced by acceptPoint().
|
inlineprotectedinherited |
< Mark the geometry as changed for clients to notice
Get the current stage of the manager
Definition at line 141 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 |
Definition at line 86 of file ellipse_geom_manager.cpp.
References ANGLE_360, ELLIPSE< NumericType >::GetAngleAtPoint(), m_center, m_endAngle, m_majorRadius, m_minorRadius, m_rotation, and m_startAngle.
Referenced by acceptPoint().
|
private |
Definition at line 91 of file ellipse_geom_manager.h.
Referenced by GetBboxCorner1(), setBboxCorner1(), and setBboxCorner2().
|
private |
Definition at line 92 of file ellipse_geom_manager.h.
Referenced by GetBboxCorner2(), setBboxCorner1(), and setBboxCorner2().
|
private |
Definition at line 93 of file ellipse_geom_manager.h.
Referenced by GetEllipse(), setBboxCorner2(), setEndAngle(), and setStartAngle().
|
privateinherited |
The last (raw) point added, which is usually the cursor position.
Definition at line 174 of file multistep_geom_manager.h.
Referenced by ClearGeometryChanged(), HasGeometryChanged(), and setGeometryChanged().
Definition at line 98 of file ellipse_geom_manager.h.
Referenced by GetEllipse(), GetEndAngle(), setBboxCorner2(), setEndAngle(), and setStartAngle().
|
privateinherited |
Definition at line 177 of file multistep_geom_manager.h.
Referenced by AddPoint(), and GetLastPoint().
|
private |
Definition at line 94 of file ellipse_geom_manager.h.
Referenced by GetEllipse(), setBboxCorner2(), setEndAngle(), and setStartAngle().
|
private |
Definition at line 95 of file ellipse_geom_manager.h.
Referenced by GetEllipse(), setBboxCorner2(), setEndAngle(), and setStartAngle().
Definition at line 96 of file ellipse_geom_manager.h.
Referenced by GetEllipse(), setBboxCorner2(), setEndAngle(), and setStartAngle().
Definition at line 97 of file ellipse_geom_manager.h.
Referenced by GetEllipse(), GetStartAngle(), setBboxCorner2(), setEndAngle(), and setStartAngle().
|
privateinherited |
The current manager step, from 0 to some highest number that depends on the manager.
Definition at line 182 of file multistep_geom_manager.h.
Referenced by getStep(), IsComplete(), IsReset(), performStep(), and Reset().