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

Interactive bezier drawing behaviour: start -> control1 -> end -> control2. More...

#include <bezier_draw_behavior.h>

Inheritance diagram for BEZIER_DRAW_BEHAVIOR:
MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT > SHAPE_DRAW_BEHAVIOR

Public Member Functions

 BEZIER_DRAW_BEHAVIOR (const BEZIER_DRAW_BEHAVIOR &)=delete
 
BEZIER_DRAW_BEHAVIOR & operator= (const BEZIER_DRAW_BEHAVIOR &)=delete
 
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::BEZIER_ASSISTANT & 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 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.
 

Protected Attributes

KIGFX::PREVIEW::BEZIER_GEOM_MANAGER m_manager
 
KIGFX::PREVIEW::BEZIER_ASSISTANT m_assistant
 

Detailed Description

Interactive bezier drawing behaviour: start -> control1 -> end -> control2.

Definition at line 34 of file bezier_draw_behavior.h.

Constructor & Destructor Documentation

◆ BEZIER_DRAW_BEHAVIOR()

BEZIER_DRAW_BEHAVIOR::BEZIER_DRAW_BEHAVIOR ( const BEZIER_DRAW_BEHAVIOR & )
delete

Member Function Documentation

◆ AddPoint()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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 BEZIER_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 43 of file bezier_draw_behavior.h.

References MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >::m_manager, and KIGFX::PREVIEW::BEZIER_GEOM_MANAGER::SET_START.

◆ operator=()

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

◆ RemoveLastPoint()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_ASSISTANT >::RemoveLastPoint ( )
inlineoverridevirtualinherited

Undo the last locked-in point.

Implements SHAPE_DRAW_BEHAVIOR.

Definition at line 69 of file managed_draw_behavior.h.

◆ Reset()

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

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 95 of file shape_draw_behavior.h.

Referenced by DRAWING_TOOL::drawManagedShape().

◆ SetArcDrawMode()

virtual void SHAPE_DRAW_BEHAVIOR::SetArcDrawMode ( ARC_DRAW_MODE aMode)
inlinevirtualinherited

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

◆ SetCursorPosition()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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()

virtual void SHAPE_DRAW_BEHAVIOR::SetTangentSeed ( const VECTOR2I & aStart,
const VECTOR2D & aDirection,
bool aDirectionIsAxis = false )
inlinevirtualinherited

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 in ARC_DRAW_BEHAVIOR.

Definition at line 116 of file shape_draw_behavior.h.

◆ SetUnits()

void MANAGED_DRAW_BEHAVIOR< KIGFX::PREVIEW::BEZIER_GEOM_MANAGER, KIGFX::PREVIEW::BEZIER_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()

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 92 of file shape_draw_behavior.h.

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

Member Data Documentation

◆ m_assistant

◆ m_manager


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