|
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 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 41 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 >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
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.
Definition at line 91 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 >.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().
|
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 83 of file shape_draw_behavior.h.
Referenced by DRAWING_TOOL::drawManagedShape().
|
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().
|
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 80 of file shape_draw_behavior.h.
Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().