KiCad PCB EDA Suite
Loading...
Searching...
No Matches
graphic_edit.cpp File Reference
#include <tools/graphic_edit.h>
#include <board_item.h>
#include <pcb_shape.h>
#include <cmath>

Go to the source code of this file.

Functions

const PCB_SHAPEGraphicEditShape (const EDA_ITEM *aItem)
 Any graphical shape a planner or a boundary search might use. Anything else gives null.
 
bool IsGraphicExtendSource (const PCB_SHAPE &aShape)
 Extend needs two ends to work with.
 
bool IsGraphicTrimSource (const PCB_SHAPE &aShape)
 Trim also takes the closed shapes, which it opens up.
 
const PCB_SHAPEGraphicEditSource (const BOARD_ITEM &aSource, bool(*aAccepts)(const PCB_SHAPE &), GRAPHIC_EDIT_RESULT &aResult)
 The shape to edit, or null with the reason in aResult. aAccepts decides the kinds.
 
const PCB_SHAPEGraphicEditBoundary (const BOARD_ITEM *aBoundary, const PCB_SHAPE &aSource)
 A boundary usable against aSource. Null if it is the source, off-layer or unusable.
 
SHAPE_ARC GraphicEditArc (const PCB_SHAPE &aShape)
 
bool IsGraphicEditArcUsable (const SHAPE_ARC &aArc)
 False for radii and sweeps the planners refuse. Check before planning an arc.
 
bool GraphicEditCoincident (const VECTOR2I &aA, const VECTOR2I &aB)
 Points built by different routes land a rounding step apart.
 

Function Documentation

◆ GraphicEditArc()

◆ GraphicEditBoundary()

const PCB_SHAPE * GraphicEditBoundary ( const BOARD_ITEM * aBoundary,
const PCB_SHAPE & aSource )

A boundary usable against aSource. Null if it is the source, off-layer or unusable.

Definition at line 79 of file graphic_edit.cpp.

References PCB_SHAPE::GetLayer(), and GraphicEditShape().

Referenced by GRAPHIC_EXTEND_PLANNER::Plan(), and GRAPHIC_TRIM_PLANNER::Plan().

◆ GraphicEditCoincident()

bool GraphicEditCoincident ( const VECTOR2I & aA,
const VECTOR2I & aB )

Points built by different routes land a rounding step apart.

Definition at line 105 of file graphic_edit.cpp.

References VECTOR2< T >::SquaredDistance().

Referenced by arcParameter(), and GRAPHIC_EXTEND_PLANNER::Plan().

◆ GraphicEditShape()

const PCB_SHAPE * GraphicEditShape ( const EDA_ITEM * aItem)

◆ GraphicEditSource()

const PCB_SHAPE * GraphicEditSource ( const BOARD_ITEM & aSource,
bool(* aAccepts )(const PCB_SHAPE &),
GRAPHIC_EDIT_RESULT & aResult )

The shape to edit, or null with the reason in aResult. aAccepts decides the kinds.

Definition at line 58 of file graphic_edit.cpp.

References GraphicEditShape(), BOARD_ITEM::IsLocked(), LOCKED_SOURCE, GRAPHIC_EDIT_RESULT::m_Refusal, and UNSUPPORTED_SOURCE.

Referenced by GRAPHIC_EXTEND_PLANNER::Plan(), and GRAPHIC_TRIM_PLANNER::Plan().

◆ IsGraphicEditArcUsable()

bool IsGraphicEditArcUsable ( const SHAPE_ARC & aArc)

False for radii and sweeps the planners refuse. Check before planning an arc.

Definition at line 96 of file graphic_edit.cpp.

References std::abs(), EDA_ANGLE::AsDegrees(), SHAPE_ARC::GetCentralAngle(), SHAPE_ARC::GetRadius(), GRAPHIC_EDIT_ANGLE_EPSILON, and MAX_GRAPHIC_EDIT_ARC_RADIUS.

Referenced by buildCarrier(), GRAPHIC_EXTEND_PLANNER::Plan(), and GRAPHIC_EXTEND_PLANNER::QueryBounds().

◆ IsGraphicExtendSource()

bool IsGraphicExtendSource ( const PCB_SHAPE & aShape)

Extend needs two ends to work with.

Definition at line 46 of file graphic_edit.cpp.

References ARC, EDA_SHAPE::GetShape(), and SEGMENT.

Referenced by GRAPHIC_EDIT_TOOL::Extend(), GRAPHIC_EXTEND_PLANNER::Plan(), and GRAPHIC_EXTEND_PLANNER::QueryBounds().

◆ IsGraphicTrimSource()

bool IsGraphicTrimSource ( const PCB_SHAPE & aShape)

Trim also takes the closed shapes, which it opens up.

Definition at line 52 of file graphic_edit.cpp.

References GraphicEditShape().

Referenced by GRAPHIC_TRIM_PLANNER::Plan(), and GRAPHIC_EDIT_TOOL::Trim().