KiCad PCB EDA Suite
drawing_tool.cpp File Reference

Go to the source code of this file.

Typedefs

using SCOPED_DRAW_MODE = SCOPED_SET_RESET< DRAWING_TOOL::MODE >
 

Functions

static void updateSegmentFromConstructionMgr (const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER &aMgr, DRAWSEGMENT *aGraphic)
 Update an DRAWSEGMENT from the current state of an Two POINT Geometry Manager. More...
 
static void updateArcFromConstructionMgr (const KIGFX::PREVIEW::ARC_GEOM_MANAGER &aMgr, DRAWSEGMENT &aArc)
 Update an arc DRAWSEGMENT from the current state of an Arc Geometry Manager. More...
 

Typedef Documentation

◆ SCOPED_DRAW_MODE

Function Documentation

◆ updateArcFromConstructionMgr()

static void updateArcFromConstructionMgr ( const KIGFX::PREVIEW::ARC_GEOM_MANAGER aMgr,
DRAWSEGMENT aArc 
)
static

Update an arc DRAWSEGMENT from the current state of an Arc Geometry Manager.

Definition at line 1250 of file drawing_tool.cpp.

1252 {
1253  auto vec = aMgr.GetOrigin();
1254 
1255  aArc.SetCenter( { vec.x, vec.y } );
1256 
1257  vec = aMgr.GetStartRadiusEnd();
1258  aArc.SetArcStart( { vec.x, vec.y } );
1259 
1260  aArc.SetAngle( RAD2DECIDEG( -aMgr.GetSubtended() ) );
1261 }
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
double RAD2DECIDEG(double rad)
Definition: trigo.h:219
VECTOR2I GetStartRadiusEnd() const
Get the coordinates of the arc start
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
double GetSubtended() const
Get the angle of the vector leading to the end point (valid if step >= SET_ANGLE)
VECTOR2I GetOrigin() const
Get the centre point of the arc (valid when state > SET_ORIGIN)
void SetAngle(double aAngle)
Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.

References KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetOrigin(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStartRadiusEnd(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetSubtended(), RAD2DECIDEG(), DRAWSEGMENT::SetAngle(), DRAWSEGMENT::SetArcStart(), and DRAWSEGMENT::SetCenter().

Referenced by DRAWING_TOOL::drawArc().

◆ updateSegmentFromConstructionMgr()

static void updateSegmentFromConstructionMgr ( const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER aMgr,
DRAWSEGMENT aGraphic 
)
static

Update an DRAWSEGMENT from the current state of an Two POINT Geometry Manager.

Definition at line 960 of file drawing_tool.cpp.

962 {
963  auto vec = aMgr.GetOrigin();
964 
965  aGraphic->SetStart( { vec.x, vec.y } );
966 
967  vec = aMgr.GetEnd();
968  aGraphic->SetEnd( { vec.x, vec.y } );
969 }
void SetStart(const wxPoint &aStart)
void SetEnd(const wxPoint &aEnd)

References KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetEnd(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetOrigin(), DRAWSEGMENT::SetEnd(), and DRAWSEGMENT::SetStart().

Referenced by DRAWING_TOOL::drawSegment().