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

TWO_POINT_GEOMETRY_MANAGER. 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
 
bool m_changed = false
 

Has the gemotry changed such that a client should redraw?

More...
 
bool m_originSet = false
 

Detailed Description

TWO_POINT_GEOMETRY_MANAGER.

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

Definition at line 43 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 122 of file two_point_geom_manager.h.

123  {
124  m_changed = false;
125  }
bool m_changed
Has the gemotry changed such that a client should redraw?

References m_changed.

◆ GetAngleSnap()

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

Definition at line 87 of file two_point_geom_manager.h.

References m_angleSnap.

◆ GetEnd()

◆ GetOrigin()

◆ HasGeometryChanged()

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

Definition at line 113 of file two_point_geom_manager.h.

114  {
115  return m_changed;
116  }
bool m_changed
Has the gemotry changed such that a client should redraw?

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

References m_originSet.

Referenced by 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 103 of file two_point_geom_manager.h.

104  {
105  m_originSet = false;
107  }
void setGeometryChanged()
Mark the geometry as changed for clients to notice

References m_originSet, and setGeometryChanged().

◆ SetAngleSnap()

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

◆ 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 64 of file two_point_geom_manager.h.

65  {
66  if( m_angleSnap )
67  {
69  }
70  else
71  {
72  m_end = aEnd;
73  }
75  }
void setGeometryChanged()
Mark the geometry as changed for clients to notice
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec)
Snap a vector onto the nearest 0, 45 or 90 degree line.

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

Referenced by MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_VIEWER_TOOLS::MeasureTool(), and GERBVIEW_SELECTION_TOOL::MeasureTool().

◆ setGeometryChanged()

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

Mark the geometry as changed for clients to notice

Definition at line 129 of file two_point_geom_manager.h.

130  {
131  m_changed = true;
132  }
bool m_changed
Has the gemotry changed such that a client should redraw?

References m_changed.

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

◆ SetOrigin()

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

Set the origin of the ruler (the fixed end)

Definition at line 48 of file two_point_geom_manager.h.

49  {
50  m_origin = aOrigin;
51  m_originSet = true;
53  }
void setGeometryChanged()
Mark the geometry as changed for clients to notice

References m_origin, m_originSet, and setGeometryChanged().

Referenced by MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_VIEWER_TOOLS::MeasureTool(), and GERBVIEW_SELECTION_TOOL::MeasureTool().

Member Data Documentation

◆ m_angleSnap

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

Definition at line 137 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

Has the gemotry changed such that a client should redraw?

Definition at line 140 of file two_point_geom_manager.h.

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

◆ m_end

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

Definition at line 136 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 136 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 141 of file two_point_geom_manager.h.

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


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