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 color = color.Mix( bg, 0.5f );
230
231 aPlotter->SetColor( color );
232 aPlotter->SetDash( penWidth, lineStyle );
233
234 switch( GetShape() )
235 {
236 case SHAPE_T::ARC:
237 {
238 // In some plotters (not all) the arc is approximated by segments, and
239 // a error max is needed. We try to approximate by 360/5 segments by 360 deg
240 int arc2segment_error = CircleToEndSegmentDeltaRadius( GetRadius(), 360/5 );
241 aPlotter->Arc( center, start, end, fill, penWidth, arc2segment_error );
242 }
243 break;
244
245 case SHAPE_T::CIRCLE:
246 aPlotter->Circle( center, GetRadius() * 2, fill, penWidth );
247 break;
248
249 case SHAPE_T::RECT:
250 aPlotter->Rect( start, end, fill, penWidth );
251 break;
252
253 case SHAPE_T::POLY:
254 case SHAPE_T::BEZIER:
255 aPlotter->PlotPoly( cornerList, fill, penWidth );
256 break;
257
258 default:
260 }
261
262 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
263}
264
265
267{
268 return GetWidth();
269}
270
271
272void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
273 const TRANSFORM& aTransform, bool aDimmed )
274{
275 if( IsPrivate() )
276 return;
277
278 bool forceNoFill = static_cast<bool>( aData );
279 int penWidth = GetEffectivePenWidth( aSettings );
280
281 if( forceNoFill && IsFilled() && penWidth == 0 )
282 return;
283
284 wxDC* DC = aSettings->GetPrintDC();
285 VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
286 VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
287 VECTOR2I c;
289
290 if( color == COLOR4D::UNSPECIFIED )
291 color = aSettings->GetLayerColor( LAYER_DEVICE );
292
293 COLOR4D bg = aSettings->GetBackgroundColor();
294
295 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
296 bg = COLOR4D::WHITE;
297
298 if( aDimmed )
299 color = color.Mix( bg, 0.5f );
300
301 unsigned ptCount = 0;
302 VECTOR2I* buffer = nullptr;
303
304 if( GetShape() == SHAPE_T::POLY )
305 {
306 const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
307
308 ptCount = poly.GetPointCount();
309 buffer = new VECTOR2I[ptCount];
310
311 for( unsigned ii = 0; ii < ptCount; ++ii )
312 buffer[ii] = aTransform.TransformCoordinate( poly.CPoint( ii ) ) + aOffset;
313 }
314 else if( GetShape() == SHAPE_T::BEZIER )
315 {
316 ptCount = m_bezierPoints.size();
317 buffer = new VECTOR2I[ptCount];
318
319 for( size_t ii = 0; ii < ptCount; ++ii )
320 buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset;
321 }
322 else if( GetShape() == SHAPE_T::ARC )
323 {
324 c = aTransform.TransformCoordinate( getCenter() ) + aOffset;
325
326 EDA_ANGLE t1, t2;
327
328 CalcArcAngles( t1, t2 );
329
330 // N.B. The order of evaluation is critical here as MapAngles will modify t1, t2
331 // and the Normalize routine depends on these modifications for the correct output
332 bool transformed = aTransform.MapAngles( &t1, &t2 );
333 EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180();
334 bool transformed2 = ( arc_angle > ANGLE_0 ) && ( arc_angle < ANGLE_180 );
335
336 if( transformed == transformed2 )
337 std::swap( pt1, pt2 );
338 }
339
340 COLOR4D fillColor = COLOR4D::UNSPECIFIED;
341
342 if( !forceNoFill )
343 {
345 fillColor = color;
347 fillColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
349 fillColor = GetFillColor();
350 }
351
352 if( fillColor != COLOR4D::UNSPECIFIED )
353 {
354 switch( GetShape() )
355 {
356 case SHAPE_T::ARC:
357 GRFilledArc( DC, pt1, pt2, c, 0, fillColor, fillColor );
358 break;
359
360 case SHAPE_T::CIRCLE:
361 GRFilledCircle( DC, pt1, GetRadius(), 0, fillColor, fillColor );
362 break;
363
364 case SHAPE_T::RECT:
365 GRFilledRect( DC, pt1, pt2, 0, fillColor, fillColor );
366 break;
367
368 case SHAPE_T::POLY:
369 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
370 break;
371
372 case SHAPE_T::BEZIER:
373 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
374 break;
375
376 default:
378 }
379 }
380
381 penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
382
384 {
385 switch( GetShape() )
386 {
387 case SHAPE_T::ARC:
388 GRArc( DC, pt1, pt2, c, penWidth, color );
389 break;
390
391 case SHAPE_T::CIRCLE:
392 GRCircle( DC, pt1, GetRadius(), penWidth, color );
393 break;
394
395 case SHAPE_T::RECT:
396 GRRect( DC, pt1, pt2, penWidth, color );
397 break;
398
399 case SHAPE_T::POLY:
400 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
401 break;
402
403 case SHAPE_T::BEZIER:
404 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
405 break;
406
407 default:
409 }
410 }
411 else
412 {
413 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
414
415 for( SHAPE* shape : shapes )
416 {
417 STROKE_PARAMS::Stroke( shape, GetEffectiveLineStyle(), penWidth, aSettings,
418 [&]( const VECTOR2I& a, const VECTOR2I& b )
419 {
420 VECTOR2I pts = aTransform.TransformCoordinate( a ) + aOffset;
421 VECTOR2I pte = aTransform.TransformCoordinate( b ) + aOffset;
422 GRLine( DC, pts.x, pts.y, pte.x, pte.y, penWidth, color );
423 } );
424 }
425
426 for( SHAPE* shape : shapes )
427 delete shape;
428 }
429
430 delete[] buffer;
431}
432
433
435{
436 BOX2I bbox = getBoundingBox();
437
438 bbox.RevertYAxis();
439
440 return bbox;
441}
442
443
444void LIB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
445{
446 LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
447
448 ShapeGetMsgPanelInfo( aFrame, aList );
449}
450
451
452wxString LIB_SHAPE::GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const
453{
454 switch( GetShape() )
455 {
456 case SHAPE_T::ARC:
457 return wxString::Format( _( "Arc, radius %s" ),
458 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
459
460 case SHAPE_T::CIRCLE:
461 return wxString::Format( _( "Circle, radius %s" ),
462 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
463
464 case SHAPE_T::RECT:
465 return wxString::Format( _( "Rectangle, width %s height %s" ),
466 aUnitsProvider->MessageTextFromValue( std::abs( m_start.x - m_end.x ) ),
467 aUnitsProvider->MessageTextFromValue( std::abs( m_start.y - m_end.y ) ) );
468
469 case SHAPE_T::POLY:
470 return wxString::Format( _( "Polyline, %d points" ),
471 int( m_poly.Outline( 0 ).GetPointCount() ) );
472
473 case SHAPE_T::BEZIER:
474 return wxString::Format( _( "Bezier Curve, %d points" ),
475 int( m_bezierPoints.size() ) );
476
477 default:
479 return wxEmptyString;
480 }
481}
482
483
485{
486 switch( GetShape() )
487 {
489 case SHAPE_T::ARC: return BITMAPS::add_arc;
493
494 default:
497 }
498}
499
500
501void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition )
502{
503 if( GetShape() == SHAPE_T::POLY )
504 {
505 if( m_poly.IsEmpty() )
507
508 m_poly.Outline( 0 ).Append( aPosition, true );
509 }
510 else
511 {
513 }
514}
515
516
517
518
519void LIB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
520{
521 aCount = 3;
522 aLayers[0] = IsPrivate() ? LAYER_PRIVATE_NOTES : LAYER_DEVICE;
524 aLayers[2] = LAYER_SELECTION_SHADOWS;
525}
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:500
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:432
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:490
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: eda_shape.cpp:614
int GetRadius() const
Definition: eda_shape.cpp:511
SHAPE_T GetShape() const
Definition: eda_shape.h:113
bool hitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Definition: eda_shape.cpp:733
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:672
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:1496
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
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:272
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:444
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:501
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: lib_shape.cpp:452
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:266
const BOX2I GetBoundingBox() const override
Definition: lib_shape.cpp:434
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
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:484
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:519
Define a library symbol object.
Definition: lib_symbol.h:98
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:123
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:78
VECTOR2I TransformCoordinate(const VECTOR2I &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:41
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:48
#define _(s)
static constexpr EDA_ANGLE & ANGLE_180
Definition: eda_angle.h:416
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:412
#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
TRANSFORM DefaultTransform
Definition: eeschema.cpp:68
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:387
void GRCircle(wxDC *aDC, const VECTOR2I &aPos, int aRadius, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:348
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:378
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:162
void GRFilledRect(wxDC *DC, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, const COLOR4D &aColor, const COLOR4D &aBgColor)
Definition: gr_basic.cpp:394
void GRArc(wxDC *aDC, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, int aWidth, const COLOR4D &aColor)
Definition: gr_basic.cpp:369
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:332
bool GetGRForceBlackPenState(void)
Definition: gr_basic.cpp:156
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:360
@ 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:401
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
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78