KiCad PCB EDA Suite
sch_shape.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <sch_draw_panel.h>
26#include <macros.h>
27#include <plotters/plotter.h>
28#include <base_units.h>
29#include <widgets/msgpanel.h>
30#include <bitmaps.h>
31#include <eda_draw_frame.h>
32#include <general.h>
33#include <schematic.h>
34#include <sch_shape.h>
35#include "plotters/plotter.h"
36
37
38SCH_SHAPE::SCH_SHAPE( SHAPE_T aShape, int aLineWidth, FILL_T aFillType, KICAD_T aType ) :
39 SCH_ITEM( nullptr, aType ),
40 EDA_SHAPE( aShape, aLineWidth, aFillType )
41{
43}
44
45
47{
48 return new SCH_SHAPE( *this );
49}
50
51
53{
54 SCH_SHAPE* shape = static_cast<SCH_SHAPE*>( aItem );
55
56 EDA_SHAPE::SwapShape( shape );
57 std::swap( m_layer, shape->m_layer );
58}
59
60
61void SCH_SHAPE::SetStroke( const STROKE_PARAMS& aStroke )
62{
63 m_stroke = aStroke;
64}
65
66
67void SCH_SHAPE::Move( const VECTOR2I& aOffset )
68{
69 move( aOffset );
70}
71
72
74{
75 if( GetShape() == SHAPE_T::RECT )
76 {
77 VECTOR2I size = GetEnd() - GetPosition();
78
79 if( size.y < 0 )
80 {
81 SetStartY( GetStartY() + size.y );
82 SetEndY( GetStartY() - size.y );
83 }
84
85 if( size.x < 0 )
86 {
87 SetStartX( GetStartX() + size.x );
88 SetEndX( GetStartX() - size.x );
89 }
90 }
91}
92
93
95{
96 flip( VECTOR2I( aCenter, 0 ), true );
97}
98
99
101{
102 flip( VECTOR2I( 0, aCenter ), false );
103}
104
105
106void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
107{
108 rotate( aCenter, -ANGLE_90 );
109}
110
111
112void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
113{
114 int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
115
116 static std::vector<VECTOR2I> cornerList;
117
118 if( GetShape() == SHAPE_T::POLY )
119 {
120 cornerList.clear();
121
122 for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
123 cornerList.push_back( pt );
124 }
125
126 if( aBackground )
127 {
128 if( !aPlotter->GetColorMode() )
129 return;
130
131 if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED )
132 {
133 if( GetFillColor() != COLOR4D::UNSPECIFIED )
134 aPlotter->SetColor( GetFillColor() );
135 else
136 aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) );
137
138 switch( GetShape() )
139 {
140 case SHAPE_T::ARC:
141 {
142 // In some plotters (not all) the arc is approximated by segments, and
143 // a error max is needed. We try to approximate by 360/5 segments by 360 deg
144 int arc2segment_error = CircleToEndSegmentDeltaRadius( GetRadius(), 360/5 );
145 aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, arc2segment_error );
146 }
147
148 break;
149
150 case SHAPE_T::CIRCLE:
151 aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
152 break;
153
154 case SHAPE_T::RECT:
155 aPlotter->Rect( GetStart(), GetEnd(), m_fill, 0 );
156 break;
157
158 case SHAPE_T::POLY:
159 aPlotter->PlotPoly( cornerList, m_fill, 0 );
160 break;
161
162 case SHAPE_T::BEZIER:
163 aPlotter->PlotPoly( m_bezierPoints, m_fill, 0 );
164 break;
165
166 default:
168 }
169 }
170 }
171 else /* if( aForeground ) */
172 {
173 if( aPlotter->GetColorMode() && GetStroke().GetColor() != COLOR4D::UNSPECIFIED )
174 aPlotter->SetColor( GetStroke().GetColor() );
175 else
176 aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) );
177
178 aPlotter->SetCurrentLineWidth( pen_size );
179 aPlotter->SetDash( pen_size, GetEffectiveLineStyle() );
180
181 switch( GetShape() )
182 {
183 case SHAPE_T::ARC:
184 {
185 // In some plotters (not all) the arc is approximated by segments, and
186 // a error max is needed. We try to approximate by 360/5 segments by 360 deg
187 int arc2segment_error = CircleToEndSegmentDeltaRadius( GetRadius(), 360/5 );
188 aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size, arc2segment_error );
189 }
190
191 break;
192
193 case SHAPE_T::CIRCLE:
194 aPlotter->Circle( getCenter(), GetRadius() * 2, FILL_T::NO_FILL, pen_size );
195 break;
196
197 case SHAPE_T::RECT:
198 {
199 std::vector<VECTOR2I> pts = GetRectCorners();
200
201 aPlotter->MoveTo( pts[0] );
202 aPlotter->LineTo( pts[1] );
203 aPlotter->LineTo( pts[2] );
204 aPlotter->LineTo( pts[3] );
205 aPlotter->FinishTo( pts[0] );
206 }
207 break;
208
209 case SHAPE_T::POLY:
210 aPlotter->PlotPoly( cornerList, FILL_T::NO_FILL, pen_size );
211 break;
212
213 case SHAPE_T::BEZIER:
214 aPlotter->PlotPoly( m_bezierPoints, FILL_T::NO_FILL, pen_size );
215 break;
216
217 default:
219 }
220
221 aPlotter->SetDash( pen_size, PLOT_DASH_TYPE::SOLID );
222 }
223}
224
225
227{
228 if( m_stroke.GetWidth() > 0 )
229 return m_stroke.GetWidth();
230
231 // Historically 0 meant "default width" and negative numbers meant "don't stroke".
232 if( GetWidth() < 0 )
233 return 0;
234
235 SCHEMATIC* schematic = Schematic();
236
237 if( schematic )
238 return schematic->Settings().m_DefaultLineWidth;
239
241}
242
243
244void SCH_SHAPE::PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
245{
246 wxDC* DC = aSettings->GetPrintDC();
248
249 unsigned ptCount = 0;
250 VECTOR2I* buffer = nullptr;
251
252 if( GetShape() == SHAPE_T::POLY )
253 {
254 SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
255
256 ptCount = poly.GetPointCount();
257 buffer = new VECTOR2I[ptCount];
258
259 for( unsigned ii = 0; ii < ptCount; ++ii )
260 buffer[ii] = poly.CPoint( ii );
261 }
262 else if( GetShape() == SHAPE_T::BEZIER )
263 {
264 ptCount = m_bezierPoints.size();
265 buffer = new VECTOR2I[ptCount];
266
267 for( size_t ii = 0; ii < ptCount; ++ii )
268 buffer[ii] = m_bezierPoints[ii];
269 }
270
272 {
273 if( GetFillColor() == COLOR4D::UNSPECIFIED )
274 color = aSettings->GetLayerColor( LAYER_NOTES );
275 else
277
278 switch( GetShape() )
279 {
280 case SHAPE_T::ARC:
281 GRFilledArc( DC, GetEnd(), GetStart(), getCenter(), 0, color, color );
282 break;
283
284 case SHAPE_T::CIRCLE:
286 break;
287
288 case SHAPE_T::RECT:
289 GRFilledRect( DC, GetStart(), GetEnd(), 0, color, color );
290 break;
291
292 case SHAPE_T::POLY:
293 GRPoly( DC, ptCount, buffer, true, 0, color, color );
294 break;
295
296 case SHAPE_T::BEZIER:
297 GRPoly( DC, ptCount, buffer, true, 0, color, color );
298 break;
299
300 default:
302 }
303 }
304
305 delete[] buffer;
306
307}
308
309
310void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
311{
312 int penWidth = GetPenWidth();
313 wxDC* DC = aSettings->GetPrintDC();
315
316 if( color == COLOR4D::UNSPECIFIED )
317 color = aSettings->GetLayerColor( LAYER_NOTES );
318
319 COLOR4D bg = aSettings->GetBackgroundColor();
320
321 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
322 bg = COLOR4D::WHITE;
323
324 unsigned ptCount = 0;
325 VECTOR2I* buffer = nullptr;
326
327 if( GetShape() == SHAPE_T::POLY )
328 {
329 SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
330
331 ptCount = poly.GetPointCount();
332 buffer = new VECTOR2I[ptCount];
333
334 for( unsigned ii = 0; ii < ptCount; ++ii )
335 buffer[ii] = poly.CPoint( ii );
336 }
337 else if( GetShape() == SHAPE_T::BEZIER )
338 {
339 ptCount = m_bezierPoints.size();
340 buffer = new VECTOR2I[ptCount];
341
342 for( size_t ii = 0; ii < ptCount; ++ii )
343 buffer[ii] = m_bezierPoints[ii];
344 }
345
346 COLOR4D fillColor = COLOR4D::UNSPECIFIED;
347
349 fillColor = color;
351 fillColor = GetFillColor();
352
353 if( fillColor != COLOR4D::UNSPECIFIED )
354 {
355 switch( GetShape() )
356 {
357 case SHAPE_T::ARC:
358 GRFilledArc( DC, GetEnd(), GetStart(), getCenter(), 0, fillColor, fillColor );
359 break;
360
361 case SHAPE_T::CIRCLE:
362 GRFilledCircle( DC, GetStart(), GetRadius(), 0, fillColor, fillColor );
363 break;
364
365 case SHAPE_T::RECT:
366 GRFilledRect( DC, GetStart(), GetEnd(), 0, fillColor, fillColor );
367 break;
368
369 case SHAPE_T::POLY:
370 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
371 break;
372
373 case SHAPE_T::BEZIER:
374 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
375 break;
376
377 default:
379 }
380 }
381 else
382 {
383 penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
384 }
385
386 if( penWidth > 0 )
387 {
389 {
390 switch( GetShape() )
391 {
392 case SHAPE_T::ARC:
393 GRArc( DC, GetEnd(), GetStart(), getCenter(), penWidth, color );
394 break;
395
396 case SHAPE_T::CIRCLE:
397 GRCircle( DC, GetStart(), GetRadius(), penWidth, color );
398 break;
399
400 case SHAPE_T::RECT:
401 GRRect( DC, GetStart(), GetEnd(), penWidth, color );
402 break;
403
404 case SHAPE_T::POLY:
405 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
406 break;
407
408 case SHAPE_T::BEZIER:
409 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
410 break;
411
412 default:
414 }
415 }
416 else
417 {
418 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
419
420 for( SHAPE* shape : shapes )
421 {
422 STROKE_PARAMS::Stroke( shape, GetEffectiveLineStyle(), penWidth, aSettings,
423 [&]( const VECTOR2I& a, const VECTOR2I& b )
424 {
425 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
426 } );
427 }
428
429 for( SHAPE* shape : shapes )
430 delete shape;
431 }
432 }
433
434 delete[] buffer;
435}
436
437
438void SCH_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
439{
440 SCH_ITEM::GetMsgPanelInfo( aFrame, aList );
441
442 ShapeGetMsgPanelInfo( aFrame, aList );
443}
444
445
446wxString SCH_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
447{
448 switch( GetShape() )
449 {
450 case SHAPE_T::ARC:
451 return wxString::Format( _( "Arc, radius %s" ),
452 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
453
454 case SHAPE_T::CIRCLE:
455 return wxString::Format( _( "Circle, radius %s" ),
456 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
457
458 case SHAPE_T::RECT:
459 return wxString::Format( _( "Rectangle, width %s height %s" ),
460 aUnitsProvider->MessageTextFromValue( std::abs( m_start.x - m_end.x ) ),
461 aUnitsProvider->MessageTextFromValue( std::abs( m_start.y - m_end.y ) ) );
462
463 case SHAPE_T::POLY:
464 return wxString::Format( _( "Polyline, %d points" ),
465 int( m_poly.Outline( 0 ).GetPointCount() ) );
466
467 case SHAPE_T::BEZIER:
468 return wxString::Format( _( "Bezier Curve, %d points" ),
469 int( m_bezierPoints.size() ) );
470
471 default:
473 return wxEmptyString;
474 }
475}
476
477
479{
480 switch( GetShape() )
481 {
483 case SHAPE_T::ARC: return BITMAPS::add_arc;
487
488 default:
491 }
492}
493
494
495void SCH_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
496{
497 aCount = 3;
498 aLayers[0] = LAYER_NOTES;
499 aLayers[1] = LAYER_NOTES_BACKGROUND;
500 aLayers[2] = LAYER_SELECTION_SHADOWS;
501}
502
503
504void SCH_SHAPE::AddPoint( const VECTOR2I& aPosition )
505{
506 if( GetShape() == SHAPE_T::POLY )
507 {
508 if( m_poly.IsEmpty() )
510
511 m_poly.Outline( 0 ).Append( aPosition, true );
512 }
513 else
514 {
516 }
517}
518
519
int color
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
@ question_mark
@ add_rectangle
@ add_graphical_segments
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: eda_item.h:209
void SetStartX(int x)
Definition: eda_shape.h:136
void move(const VECTOR2I &aMoveVector)
Definition: eda_shape.cpp:173
VECTOR2I getCenter() const
Definition: eda_shape.cpp:444
int GetStartY() const
Definition: eda_shape.h:121
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Definition: eda_shape.cpp:263
void flip(const VECTOR2I &aCentre, bool aFlipLeftRight)
Definition: eda_shape.cpp:320
FILL_T GetFillMode() const
Definition: eda_shape.h:101
void SetEndY(int y)
Definition: eda_shape.h:155
void SetStartY(int y)
Definition: eda_shape.h:130
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:289
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: eda_shape.cpp:626
int GetRadius() const
Definition: eda_shape.cpp:523
SHAPE_T GetShape() const
Definition: eda_shape.h:113
void SetEndX(int x)
Definition: eda_shape.h:161
VECTOR2I m_start
Definition: eda_shape.h:369
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
COLOR4D GetFillColor() const
Definition: eda_shape.h:105
void SwapShape(EDA_SHAPE *aImage)
Definition: eda_shape.cpp:1485
std::vector< VECTOR2I > GetRectCorners() const
Definition: eda_shape.cpp:1035
std::vector< VECTOR2I > m_bezierPoints
Definition: eda_shape.h:378
int GetWidth() const
Definition: eda_shape.h:109
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:75
int GetStartX() const
Definition: eda_shape.h:122
VECTOR2I m_end
Definition: eda_shape.h:370
SHAPE_POLY_SET m_poly
Definition: eda_shape.h:379
STROKE_PARAMS m_stroke
Definition: eda_shape.h:365
FILL_T m_fill
Definition: eda_shape.h:366
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
wxDC * GetPrintDC() const
Base plotter engine class.
Definition: plotter.h:110
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
virtual void Circle(const VECTOR2I &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
virtual void Arc(const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aEnd, FILL_T aFill, int aWidth, int aMaxError)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:149
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
bool GetColorMode() const
Definition: plotter.h:138
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
void LineTo(const VECTOR2I &pos)
Definition: plotter.h:252
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
virtual void Rect(const VECTOR2I &p1, const VECTOR2I &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
virtual void SetColor(const COLOR4D &color)=0
Holds all the data relating to one schematic.
Definition: schematic.h:61
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
Definition: sch_item.h:253
SCH_LAYER_ID m_layer
Definition: sch_item.h:491
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: sch_shape.h:67
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_shape.cpp:446
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_shape.cpp:495
SCH_SHAPE(SHAPE_T aShape, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, KICAD_T aType=SCH_SHAPE_T)
Definition: sch_shape.cpp:38
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_shape.cpp:94
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
Definition: sch_shape.cpp:67
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_shape.cpp:46
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: sch_shape.cpp:61
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_shape.cpp:52
void Normalize()
Definition: sch_shape.cpp:73
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_shape.cpp:100
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: sch_shape.cpp:438
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_shape.cpp:106
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_shape.cpp:112
void AddPoint(const VECTOR2I &aPosition)
Definition: sch_shape.cpp:504
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_shape.cpp:478
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print the (optional) backaground elements if they exist.
Definition: sch_shape.cpp:244
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a schematic item.
Definition: sch_shape.cpp:310
int GetPenWidth() const override
Definition: sch_shape.cpp:226
STROKE_PARAMS GetStroke() const override
Definition: sch_shape.h:64
VECTOR2I GetPosition() const override
Definition: sch_shape.h:77
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual size_t GetPointCount() const override
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const std::vector< VECTOR2I > & CPoints() const
bool IsEmpty() const
SHAPE_LINE_CHAIN & Outline(int aIndex)
int NewOutline()
Creates a new hole in a given outline.
An abstract shape on 2D plane.
Definition: shape.h:124
Simple container to manage line stroke parameters.
Definition: stroke_params.h:88
int GetWidth() const
Definition: stroke_params.h:98
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
KIGFX::COLOR4D GetColor() const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
@ WHITE
Definition: color4d.h:46
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _(s)
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:431
SHAPE_T
Definition: eda_shape.h:41
FILL_T
Definition: eda_shape.h:54
@ FILLED_WITH_COLOR
@ FILLED_SHAPE
int CircleToEndSegmentDeltaRadius(int aInnerCircleRadius, int aSegCount)
void GRRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:396
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:357
void GRFilledArc(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Definition: gr_basic.cpp:387
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:171
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:403
void GRArc(wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:378
void GRPoly(wxDC *DC, int n, const VECTOR2I *Points, bool Fill, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Draw a new polyline and fill it if Fill, in drawing space.
Definition: gr_basic.cpp:341
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:165
void GRFilledCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aStrokeColor, const COLOR4D &aFillColor)
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y).
Definition: gr_basic.cpp:369
@ LAYER_NOTES
Definition: layer_ids.h:358
@ LAYER_NOTES_BACKGROUND
Definition: layer_ids.h:360
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:120
Message panel definition file.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590