KiCad PCB EDA Suite
class_gerber_draw_item.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) 1992-2016 <Jean-Pierre Charras>
5  * Copyright (C) 1992-2016 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 
29 #include <fctsys.h>
30 #include <gr_basic.h>
31 #include <common.h>
32 #include <trigo.h>
33 #include <class_drawpanel.h>
34 #include <msgpanel.h>
35 #include <gerbview_frame.h>
36 
37 #include <class_gerber_draw_item.h>
40 
41 
44 {
45  m_GerberImageFile = aGerberImageFile;
47  m_Flashed = false;
48  m_DCode = 0;
49  m_UnitsMetric = false;
50  m_LayerNegative = false;
51  m_swapAxis = false;
52  m_mirrorA = false;
53  m_mirrorB = false;
54  m_drawScale.x = m_drawScale.y = 1.0;
55  m_lyrRotation = 0;
56 
57  if( m_GerberImageFile )
59 }
60 
61 
63 {
64 }
65 
66 
68 {
69  m_netAttributes = aNetAttributes;
70 
73  m_GerberImageFile->m_ComponentsList.insert( std::make_pair( m_netAttributes.m_Cmpref, 0 ) );
74 
76  m_GerberImageFile->m_NetnamesList.insert( std::make_pair( m_netAttributes.m_Netname, 0 ) );
77 }
78 
79 
81 {
82  // returns the layer this item is on, or 0 if the m_GerberImageFile is NULL.
84 }
85 
86 
87 wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
88 {
89  /* Note: RS274Xrevd_e is obscure about the order of transforms:
90  * For instance: Rotation must be made after or before mirroring ?
91  * Note: if something is changed here, GetYXPosition must reflect changes
92  */
93  wxPoint abPos = aXYPosition + m_GerberImageFile->m_ImageJustifyOffset;
94 
95  if( m_swapAxis )
96  std::swap( abPos.x, abPos.y );
97 
99  abPos.x = KiROUND( abPos.x * m_drawScale.x );
100  abPos.y = KiROUND( abPos.y * m_drawScale.y );
101  double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
102 
103  if( rotation )
104  RotatePoint( &abPos, -rotation );
105 
106  // Negate A axis if mirrored
107  if( m_mirrorA )
108  abPos.x = -abPos.x;
109 
110  // abPos.y must be negated when no mirror, because draw axis is top to bottom
111  if( !m_mirrorB )
112  abPos.y = -abPos.y;
113  return abPos;
114 }
115 
116 
118 {
119  // do the inverse transform made by GetABPosition
120  wxPoint xyPos = aABPosition;
121 
122  if( m_mirrorA )
123  xyPos.x = -xyPos.x;
124 
125  if( !m_mirrorB )
126  xyPos.y = -xyPos.y;
127 
128  double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
129 
130  if( rotation )
131  RotatePoint( &xyPos, rotation );
132 
133  xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
134  xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
136 
137  if( m_swapAxis )
138  std::swap( xyPos.x, xyPos.y );
139 
140  return xyPos - m_GerberImageFile->m_ImageJustifyOffset;
141 }
142 
143 
145 {
147  m_swapAxis = m_GerberImageFile->m_SwapAxis; // false if A = X, B = Y;
148 
149  // true if A =Y, B = Y
150  m_mirrorA = m_GerberImageFile->m_MirrorA; // true: mirror / axe A
151  m_mirrorB = m_GerberImageFile->m_MirrorB; // true: mirror / axe B
152  m_drawScale = m_GerberImageFile->m_Scale; // A and B scaling factor
153  m_layerOffset = m_GerberImageFile->m_Offset; // Offset from OF command
154 
155  // Rotation from RO command:
158 }
159 
160 
162 {
163  switch( m_Shape )
164  {
165  case GBR_SEGMENT:
166  return _( "Line" );
167 
168  case GBR_ARC:
169  return _( "Arc" );
170 
171  case GBR_CIRCLE:
172  return _( "Circle" );
173 
174  case GBR_SPOT_OVAL:
175  return wxT( "spot_oval" );
176 
177  case GBR_SPOT_CIRCLE:
178  return wxT( "spot_circle" );
179 
180  case GBR_SPOT_RECT:
181  return wxT( "spot_rect" );
182 
183  case GBR_SPOT_POLY:
184  return wxT( "spot_poly" );
185 
186  case GBR_POLYGON:
187  return wxT( "polygon" );
188 
189  case GBR_SPOT_MACRO:
190  {
191  wxString name = wxT( "apt_macro" );
192  D_CODE* dcode = GetDcodeDescr();
193 
194  if( dcode && dcode->GetMacro() )
195  name << wxT(" ") << dcode->GetMacro()->name;
196 
197  return name;
198  }
199 
200  default:
201  return wxT( "??" );
202  }
203 }
204 
205 
207 {
208  if( (m_DCode < FIRST_DCODE) || (m_DCode > LAST_DCODE) )
209  return NULL;
210 
211  if( m_GerberImageFile == NULL )
212  return NULL;
213 
214  return m_GerberImageFile->GetDCODE( m_DCode, false );
215 }
216 
217 
219 {
220  // return a rectangle which is (pos,dim) in nature. therefore the +1
221  EDA_RECT bbox( m_Start, wxSize( 1, 1 ) );
222 
223  bbox.Inflate( m_Size.x / 2, m_Size.y / 2 );
224 
225  // calculate the corners coordinates in current gerber axis orientations
226  wxPoint org = GetABPosition( bbox.GetOrigin() );
227  wxPoint end = GetABPosition( bbox.GetEnd() );
228 
229  // Set the corners position:
230  bbox.SetOrigin( org );
231  bbox.SetEnd( end );
232  bbox.Normalize();
233 
234  return bbox;
235 }
236 
237 
238 void GERBER_DRAW_ITEM::MoveAB( const wxPoint& aMoveVector )
239 {
240  wxPoint xymove = GetXYPosition( aMoveVector );
241 
242  m_Start += xymove;
243  m_End += xymove;
244  m_ArcCentre += xymove;
245 
246  for( unsigned ii = 0; ii < m_PolyCorners.size(); ii++ )
247  m_PolyCorners[ii] += xymove;
248 }
249 
250 
251 void GERBER_DRAW_ITEM::MoveXY( const wxPoint& aMoveVector )
252 {
253  m_Start += aMoveVector;
254  m_End += aMoveVector;
255  m_ArcCentre += aMoveVector;
256 
257  for( unsigned ii = 0; ii < m_PolyCorners.size(); ii++ )
258  m_PolyCorners[ii] += aMoveVector;
259 }
260 
261 
263 {
265 
266  // if isClear is true, this item has negative shape
267  return isClear;
268 }
269 
270 
271 void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
272  const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aDrawOptions )
273 {
274  // used when a D_CODE is not found. default D_CODE to draw a flashed item
275  static D_CODE dummyD_CODE( 0 );
276  bool isFilled;
277  int radius;
278  int halfPenWidth;
279  static bool show_err;
280  D_CODE* d_codeDescr = GetDcodeDescr();
281 
282  if( d_codeDescr == NULL )
283  d_codeDescr = &dummyD_CODE;
284 
286 
287  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
288  color.SetToLegacyHighlightColor();
289 
290  /* isDark is true if flash is positive and should use a drawing
291  * color other than the background color, else use the background color
292  * when drawing so that an erasure happens.
293  */
295 
296  if( !isDark )
297  {
298  // draw in background color ("negative" color)
299  color = aDrawOptions->m_NegativeDrawColor;
300  }
301 
302  GRSetDrawMode( aDC, aDrawMode );
303 
304  isFilled = aDrawOptions->m_DisplayLinesFill;
305 
306  switch( m_Shape )
307  {
308  case GBR_POLYGON:
309  isFilled = aDrawOptions->m_DisplayPolygonsFill;
310 
311  if( !isDark )
312  isFilled = true;
313 
314  DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );
315  break;
316 
317  case GBR_CIRCLE:
318  radius = KiROUND( GetLineLength( m_Start, m_End ) );
319 
320  halfPenWidth = m_Size.x >> 1;
321 
322  if( !isFilled )
323  {
324  // draw the border of the pen's path using two circles, each as narrow as possible
325  GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
326  radius - halfPenWidth, 0, color );
327  GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
328  radius + halfPenWidth, 0, color );
329  }
330  else // Filled mode
331  {
332  GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
333  radius, m_Size.x, color );
334  }
335  break;
336 
337  case GBR_ARC:
338  // Currently, arcs plotted with a rectangular aperture are not supported.
339  // a round pen only is expected.
340 
341 #if 0 // for arc debug only
342  GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
343  GetABPosition( m_ArcCentre ), 0, color );
344  GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_End ),
345  GetABPosition( m_ArcCentre ), 0, color );
346 #endif
347 
348  if( !isFilled )
349  {
350  GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
352  0, color );
353  }
354  else
355  {
356  GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
358  m_Size.x, color );
359  }
360 
361  break;
362 
363  case GBR_SPOT_CIRCLE:
364  case GBR_SPOT_RECT:
365  case GBR_SPOT_OVAL:
366  case GBR_SPOT_POLY:
367  case GBR_SPOT_MACRO:
368  isFilled = aDrawOptions->m_DisplayFlashedItemsFill;
369  d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color,
370  m_Start, isFilled );
371  break;
372 
373  case GBR_SEGMENT:
374  /* Plot a line from m_Start to m_End.
375  * Usually, a round pen is used, but some gerber files use a rectangular pen
376  * In fact, any aperture can be used to plot a line.
377  * currently: only a square pen is handled (I believe using a polygon gives a strange plot).
378  */
379  if( d_codeDescr->m_Shape == APT_RECT )
380  {
381  if( m_PolyCorners.size() == 0 )
383 
384  DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );
385  }
386  else
387  {
388  if( !isFilled )
389  {
390  GRCSegm( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
391  GetABPosition( m_End ), m_Size.x, color );
392  }
393  else
394  {
395  GRFilledSegment( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
396  GetABPosition( m_End ), m_Size.x, color );
397  }
398  }
399 
400  break;
401 
402  default:
403  if( !show_err )
404  {
405  wxMessageBox( wxT( "Trace_Segment() type error" ) );
406  show_err = true;
407  }
408 
409  break;
410  }
411 }
412 
413 
415 {
416  m_PolyCorners.clear();
417  m_PolyCorners.reserve(6);
418 
419  wxPoint start = m_Start;
420  wxPoint end = m_End;
421 
422  // make calculations more easy if ensure start.x < end.x
423  // (only 2 quadrants to consider)
424  if( start.x > end.x )
425  std::swap( start, end );
426 
427  // calculate values relative to start point:
428  wxPoint delta = end - start;
429 
430  // calculate corners for the first quadrant only (delta.x and delta.y > 0 )
431  // currently, delta.x already is > 0.
432  // make delta.y > 0
433  bool change = delta.y < 0;
434 
435  if( change )
436  delta.y = -delta.y;
437 
438  // Now create the full polygon.
439  // Due to previous changes, the shape is always something like
440  // 3 4
441  // 2 5
442  // 1 6
443  wxPoint corner;
444  corner.x -= m_Size.x/2;
445  corner.y -= m_Size.y/2;
446  m_PolyCorners.push_back( corner ); // Lower left corner, start point (1)
447  corner.y += m_Size.y;
448  m_PolyCorners.push_back( corner ); // upper left corner, start point (2)
449 
450  if( delta.x || delta.y)
451  {
452  corner += delta;
453  m_PolyCorners.push_back( corner ); // upper left corner, end point (3)
454  }
455 
456  corner.x += m_Size.x;
457  m_PolyCorners.push_back( corner ); // upper right corner, end point (4)
458  corner.y -= m_Size.y;
459  m_PolyCorners.push_back( corner ); // lower right corner, end point (5)
460 
461  if( delta.x || delta.y )
462  {
463  corner -= delta;
464  m_PolyCorners.push_back( corner ); // lower left corner, start point (6)
465  }
466 
467  // Create final polygon:
468  for( unsigned ii = 0; ii < m_PolyCorners.size(); ii++ )
469  {
470  if( change )
471  m_PolyCorners[ii].y = -m_PolyCorners[ii].y;
472 
473  m_PolyCorners[ii] += start;
474  }
475 }
476 
477 
479  wxDC* aDC,
480  COLOR4D aColor,
481  const wxPoint& aOffset,
482  bool aFilledShape )
483 {
484  std::vector<wxPoint> points;
485 
486  points = m_PolyCorners;
487  for( unsigned ii = 0; ii < points.size(); ii++ )
488  {
489  points[ii] += aOffset;
490  points[ii] = GetABPosition( points[ii] );
491  }
492 
493  GRClosedPoly( aClipBox, aDC, points.size(), &points[0], aFilledShape, aColor, aColor );
494 }
495 
496 
497 void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
498 {
499  wxString msg;
500  wxString text;
501 
502  msg = ShowGBRShape();
503  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
504 
505  // Display D_Code value:
506  msg.Printf( _( "D Code %d" ), m_DCode );
507  D_CODE* apertDescr = GetDcodeDescr();
508 
509  if( apertDescr->m_AperFunction.IsEmpty() )
510  text = _( "No attribute" );
511  else
512  text = apertDescr->m_AperFunction;
513 
514  aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );
515 
516  // Display graphic layer number
518  aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, BROWN ) );
519 
520  // Display item rotation
521  // The full rotation is Image rotation + m_lyrRotation
522  // but m_lyrRotation is specific to this object
523  // so we display only this parameter
524  msg.Printf( wxT( "%f" ), m_lyrRotation );
525  aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BLUE ) );
526 
527  // Display item polarity (item specific)
528  msg = m_LayerNegative ? _("Clear") : _("Dark");
529  aList.push_back( MSG_PANEL_ITEM( _( "Polarity" ), msg, BLUE ) );
530 
531  // Display mirroring (item specific)
532  msg.Printf( wxT( "A:%s B:%s" ),
533  m_mirrorA ? _("Yes") : _("No"),
534  m_mirrorB ? _("Yes") : _("No"));
535  aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKRED ) );
536 
537  // Display AB axis swap (item specific)
538  msg = m_swapAxis ? wxT( "A=Y B=X" ) : wxT( "A=X B=Y" );
539  aList.push_back( MSG_PANEL_ITEM( _( "AB axis" ), msg, DARKRED ) );
540 
541  // Display net info, if exists
543  return;
544 
545  // Build full net info:
546  wxString net_msg;
547  wxString cmp_pad_msg;
548 
550  {
551  net_msg = _( "Net:" );
552  net_msg << " ";
553  if( m_netAttributes.m_Netname.IsEmpty() )
554  net_msg << "<no net name>";
555  else
556  net_msg << m_netAttributes.m_Netname;
557  }
558 
560  {
561  cmp_pad_msg.Printf( _( "Cmp: %s; Pad: %s" ),
564  }
565 
567  {
568  cmp_pad_msg = _( "Cmp:" );
569  cmp_pad_msg << " " << m_netAttributes.m_Cmpref;
570  }
571 
572 
573  aList.push_back( MSG_PANEL_ITEM( net_msg, cmp_pad_msg, CYAN ) );
574 }
575 
576 
577 bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos ) const
578 {
579  // calculate aRefPos in XY gerber axis:
580  wxPoint ref_pos = GetXYPosition( aRefPos );
581 
582  // TODO: a better analyze of the shape (perhaps create a D_CODE::HitTest for flashed items)
583  int radius = std::min( m_Size.x, m_Size.y ) >> 1;
584 
585  if( m_Flashed )
586  return HitTestPoints( m_Start, ref_pos, radius );
587  else
588  return TestSegmentHit( ref_pos, m_Start, m_End, radius );
589 }
590 
591 
592 bool GERBER_DRAW_ITEM::HitTest( const EDA_RECT& aRefArea ) const
593 {
594  wxPoint pos = GetABPosition( m_Start );
595 
596  if( aRefArea.Contains( pos ) )
597  return true;
598 
599  pos = GetABPosition( m_End );
600 
601  if( aRefArea.Contains( pos ) )
602  return true;
603 
604  return false;
605 }
606 
607 
608 #if defined(DEBUG)
609 
610 void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
611 {
612  NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
613 
614  " shape=\"" << m_Shape << '"' <<
615  " addr=\"" << std::hex << this << std::dec << '"' <<
616  " layer=\"" << GetLayer() << '"' <<
617  " size=\"" << m_Size << '"' <<
618  " flags=\"" << m_Flags << '"' <<
619  " status=\"" << GetStatus() << '"' <<
620  "<start" << m_Start << "/>" <<
621  "<end" << m_End << "/>";
622 
623  os << "</" << GetClass().Lower().mb_str() << ">\n";
624 }
625 
626 #endif
Definition: colors.h:57
COLOR4D GetPositiveDrawColor() const
void SetLayerParameters()
Function SetLayerParameters Initialize parameters from Image and Layer parameters found in the gerber...
void DrawGbrPoly(EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, const wxPoint &aOffset, bool aFilledShape)
Function DrawGbrPoly a helper function used to draw the polygon stored in m_PolyCorners.
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
wxString name
The name of the aperture macro.
wxString GetClass() const override
Function GetClass returns the class name.
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB...
Definition: trigo.h:183
void MoveAB(const wxPoint &aMoveVector)
Function MoveAB move this object.
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
print info associated to a component (TO.C attribute)
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
bool HasNegativeItems()
Function HasNegativeItems.
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
D_CODE * GetDcodeDescr()
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
bool Contains(const wxPoint &aPoint) const
Function Contains.
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
std::vector< wxPoint > m_PolyCorners
D_CODE * GetDCODE(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
GERBER_DRAW_ITEM(GERBER_FILE_IMAGE *aGerberparams)
wxString m_Cmpref
the component reference parent of the data
void SetOrigin(const wxPoint &pos)
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:481
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
void SetNetAttributes(const GBR_NETLIST_METADATA &aNetAttributes)
STATUS_FLAGS GetStatus() const
Definition: base_struct.h:250
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:777
static const int delta[8][2]
Definition: solve.cpp:112
Definition: dcode.h:51
Definition: colors.h:54
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
#define LAST_DCODE
Definition: dcode.h:71
const wxPoint & GetOrigin() const
COLOR4D m_NegativeDrawColor
The color used to draw negative objects, usually the background color, but not always, when negative objects must be visible.
int GetLayer() const
Function GetLayer returns the layer this item is on.
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
#define FIRST_DCODE
Definition: dcode.h:70
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
void SetEnd(int x, int y)
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
Definition: colors.h:59
static GERBER_FILE_IMAGE_LIST & GetImagesList()
GBR_NETLIST_METADATA m_netAttributes
the string given by a TO attribute set in aperture (dcode).
wxString m_Netname
for items associated to a net: the netname
EDA_RECT * GetClipBox()
Definition: colors.h:60
void ConvertSegmentToPolygon()
Function ConvertSegmentToPolygon convert a line to an equivalent polygon.
std::map< wxString, int > m_NetnamesList
const wxPoint GetEnd() const
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE ...
Definition: dcode.h:109
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset, GBR_DISPLAY_OPTIONS *aDrawOptions)
void Normalize()
Function Normalize ensures that the height ant width are positive.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:81
void DrawFlashedShape(GERBER_DRAW_ITEM *aParent, EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, wxPoint aShapePos, bool aFilledShape)
Function DrawFlashedShape Draw the dcode shape for flashed items.
Definition: dcode.cpp:153
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:592
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:791
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
Definition: trigo.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
Class EDA_RECT handles the component boundary box.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
The common library.
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:158
print info associated to a flashed pad (TO.P attribute)
bool HitTest(const wxPoint &aRefPos) const override
Function HitTest tests if the given wxPoint is within the bounds of this object.
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:142
void MoveXY(const wxPoint &aMoveVector)
Function MoveXY move this object.
Message panel definition file.
wxPoint GetXYPosition(const wxPoint &aABPosition) const
Function GetXYPosition returns the image position of aPosition for this object.
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
print info associated to a net (TO.N attribute)
GERBER_FILE_IMAGE * m_GerberImageFile
std::map< wxString, int > m_ComponentsList
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
#define min(a, b)
Definition: auxiliary.h:85
int m_NetAttribType
the type of net info (used to define the gerber string to create)
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:873
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62