KiCad PCB EDA Suite
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER Class Reference

Represent a very simple geometry manager for items that have a start and end point. More...

#include <two_point_geom_manager.h>

Public Member Functions

void SetOrigin (const VECTOR2I &aOrigin)
 < Set the origin of the ruler (the fixed end) More...
 
VECTOR2I GetOrigin () const
 
void SetEnd (const VECTOR2I &aEnd)
 Set the current end of the rectangle (the end that moves with the cursor. More...
 
VECTOR2I GetEnd () const
 
void SetAngleSnap (bool aSnap)
 
bool GetAngleSnap () const
 
bool IsReset () const
 
void Reset ()
 Reset the manager to the initial state. More...
 
bool HasGeometryChanged () const
 
void ClearGeometryChanged ()
 Clear the geometry changed flag, call after the client code has updated everything as needed. More...
 

Protected Member Functions

void setGeometryChanged ()
 < Mark the geometry as changed for clients to notice More...
 

Private Attributes

VECTOR2I m_origin
 
VECTOR2I m_end
 
bool m_angleSnap = false
 Has the geometry changed such that a client should redraw? More...
 
bool m_changed = false
 
bool m_originSet = false
 

Detailed Description

Represent a very simple geometry manager for items that have a start and end point.

Definition at line 40 of file two_point_geom_manager.h.

Member Function Documentation

◆ ClearGeometryChanged()

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

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

Definition at line 117 of file two_point_geom_manager.h.

References m_changed.

◆ GetAngleSnap()

bool KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetAngleSnap ( ) const
inline

Definition at line 83 of file two_point_geom_manager.h.

84  {
85  return m_angleSnap;
86  }
bool m_angleSnap
Has the geometry changed such that a client should redraw?

References m_angleSnap.

◆ GetEnd()

◆ GetOrigin()

◆ HasGeometryChanged()

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

Definition at line 108 of file two_point_geom_manager.h.

References m_changed.

◆ IsReset()

bool KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::IsReset ( ) const
inline
Returns
true if the manager is in the initial state

Definition at line 91 of file two_point_geom_manager.h.

References m_originSet.

Referenced by updateSegmentFromGeometryMgr(), KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewBBox(), and KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewDraw().

◆ Reset()

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

Reset the manager to the initial state.

Definition at line 99 of file two_point_geom_manager.h.

100  {
101  m_originSet = false;
103  }
void setGeometryChanged()
< Mark the geometry as changed for clients to notice

References m_originSet, and setGeometryChanged().

Referenced by DRAWING_TOOL::drawSegment().

◆ SetAngleSnap()

void KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetAngleSnap ( bool  aSnap)
inline

Definition at line 78 of file two_point_geom_manager.h.

79  {
80  m_angleSnap = aSnap;
81  }
bool m_angleSnap
Has the geometry changed such that a client should redraw?

References m_angleSnap.

Referenced by MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), and PCB_VIEWER_TOOLS::MeasureTool().

◆ SetEnd()

void KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetEnd ( const VECTOR2I aEnd)
inline

Set the current end of the rectangle (the end that moves with the cursor.

Definition at line 60 of file two_point_geom_manager.h.

61  {
62  if( m_angleSnap )
63  {
65  }
66  else
67  {
68  m_end = aEnd;
69  }
71  }
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec, bool only45=false)
Snap a vector onto the nearest 0, 45 or 90 degree line.
bool m_angleSnap
Has the geometry changed such that a client should redraw?
void setGeometryChanged()
< Mark the geometry as changed for clients to notice

References GetVectorSnapped45(), m_angleSnap, m_end, m_origin, and setGeometryChanged().

Referenced by MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), and PCB_VIEWER_TOOLS::MeasureTool().

◆ setGeometryChanged()

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

< Mark the geometry as changed for clients to notice

Definition at line 124 of file two_point_geom_manager.h.

References m_changed.

Referenced by Reset(), SetEnd(), and SetOrigin().

◆ SetOrigin()

void KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetOrigin ( const VECTOR2I aOrigin)
inline

Member Data Documentation

◆ m_angleSnap

bool KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::m_angleSnap = false
private

Has the geometry changed such that a client should redraw?

Definition at line 132 of file two_point_geom_manager.h.

Referenced by GetAngleSnap(), SetAngleSnap(), and SetEnd().

◆ m_changed

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

◆ m_end

VECTOR2I KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::m_end
private

Definition at line 131 of file two_point_geom_manager.h.

Referenced by GetEnd(), and SetEnd().

◆ m_origin

VECTOR2I KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::m_origin
private

Definition at line 131 of file two_point_geom_manager.h.

Referenced by GetOrigin(), SetEnd(), and SetOrigin().

◆ m_originSet

bool KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::m_originSet = false
private

Definition at line 136 of file two_point_geom_manager.h.

Referenced by IsReset(), Reset(), and SetOrigin().


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