KiCad PCB EDA Suite
drawing_tool.cpp File Reference
#include "drawing_tool.h"
#include "pcb_actions.h"
#include <pcb_edit_frame.h>
#include <project.h>
#include <id.h>
#include <confirm.h>
#include <import_gfx/dialog_import_gfx.h>
#include <view/view_controls.h>
#include <view/view.h>
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h>
#include <geometry/geometry_utils.h>
#include <ratsnest_data.h>
#include <board_commit.h>
#include <scoped_set_reset.h>
#include <bitmaps.h>
#include <painter.h>
#include <status_popup.h>
#include "grid_helper.h"
#include "point_editor.h"
#include <dialogs/dialog_text_properties.h>
#include <preview_items/arc_assistant.h>
#include <class_board.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <class_dimension.h>
#include <class_zone.h>
#include <class_module.h>
#include <tools/selection_tool.h>
#include <tools/tool_event_utils.h>
#include <tools/zone_create_helper.h>

Go to the source code of this file.

Typedefs

using SCOPED_DRAW_MODE = SCOPED_SET_RESET< DRAWING_TOOL::MODE >
 

Functions

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 1141 of file drawing_tool.cpp.

1143 {
1144  auto vec = aMgr.GetOrigin();
1145 
1146  aArc.SetCenter( { vec.x, vec.y } );
1147 
1148  vec = aMgr.GetStartRadiusEnd();
1149  aArc.SetArcStart( { vec.x, vec.y } );
1150 
1151  aArc.SetAngle( RAD2DECIDEG( -aMgr.GetSubtended() ) );
1152 }
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
double RAD2DECIDEG(double rad)
Definition: trigo.h:215
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().