|
KiCad PCB EDA Suite
|
Abstract interface for interactive shape-drawing behaviours. More...
#include <shape_draw_behavior.h>
Public Member Functions | |
| virtual | ~SHAPE_DRAW_BEHAVIOR ()=default |
| virtual bool | IsComplete () const =0 |
| True when all points have been locked in. | |
| virtual bool | HasGeometryChanged () const =0 |
| True if the geometry changed since the last call to ClearGeometryChanged(). | |
| virtual void | ClearGeometryChanged ()=0 |
| Reset the geometry-changed flag (call after updating the preview). | |
| virtual int | GetStep () const =0 |
| Return the current construction step (0-based, shape-specific meaning). | |
| virtual void | Reset ()=0 |
| Reset the behaviour to its initial state for chained object creation loops. | |
| virtual void | AddPoint (const VECTOR2I &aPosition)=0 |
| Lock in a point and advance the construction state. | |
| virtual void | SetCursorPosition (const VECTOR2I &aPosition)=0 |
| Preview the cursor position without advancing state. | |
| virtual void | RemoveLastPoint ()=0 |
| Undo the last locked-in point. | |
| 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. | |
| virtual EDA_ITEM & | GetAssistant ()=0 |
| Return the visual assistant overlay item. | |
| virtual void | SetUnits (EDA_UNITS aUnits)=0 |
| Forward a units change to the assistant overlay. | |
Abstract interface for interactive shape-drawing behaviours.
Concrete implementations wrap a geometry manager (for the construction state machine) and an assistant (for the visual overlay).
Callers drive the behaviour through this class and finally must use ApplyToShape() to transfer the geometry to an EDA_SHAPE.
The visual assistant (returned by GetAssistant()) must be added to a KIGFX::VIEW by the caller.
Definition at line 53 of file shape_draw_behavior.h.
|
virtualdefault |
|
pure virtual |
Lock in a point and advance the construction state.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
|
pure virtual |
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().
|
pure virtual |
Reset the geometry-changed flag (call after updating the preview).
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
pure virtual |
Return the visual assistant overlay item.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
pure virtual |
Return the current construction step (0-based, shape-specific meaning).
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
|
pure virtual |
True if the geometry changed since the last call to ClearGeometryChanged().
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
pure virtual |
True when all points have been locked in.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
inlinevirtual |
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().
|
pure virtual |
Undo the last locked-in point.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
|
pure virtual |
Reset the behaviour to its initial state for chained object creation loops.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
inlinevirtual |
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().
|
inlinevirtual |
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().
|
pure virtual |
Preview the cursor position without advancing state.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
inlinevirtual |
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.
|
pure virtual |
Forward a units change to the assistant overlay.
Implemented in MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >, MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >, and MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
inlinevirtual |
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().