KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SHAPE_DRAW_BEHAVIOR Class Referenceabstract

Abstract interface for interactive shape-drawing behaviours. More...

#include <shape_draw_behavior.h>

Inheritance diagram for SHAPE_DRAW_BEHAVIOR:
MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT > MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT > MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER, KIGFX::PREVIEW::ELLIPSE_ASSISTANT > MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT > ARC_DRAW_BEHAVIOR BEZIER_DRAW_BEHAVIOR ELLIPSE_ARC_DRAW_BEHAVIOR

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_ITEMGetAssistant ()=0
 Return the visual assistant overlay item.
 
virtual void SetUnits (EDA_UNITS aUnits)=0
 Forward a units change to the assistant overlay.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~SHAPE_DRAW_BEHAVIOR()

virtual SHAPE_DRAW_BEHAVIOR::~SHAPE_DRAW_BEHAVIOR ( )
virtualdefault

Member Function Documentation

◆ AddPoint()

◆ ApplyToShape()

virtual void SHAPE_DRAW_BEHAVIOR::ApplyToShape ( EDA_SHAPE & aShape) const
pure virtual

◆ ClearGeometryChanged()

◆ GetAssistant()

◆ GetStep()

◆ HasGeometryChanged()

◆ IsComplete()

◆ OnProperties()

virtual bool SHAPE_DRAW_BEHAVIOR::OnProperties ( EDA_SHAPE & aShape)
inlinevirtual

Called when the user invokes the properties action mid-draw.

Returns
true if the behavior handled the request (the event loop should continue); false if the event should be passed on.

Reimplemented in ARC_DRAW_BEHAVIOR.

Definition at line 91 of file shape_draw_behavior.h.

Referenced by DRAWING_TOOL::drawManagedShape().

◆ RemoveLastPoint()

◆ Reset()

◆ SetAngleSnap()

virtual void SHAPE_DRAW_BEHAVIOR::SetAngleSnap ( bool aSnap)
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().

◆ SetCursorPosition()

◆ SetUnits()

◆ ToggleClockwise()

virtual void SHAPE_DRAW_BEHAVIOR::ToggleClockwise ( )
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().


The documentation for this class was generated from the following file: