KiCad PCB EDA Suite
Loading...
Searching...
No Matches
MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT > Class Template Referenceabstract

Template base for SHAPE_DRAW_BEHAVIOR implementations that wrap a MULTISTEP_GEOM_MANAGER and an assistant. More...

#include <managed_draw_behavior.h>

Inheritance diagram for MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >:
SHAPE_DRAW_BEHAVIOR

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 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
 

Detailed Description

template<typename ManagerT, typename AssistantT>
class MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >

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.

Template Parameters
ManagerTthe geometry-manager type (e.g. ARC_GEOM_MANAGER).
AssistantTthe visual-assistant type (e.g. ARC_ASSISTANT).

Definition at line 41 of file managed_draw_behavior.h.

Constructor & Destructor Documentation

◆ MANAGED_DRAW_BEHAVIOR()

template<typename ManagerT, typename AssistantT>
MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::MANAGED_DRAW_BEHAVIOR ( const EDA_IU_SCALE & aIuScale,
EDA_UNITS aUnits )
inline

Definition at line 46 of file managed_draw_behavior.h.

References m_assistant, and m_manager.

Member Function Documentation

◆ AddPoint()

template<typename ManagerT, typename AssistantT>
void MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::AddPoint ( const VECTOR2I & aPosition)
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.

◆ ApplyToShape()

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

◆ ClearGeometryChanged()

template<typename ManagerT, typename AssistantT>
void MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::ClearGeometryChanged ( )
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.

◆ GetAssistant()

template<typename ManagerT, typename AssistantT>
AssistantT & MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::GetAssistant ( )
inlineoverridevirtual

Return the visual assistant overlay item.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 73 of file managed_draw_behavior.h.

References m_assistant.

◆ GetStep()

template<typename ManagerT, typename AssistantT>
int MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::GetStep ( ) const
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.

◆ HasGeometryChanged()

template<typename ManagerT, typename AssistantT>
bool MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::HasGeometryChanged ( ) const
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.

◆ IsComplete()

template<typename ManagerT, typename AssistantT>
bool MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::IsComplete ( ) const
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.

◆ OnProperties()

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

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()

template<typename ManagerT, typename AssistantT>
void MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::RemoveLastPoint ( )
inlineoverridevirtual

Undo the last locked-in point.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 69 of file managed_draw_behavior.h.

References m_manager.

◆ Reset()

template<typename ManagerT, typename AssistantT>
void MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::Reset ( )
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.

◆ SetAngleSnap()

virtual void SHAPE_DRAW_BEHAVIOR::SetAngleSnap ( bool aSnap)
inlinevirtualinherited

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()

template<typename ManagerT, typename AssistantT>
void MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::SetCursorPosition ( const VECTOR2I & aPosition)
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.

◆ SetUnits()

template<typename ManagerT, typename AssistantT>
void MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::SetUnits ( EDA_UNITS aUnits)
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.

◆ ToggleClockwise()

virtual void SHAPE_DRAW_BEHAVIOR::ToggleClockwise ( )
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 80 of file shape_draw_behavior.h.

Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().

Member Data Documentation

◆ m_assistant

template<typename ManagerT, typename AssistantT>
AssistantT MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::m_assistant
protected

Definition at line 78 of file managed_draw_behavior.h.

Referenced by GetAssistant(), MANAGED_DRAW_BEHAVIOR(), and SetUnits().

◆ m_manager

template<typename ManagerT, typename AssistantT>
ManagerT MANAGED_DRAW_BEHAVIOR< ManagerT, AssistantT >::m_manager
protected

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