|
KiCad PCB EDA Suite
|
#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_TRACK * | FindSnapTrack (PCB_BASE_EDIT_FRAME *aFrame, const PCB_VIA *aVia, const VECTOR2I &aPosition, const LSET &aLayers, int aSnapRange) |
| PAD * | FindSnapPad (PCB_BASE_EDIT_FRAME *aFrame, const PCB_VIA *aVia, const VECTOR2I &aPosition, const LSET &aLayers, int aSnapRange) |
| static PCB_SHAPE * | FindSnapGraphic (PCB_BASE_EDIT_FRAME *aFrame, const PCB_VIA *aVia, const VECTOR2I &aPosition, const LSET &aLayers, int aSnapRange=0) |
Definition at line 99 of file drawing_tool.cpp.
|
static |
Definition at line 104 of file drawing_tool.cpp.
References COMMIT::Add(), CENTER, COINCIDENT, ConstraintIsDuplicateOnBoard(), END, end, PCB_DIMENSION_BASE::GetEnd(), PCB_DIMENSION_BASE::GetStart(), EDA_ITEM::m_Uuid, PCB_DIM_ALIGNED_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, pcbIUScale, POINT_ON_LINE, SelectEndpointBindings(), SelectRadialDimensionTarget(), START, EDA_ITEM::Type(), and WHOLE.
Referenced by DRAWING_TOOL::DrawDimension().
| bool CheckItemDRCViolation | ( | BOARD_CONNECTED_ITEM * | aItem, |
| PCB_BASE_EDIT_FRAME * | aFrame, | ||
| DRC_ENGINE * | aEngine, | ||
| int | aWorstClearance, | ||
| int | aEpsilon ) |
Definition at line 3960 of file drawing_tool.cpp.
References DISALLOW_CONSTRAINT, DRC_ENGINE::EvalRules(), EDA_ITEM::GetBoundingBox(), PCB_BASE_FRAME::GetCanvas(), ZONE::GetIsRuleArea(), DRC_CONSTRAINT::GetSeverity(), PCB_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), EDA_TEXT::IsVisible(), ItemHasDRCViolation(), DRC_CONSTRAINT::m_DisallowFlags, PCB_FIELD_T, PCB_FOOTPRINT_T, PCB_GROUP_T, PCB_TEXT_T, PCB_ZONE_T, KIGFX::VIEW::Query(), RPT_SEVERITY_IGNORE, EDA_ITEM::Type(), and UNDEFINED_LAYER.
Referenced by DRAWING_TOOL::DrawVia(), and DRAWING_TOOL::PlaceMicroviaStack().
| 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().
Definition at line 2666 of file drawing_tool.cpp.
References center, EDA_ANGLE::Cos(), EDA_SHAPE::GetEllipseCenter(), EDA_SHAPE::GetEllipseMajorRadius(), EDA_SHAPE::GetEllipseMinorRadius(), EDA_SHAPE::GetEllipseRotation(), KiROUND(), RADIANS_T, EDA_ANGLE::Sin(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DRAWING_TOOL::drawShape().
|
static |
Definition at line 4127 of file drawing_tool.cpp.
References LSET::AllCuMask(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetCanvas(), BOARD_ITEM::GetLayerSet(), PCB_DRAW_PANEL_GAL::GetView(), PCB_VIA::GetWidth(), PCB_SHAPE::HitTest(), PCB_SHAPE_T, KIGFX::VIEW::Query(), EDA_ITEM::Type(), and ViaSnapBoundingBox().
Referenced by DRAWING_TOOL::DrawVia().
| PAD * FindSnapPad | ( | PCB_BASE_EDIT_FRAME * | aFrame, |
| const PCB_VIA * | aVia, | ||
| const VECTOR2I & | aPosition, | ||
| const LSET & | aLayers, | ||
| int | aSnapRange ) |
Definition at line 4096 of file drawing_tool.cpp.
References PCB_BASE_FRAME::GetCanvas(), BOARD_ITEM::GetLayerSet(), PCB_DRAW_PANEL_GAL::GetView(), pad, PCB_PAD_T, KIGFX::VIEW::Query(), EDA_ITEM::Type(), and ViaSnapBoundingBox().
Referenced by DRAWING_TOOL::DrawVia(), and DRAWING_TOOL::PlaceMicroviaStack().
| PCB_TRACK * FindSnapTrack | ( | PCB_BASE_EDIT_FRAME * | aFrame, |
| const PCB_VIA * | aVia, | ||
| const VECTOR2I & | aPosition, | ||
| const LSET & | aLayers, | ||
| int | aSnapRange ) |
Definition at line 4033 of file drawing_tool.cpp.
References PCB_BASE_FRAME::GetCanvas(), PCB_TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetLayer(), BOARD_ITEM::GetLayerSet(), PCB_TRACK::GetStart(), PCB_DRAW_PANEL_GAL::GetView(), PCB_TRACK::GetWidth(), PCB_VIA::GetWidth(), PCB_ARC::HitTest(), PCB_ARC_T, PCB_TRACE_T, KIGFX::VIEW::Query(), TestSegmentHit(), EDA_ITEM::Type(), and ViaSnapBoundingBox().
Referenced by DRAWING_TOOL::DrawVia(), and DRAWING_TOOL::PlaceMicroviaStack().
|
static |
Definition at line 3865 of file drawing_tool.cpp.
References clearance, CLEARANCE_CONSTRAINT, SHAPE_POLY_SET::Collide(), DRC_ENGINE::EvalRules(), ZONE::GetBoardOutline(), ZONE::GetDoNotAllowTracks(), ZONE::GetDoNotAllowVias(), BOARD_ITEM::GetEffectiveHoleShape(), BOARD_ITEM::GetEffectiveShape(), ZONE::GetIsRuleArea(), BOARD_ITEM::GetLayerSet(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_ITEM::GetParentFootprint(), DRC_CONSTRAINT::GetValue(), BOARD_ITEM::HasHole(), HOLE_CLEARANCE_CONSTRAINT, IsCopperLayer(), MINOPTMAX< T >::Min(), ZONE::Outline(), PCB_REFERENCE_IMAGE_T, EDA_ITEM::Type(), UNDEFINED_LAYER, and via.
Referenced by CheckItemDRCViolation().
|
static |
Definition at line 192 of file drawing_tool.cpp.
References _, APPEND_UNDO, ApplyConstraintImmediately(), COMMIT::Empty(), COMMIT::Modify(), and BOARD_COMMIT::Push().
Referenced by DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawBezier(), DRAWING_TOOL::DrawEllipseArc(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::drawShape(), and DRAWING_TOOL::runSimpleShapeDraw().
|
static |
Definition at line 172 of file drawing_tool.cpp.
References COMMIT::Add(), and SelectShapeAutoConstraints().
Referenced by DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawBezier(), DRAWING_TOOL::DrawEllipseArc(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::drawShape(), and DRAWING_TOOL::runSimpleShapeDraw().
|
static |
Definition at line 2688 of file drawing_tool.cpp.
References std::abs(), ANGLE_0, ANGLE_360, ANGLE_90, center, ELLIPSE, ELLIPSE_ARC, end, KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetEnd(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::GetOrigin(), EDA_SHAPE::GetShape(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::IsReset(), PCB_SHAPE::SetEllipseCenter(), PCB_SHAPE::SetEllipseEndAngle(), PCB_SHAPE::SetEllipseMajorRadius(), PCB_SHAPE::SetEllipseMinorRadius(), PCB_SHAPE::SetEllipseRotation(), PCB_SHAPE::SetEllipseStartAngle(), PCB_SHAPE::SetEnd(), PCB_SHAPE::SetStart(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DRAWING_TOOL::drawShape().
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().
| 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().