37 std::unique_ptr<PCB_SHAPE> seg = std::make_unique<PCB_SHAPE>( &aFootprint, SHAPE_T::SEGMENT );
39 seg->SetStart( aSeg.
A );
40 seg->SetEnd( aSeg.
B );
43 seg->SetLayer( aLayer );
48 aFootprint.
Add( seg.release() );
55 for(
unsigned i = 0; i < aPts.size() - 1; ++i )
57 DrawSegment( aFootprint, { aPts[i], aPts[i + 1] }, aWidth, aLayer );
65 std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>( &aFootprint, SHAPE_T::ARC );
67 arc->SetCenter( aCentre );
68 arc->SetStart( aStart );
69 arc->SetArcAngleAndEnd( aAngle );
72 arc->SetLayer( aLayer );
77 aFootprint.
Add( arc.release() );
84 const auto x_r = aPos.
x + aSize.
x / 2;
85 const auto x_l = aPos.
x - aSize.
x / 2;
86 const auto y_t = aPos.
y + aSize.
y / 2;
87 const auto y_b = aPos.
y - aSize.
y / 2;
89 const auto xin_r = x_r - aRadius;
90 const auto xin_l = x_l + aRadius;
91 const auto yin_t = y_t - aRadius;
92 const auto yin_b = y_b + aRadius;
97 DrawSegment( aFootprint, { { xin_l, y_t }, { xin_r, y_t } }, aWidth, aLayer );
98 DrawSegment( aFootprint, { { xin_l, y_b }, { xin_r, y_b } }, aWidth, aLayer );
103 DrawSegment( aFootprint, { { x_l, yin_b }, { x_l, yin_t } }, aWidth, aLayer );
104 DrawSegment( aFootprint, { { x_r, yin_b }, { x_r, yin_t } }, aWidth, aLayer );
109 DrawArc( aFootprint, { xin_r, yin_t }, { x_r, yin_t },
ANGLE_90, aWidth, aLayer );
110 DrawArc( aFootprint, { xin_l, yin_t }, { xin_l, y_t },
ANGLE_90, aWidth, aLayer );
111 DrawArc( aFootprint, { xin_l, yin_b }, { x_l, yin_b },
ANGLE_90, aWidth, aLayer );
112 DrawArc( aFootprint, { xin_r, yin_b }, { xin_r, y_b },
ANGLE_90, aWidth, aLayer );
Construction utilities for PCB tests.
Simple container to manage line stroke parameters.
static constexpr EDA_ANGLE ANGLE_90
PCB_LAYER_ID
A quick note on layer IDs:
void DrawArc(FOOTPRINT &aFootprint, const VECTOR2I &aCentre, const VECTOR2I &aStart, const EDA_ANGLE &aAngle, int aWidth, PCB_LAYER_ID aLayer)
Draw an arc on a footprint.
void DrawSegment(FOOTPRINT &aFootprint, const SEG &aSeg, int aWidth, PCB_LAYER_ID aLayer)
Draw a segment in the given footprint.
void DrawRect(FOOTPRINT &aFootprint, const VECTOR2I &aPos, const VECTOR2I &aSize, int aRadius, int aWidth, PCB_LAYER_ID aLayer)
Draw a rectangle on a footprint.
void DrawPolyline(FOOTPRINT &aFootprint, const std::vector< VECTOR2I > &aPts, int aWidth, PCB_LAYER_ID aLayer)
Draw a polyline - a set of linked segments.