KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ARC_DRAW_BEHAVIOR Class Reference

Interactive arc drawing behaviour. More...

#include <arc_draw_behavior.h>

Inheritance diagram for ARC_DRAW_BEHAVIOR:
MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT > SHAPE_DRAW_BEHAVIOR

Public Member Functions

 ARC_DRAW_BEHAVIOR (const ARC_DRAW_BEHAVIOR &)=delete
 
ARC_DRAW_BEHAVIOR & operator= (const ARC_DRAW_BEHAVIOR &)=delete
 
void SetAngleSnap (bool aSnap) override
 Enable or disable angle snapping (circular arcs only; no-op for others).
 
void ToggleClockwise () override
 Flip arc direction (applies only when the shape has such a concept of directionality, e.g.
 
void SetArcDrawMode (ARC_DRAW_MODE aMode) override
 Select the construction sequence (circular arcs only; no-op for others).
 
void SetTangentSeed (const VECTOR2I &aStart, const VECTOR2D &aDirection, bool aDirectionIsAxis=false) override
 Preload the start point and departure direction for ARC_DRAW_MODE::TANGENT.
 
bool OnProperties (EDA_SHAPE &aShape) override
 Called when the user invokes the properties action mid-draw.
 
void ApplyToShape (EDA_SHAPE &aShape) const override
 Transfer the current geometry to an EDA_SHAPE.
 
 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.
 
KIGFX::PREVIEW::ARC_ASSISTANT & GetAssistant () override
 Return the visual assistant overlay item.
 
void SetUnits (EDA_UNITS aUnits) override
 Forward a units change to the assistant overlay.
 

Protected Attributes

KIGFX::PREVIEW::ARC_GEOM_MANAGER m_manager
 
KIGFX::PREVIEW::ARC_ASSISTANT m_assistant
 

Detailed Description

Interactive arc drawing behaviour.

The points to click depend on the arc draw mode, which defaults to center -> start -> end angle.

Definition at line 37 of file arc_draw_behavior.h.

Constructor & Destructor Documentation

◆ ARC_DRAW_BEHAVIOR()

ARC_DRAW_BEHAVIOR::ARC_DRAW_BEHAVIOR ( const ARC_DRAW_BEHAVIOR & )
delete

References ARC_DRAW_BEHAVIOR().

Referenced by ARC_DRAW_BEHAVIOR(), and operator=().

Member Function Documentation

◆ AddPoint()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::AddPoint ( const VECTOR2I & aP)
inlineoverridevirtualinherited

Lock in a point and advance the construction state.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 67 of file managed_draw_behavior.h.

◆ ApplyToShape()

◆ ClearGeometryChanged()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::ClearGeometryChanged ( )
inlineoverridevirtualinherited

Reset the geometry-changed flag (call after updating the preview).

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 58 of file managed_draw_behavior.h.

◆ GetAssistant()

Return the visual assistant overlay item.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 73 of file managed_draw_behavior.h.

◆ GetStep()

int MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::GetStep ( ) const
inlineoverridevirtualinherited

Return the current construction step (0-based, shape-specific meaning).

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 61 of file managed_draw_behavior.h.

◆ HasGeometryChanged()

bool MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::HasGeometryChanged ( ) const
inlineoverridevirtualinherited

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.

◆ IsComplete()

bool MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::IsComplete ( ) const
inlineoverridevirtualinherited

True when all points have been locked in.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 56 of file managed_draw_behavior.h.

◆ MANAGED_DRAW_BEHAVIOR()

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.

◆ OnProperties()

bool ARC_DRAW_BEHAVIOR::OnProperties ( EDA_SHAPE & aShape)
inlineoverridevirtual

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 from SHAPE_DRAW_BEHAVIOR.

Definition at line 55 of file arc_draw_behavior.h.

References ANGLE_90, ApplyToShape(), MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::m_manager, KIGFX::PREVIEW::ARC_GEOM_MANAGER::SECOND_POINT, EDA_SHAPE::SetArcAngleAndEnd(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::THIRD_POINT.

◆ operator=()

ARC_DRAW_BEHAVIOR & ARC_DRAW_BEHAVIOR::operator= ( const ARC_DRAW_BEHAVIOR & )
delete

References ARC_DRAW_BEHAVIOR().

◆ RemoveLastPoint()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::RemoveLastPoint ( )
inlineoverridevirtualinherited

Undo the last locked-in point.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 69 of file managed_draw_behavior.h.

◆ Reset()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::Reset ( )
inlineoverridevirtualinherited

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.

◆ SetAngleSnap()

void ARC_DRAW_BEHAVIOR::SetAngleSnap ( bool aSnap)
inlineoverridevirtual

Enable or disable angle snapping (circular arcs only; no-op for others).

Reimplemented from SHAPE_DRAW_BEHAVIOR.

Definition at line 45 of file arc_draw_behavior.h.

References MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::m_manager.

◆ SetArcDrawMode()

void ARC_DRAW_BEHAVIOR::SetArcDrawMode ( ARC_DRAW_MODE aMode)
inlineoverridevirtual

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 from SHAPE_DRAW_BEHAVIOR.

Definition at line 48 of file arc_draw_behavior.h.

References MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::m_manager.

◆ SetCursorPosition()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::SetCursorPosition ( const VECTOR2I & aP)
inlineoverridevirtualinherited

Preview the cursor position without advancing state.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 68 of file managed_draw_behavior.h.

◆ SetTangentSeed()

void ARC_DRAW_BEHAVIOR::SetTangentSeed ( const VECTOR2I & aStart,
const VECTOR2D & aDirection,
bool aDirectionIsAxis = false )
inlineoverridevirtual

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.

Parameters
aDirectionIsAxisfalse 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 from SHAPE_DRAW_BEHAVIOR.

Definition at line 50 of file arc_draw_behavior.h.

References MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::m_manager.

◆ SetUnits()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::SetUnits ( EDA_UNITS aUnits)
inlineoverridevirtualinherited

Forward a units change to the assistant overlay.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 74 of file managed_draw_behavior.h.

◆ ToggleClockwise()

void ARC_DRAW_BEHAVIOR::ToggleClockwise ( )
inlineoverridevirtual

Flip arc direction (applies only when the shape has such a concept of directionality, e.g.

circular arcs).

Reimplemented from SHAPE_DRAW_BEHAVIOR.

Definition at line 46 of file arc_draw_behavior.h.

References MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::ARC_GEOM_MANAGER, KIGFX::PREVIEW::ARC_ASSISTANT >::m_manager.

Member Data Documentation

◆ m_assistant

◆ m_manager


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