KiCad PCB EDA Suite
drawing_tool.cpp File Reference

Go to the source code of this file.

Classes

class  VIA_SIZE_MENU
 

Typedefs

using SCOPED_DRAW_MODE = SCOPED_SET_RESET< DRAWING_TOOL::MODE >
 

Functions

static void updateSegmentFromGeometryMgr (const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER &aMgr, PCB_SHAPE *aGraphic)
 Update a PCB_SHAPE from the current state of a #TWO_POINT_GEOMETRY_MANAGER. More...
 
static void updateArcFromConstructionMgr (const KIGFX::PREVIEW::ARC_GEOM_MANAGER &aMgr, PCB_SHAPE &aArc)
 Update an arc PCB_SHAPE 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,
PCB_SHAPE aArc 
)
static

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

Definition at line 1712 of file drawing_tool.cpp.

1714 {
1715  auto vec = aMgr.GetOrigin();
1716 
1717  aArc.SetCenter( { vec.x, vec.y } );
1718 
1719  vec = aMgr.GetStartRadiusEnd();
1720  aArc.SetArcStart( { vec.x, vec.y } );
1721 
1722  aArc.SetAngle( RAD2DECIDEG( -aMgr.GetSubtended() ) );
1723 
1724  vec = aMgr.GetEndRadiusEnd();
1725  aArc.SetArcEnd( { vec.x, vec.y } );
1726 }
VECTOR2I GetEndRadiusEnd() const
Get the radius of the arc (valid if step >= SET_START)
double RAD2DECIDEG(double rad)
Definition: trigo.h:234
VECTOR2I GetStartRadiusEnd() const
Get the coordinates of the arc end point.
VECTOR2I GetOrigin() const
< Get the center point of the arc (valid when state > SET_ORIGIN)
void SetCenter(const wxPoint &aCenterPoint)
Definition: pcb_shape.h:198
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
Definition: pcb_shape.h:193
virtual void SetAngle(double aAngle, bool aUpdateEnd=true)
Set the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: pcb_shape.cpp:519
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
Definition: pcb_shape.h:183

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

Referenced by DRAWING_TOOL::drawArc().

◆ updateSegmentFromGeometryMgr()

static void updateSegmentFromGeometryMgr ( const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER aMgr,
PCB_SHAPE aGraphic 
)
static

Update a PCB_SHAPE from the current state of a #TWO_POINT_GEOMETRY_MANAGER.

Definition at line 1380 of file drawing_tool.cpp.

1382 {
1383  if( !aMgr.IsReset() )
1384  {
1385  aGraphic->SetStart( (wxPoint) aMgr.GetOrigin() );
1386  aGraphic->SetEnd( (wxPoint) aMgr.GetEnd() );
1387  }
1388 }
void SetStart(const wxPoint &aStart)
Definition: pcb_shape.h:127
void SetEnd(const wxPoint &aEnd)
Definition: pcb_shape.h:137

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

Referenced by DRAWING_TOOL::drawSegment().