KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drawing_tool.cpp File Reference
#include "drawing_tool.h"
#include "geometry/shape_rect.h"
#include "dialog_table_properties.h"
#include <set>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <pcbnew_settings.h>
#include <footprint_editor_settings.h>
#include <dialogs/dialog_barcode_properties.h>
#include <dialogs/dialog_text_properties.h>
#include <dialogs/dialog_track_via_size.h>
#include <gal/graphics_abstraction_layer.h>
#include <geometry/geometry_utils.h>
#include <geometry/shape_segment.h>
#include <import_gfx/dialog_import_graphics.h>
#include <preview_items/arc_assistant.h>
#include <preview_items/bezier_assistant.h>
#include <preview_items/two_point_assistant.h>
#include <preview_items/two_point_geom_manager.h>
#include <ratsnest/ratsnest_data.h>
#include <router/router_tool.h>
#include <status_popup.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_grid_helper.h>
#include <kiplatform/ui.h>
#include <tools/pcb_selection_tool.h>
#include <pcb_barcode.h>
#include <tools/tool_event_utils.h>
#include <tool/arc_draw_behavior.h>
#include <tool/bezier_draw_behavior.h>
#include <tool/ellipse_draw_behavior.h>
#include <tools/zone_create_helper.h>
#include <tools/zone_filler_tool.h>
#include <view/view.h>
#include <widgets/appearance_controls.h>
#include <widgets/wx_infobar.h>
#include <wildcards_and_files_ext.h>
#include <wx/filedlg.h>
#include <wx/msgdlg.h>
#include <bitmaps.h>
#include <board.h>
#include <board_commit.h>
#include <board_design_settings.h>
#include <drc/drc_engine.h>
#include <drc/drc_rule.h>
#include <confirm.h>
#include <footprint.h>
#include <macros.h>
#include <gal/painter.h>
#include <pad.h>
#include <pcb_edit_frame.h>
#include <pcb_group.h>
#include <pcb_point.h>
#include <pcb_reference_image.h>
#include <pcb_text.h>
#include <pcb_textbox.h>
#include <pcb_table.h>
#include <pcb_tablecell.h>
#include <pcb_track.h>
#include <pcb_dimension.h>
#include <pcb_grid_item.h>
#include <constraints/board_constraint_adapter.h>
#include <constraints/constraint_builder.h>
#include <constraints/pcb_constraint.h>
#include <pcbnew_id.h>
#include <scoped_set_reset.h>
#include <string_utils.h>
#include <zone.h>
#include <fix_board_shape.h>
#include <view/view_controls.h>

Go to the source code of this file.

Classes

class  VIA_SIZE_MENU
 
struct  POINT_PLACER
 

Typedefs

using SCOPED_DRAW_MODE = SCOPED_SET_RESET<DRAWING_TOOL::MODE>
 

Functions

static void bindDimensionEndpoints (BOARD *aBoard, PCB_DIMENSION_BASE *aDimension, BOARD_ITEM *aParent, BOARD_COMMIT &aCommit)
 
static std::vector< PCB_CONSTRAINT * > stageAutoConstraints (BOARD *aBoard, PCB_SHAPE *aShape, BOARD_ITEM *aParent, BOARD_COMMIT &aCommit, bool aAxisConstraint)
 
static void snapAutoConstraints (PCB_BASE_EDIT_FRAME *aFrame, BOARD *aBoard, const std::vector< PCB_CONSTRAINT * > &aConstraints)
 
static VECTOR2I evalEllipsePoint (const PCB_SHAPE *aGraphic, const VECTOR2I &aCursorPos)
 
static void updateSegmentFromGeometryMgr (const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER &aMgr, PCB_SHAPE *aGraphic)
 
int ComputeWorstViaClearance (PCB_BASE_EDIT_FRAME *aFrame, DRC_ENGINE *aEngine)
 Shared placement DRC checks, used by the plain via tool and the microvia stack tool so both block placement over foreign copper consistently.
 
static bool ItemHasDRCViolation (BOARD_CONNECTED_ITEM *aItem, BOARD_ITEM *aOther, DRC_ENGINE *aEngine, int aEpsilon)
 
