KiCad PCB EDA Suite
Loading...
Searching...
No Matches
graphic_edit.h File Reference
#include <eda_shape.h>
#include <geometry/shape_arc.h>
#include <math/vector2d.h>
#include <limits>
#include <vector>

Go to the source code of this file.

Classes

struct  GRAPHIC_EDIT_GEOMETRY
 
struct  GRAPHIC_EDIT_RESULT
 

Enumerations

enum class  GRAPHIC_EDIT_REFUSAL {
  NONE , UNSUPPORTED_SOURCE , LOCKED_SOURCE , NO_INTERSECTION ,
  AMBIGUOUS , DEGENERATE
}
 Why a planner refused. Each one gets its own message. More...
 

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.
 

Variables

constexpr int MAX_GRAPHIC_EDIT_ARC_RADIUS = std::numeric_limits<int>::max() / 2
 Larger arcs overflow the boundary search box.
 
constexpr double GRAPHIC_EDIT_ANGLE_EPSILON = 1e-6
 Sweeps this near zero or a full turn are ambiguous.
 

Enumeration Type Documentation

◆ GRAPHIC_EDIT_REFUSAL

enum class GRAPHIC_EDIT_REFUSAL
strong

Why a planner refused. Each one gets its own message.

Enumerator
NONE 
UNSUPPORTED_SOURCE 
LOCKED_SOURCE 
NO_INTERSECTION 
AMBIGUOUS 
DEGENERATE 

Definition at line 41 of file graphic_edit.h.

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().

Variable Documentation

◆ GRAPHIC_EDIT_ANGLE_EPSILON

double GRAPHIC_EDIT_ANGLE_EPSILON = 1e-6
constexpr

Sweeps this near zero or a full turn are ambiguous.

Definition at line 38 of file graphic_edit.h.

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

◆ MAX_GRAPHIC_EDIT_ARC_RADIUS

int MAX_GRAPHIC_EDIT_ARC_RADIUS = std::numeric_limits<int>::max() / 2
constexpr

Larger arcs overflow the boundary search box.

Definition at line 35 of file graphic_edit.h.

Referenced by buildCarrier(), and IsGraphicEditArcUsable().