KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER Class Referenceabstract

A geometry manager that works by accepting a sequence of points and advancing though stages of geometric construction with each point "locked in". More...

#include <multistep_geom_manager.h>

Inheritance diagram for KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER:
KIGFX::PREVIEW::ARC_GEOM_MANAGER KIGFX::PREVIEW::BEZIER_GEOM_MANAGER

Public Member Functions

virtual ~MULTISTEP_GEOM_MANAGER ()
 
void AddPoint (const VECTOR2I &aPt, bool aLockIn)
 Add a point to the construction manager.
 
void RemoveLastPoint ()
 Undo the last point, and move the manager back to the previous step.
 
bool IsReset () const
 
void Reset ()
 Reset the manager to the initial state.
 
bool IsComplete () const
 
VECTOR2I GetLastPoint () const
 Get the last point added (locked in or not).
 
bool HasGeometryChanged () const
 
void ClearGeometryChanged ()
 Clear the geometry changed flag, call after the client code has updated everything as needed.
 

Protected Member Functions

void setGeometryChanged ()
 < Mark the geometry as changed for clients to notice
 
int getStep () const
 

Private Member Functions

virtual bool acceptPoint (const VECTOR2I &aPt)=0
 < Function that accepts a point for a stage, or rejects it to return to the previous stage
 
virtual int getMaxStep () const =0
 The highest step this manager has - used to recognize completion and to clamp the step as it advances.
 
void performStep (bool aForward)
 Has the geometry changed such that a client should redraw?
 

Private Attributes

bool m_changed = false
 The last (raw) point added, which is usually the cursor position.
 
VECTOR2I m_lastPoint
 
int m_step = 0
 The current manager step, from 0 to some highest number that depends on the manager.
 

Detailed Description

A geometry manager that works by accepting a sequence of points and advancing though stages of geometric construction with each point "locked in".

For example, constructing an arc might go:

  • Set origin
  • Set start point
  • Set end point

The exact steps and how the points translate to geometry depends on the subclass.

Definition at line 47 of file multistep_geom_manager.h.

Constructor & Destructor Documentation

◆ ~MULTISTEP_GEOM_MANAGER()

virtual KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::~MULTISTEP_GEOM_MANAGER ( )
inlinevirtual

Definition at line 50 of file multistep_geom_manager.h.

Member Function Documentation

◆ acceptPoint()

virtual bool KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::acceptPoint ( const VECTOR2I aPt)
privatepure virtual

< Function that accepts a point for a stage, or rejects it to return to the previous stage

Implemented in KIGFX::PREVIEW::ARC_GEOM_MANAGER, and KIGFX::PREVIEW::BEZIER_GEOM_MANAGER.

Referenced by AddPoint(), and RemoveLastPoint().

◆ AddPoint()

void KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::AddPoint ( const VECTOR2I aPt,
bool  aLockIn 
)
inline

Add a point to the construction manager.

Parameters
aPtthe new point
aLockInwhether to "lock in" the point, and move the geometry manager to the next (or previous) step. False to update geometry and not affect manager state.

Definition at line 61 of file multistep_geom_manager.h.

References acceptPoint(), m_lastPoint, performStep(), and setGeometryChanged().

Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().

◆ ClearGeometryChanged()

void KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::ClearGeometryChanged ( )
inline

Clear the geometry changed flag, call after the client code has updated everything as needed.

Definition at line 137 of file multistep_geom_manager.h.

References m_changed.

◆ GetLastPoint()

VECTOR2I KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::GetLastPoint ( ) const
inline

Get the last point added (locked in or not).

This can* be useful when drawing previews, as the point given isn't always what gets locked into the geometry, if that step doesn't have full degrees of freedom.

Definition at line 120 of file multistep_geom_manager.h.

References m_lastPoint.

Referenced by RemoveLastPoint(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), and KIGFX::PREVIEW::BEZIER_ASSISTANT::ViewDraw().

◆ getMaxStep()

virtual int KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getMaxStep ( ) const
privatepure virtual

The highest step this manager has - used to recognize completion and to clamp the step as it advances.

Moves the manager forward or backward through the stages

Implemented in KIGFX::PREVIEW::ARC_GEOM_MANAGER, and KIGFX::PREVIEW::BEZIER_GEOM_MANAGER.

Referenced by IsComplete(), and performStep().

◆ getStep()

int KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::getStep ( ) const
inlineprotected

◆ HasGeometryChanged()

bool KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::HasGeometryChanged ( ) const
inline
Returns
true if the geometry has changed, eg such that a client should redraw.

Definition at line 128 of file multistep_geom_manager.h.

References m_changed.

Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().

◆ IsComplete()

bool KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::IsComplete ( ) const
inline
Returns
true if the manager reached the final state.

Definition at line 109 of file multistep_geom_manager.h.

References getMaxStep(), and m_step.

Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().

◆ IsReset()

bool KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::IsReset ( ) const
inline

◆ performStep()

void KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::performStep ( bool  aForward)
inlineprivate

Has the geometry changed such that a client should redraw?

Definition at line 169 of file multistep_geom_manager.h.

References getMaxStep(), and m_step.

Referenced by AddPoint(), and RemoveLastPoint().

◆ RemoveLastPoint()

void KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::RemoveLastPoint ( )
inline

Undo the last point, and move the manager back to the previous step.

Definition at line 79 of file multistep_geom_manager.h.

References acceptPoint(), GetLastPoint(), performStep(), and setGeometryChanged().

Referenced by DRAWING_TOOL::drawArc(), and DRAWING_TOOL::drawOneBezier().

◆ Reset()

void KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::Reset ( )
inline

Reset the manager to the initial state.

Definition at line 100 of file multistep_geom_manager.h.

References m_step, and setGeometryChanged().

◆ setGeometryChanged()

void KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::setGeometryChanged ( )
inlineprotected

< Mark the geometry as changed for clients to notice

Get the current stage of the manager

Definition at line 145 of file multistep_geom_manager.h.

References m_changed.

Referenced by AddPoint(), RemoveLastPoint(), Reset(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::SetClockwise(), and KIGFX::PREVIEW::ARC_GEOM_MANAGER::ToggleClockwise().

Member Data Documentation

◆ m_changed

bool KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_changed = false
private

The last (raw) point added, which is usually the cursor position.

Definition at line 178 of file multistep_geom_manager.h.

Referenced by ClearGeometryChanged(), HasGeometryChanged(), and setGeometryChanged().

◆ m_lastPoint

VECTOR2I KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_lastPoint
private

Definition at line 181 of file multistep_geom_manager.h.

Referenced by AddPoint(), and GetLastPoint().

◆ m_step

int KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::m_step = 0
private

The current manager step, from 0 to some highest number that depends on the manager.

Definition at line 186 of file multistep_geom_manager.h.

Referenced by getStep(), IsComplete(), IsReset(), performStep(), and Reset().


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