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-2021 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 
35 
36 LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aDefaultLineWidth,
37  FILL_T aFillType ) :
38  LIB_ITEM( LIB_SHAPE_T, aParent ),
39  EDA_SHAPE( aShape, aDefaultLineWidth, aFillType, true )
40 {
41  m_editState = 0;
42 }
43 
44 
45 bool LIB_SHAPE::HitTest( const wxPoint& aPosRef, int aAccuracy ) const
46 {
47  if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) )
48  aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE );
49 
50  return hitTest( DefaultTransform.TransformCoordinate( aPosRef ), aAccuracy );
51 }
52 
53 
54 bool LIB_SHAPE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
55 {
57  return false;
58 
59  return hitTest( DefaultTransform.TransformCoordinate( aRect ), aContained, aAccuracy );
60 }
61 
62 
64 {
65  return new LIB_SHAPE( *this );
66 }
67 
68 
69 int LIB_SHAPE::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags ) const
70 {
71  int retv = LIB_ITEM::compare( aOther, aCompareFlags );
72 
73  if( retv )
74  return retv;
75 
76  return EDA_SHAPE::Compare( &static_cast<const LIB_SHAPE&>( aOther ) );
77 }
78 
79 
80 void LIB_SHAPE::Offset( const wxPoint& aOffset )
81 {
82  move( aOffset );
83 }
84 
85 
86 void LIB_SHAPE::MoveTo( const wxPoint& aPosition )
87 {
88  setPosition( aPosition );
89 }
90 
91 
92 void LIB_SHAPE::MirrorHorizontal( const wxPoint& aCenter )
93 {
94  flip( aCenter, true );
95 }
96 
97 
98 void LIB_SHAPE::MirrorVertical( const wxPoint& aCenter )
99 {
100  flip( aCenter, false );
101 }
102 
103 
104 void LIB_SHAPE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
105 {
106  int rot_angle = aRotateCCW ? -900 : 900;
107 
108  rotate( aCenter, rot_angle );
109 }
110 
111 
112 void LIB_SHAPE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
113  const TRANSFORM& aTransform ) const
114 {
115  wxPoint start = aTransform.TransformCoordinate( m_start ) + aOffset;
116  wxPoint end = aTransform.TransformCoordinate( m_end ) + aOffset;
117  wxPoint center;
118  int startAngle = 0;
119  int endAngle = 0;
120  int pen_size = GetEffectivePenWidth( aPlotter->RenderSettings() );
121  FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
122 
123  static std::vector<wxPoint> cornerList;
124 
125  if( GetShape() == SHAPE_T::POLY )
126  {
127  const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
128  cornerList.clear();
129 
130  for( const VECTOR2I& pt : poly.CPoints() )
131  cornerList.push_back( aTransform.TransformCoordinate( (wxPoint) pt ) + aOffset );
132  }
133  else if( GetShape() == SHAPE_T::BEZIER )
134  {
135  cornerList.clear();
136 
137  for( const wxPoint& pt : m_bezierPoints )
138  cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
139  }
140  else if( GetShape() == SHAPE_T::ARC )
141  {
142  center = aTransform.TransformCoordinate( getCenter() ) + aOffset;
143 
144  CalcArcAngles( startAngle, endAngle );
145  aTransform.MapAngles( &startAngle, &endAngle );
146  }
147 
149  {
150  aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
151 
152  switch( GetShape() )
153  {
154  case SHAPE_T::ARC:
155  aPlotter->Arc( center, -endAngle, -startAngle, GetRadius(), fill, 0 );
156  break;
157 
158  case SHAPE_T::CIRCLE:
159  aPlotter->Circle( start, GetRadius() * 2, fill, 0 );
160  break;
161 
162  case SHAPE_T::RECT:
163  aPlotter->Rect( start, end, fill, 0 );
164  break;
165 
166  case SHAPE_T::POLY:
167  case SHAPE_T::BEZIER:
168  aPlotter->PlotPoly( cornerList, fill, 0 );
169  break;
170 
171  default:
173  }
174 
175  if( pen_size <= 0 )
176  return;
177  else
178  fill = FILL_T::NO_FILL;
179  }
180 
181  aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
182 
183  switch( GetShape() )
184  {
185  case SHAPE_T::ARC:
186  aPlotter->Arc( center, -endAngle, -startAngle, GetRadius(), fill, pen_size );
187  break;
188 
189  case SHAPE_T::CIRCLE:
190  aPlotter->Circle( start, GetRadius() * 2, fill, pen_size );
191  break;
192 
193  case SHAPE_T::RECT:
194  aPlotter->Rect( start, end, fill, pen_size );
195  break;
196 
197  case SHAPE_T::POLY:
198  case SHAPE_T::BEZIER:
199  aPlotter->PlotPoly( cornerList, fill, pen_size );
200  break;
201 
202  default:
204  }
205 }
206 
207 
209 {
210  return GetWidth();
211 }
212 
213 
214 void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
215  void* aData, const TRANSFORM& aTransform )
216 {
217  bool forceNoFill = static_cast<bool>( aData );
218  int penWidth = GetEffectivePenWidth( aSettings );
219 
220  if( forceNoFill && IsFilled() && penWidth == 0 )
221  return;
222 
223  wxDC* DC = aSettings->GetPrintDC();
224  wxPoint pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
225  wxPoint pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
226  wxPoint c;
227  COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
228  COLOR4D fillColor = color;
229 
230  unsigned ptCount = 0;
231  wxPoint* buffer = nullptr;
232 
233  if( GetShape() == SHAPE_T::POLY )
234  {
235  const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
236 
237  ptCount = poly.GetPointCount();
238  buffer = new wxPoint[ ptCount ];
239 
240  for( unsigned ii = 0; ii < ptCount; ++ii )
241  buffer[ii] = aTransform.TransformCoordinate( (wxPoint) poly.CPoint( ii ) ) + aOffset;
242  }
243  else if( GetShape() == SHAPE_T::BEZIER )
244  {
245  ptCount = m_bezierPoints.size();
246  buffer = new wxPoint[ ptCount ];
247 
248  for( size_t ii = 0; ii < ptCount; ++ii )
249  buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset;
250  }
251  else if( GetShape() == SHAPE_T::ARC )
252  {
253  c = aTransform.TransformCoordinate( getCenter() ) + aOffset;
254 
255  int t1, t2;
256 
257  CalcArcAngles( t1, t2 );
258 
259  if( NormalizeAngle180( t1 - t2 ) > 0 )
260  std::swap( pt1, pt2 );
261  }
262 
263  if( forceNoFill || GetFillType() == FILL_T::NO_FILL )
264  {
265  penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
266 
267  switch( GetShape() )
268  {
269  case SHAPE_T::ARC:
270  GRArc1( nullptr, DC, pt1, pt2, c, penWidth, color );
271  break;
272 
273  case SHAPE_T::CIRCLE:
274  GRCircle( nullptr, DC, pt1.x, pt1.y, GetRadius(), penWidth, color );
275  break;
276 
277  case SHAPE_T::RECT:
278  GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color );
279  break;
280 
281  case SHAPE_T::POLY:
282  GRPoly( nullptr, DC, ptCount, buffer, false, penWidth, color, color );
283  break;
284 
285  case SHAPE_T::BEZIER:
286  GRPoly( nullptr, DC, ptCount, buffer, false, penWidth, color, color );
287  break;
288 
289  default:
291  }
292  }
293  else
294  {
296  fillColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
297 
298  switch( GetShape() )
299  {
300  case SHAPE_T::ARC:
301  // If we stroke in GRFilledArc it will stroke the two radials too, so we have to
302  // fill and stroke separately
303 
304  GRFilledArc1( nullptr, DC, pt1, pt2, c, 0, fillColor, fillColor );
305 
306  GRArc1( nullptr, DC, pt1, pt2, c, penWidth, color );
307  break;
308 
309  case SHAPE_T::CIRCLE:
310  GRFilledCircle( nullptr, DC, pt1.x, pt1.y, GetRadius(), 0, color, fillColor );
311  break;
312 
313  case SHAPE_T::RECT:
314  GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, fillColor );
315  break;
316 
317  case SHAPE_T::POLY:
318  if( penWidth > 0 )
319  GRPoly( nullptr, DC, ptCount, buffer, true, penWidth, color, fillColor );
320  else
321  GRPoly( nullptr, DC, ptCount, buffer, true, 0, fillColor, fillColor );
322  break;
323 
324  case SHAPE_T::BEZIER:
325  if( penWidth > 0 )
326  GRPoly( nullptr, DC, ptCount, buffer, true, penWidth, color, fillColor );
327  else
328  GRPoly( nullptr, DC, ptCount, buffer, true, 0, fillColor, fillColor );
329  break;
330 
331  default:
333  }
334  }
335 
336  delete[] buffer;
337 }
338 
339 
341 {
342  EDA_RECT rect = getBoundingBox();
343 
344  rect.RevertYAxis();
345 
346  return rect;
347 }
348 
349 
350 void LIB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
351 {
352  LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
353 
354  ShapeGetMsgPanelInfo( aFrame, aList );
355 }
356 
357 
358 wxString LIB_SHAPE::GetSelectMenuText( EDA_UNITS aUnits ) const
359 {
360  switch( GetShape() )
361  {
362  case SHAPE_T::ARC:
363  return wxString::Format( _( "Arc, radius %s" ),
364  MessageTextFromValue( aUnits, GetRadius() ) );
365 
366  case SHAPE_T::CIRCLE:
367  return wxString::Format( _( "Circle, radius %s" ),
368  MessageTextFromValue( aUnits, GetRadius() ) );
369 
370  case SHAPE_T::RECT:
371  return wxString::Format( _( "Rectangle, width %s height %s" ),
372  MessageTextFromValue( aUnits, std::abs( m_start.x - m_end.x ) ),
373  MessageTextFromValue( aUnits, std::abs( m_start.y - m_end.y ) ) );
374 
375  case SHAPE_T::POLY:
376  return wxString::Format( _( "Polyline, %d points" ),
377  int( m_poly.Outline( 0 ).GetPointCount() ) );
378 
379  case SHAPE_T::BEZIER:
380  return wxString::Format( _( "Bezier Curve, %d points" ),
381  int( m_bezierPoints.size() ) );
382 
383  default:
385  return wxEmptyString;
386  }
387 }
388 
389 
391 {
392  switch( GetShape() )
393  {
394  case SHAPE_T::SEGMENT: return BITMAPS::add_line;
395  case SHAPE_T::ARC: return BITMAPS::add_arc;
399 
400  default:
402  return BITMAPS::question_mark;
403  }
404 }
405 
406 
407 void LIB_SHAPE::AddPoint( const wxPoint& aPosition )
408 {
409  if( GetShape() == SHAPE_T::POLY )
410  {
411  if( m_poly.IsEmpty() )
412  m_poly.NewOutline();
413 
414  m_poly.Outline( 0 ).Append( aPosition, true );
415  }
416  else
417  {
418  wxFAIL_MSG( "LIB_SHAPE::AddPoint not implemented for " + SHAPE_T_asString() );
419  }
420 }
421 
422 
423 void LIB_SHAPE::CalcArcAngles( int& aStartAngle, int& aEndAngle ) const
424 {
425  wxPoint centerStartVector = GetStart() - GetCenter();
426  wxPoint centerEndVector = GetEnd() - GetCenter();
427 
428  // Angles in Eeschema are still integers
429  aStartAngle = KiROUND( ArcTangente( centerStartVector.y, centerStartVector.x ) );
430  aEndAngle = KiROUND( ArcTangente( centerEndVector.y, centerEndVector.x ) );
431 
432  NORMALIZE_ANGLE_POS( aStartAngle );
433  NORMALIZE_ANGLE_POS( aEndAngle ); // angles = 0 .. 3600
434 
435  // Restrict angle to less than 180 to avoid PBS display mirror Trace because it is
436  // assumed that the arc is less than 180 deg to find orientation after rotate or mirror.
437  if( ( aEndAngle - aStartAngle ) > 1800 )
438  aEndAngle -= 3600;
439  else if( ( aEndAngle - aStartAngle ) <= -1800 )
440  aEndAngle += 3600;
441 
442  while( ( aEndAngle - aStartAngle ) >= 1800 )
443  {
444  aEndAngle--;
445  aStartAngle++;
446  }
447 
448  while( ( aStartAngle - aEndAngle ) >= 1800 )
449  {
450  aEndAngle++;
451  aStartAngle--;
452  }
453 
454  NORMALIZE_ANGLE_POS( aStartAngle );
455 
456  if( !IsMoving() )
457  NORMALIZE_ANGLE_POS( aEndAngle );
458 }
459 
460 
void CalcArcAngles(int &aStartAngle, int &aEndAngle) const
Definition: lib_shape.cpp:423
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:350
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: lib_shape.cpp:63
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
void AddPoint(const wxPoint &aPosition)
Definition: lib_shape.cpp:407
int GetWidth() const
Definition: eda_shape.h:89
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: lib_shape.cpp:390
virtual size_t GetPointCount() const override
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
wxPoint getCenter() const
Definition: eda_shape.cpp:393
Implementation of conversion functions that require both schematic and board internal units.
void GRFilledRect(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, const COLOR4D &Color, const COLOR4D &BgColor)
Definition: gr_basic.cpp:708
const wxPoint & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:97
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
bool hitTest(const wxPoint &aPosition, int aAccuracy=0) const
Definition: eda_shape.cpp:657
bool IsMoving() const
Definition: eda_item.h:119
int color
Definition: DXF_plotter.cpp:57
bool IsEmpty() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void Rotate(const wxPoint &aCenter, bool aRotateCCW=true) override
Rotate the object about aCenter point.
Definition: lib_shape.cpp:104
void GRRect(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color)
Definition: gr_basic.cpp:701
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:480
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:290
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: eda_shape.cpp:522
The base class for create windows for drawing purpose.
Define a library symbol object.
Definition: lib_symbol.h:96
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
Definition: eda_rect.h:198
wxPoint m_end
Definition: eda_shape.h:300
FILL_T
Definition: eda_shape.h:53
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
This file contains miscellaneous commonly used macros and functions.
void MirrorHorizontal(const wxPoint &aCenter) override
Mirror the draw object along the horizontal (X) axis about aCenter point.
Definition: lib_shape.cpp:92
int GetPenWidth() const override
Definition: lib_shape.cpp:208
bool IsFilled() const
Definition: eda_shape.h:81
void rotate(const wxPoint &aRotCentre, double aAngle)
Definition: eda_shape.cpp:224
T NormalizeAngle180(T Angle)
Normalize angle to be in the -180.0 .. 180.0 range.
Definition: trigo.h:387
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const override
Definition: lib_shape.h:57
const wxPoint & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:122
for transforming drawing coordinates for a wxDC device context.
Definition: transform.h:45
const std::vector< VECTOR2I > & CPoints() const
void move(const wxPoint &aMoveVector)
Definition: eda_shape.cpp:137
COMPARE_FLAGS
The list of flags used by the compare function.
Definition: lib_item.h:80
SHAPE_T
Definition: eda_shape.h:40
SHAPE_LINE_CHAIN & Outline(int aIndex)
std::vector< wxPoint > m_bezierPoints
Definition: eda_shape.h:307
SHAPE_POLY_SET m_poly
Definition: eda_shape.h:308
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, const COLOR4D &Color)
Draw a circle onto the drawing context aDC centered at the user coordinates (x,y).
Definition: gr_basic.cpp:507
#define MINIMUM_SELECTION_DISTANCE
Definition: lib_item.h:47
int m_editState
Definition: eda_shape.h:310
FILL_T m_fill
Definition: eda_shape.h:298
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:120
void MirrorVertical(const wxPoint &aCenter) override
Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.
Definition: lib_shape.cpp:98
#define STRUCT_DELETED
flag indication structures to be erased
#define _(s)
wxDC * GetPrintDC() const
void Plot(PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) const override
Plot the draw item using the plot object.
Definition: lib_shape.cpp:112
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: lib_shape.cpp:45
wxPoint GetCenter() const
Definition: lib_shape.h:89
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:71
void setPosition(const wxPoint &aPos)
Definition: eda_shape.cpp:89
int NewOutline()
Creates a new hole in a given outline.
void Offset(const wxPoint &aOffset) override
Set the drawing object by aOffset from the current position.
Definition: lib_shape.cpp:80
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:43
int Compare(const EDA_SHAPE *aOther) const
Definition: eda_shape.cpp:1424
wxPoint m_start
Definition: eda_shape.h:299
const EDA_RECT GetBoundingBox() const override
Definition: lib_shape.cpp:340
virtual void SetColor(const COLOR4D &color)=0
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
EDA_UNITS
Definition: eda_units.h:38
void print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
Print the item to aDC.
Definition: lib_shape.cpp:214
const EDA_RECT getBoundingBox() const
Definition: eda_shape.cpp:596
Base plotter engine class.
Definition: plotter.h:121
void MoveTo(const wxPoint &aPosition) override
Move a draw object to aPosition.
Definition: lib_shape.cpp:86
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: lib_shape.cpp:358
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, const COLOR4D &Color)
Definition: gr_basic.cpp:544
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:156
TRANSFORM DefaultTransform
Definition: eeschema.cpp:56
#define SKIP_STRUCT
flag indicating that the structure should be ignored
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
void GRFilledArc1(EDA_RECT *ClipBox, wxDC *DC, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aCenter, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Definition: gr_basic.cpp:584
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Handle the component boundary box.
Definition: eda_rect.h:42
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
LIB_SHAPE(LIB_SYMBOL *aParent, SHAPE_T aShape, int aLineWidth=0, FILL_T aFillType=FILL_T::NO_FILL)
Definition: lib_shape.cpp:36
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:164
int GetDefaultPenWidth() const
SHAPE_T GetShape() const
Definition: eda_shape.h:92
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *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:453
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:183
int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const override
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_shape.cpp:69
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:79
int GetRadius() const
Definition: eda_shape.cpp:466
Message panel definition file.
void flip(const wxPoint &aCentre, bool aFlipLeftRight)
Definition: eda_shape.cpp:281
virtual int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:67
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
FILL_T GetFillType() const
Definition: eda_shape.h:79
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Definition: gr_basic.cpp:525
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103