|
KiCad PCB EDA Suite
|
Template base for SHAPE_DRAW_BEHAVIOR implementations that wrap a MULTISTEP_GEOM_MANAGER and an assistant. More...
#include <managed_draw_behavior.h>
Public Member Functions | |
| MANAGED_DRAW_BEHAVIOR (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits) | |
| bool | IsComplete () const override |
| True when all points have been locked in. | |
| bool | HasGeometryChanged () const override |
| True if the geometry changed since the last call to ClearGeometryChanged(). | |
| void | ClearGeometryChanged () override |
| Reset the geometry-changed flag (call after updating the preview). | |
| void | Reset () override |
| Reset the behaviour to its initial state for chained object creation loops. | |
| int | GetStep () const override |
| Return the current construction step (0-based, shape-specific meaning). | |
| void | AddPoint (const VECTOR2I &aP) override |
| Lock in a point and advance the construction state. | |
| void | SetCursorPosition (const VECTOR2I &aP) override |
| Preview the cursor position without advancing state. | |
| void | RemoveLastPoint () override |
| Undo the last locked-in point. | |
| AssistantT & | GetAssistant () override |
| Return the visual assistant overlay item. | |
| void | SetUnits (EDA_UNITS aUnits) override |
| Forward a units change to the assistant overlay. | |
| virtual void | ToggleClockwise () |
| Flip arc direction (applies only when the shape has such a concept of directionality, e.g. | |
| virtual void | SetAngleSnap (bool aSnap) |
| Enable or disable angle snapping (circular arcs only; no-op for others). | |
| virtual void | SetArcDrawMode (ARC_DRAW_MODE aMode) |
| Select the construction sequence (circular arcs only; no-op for others). | |
| virtual void | SetTangentSeed (const VECTOR2I &aStart, const VECTOR2D &aDirection, bool aDirectionIsAxis=false) |
| Preload the start point and departure direction for ARC_DRAW_MODE::TANGENT. | |
| virtual bool | OnProperties (EDA_SHAPE &aShape) |
| Called when the user invokes the properties action mid-draw. | |
| virtual void | ApplyToShape (EDA_SHAPE &aShape) const =0 |
| Transfer the current geometry to an EDA_SHAPE. | |
Protected Attributes | |
| ManagerT | m_manager |
| AssistantT | m_assistant |
Template base for SHAPE_DRAW_BEHAVIOR implementations that wrap a MULTISTEP_GEOM_MANAGER and an assistant.
Provides the standard pass-through methods (IsStarted, AddPoint, etc.) so that concrete classes only need to supply ApplyToShape() and any shape-specific geometry accessors.
| ManagerT | the geometry-manager type (e.g. ARC_GEOM_MANAGER). |
| AssistantT | the visual-assistant type (e.g. ARC_ASSISTANT). |
Definition at line 41 of file managed_draw_behavior.h.
|
inline |
Definition at line 46 of file managed_draw_behavior.h.
References m_assistant, and m_manager.
|
inlineoverridevirtual |
Lock in a point and advance the construction state.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 67 of file managed_draw_behavior.h.
References m_manager.
|
pure virtualinherited |
Transfer the current geometry to an EDA_SHAPE.
Implemented in ARC_DRAW_BEHAVIOR, BEZIER_DRAW_BEHAVIOR, and ELLIPSE_ARC_DRAW_BEHAVIOR.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
inlineoverridevirtual |
Reset the geometry-changed flag (call after updating the preview).
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 58 of file managed_draw_behavior.h.
References m_manager.
|
inlineoverridevirtual |
Return the visual assistant overlay item.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 73 of file managed_draw_behavior.h.
References m_assistant.
|
inlineoverridevirtual |
Return the current construction step (0-based, shape-specific meaning).
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 61 of file managed_draw_behavior.h.
References m_manager.
|
inlineoverridevirtual |
True if the geometry changed since the last call to ClearGeometryChanged().
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 57 of file managed_draw_behavior.h.
References m_manager.
|
inlineoverridevirtual |
True when all points have been locked in.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 56 of file managed_draw_behavior.h.
References m_manager.
|
inlinevirtualinherited |
Called when the user invokes the properties action mid-draw.
Reimplemented in ARC_DRAW_BEHAVIOR, BEZIER_DRAW_BEHAVIOR, and ELLIPSE_ARC_DRAW_BEHAVIOR.
Definition at line 125 of file shape_draw_behavior.h.
Referenced by DRAWING_TOOL::drawManagedShape().
|
inlineoverridevirtual |
Undo the last locked-in point.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 69 of file managed_draw_behavior.h.
References m_manager.
|
inlineoverridevirtual |
Reset the behaviour to its initial state for chained object creation loops.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 59 of file managed_draw_behavior.h.
References m_manager.
|
inlinevirtualinherited |
Enable or disable angle snapping (circular arcs only; no-op for others).
Reimplemented in ARC_DRAW_BEHAVIOR.
Definition at line 95 of file shape_draw_behavior.h.
Referenced by DRAWING_TOOL::drawManagedShape().
|
inlinevirtualinherited |
Select the construction sequence (circular arcs only; no-op for others).
Switching mid-draw keeps the first locked point when it is an arc start in both modes, which is every mode except CENTER_START_END; otherwise construction restarts.
Reimplemented in ARC_DRAW_BEHAVIOR.
Definition at line 103 of file shape_draw_behavior.h.
Referenced by StartArcDrawMode().
|
inlineoverridevirtual |
Preview the cursor position without advancing state.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 68 of file managed_draw_behavior.h.
References m_manager.
|
inlinevirtualinherited |
Preload the start point and departure direction for ARC_DRAW_MODE::TANGENT.
Reset() clears the seed, so call this after Reset() and before the first AddPoint(). Without a seed, TANGENT takes its start and direction from clicks exactly like START_DIR_END.
| aDirectionIsAxis | false when aDirection is the signed departure direction (continuing from an endpoint); true when only the tangent line is known (starting inside an item), in which case the sign giving the smaller sweep to the cursor is used and ToggleClockwise() flips it. |
Reimplemented in ARC_DRAW_BEHAVIOR.
Definition at line 116 of file shape_draw_behavior.h.
|
inlineoverridevirtual |
Forward a units change to the assistant overlay.
Implements SHAPE_DRAW_BEHAVIOR.
Definition at line 74 of file managed_draw_behavior.h.
References m_assistant.
|
inlinevirtualinherited |
Flip arc direction (applies only when the shape has such a concept of directionality, e.g.
circular arcs).
Reimplemented in ARC_DRAW_BEHAVIOR.
Definition at line 92 of file shape_draw_behavior.h.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
protected |
Definition at line 78 of file managed_draw_behavior.h.
Referenced by GetAssistant(), MANAGED_DRAW_BEHAVIOR(), and SetUnits().
|
protected |
Definition at line 77 of file managed_draw_behavior.h.
Referenced by AddPoint(), ClearGeometryChanged(), GetStep(), HasGeometryChanged(), IsComplete(), MANAGED_DRAW_BEHAVIOR(), RemoveLastPoint(), Reset(), and SetCursorPosition().