KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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_ITEM::SwapFlags( aItem );
55
56 SCH_SHAPE* shape = static_cast<SCH_SHAPE*>( aItem );
57
58 EDA_SHAPE::SwapShape( shape );
59 std::swap( m_layer, shape->m_layer );
60}
61
62
63void SCH_SHAPE::SetStroke( const STROKE_PARAMS& aStroke )
64{
65 m_stroke = aStroke;
66}
67
68
69void SCH_SHAPE::Move( const VECTOR2I& aOffset )
70{
71 move( aOffset );
72}
73
74
76{
77 if( GetShape() == SHAPE_T::RECTANGLE )
78 {
79 VECTOR2I size = GetEnd() - GetPosition();
80
81 if( size.y < 0 )
82 {
83 SetStartY( GetStartY() + size.y );
84 SetEndY( GetStartY() - size.y );
85 }
86
87 if( size.x < 0 )
88 {
89 SetStartX( GetStartX() + size.x );
90 SetEndX( GetStartX() - size.x );
91 }
92 }
93}
94
95
97{
98 flip( VECTOR2I( aCenter, 0 ), true );
99}
100
101
103{
104 flip( VECTOR2I( 0, aCenter ), false );
105}
106
107
108void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
109{
110 rotate( aCenter, -ANGLE_90 );
111}
112
113
114void SCH_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground ) const
115{
116 int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
117
118 static std::vector<VECTOR2I> cornerList;
119
120 if( GetShape() == SHAPE_T::POLY )
121 {
122 cornerList.clear();
123
124 for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
125 cornerList.push_back( pt );
126 }
127
128 if( aBackground )
129 {
130 if( !aPlotter->GetColorMode() )
131 return;
132
133 if( m_fill == FILL_T::FILLED_WITH_COLOR && GetFillColor() != COLOR4D::UNSPECIFIED )
134 {
135 if( GetFillColor() != COLOR4D::UNSPECIFIED )
136 aPlotter->SetColor( GetFillColor() );
137 else
138 aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) );
139
140 switch( GetShape() )
141 {
142 case SHAPE_T::ARC:
143 aPlotter->Arc( GetStart(), GetArcMid(), GetEnd(), m_fill, 0 );
144 break;
145
146 case SHAPE_T::CIRCLE:
147 aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
148 break;
149
150 case SHAPE_T::RECTANGLE:
151 aPlotter->Rect( GetStart(), GetEnd(), m_fill, 0 );
152 break;
153
154 case SHAPE_T::POLY:
155 aPlotter->PlotPoly( cornerList, m_fill, 0 );
156 break;
157
158 case SHAPE_T::BEZIER:
159 aPlotter->PlotPoly( m_bezierPoints, m_fill, 0 );
160 break;
161
162 default:
164 }
165 }
166 }
167 else /* if( aForeground ) */
168 {
169 if( aPlotter->GetColorMode() && GetStroke().GetColor() != COLOR4D::UNSPECIFIED )
170 aPlotter->SetColor( GetStroke().GetColor() );
171 else
172 aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) );
173
174 aPlotter->SetCurrentLineWidth( pen_size );
175 aPlotter->SetDash( pen_size, GetEffectiveLineStyle() );
176
177 switch( GetShape() )
178 {
179 case SHAPE_T::ARC:
180 aPlotter->Arc( GetStart(), GetArcMid(), GetEnd(), m_fill, pen_size );
181 break;
182
183 case SHAPE_T::CIRCLE:
184 aPlotter->Circle( getCenter(), GetRadius() * 2, FILL_T::NO_FILL, pen_size );
185 break;
186
187 case SHAPE_T::RECTANGLE:
188 {
189 std::vector<VECTOR2I> pts = GetRectCorners();
190
191 aPlotter->MoveTo( pts[0] );
192 aPlotter->LineTo( pts[1] );
193 aPlotter->LineTo( pts[2] );
194 aPlotter->LineTo( pts[3] );
195 aPlotter->FinishTo( pts[0] );
196 }
197 break;
198
199 case SHAPE_T::POLY:
200 aPlotter->PlotPoly( cornerList, FILL_T::NO_FILL, pen_size );
201 break;
202
203 case SHAPE_T::BEZIER:
204 aPlotter->PlotPoly( m_bezierPoints, FILL_T::NO_FILL, pen_size );
205 break;
206
207 default:
209 }
210
211 aPlotter->SetDash( pen_size, PLOT_DASH_TYPE::SOLID );
212 }
213}
214
215
217{
218 if( m_stroke.GetWidth() > 0 )
219 return m_stroke.GetWidth();
220
221 // Historically 0 meant "default width" and negative numbers meant "don't stroke".
222 if( GetWidth() < 0 )
223 return 0;
224
225 SCHEMATIC* schematic = Schematic();
226
227 if( schematic )
228 return schematic->Settings().m_DefaultLineWidth;
229
231}
232
233
234void SCH_SHAPE::PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
235{
236 wxDC* DC = aSettings->GetPrintDC();
238
239 unsigned ptCount = 0;
240 VECTOR2I* buffer = nullptr;
241
242 if( GetShape() == SHAPE_T::POLY )
243 {
244 SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
245
246 ptCount = poly.GetPointCount();
247 buffer = new VECTOR2I[ptCount];
248
249 for( unsigned ii = 0; ii < ptCount; ++ii )
250 buffer[ii] = poly.CPoint( ii );
251 }
252 else if( GetShape() == SHAPE_T::BEZIER )
253 {
254 ptCount = m_bezierPoints.size();
255 buffer = new VECTOR2I[ptCount];
256
257 for( size_t ii = 0; ii < ptCount; ++ii )
258 buffer[ii] = m_bezierPoints[ii];
259 }
260
261 if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
262 {
263 if( GetFillColor() == COLOR4D::UNSPECIFIED )
264 color = aSettings->GetLayerColor( LAYER_NOTES );
265 else
267
268 switch( GetShape() )
269 {
270 case SHAPE_T::ARC:
271 GRFilledArc( DC, GetEnd(), GetStart(), getCenter(), 0, color, color );
272 break;
273
274 case SHAPE_T::CIRCLE:
276 break;
277
278 case SHAPE_T::RECTANGLE:
279 GRFilledRect( DC, GetStart(), GetEnd(), 0, color, color );
280 break;
281
282 case SHAPE_T::POLY:
283 GRPoly( DC, ptCount, buffer, true, 0, color, color );
284 break;
285
286 case SHAPE_T::BEZIER:
287 GRPoly( DC, ptCount, buffer, true, 0, color, color );
288 break;
289
290 default:
292 }
293 }
294
295 delete[] buffer;
296
297}
298
299
300void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
301{
302 int penWidth = GetPenWidth();
303 wxDC* DC = aSettings->GetPrintDC();
305
306 if( color == COLOR4D::UNSPECIFIED )
307 color = aSettings->GetLayerColor( LAYER_NOTES );
308
309 COLOR4D bg = aSettings->GetBackgroundColor();
310
311 if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
312 bg = COLOR4D::WHITE;
313
314 unsigned ptCount = 0;
315 VECTOR2I* buffer = nullptr;
316
317 if( GetShape() == SHAPE_T::POLY )
318 {
319 SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
320
321 ptCount = poly.GetPointCount();
322 buffer = new VECTOR2I[ptCount];
323
324 for( unsigned ii = 0; ii < ptCount; ++ii )
325 buffer[ii] = poly.CPoint( ii );
326 }
327 else if( GetShape() == SHAPE_T::BEZIER )
328 {
329 ptCount = m_bezierPoints.size();
330 buffer = new VECTOR2I[ptCount];
331
332 for( size_t ii = 0; ii < ptCount; ++ii )
333 buffer[ii] = m_bezierPoints[ii];
334 }
335
336 COLOR4D fillColor = COLOR4D::UNSPECIFIED;
337
338 if( GetFillMode() == FILL_T::FILLED_SHAPE )
339 fillColor = color;
340 else if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
341 fillColor = GetFillColor();
342
343 if( fillColor != COLOR4D::UNSPECIFIED )
344 {
345 switch( GetShape() )
346 {
347 case SHAPE_T::ARC:
348 GRFilledArc( DC, GetEnd(), GetStart(), getCenter(), 0, fillColor, fillColor );
349 break;
350
351 case SHAPE_T::CIRCLE:
352 GRFilledCircle( DC, GetStart(), GetRadius(), 0, fillColor, fillColor );
353 break;
354
355 case SHAPE_T::RECTANGLE:
356 GRFilledRect( DC, GetStart(), GetEnd(), 0, fillColor, fillColor );
357 break;
358
359 case SHAPE_T::POLY:
360 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
361 break;
362
363 case SHAPE_T::BEZIER:
364 GRPoly( DC, ptCount, buffer, true, 0, fillColor, fillColor );
365 break;
366
367 default:
369 }
370 }
371 else
372 {
373 penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
374 }
375
376 if( penWidth > 0 )
377 {
378 if( GetEffectiveLineStyle() == PLOT_DASH_TYPE::SOLID )
379 {
380 switch( GetShape() )
381 {
382 case SHAPE_T::ARC:
383 GRArc( DC, GetEnd(), GetStart(), getCenter(), penWidth, color );
384 break;
385
386 case SHAPE_T::CIRCLE:
387 GRCircle( DC, GetStart(), GetRadius(), penWidth, color );
388 break;
389
390 case SHAPE_T::RECTANGLE:
391 GRRect( DC, GetStart(), GetEnd(), penWidth, color );
392 break;
393
394 case SHAPE_T::POLY:
395 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
396 break;
397
398 case SHAPE_T::BEZIER:
399 GRPoly( DC, ptCount, buffer, false, penWidth, color, color );
400 break;
401
402 default:
404 }
405 }
406 else
407 {
408 std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
409
410 for( SHAPE* shape : shapes )
411 {
412 STROKE_PARAMS::Stroke( shape, GetEffectiveLineStyle(), penWidth, aSettings,
413 [&]( const VECTOR2I& a, const VECTOR2I& b )
414 {
415 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
416 } );
417 }
418
419 for( SHAPE* shape : shapes )
420 delete shape;
421 }
422 }
423
424 delete[] buffer;
425}
426
427
428void SCH_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
429{
430 SCH_ITEM::GetMsgPanelInfo( aFrame, aList );
431
432 ShapeGetMsgPanelInfo( aFrame, aList );
433}
434
435
436wxString SCH_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
437{
438 switch( GetShape() )
439 {
440 case SHAPE_T::ARC:
441 return wxString::Format( _( "Arc, radius %s" ),
442 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
443
444 case SHAPE_T::CIRCLE:
445 return wxString::Format( _( "Circle, radius %s" ),
446 aUnitsProvider->MessageTextFromValue( GetRadius() ) );
447
448 case SHAPE_T::RECTANGLE:
449 return wxString::Format( _( "Rectangle, width %s height %s" ),
450 aUnitsProvider->MessageTextFromValue( std::abs( m_start.x - m_end.x ) ),
451 aUnitsProvider->MessageTextFromValue( std::abs( m_start.y - m_end.y ) ) );
452
453 case SHAPE_T::POLY:
454 return wxString::Format( _( "Polyline, %d points" ),
455 int( m_poly.Outline( 0 ).GetPointCount() ) );
456
457 case SHAPE_T::BEZIER:
458 return wxString::Format( _( "Bezier Curve, %d points" ),
459 int( m_bezierPoints.size() ) );
460
461 default:
463 return wxEmptyString;
464 }
465}
466
467
469{
470 switch( GetShape() )
471 {
472 case SHAPE_T::SEGMENT: return BITMAPS::add_line;
473 case SHAPE_T::ARC: return BITMAPS::add_arc;
474 case SHAPE_T::CIRCLE: return BITMAPS::add_circle;
475 case SHAPE_T::RECTANGLE: return BITMAPS::add_rectangle;
476 case SHAPE_T::POLY: return BITMAPS::add_graphical_segments;
477
478 default:
480 return BITMAPS::question_mark;
481 }
482}
483
484
485void SCH_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
486{
487 aCount = 3;
488 aLayers[0] = LAYER_NOTES;
489 aLayers[1] = LAYER_NOTES_BACKGROUND;
490 aLayers[2] = LAYER_SELECTION_SHADOWS;
491}
492
493
494void SCH_SHAPE::AddPoint( const VECTOR2I& aPosition )
495{
496 if( GetShape() == SHAPE_T::POLY )
497 {
498 if( m_poly.IsEmpty() )
500
501 m_poly.Outline( 0 ).Append( aPosition, true );
502 }
503 else
504 {
506 }
507}
508
509
510static struct SCH_SHAPE_DESC
511{
513 {
520
521 // Only polygons have meaningful Position properties.
522 // On other shapes, these are duplicates of the Start properties.
523 auto isPolygon =
524 []( INSPECTABLE* aItem ) -> bool
525 {
526 if( SCH_SHAPE* shape = dynamic_cast<SCH_SHAPE*>( aItem ) )
527 return shape->GetShape() == SHAPE_T::POLY;
528
529 return false;
530 };
531
533 _HKI( "Position X" ), isPolygon );
535 _HKI( "Position Y" ), isPolygon );
536 }
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
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:199
void SetStartX(int x)
Definition: eda_shape.h:140
VECTOR2I getCenter() const
Definition: eda_shape.cpp:514
int GetStartY() const
Definition: eda_shape.h:125
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Definition: eda_shape.cpp:333
void flip(const VECTOR2I &aCentre, bool aFlipLeftRight)
Definition: eda_shape.cpp:390
FILL_T GetFillMode() const
Definition: eda_shape.h:102
void SetEndY(int y)
Definition: eda_shape.h:159
void SetStartY(int y)
Definition: eda_shape.h:134
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:298
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: eda_shape.cpp:711
int GetRadius() const
Definition: eda_shape.cpp:588
SHAPE_T GetShape() const
Definition: eda_shape.h:117
void SetEndX(int x)
Definition: eda_shape.h:165
VECTOR2I m_start
Definition: eda_shape.h:387
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:149
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:124
COLOR4D GetFillColor() const
Definition: eda_shape.h:106
void SwapShape(EDA_SHAPE *aImage)
Definition: eda_shape.cpp:1533
std::vector< VECTOR2I > GetRectCorners() const
Definition: eda_shape.cpp:1105
std::vector< VECTOR2I > m_bezierPoints
Definition: eda_shape.h:396
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:87
int GetStartX() const
Definition: eda_shape.h:126
VECTOR2I m_end
Definition: eda_shape.h:388
SHAPE_POLY_SET m_poly
Definition: eda_shape.h:397
virtual int GetWidth() const
Definition: eda_shape.h:110
STROKE_PARAMS m_stroke
Definition: eda_shape.h:377
FILL_T m_fill
Definition: eda_shape.h:378
VECTOR2I GetArcMid() const
Definition: eda_shape.cpp:558
Class that other classes need to inherit from, in order to be inspectable.
Definition: inspectable.h:36
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.
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:104
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 VECTOR2D &aStart, const VECTOR2D &aMid, const VECTOR2D &aEnd, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH)
Definition: plotter.cpp:149
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:242
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:252
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
bool GetColorMode() const
Definition: plotter.h:132
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:247
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
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Holds all the data relating to one schematic.
Definition: schematic.h:75
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:209
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:150
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:113
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
Definition: sch_item.h:264
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
Definition: sch_item.cpp:267
SCH_LAYER_ID m_layer
Definition: sch_item.h:510
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:436
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:485
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:96
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
Definition: sch_shape.cpp:69
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:63
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:75
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_shape.cpp:102
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:428
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_shape.cpp:108
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
Definition: sch_shape.cpp:114
void AddPoint(const VECTOR2I &aPosition)
Definition: sch_shape.cpp:494
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_shape.cpp:468
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print the (optional) backaground elements if they exist.
Definition: sch_shape.cpp:234
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a schematic item.
Definition: sch_shape.cpp:300
int GetPenWidth() const override
Definition: sch_shape.cpp:216
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
Return true if the set is empty (no polygons at all)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
An abstract shape on 2D plane.
Definition: shape.h:126
Simple container to manage line stroke parameters.
Definition: stroke_params.h:81
int GetWidth() const
Definition: stroke_params.h:91
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
Definition: stroke_params.h:97
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define _HKI(x)
#define _(s)
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:439
SHAPE_T
Definition: eda_shape.h:42
FILL_T
Definition: eda_shape.h:55
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:363
@ LAYER_NOTES_BACKGROUND
Definition: layer_ids.h:365
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:387
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
Message panel definition file.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:426
#define TYPE_HASH(x)
Definition: property.h:64
#define REGISTER_TYPE(x)
Definition: property_mgr.h:356
static struct SCH_SHAPE_DESC _SCH_SHAPE_DESC
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:588