bool CheckItemDRCViolation (BOARD_CONNECTED_ITEM *aItem, PCB_BASE_EDIT_FRAME *aFrame, DRC_ENGINE *aEngine, int aWorstClearance, int aEpsilon)
 
int ViaSnapRange (PCB_BASE_EDIT_FRAME *aFrame)
 Shared placement snapping, used by the plain via tool and the microvia stack tool.
 
static BOX2I ViaSnapBoundingBox (const PCB_VIA &aVia, const VECTOR2I &aPosition)
 Get the bounding box the via would have if placed at the given position (the via's bounding box is relative to its own position).
 
PCB_TRACKFindSnapTrack (PCB_BASE_EDIT_FRAME *aFrame, const PCB_VIA *aVia, const VECTOR2I &aPosition, const LSET &aLayers, int aSnapRange)
 
PADFindSnapPad (PCB_BASE_EDIT_FRAME *aFrame, const PCB_VIA *aVia, const VECTOR2I &aPosition, const LSET &aLayers, int aSnapRange)
 
static PCB_SHAPEFindSnapGraphic (PCB_BASE_EDIT_FRAME *aFrame, const PCB_VIA *aVia, const VECTOR2I &aPosition, const LSET &aLayers, int aSnapRange=0)
 

Typedef Documentation

◆ SCOPED_DRAW_MODE

Function Documentation

◆ bindDimensionEndpoints()

◆ CheckItemDRCViolation()

◆ ComputeWorstViaClearance()

int ComputeWorstViaClearance ( PCB_BASE_EDIT_FRAME * aFrame,
DRC_ENGINE * aEngine )

Shared placement DRC checks, used by the plain via tool and the microvia stack tool so both block placement over foreign copper consistently.

Definition at line 3829 of file drawing_tool.cpp.

References CLEARANCE_CONSTRAINT, BOARD::Footprints(), PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignRulesPath(), DRC_CONSTRAINT::GetValue(), HOLE_CLEARANCE_CONSTRAINT, DRC_ENGINE::InitEngine(), MINOPTMAX< T >::Min(), pad, and DRC_ENGINE::QueryWorstConstraint().

Referenced by DRAWING_TOOL::DrawVia(), and DRAWING_TOOL::PlaceMicroviaStack().

◆ evalEllipsePoint()

◆ FindSnapGraphic()

◆ FindSnapPad()

PAD * FindSnapPad ( PCB_BASE_EDIT_FRAME * aFrame,
const PCB_VIA * aVia,
const VECTOR2I & aPosition,
const LSET & aLayers,
int aSnapRange )

◆ FindSnapTrack()

◆ ItemHasDRCViolation()

◆ snapAutoConstraints()

◆ stageAutoConstraints()

static std::vector< PCB_CONSTRAINT * > stageAutoConstraints ( BOARD * aBoard,
PCB_SHAPE * aShape,
BOARD_ITEM * aParent,
BOARD_COMMIT & aCommit,
bool aAxisConstraint )
static

◆ updateSegmentFromGeometryMgr()

◆ ViaSnapBoundingBox()

static BOX2I ViaSnapBoundingBox ( const PCB_VIA & aVia,
const VECTOR2I & aPosition )
static

Get the bounding box the via would have if placed at the given position (the via's bounding box is relative to its own position).

Definition at line 4025 of file drawing_tool.cpp.

References PCB_VIA::GetBoundingBox(), PCB_VIA::GetPosition(), and BOX2< Vec >::Move().

Referenced by FindSnapGraphic(), FindSnapPad(), and FindSnapTrack().

◆ ViaSnapRange()

int ViaSnapRange ( PCB_BASE_EDIT_FRAME * aFrame)

Shared placement snapping, used by the plain via tool and the microvia stack tool.

aVia gives the reach and the bounding box to search, aLayers which layers may be snapped to, so a stack can offer every layer it spans rather than just the via's own.

Definition at line 4010 of file drawing_tool.cpp.

References PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetGAL(), PCB_DRAW_PANEL_GAL::GetView(), KIGFX::GAL::GetVisibleGridSize(), KiROUND(), scale, KIGFX::VIEW::ToWorld(), and VECTOR2< T >::x.

Referenced by DRAWING_TOOL::PlaceMicroviaStack().