KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_dimension.cpp File Reference
#include <bitmaps.h>
#include <pcb_edit_frame.h>
#include <base_units.h>
#include <convert_basic_shapes_to_polygon.h>
#include <font/font.h>
#include <board.h>
#include <pcb_dimension.h>
#include <pcb_text.h>
#include <geometry/shape_compound.h>
#include <geometry/shape_circle.h>
#include <geometry/shape_segment.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
#include <trigo.h>

Go to the source code of this file.

Classes

struct  DIMENSION_DESC
 
struct  ALIGNED_DIMENSION_DESC
 
struct  ORTHOGONAL_DIMENSION_DESC
 
struct  RADIAL_DIMENSION_DESC
 
struct  LEADER_DIMENSION_DESC
 
struct  CENTER_DIMENSION_DESC
 

Functions

static OPT_VECTOR2I segPolyIntersection (const SHAPE_POLY_SET &aPoly, const SEG &aSeg, bool aStart=true)
 Find the intersection between a given segment and polygon outline.
 
static OPT_VECTOR2I segCircleIntersection (CIRCLE &aCircle, SEG &aSeg, bool aStart=true)
 
static void CollectKnockedOutSegments (const SHAPE_POLY_SET &aPoly, const SEG &aSeg, std::vector< std::shared_ptr< SHAPE > > &aSegmentsAfterKnockout)
 Knockout a polygon from a segment.
 

Variables

static const int INWARD_ARROW_LENGTH_TO_HEAD_RATIO = 2
 
static const EDA_ANGLE s_arrowAngle (27.5, DEGREES_T)
 
static struct DIMENSION_DESC _DIMENSION_DESC
 
static struct ALIGNED_DIMENSION_DESC ALIGNED_DIMENSION_DESC
 
static struct ORTHOGONAL_DIMENSION_DESC ORTHOGONAL_DIMENSION_DESC
 
static struct RADIAL_DIMENSION_DESC RADIAL_DIMENSION_DESC
 
static struct LEADER_DIMENSION_DESC LEADER_DIMENSION_DESC
 
static struct CENTER_DIMENSION_DESC CENTER_DIMENSION_DESC
 

Function Documentation

◆ CollectKnockedOutSegments()

static void CollectKnockedOutSegments ( const SHAPE_POLY_SET aPoly,
const SEG aSeg,
std::vector< std::shared_ptr< SHAPE > > &  aSegmentsAfterKnockout 
)
static

Knockout a polygon from a segment.

This function will add 0, 1 or 2 segments to the vector, depending on how the polygon intersects the segment.

Definition at line 110 of file pcb_dimension.cpp.

References SEG::A, SEG::B, SHAPE_POLY_SET::Contains(), and segPolyIntersection().

Referenced by PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), and PCB_DIM_RADIAL::updateGeometry().

◆ segCircleIntersection()

static OPT_VECTOR2I segCircleIntersection ( CIRCLE aCircle,
SEG aSeg,
bool  aStart = true 
)
static

Definition at line 82 of file pcb_dimension.cpp.

References SEG::A, SEG::B, CIRCLE::Contains(), and CIRCLE::Intersect().

Referenced by PCB_DIM_LEADER::updateGeometry().

◆ segPolyIntersection()

static OPT_VECTOR2I segPolyIntersection ( const SHAPE_POLY_SET aPoly,
const SEG aSeg,
bool  aStart = true 
)
static

Find the intersection between a given segment and polygon outline.

Parameters
aPolyis the polygon to collide.
aSegis the segment to collide.
aStartif true will start from aSeg.A, otherwise aSeg.B.
Returns
a point on aSeg that collides with aPoly closest to the start, if one exists.

Definition at line 56 of file pcb_dimension.cpp.

References SEG::A, SEG::B, SHAPE_POLY_SET::CIterateSegments(), and SHAPE_POLY_SET::Contains().

Referenced by CollectKnockedOutSegments(), and PCB_DIM_LEADER::updateGeometry().

Variable Documentation

◆ _DIMENSION_DESC

struct DIMENSION_DESC _DIMENSION_DESC
static

◆ ALIGNED_DIMENSION_DESC

◆ CENTER_DIMENSION_DESC

◆ INWARD_ARROW_LENGTH_TO_HEAD_RATIO

const int INWARD_ARROW_LENGTH_TO_HEAD_RATIO = 2
static

◆ LEADER_DIMENSION_DESC

◆ ORTHOGONAL_DIMENSION_DESC

◆ RADIAL_DIMENSION_DESC

◆ s_arrowAngle