KiCad PCB EDA Suite
lib_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 <plotters/plotter.h>
27#include <macros.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 <lib_shape.h>
34#include "plotters/plotter.h"
35
36
37LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth, FILL_T aFillType,
38 KICAD_T aType ) :
39 LIB_ITEM( aType, aParent ),
40 EDA_SHAPE( aShape, aLineWidth, aFillType )
41{
42 m_editState = 0;
43}
44
45
46bool LIB_SHAPE::HitTest( const VECTOR2I& aPosRef, int aAccuracy ) const
47{
50
51 return hitTest( DefaultTransform.TransformCoordinate( aPosRef ), aAccuracy );
52}
53
54
55bool LIB_SHAPE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
56{
58 return false;
59
60 return hitTest( DefaultTransform.TransformCoordinate( aRect ), aContained, aAccuracy );
61}
62
63
65{
66 return new LIB_SHAPE( *this );
67}
68
69
70int LIB_SHAPE::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
71{
72 int retv = LIB_ITEM::compare( aOther, aCompareFlags );
73
74 if( retv )
75 return retv;
76
77 return EDA_SHAPE::Compare( &static_cast<const LIB_SHAPE&>( aOther ) );
78}
79
80
81void LIB_SHAPE::Offset( const VECTOR2I& aOffset )
82{
83 move( aOffset );
84}
85
86
87void LIB_SHAPE::MoveTo( const VECTOR2I& aPosition )
88{
89 setPosition( aPosition );
90}
91
92
94{
95 if( GetShape() == SHAPE_T::RECT )
96 {
97 VECTOR2I size = GetEnd() - GetPosition();
98
99 if( size.y > 0 )
100 {
101 SetStartY( GetStartY() + size.y );
102 SetEndY( GetStartY() - size.y );
103 }
104
105 if( size.x < 0 )
106 {
107 SetStartX( GetStartX() + size.x );
108 SetEndX( GetStartX() - size.x );
109 }
110 }
111}
112
113
115{
116 flip( aCenter, true );
117}
118
119
121{
122 flip( aCenter, false );
123}
124
125
126void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
127{
128 EDA_ANGLE rot_angle = aRotateCCW ? -ANGLE_90 : ANGLE_90;
129
130 rotate( aCenter, rot_angle );
131}
132
133
134void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffset,
135 const TRANSFORM& aTransform, bool aDimmed ) const
136{
137 if( IsPrivate() )
138 return;
139
140 VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
141 VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
142 VECTOR2I center = aTransform.TransformCoordinate( getCenter() ) + aOffset;
143
144 static std::vector<VECTOR2I> cornerList;
145
146 if( GetShape() == SHAPE_T::POLY )
147 {
148 const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
149 cornerList.clear();
150
151 for( const VECTOR2I& pt : poly.CPoints() )
152 cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
153 }
154 else if( GetShape() == SHAPE_T::BEZIER )
155 {
156 cornerList.clear();
157
158 for( const VECTOR2I& pt : m_bezierPoints )
159 cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
160 }
161 else if( GetShape() == SHAPE_T::ARC )
162 {
163 EDA_ANGLE t1, t2;
164
165 CalcArcAngles( t1, t2 );
166
167 // N.B. The order of evaluation is critical here as MapAngles will modify t1, t2
168 // and the Normalize routine depends on these modifications for the correct output
169 bool transformed = aTransform.MapAngles( &t1, &t2 );
170 EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180();
171 bool transformed2 = ( arc_angle > ANGLE_0 ) && ( arc_angle < ANGLE_180 );
172
173 if( transformed != transformed2 )
174 std::swap( start, end );
175 }
176
177 int penWidth;
179 PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
180 FILL_T fill = m_fill;
181
182 if( aBackground )
183 {
184 if( !aPlotter->GetColorMode() )
185 return;
186
187 switch( m_fill )
188 {
190 return;
191
194 break;
195
198 break;
199
200 default:
201 return;
202 }
203
204 penWidth = 0;
205 lineStyle = PLOT_DASH_TYPE::SOLID;
206 }
207 else
208 {
209 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
211
212 if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
213 lineStyle = PLOT_DASH_TYPE::SOLID;
214
216 fill = m_fill;
217 else
218 fill = FILL_T::NO_FILL;
219
220 penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
221 }
222
223 COLOR4D bg = aPlotter->RenderSettings()->GetBackgroundColor();
224
225 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
226 bg = COLOR4D::WHITE;
227
228 if( aDimmed )
229 {
230 color.Desaturate( );
231 color = color.Mix( bg, 0.5f );
232 }
233
234 aPlotter->SetColor( color );
235 aPlotter->SetDash( penWidth, lineStyle );
236
237 switch( GetShape() )
238 {
239 case SHAPE_T::ARC:
240 {
241 // In some plotters (not all) the arc is approximated by segments, and
242 // a error max is needed. We try to approximate by 360/5 segments by 360 deg
243 int arc2segment_error = CircleToEndSegmentDeltaRadius( GetRadius(), 360/5 );
244 aPlotter->Arc( center, start, end, fill, penWidth, arc2segment_error );
245 }
246 break;
247
248 case SHAPE_T::CIRCLE:
249 aPlotter->Circle( center, GetRadius() * 2, fill, penWidth );
250 break;
251
252 case SHAPE_T::RECT:
253 aPlotter->Rect( start, end, fill, penWidth );
254 break;
255
256 case SHAPE_T::POLY:
257 case SHAPE_T::BEZIER:
258 aPlotter->PlotPoly( cornerList, fill, penWidth );
259 break;
260
261 default:
263 }
264
265 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
266}
267
268
270{
271 return GetWidth();
272}
273
274
275void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
276 const TRANSFORM& aTransform, bool aDimmed )
277{
278 if( IsPrivate() )
279 return;
280
281 bool forceNoFill = static_cast<bool>( aData );
282 int penWidth = GetEffectivePenWidth( aSettings );
283
284 if( forceNoFill && IsFilled() && penWidth == 0 )
285 return;
286
287 wxDC* DC = aSettings->GetPrintDC();
288 VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
289 VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
290 VECTOR2I c;
292
293 if( color == COLOR4D::UNSPECIFIED )
294 color = aSettings->GetLayerColor( LAYER_DEVICE );
295
296 COLOR4D bg = aSettings->GetBackgroundColor();
297
298 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
299 bg = COLOR4D::WHITE;
300
301 if( aDimmed )
302 {
303 color.Desaturate( );
304 color = color.Mix( bg, 0.5f );
305 }
306
307 unsigned ptCount = 0;
308 VECTOR2I* buffer = nullptr;
309
310 if( GetShape() == SHAPE_T::POLY )
311 {
312 const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
313
314 ptCount = poly.GetPointCount();
315 buffer = new VECTOR2I[ptCount];
316
317 for( unsigned ii = 0; ii < ptCount; ++ii )
318 buffer[ii] = aTransform.TransformCoordinate( poly.CPoint( ii ) ) + aOffset;
319 }
320 else if( GetShape() == SHAPE_T::BEZIER )
321 {
322 ptCount = m_bezierPoints.size();
323 buffer = new VECTOR2I[ptCount];
324
325 for( size_t ii = 0; ii < ptCount; ++ii )
326 buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset;
327 }
328 else if( GetShape() == SHAPE_T::ARC )
329 {
330 c = aTransform.TransformCoordinate( getCenter() ) + aOffset;
331
332 EDA_ANGLE t1, t2;
333
334 CalcArcAngles( t1, t2 );
335
336 // N.B. The order of evaluation is critical here as MapAngles will modify t1, t2
337 // and the Normalize routine depends on these modifications for the correct output
338 bool transformed = aTransform.MapAngles( &t1, &t2 );
339 EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180();
340 bool transformed2 = ( arc_angle > ANGLE_0 ) && ( arc_angle < ANGLE_180 );
341
342 if( transformed == transformed2 )
343 std::swap( pt1, pt2 );
344 }
345
346 COLOR4D fillColor = COLOR4D::UNSPECIFIED;
347
348 if( !forceNoFill )
349 {
351 fillColor = color;
353 fillColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
355 fillColor = GetFillColor();
356 }
357
358 if( fillColor != COLOR4D::UNSPECIFIED )
359 {
360 if( aDimmed )
361 {
362 fillColor.Desaturate( );
363 fillColor = fillColor.Mix( bg, 0.5f );
364 }
365
366 switch( GetShape() )
367 {
368 case SHAPE_T::ARC:
369 GRFilledArc( DC, pt1, pt2, c, 0, fillColor, fillColor );
370 break;
371
372 case SHAPE_T::CIRCLE:
373 GRFilledCircle( DC, pt1, GetRadius(), 0, fillColor, fillColor );
374 break;
375
376 case SHAPE_T::RECT:
377 GRFilledRect( DC, pt1, pt2, 0, fillColor, fillColor );
378 break;
379
380 case SHAPE_T::POLY:
381 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
382 break;
383
384 case SHAPE_T::BEZIER:
385 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
386 break;
387
388 default:
390 }
391 }
392 else
393 {
394 penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
395 }
396
397 if( penWidth > 0 )
398 {
400 {
401 switch( GetShape() )
402 {
403 case SHAPE_T::ARC:
404 GRArc( DC, pt1, pt2, c, penWidth, color );
405 break;
406
407 case SHAPE_T::CIRCLE:
408 GRCircle( DC, pt1, GetRadius(), penWidth, color );
409 break;
410
411 case SHAPE_T::RECT:
412 GRRect( DC, pt1, pt2, penWidth, color );
413 break;
414
415 case SHAPE_T::POLY:
416 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
417 break;
418
419 case SHAPE_T::BEZIER:
420 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
421 break;
422
423 default:
425 }
426 }
427 else
428 {
429 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
430
431 for( SHAPE* shape : shapes )
432 {
433 STROKE_PARAMS::Stroke( shape, GetEffectiveLineStyle(), penWidth, aSettings,
434 [&]( const VECTOR2I& a, const VECTOR2I& b )
435 {
436 VECTOR2I pts = aTransform.TransformCoordinate( a ) + aOffset;
437 VECTOR2I pte = aTransform.TransformCoordinate( b ) + aOffset;
438 GRLine( DC, pts.x, pts.y, pte.x, pte.y, penWidth, color );
439 } );
440 }
441
442 for( SHAPE* shape : shapes )
443 delete shape;
444 }
445 }
446
447 delete[] buffer;
448}
449
450
452{
453 BOX2I bbox = getBoundingBox();
454
455 bbox.RevertYAxis();
456
457 return bbox;
458}
459
460
461void LIB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
462{
463 LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
464
465 ShapeGetMsgPanelInfo( aFrame, aList );
466}
467
468
469wxString LIB_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
470{
471 switch( GetShape() )
472 {
473 case SHAPE_T::ARC:
474 return wxString::Format( _( "Arc, radius %s" ),
475 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
476
477 case SHAPE_T::CIRCLE:
478 return wxString::Format( _( "Circle, radius %s" ),
479 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
480
481 case SHAPE_T::RECT:
482 return wxString::Format( _( "Rectangle, width %s height %s" ),
483 aUnitsProvider->MessageTextFromValue( std::abs( m_start.x - m_end.x ) ),
484 aUnitsProvider->MessageTextFromValue( std::abs( m_start.y - m_end.y ) ) );
485
486 case SHAPE_T::POLY:
487 return wxString::Format( _( "Polyline, %d points" ),
488 int( m_poly.Outline( 0 ).GetPointCount() ) );
489
490 case SHAPE_T::BEZIER:
491 return wxString::Format( _( "Bezier Curve, %d points" ),
492 int( m_bezierPoints.size() ) );
493
494 default:
496 return wxEmptyString;
497 }
498}
499
500
502{
503 switch( GetShape() )
504 {
506 case SHAPE_T::ARC: return BITMAPS::add_arc;
510
511 default:
514 }
515}
516
517
518void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition )
519{
520 if( GetShape() == SHAPE_T::POLY )
521 {
522 if( m_poly.IsEmpty() )
524
525 m_poly.Outline( 0 ).Append( aPosition, true );
526 }
527 else
528 {
530 }
531}
532
533
534
535
536void LIB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
537{
538 aCount = 3;
539 aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE;
541 aLayers[2] = LAYER_SELECTION_SHADOWS;
542}
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
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: box2.h:689
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
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498
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
int m_editState
Definition: eda_shape.h:381
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
bool IsFilled() const
Definition: eda_shape.h:90
void CalcArcAngles(EDA_ANGLE &aStartAngle, EDA_ANGLE &aEndAngle) const
Calc arc start and end angles such that aStartAngle < aEndAngle.
Definition: eda_shape.cpp:502
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
bool hitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Definition: eda_shape.cpp:745
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
COLOR4D GetFillColor() const
Definition: eda_shape.h:105
std::vector< VECTOR2I > m_bezierPoints
Definition: eda_shape.h:378
int GetWidth() const
Definition: eda_shape.h:109
void setPosition(const VECTOR2I &aPos)
Definition: eda_shape.cpp:93
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
const BOX2I getBoundingBox() const
Definition: eda_shape.cpp:684
SHAPE_POLY_SET m_poly
Definition: eda_shape.h:379
FILL_T m_fill
Definition: eda_shape.h:366
int Compare(const EDA_SHAPE *aOther) const
Definition: eda_shape.cpp:1508
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
COLOR4D & Desaturate()
Removes color (in HSL model)
Definition: color4d.cpp:510
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition: color4d.h:293
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
int GetDefaultPenWidth() const
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
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
bool IsPrivate() const
Definition: lib_item.h:279
virtual int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:74
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:155
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_item.cpp:47
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: lib_shape.cpp:46
STROKE_PARAMS GetStroke() const
Definition: lib_shape.h:52
void print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed) override
Print the item to aDC.
Definition: lib_shape.cpp:275
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_shape.cpp:461
void MirrorHorizontal(const VECTOR2I &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_shape.cpp:114
void AddPoint(const VECTOR2I &aPosition)
Definition: lib_shape.cpp:518
void MirrorVertical(const VECTOR2I &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_shape.cpp:120
void Offset(const VECTOR2I &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_shape.cpp:81
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
Definition: lib_shape.cpp:134
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_shape.cpp:64
int GetPenWidth() const override
Definition: lib_shape.cpp:269
const BOX2I GetBoundingBox() const override
Definition: lib_shape.cpp:451
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: lib_shape.h:60
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_shape.cpp:126
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_shape.cpp:70
LIB_SHAPE(LIB_SYMBOL *aParent, SHAPE_T aShape, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL, KICAD_T aType=LIB_SHAPE_T)
Definition: lib_shape.cpp:37
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: lib_shape.cpp:469
void MoveTo(const VECTOR2I &aPosition) override
Move a draw object to aPosition.
Definition: lib_shape.cpp:87
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_shape.cpp:501
void Normalize()
Definition: lib_shape.cpp:93
VECTOR2I GetPosition() const override
Definition: lib_shape.h:85
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the LIB_SHAPE.
Definition: lib_shape.h:96
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: lib_shape.cpp:536
Define a library symbol object.
Definition: lib_symbol.h:99
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
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
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
bool GetColorMode() const
Definition: plotter.h:138
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
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
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
PLOT_DASH_TYPE GetPlotStyle() const
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:47
bool MapAngles(EDA_ANGLE *aAngle1, EDA_ANGLE *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:83
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:46
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 _(s)
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:433
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:431
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:429
#define STRUCT_DELETED
flag indication structures to be erased
#define SKIP_STRUCT
flag indicating that the structure should be ignored
SHAPE_T
Definition: eda_shape.h:41
FILL_T
Definition: eda_shape.h:54
@ FILLED_WITH_COLOR
@ FILLED_WITH_BG_BODYCOLOR
@ 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_DEVICE
Definition: layer_ids.h:357
@ LAYER_PRIVATE_NOTES
Definition: layer_ids.h:359
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:372
@ LAYER_NOTES_BACKGROUND
Definition: layer_ids.h:360
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381
#define MINIMUM_SELECTION_DISTANCE
Definition: lib_item.h:46
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
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
TRANSFORM DefaultTransform
Definition: transform.cpp:34
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78