KiCad PCB EDA Suite
D_CODE Class Reference

Class D_CODE holds a gerber DCODE (also called Aperture) definition. More...

#include <dcode.h>

Public Member Functions

 D_CODE (int num_dcode)
 
 ~D_CODE ()
 
void Clear_D_CODE_Data ()
 
void AppendParam (double aValue)
 AppendParam() Add a parameter to the D_CODE parameter list. More...
 
unsigned GetParamCount () const
 GetParamCount() Returns the number of parameters stored in parameter list. More...
 
double GetParam (unsigned aIdx) const
 GetParam() Returns a parameter stored in parameter list. More...
 
void SetMacro (APERTURE_MACRO *aMacro)
 
APERTURE_MACROGetMacro () const
 
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. More...
 
void DrawFlashedPolygon (GERBER_DRAW_ITEM *aParent, EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, bool aFilled, const wxPoint &aPosition)
 Function DrawFlashedPolygon a helper function used to draw the polygon stored ion m_PolyCorners Draw some Apertures shapes when they are defined as filled polygons. More...
 
void ConvertShapeToPolygon ()
 Function ConvertShapeToPolygon convert a shape to an equivalent polygon. More...
 
int GetShapeDim (GERBER_DRAW_ITEM *aParent)
 Function GetShapeDim calculates a value that can be used to evaluate the size of text when displaying the D-Code of an item due to the complexity of some shapes, one cannot calculate the "size" of a shape (only a bounding box) but here, the "dimension" of the shape is the diameter of the primitive or for lines the width of the line if the shape is a line. More...
 

Static Public Member Functions

static const wxChar * ShowApertureType (APERTURE_T aType)
 Function ShowApertureType returns a character string telling what type of aperture type aType is. More...
 

Public Attributes

wxSize m_Size
 Horizontal and vertical dimensions. More...
 
APERTURE_T m_Shape
 shape ( Line, rectangle, circle , oval .. ) More...
 
int m_Num_Dcode
 D code value ( >= 10 ) More...
 
wxSize m_Drill
 dimension of the hole (if any) (draill file) More...
 
APERTURE_DEF_HOLETYPE m_DrillShape
 shape of the hole (0 = no hole, round = 1, rect = 2) */ More...
 
double m_Rotation
 shape rotation in degrees More...
 
int m_EdgesCount
 in aperture definition Polygon only: number of edges for the polygon More...
 
bool m_InUse
 false if the aperure (previously defined) is not used to draw something More...
 
bool m_Defined
 false if the aperture is not defined in the header More...
 
wxString m_AperFunction
 the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE More...
 

Private Attributes

APERTURE_MACROm_Macro
 no ownership, points to More...
 
std::vector< double > m_am_params
 parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters would customize the macro. More...
 
std::vector< wxPointm_PolyCorners
 

Detailed Description

Class D_CODE holds a gerber DCODE (also called Aperture) definition.

Definition at line 81 of file dcode.h.

Constructor & Destructor Documentation

D_CODE::D_CODE ( int  num_dcode)

Definition at line 66 of file dcode.cpp.

References Clear_D_CODE_Data(), and m_Num_Dcode.

67 {
68  m_Num_Dcode = num_dcode;
70 }
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:100
void Clear_D_CODE_Data()
Definition: dcode.cpp:78
D_CODE::~D_CODE ( )

Definition at line 73 of file dcode.cpp.

74 {
75 }

Member Function Documentation

void D_CODE::AppendParam ( double  aValue)
inline

AppendParam() Add a parameter to the D_CODE parameter list.

used to customize the corresponding aperture macro

Definition at line 123 of file dcode.h.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

124  {
125  m_am_params.push_back( aValue );
126  }
std::vector< double > m_am_params
parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters wo...
Definition: dcode.h:90
void D_CODE::Clear_D_CODE_Data ( )

Definition at line 78 of file dcode.cpp.

References APT_CIRCLE, APT_DEF_NO_HOLE, DCODE_DEFAULT_SIZE, m_Defined, m_Drill, m_DrillShape, m_EdgesCount, m_InUse, m_Macro, m_PolyCorners, m_Rotation, m_Shape, and m_Size.

Referenced by D_CODE(), and GERBER_FILE_IMAGE::InitToolTable().

79 {
83  m_Drill.x = m_Drill.y = 0;
85  m_InUse = false;
86  m_Defined = false;
87  m_Macro = NULL;
88  m_Rotation = 0.0;
89  m_EdgesCount = 0;
90  m_PolyCorners.clear();
91 }
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:98
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:106
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
double m_Rotation
shape rotation in degrees
Definition: dcode.h:103
APERTURE_MACRO * m_Macro
no ownership, points to
Definition: dcode.h:84
wxSize m_Drill
dimension of the hole (if any) (draill file)
Definition: dcode.h:101
#define DCODE_DEFAULT_SIZE
Definition: dcode.cpp:40
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:108
std::vector< wxPoint > m_PolyCorners
Definition: dcode.h:92
APERTURE_DEF_HOLETYPE m_DrillShape
shape of the hole (0 = no hole, round = 1, rect = 2) */
Definition: dcode.h:102
int m_EdgesCount
in aperture definition Polygon only: number of edges for the polygon
Definition: dcode.h:104
void D_CODE::ConvertShapeToPolygon ( )

Function ConvertShapeToPolygon convert a shape to an equivalent polygon.

Arcs and circles are approximated by segments Useful when a shape is not a graphic primitive (shape with hole, rotated shape ... ) and cannot be easily drawn.

Definition at line 300 of file dcode.cpp.

References addHoleToPolygon(), PNS::angle(), APT_CIRCLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, delta, KiROUND(), m_Drill, m_DrillShape, m_EdgesCount, m_PolyCorners, m_Rotation, m_Shape, m_Size, RotatePoint(), SEGS_CNT, wxPoint::x, and wxPoint::y.

Referenced by DrawFlashedShape().

301 {
302  wxPoint initialpos;
303  wxPoint currpos;
304 
305  m_PolyCorners.clear();
306 
307  switch( m_Shape )
308  {
309  case APT_CIRCLE: // creates only a circle with rectangular hole
310  currpos.x = m_Size.x >> 1;
311  initialpos = currpos;
312 
313  for( unsigned ii = 0; ii <= SEGS_CNT; ii++ )
314  {
315  currpos = initialpos;
316  RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
317  m_PolyCorners.push_back( currpos );
318  }
319 
321  break;
322 
323  case APT_RECT:
324  currpos.x = m_Size.x / 2;
325  currpos.y = m_Size.y / 2;
326  initialpos = currpos;
327  m_PolyCorners.push_back( currpos );
328  currpos.x -= m_Size.x;
329  m_PolyCorners.push_back( currpos );
330  currpos.y -= m_Size.y;
331  m_PolyCorners.push_back( currpos );
332  currpos.x += m_Size.x;
333  m_PolyCorners.push_back( currpos );
334  currpos.y += m_Size.y;
335  m_PolyCorners.push_back( currpos ); // close polygon
336 
338  break;
339 
340  case APT_OVAL:
341  {
342  int delta, radius;
343 
344  // we create an horizontal oval shape. then rotate if needed
345  if( m_Size.x > m_Size.y ) // horizontal oval
346  {
347  delta = (m_Size.x - m_Size.y) / 2;
348  radius = m_Size.y / 2;
349  }
350  else // vertical oval
351  {
352  delta = (m_Size.y - m_Size.x) / 2;
353  radius = m_Size.x / 2;
354  }
355 
356  currpos.y = radius;
357  initialpos = currpos;
358  m_PolyCorners.push_back( currpos );
359 
360  // build the right arc of the shape
361  unsigned ii = 0;
362 
363  for( ; ii <= SEGS_CNT / 2; ii++ )
364  {
365  currpos = initialpos;
366  RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
367  currpos.x += delta;
368  m_PolyCorners.push_back( currpos );
369  }
370 
371  // build the left arc of the shape
372  for( ii = SEGS_CNT / 2; ii <= SEGS_CNT; ii++ )
373  {
374  currpos = initialpos;
375  RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
376  currpos.x -= delta;
377  m_PolyCorners.push_back( currpos );
378  }
379 
380  m_PolyCorners.push_back( initialpos ); // close outline
381 
382  if( m_Size.y > m_Size.x ) // vertical oval, rotate polygon.
383  {
384  for( unsigned jj = 0; jj < m_PolyCorners.size(); jj++ )
385  RotatePoint( &m_PolyCorners[jj], 900 );
386  }
387 
389  }
390  break;
391 
392  case APT_POLYGON:
393  currpos.x = m_Size.x >> 1; // first point is on X axis
394  initialpos = currpos;
395 
396  // rs274x said: m_EdgesCount = 3 ... 12
397  if( m_EdgesCount < 3 )
398  m_EdgesCount = 3;
399 
400  if( m_EdgesCount > 12 )
401  m_EdgesCount = 12;
402 
403  for( int ii = 0; ii <= m_EdgesCount; ii++ )
404  {
405  currpos = initialpos;
406  RotatePoint( &currpos, ii * 3600.0 / m_EdgesCount );
407  m_PolyCorners.push_back( currpos );
408  }
409 
411 
412  if( m_Rotation ) // vertical oval, rotate polygon.
413  {
414  int angle = KiROUND( m_Rotation * 10 );
415 
416  for( unsigned jj = 0; jj < m_PolyCorners.size(); jj++ )
417  {
418  RotatePoint( &m_PolyCorners[jj], -angle );
419  }
420  }
421 
422  break;
423 
424  case APT_MACRO:
425 
426  // TODO
427  break;
428  }
429 }
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
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:98
Definition: dcode.h:52
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
double m_Rotation
shape rotation in degrees
Definition: dcode.h:103
wxSize m_Drill
dimension of the hole (if any) (draill file)
Definition: dcode.h:101
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
static const int delta[8][2]
Definition: solve.cpp:112
Definition: dcode.h:51
std::vector< wxPoint > m_PolyCorners
Definition: dcode.h:92
#define SEGS_CNT
Definition: dcode.cpp:290
APERTURE_DEF_HOLETYPE m_DrillShape
shape of the hole (0 = no hole, round = 1, rect = 2) */
Definition: dcode.h:102
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
int m_EdgesCount
in aperture definition Polygon only: number of edges for the polygon
Definition: dcode.h:104
static void addHoleToPolygon(std::vector< wxPoint > &aBuffer, APERTURE_DEF_HOLETYPE aHoleShape, wxSize aSize, wxPoint aAnchorPos)
Definition: dcode.cpp:434
void D_CODE::DrawFlashedPolygon ( GERBER_DRAW_ITEM aParent,
EDA_RECT aClipBox,
wxDC *  aDC,
COLOR4D  aColor,
bool  aFilled,
const wxPoint aPosition 
)

Function DrawFlashedPolygon a helper function used to draw the polygon stored ion m_PolyCorners Draw some Apertures shapes when they are defined as filled polygons.

APT_POLYGON is always a polygon, but some complex shapes are also converted to polygons (shapes with holes, some rotated shapes)

Parameters
aParent= the GERBER_DRAW_ITEM being drawn
aClipBox= DC clip box (NULL is no clip)
aDC= device context
aColor= the normal color to use
aFilled= true to draw in filled mode, false to draw in sketch mode
aPosition= the actual shape position

Definition at line 269 of file dcode.cpp.

References GERBER_DRAW_ITEM::GetABPosition(), GRClosedPoly(), and m_PolyCorners.

Referenced by DrawFlashedShape().

273 {
274  if( m_PolyCorners.size() == 0 )
275  return;
276 
277  std::vector<wxPoint> points;
278  points = m_PolyCorners;
279 
280  for( unsigned ii = 0; ii < points.size(); ii++ )
281  {
282  points[ii] += aPosition;
283  points[ii] = aParent->GetABPosition( points[ii] );
284  }
285 
286  GRClosedPoly( aClipBox, aDC, points.size(), &points[0], aFilled, aColor, aColor );
287 }
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
std::vector< wxPoint > m_PolyCorners
Definition: dcode.h:92
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
void D_CODE::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.

When an item is flashed, the DCode shape is the shape of the item

Parameters
aParent= the GERBER_DRAW_ITEM being drawn
aClipBox= DC clip box (NULL is no clip)
aDC= device context
aColor= the normal color to use
aShapePos= the actual shape position
aFilledShape= true to draw in filled mode, false to draw in sketch mode

Definition at line 153 of file dcode.cpp.

References APT_CIRCLE, APT_DEF_NO_HOLE, APT_DEF_ROUND_HOLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, ConvertShapeToPolygon(), delta, APERTURE_MACRO::DrawApertureMacroShape(), DrawFlashedPolygon(), GERBER_DRAW_ITEM::GetABPosition(), GetMacro(), GRCircle(), GRCSegm(), GRFillCSegm(), GRFilledCircle(), GRFilledRect(), GRRect(), m_Drill, m_DrillShape, m_PolyCorners, m_Shape, m_Size, wxPoint::x, and wxPoint::y.

Referenced by GERBER_DRAW_ITEM::Draw().

156 {
157  int radius;
158 
159  switch( m_Shape )
160  {
161  case APT_MACRO:
162  GetMacro()->DrawApertureMacroShape( aParent, aClipBox, aDC, aColor,
163  aShapePos, aFilledShape);
164  break;
165 
166  case APT_CIRCLE:
167  radius = m_Size.x >> 1;
168  if( !aFilledShape )
169  GRCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos), radius, 0, aColor );
170  else
172  {
173  GRFilledCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos),
174  radius, aColor );
175  }
176  else if( APT_DEF_ROUND_HOLE == 1 ) // round hole in shape
177  {
178  int width = (m_Size.x - m_Drill.x ) / 2;
179  GRCircle( aClipBox, aDC, aParent->GetABPosition(aShapePos),
180  radius - (width / 2), width, aColor );
181  }
182  else // rectangular hole
183  {
184  if( m_PolyCorners.size() == 0 )
186 
187  DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
188  }
189  break;
190 
191  case APT_RECT:
192  {
193  wxPoint start;
194  start.x = aShapePos.x - m_Size.x / 2;
195  start.y = aShapePos.y - m_Size.y / 2;
196  wxPoint end = start + m_Size;
197  start = aParent->GetABPosition( start );
198  end = aParent->GetABPosition( end );
199 
200  if( !aFilledShape )
201  {
202  GRRect( aClipBox, aDC, start.x, start.y, end.x, end.y, 0, aColor );
203  }
204  else if( m_DrillShape == APT_DEF_NO_HOLE )
205  {
206  GRFilledRect( aClipBox, aDC, start.x, start.y, end.x, end.y, 0, aColor, aColor );
207  }
208  else
209  {
210  if( m_PolyCorners.size() == 0 )
212 
213  DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
214  }
215  }
216  break;
217 
218  case APT_OVAL:
219  {
220  wxPoint start = aShapePos;
221  wxPoint end = aShapePos;
222 
223  if( m_Size.x > m_Size.y ) // horizontal oval
224  {
225  int delta = (m_Size.x - m_Size.y) / 2;
226  start.x -= delta;
227  end.x += delta;
228  radius = m_Size.y;
229  }
230  else // horizontal oval
231  {
232  int delta = (m_Size.y - m_Size.x) / 2;
233  start.y -= delta;
234  end.y += delta;
235  radius = m_Size.x;
236  }
237 
238  start = aParent->GetABPosition( start );
239  end = aParent->GetABPosition( end );
240 
241  if( !aFilledShape )
242  {
243  GRCSegm( aClipBox, aDC, start.x, start.y, end.x, end.y, radius, aColor );
244  }
245  else if( m_DrillShape == APT_DEF_NO_HOLE )
246  {
247  GRFillCSegm( aClipBox, aDC, start.x, start.y, end.x, end.y, radius, aColor );
248  }
249  else
250  {
251  if( m_PolyCorners.size() == 0 )
253 
254  DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
255  }
256  }
257  break;
258 
259  case APT_POLYGON:
260  if( m_PolyCorners.size() == 0 )
262 
263  DrawFlashedPolygon( aParent, aClipBox, aDC, aColor, aFilledShape, aShapePos );
264  break;
265  }
266 }
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:98
Definition: dcode.h:52
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
void DrawApertureMacroShape(GERBER_DRAW_ITEM *aParent, EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, wxPoint aShapePos, bool aFilledShape)
Function DrawApertureMacroShape Draw the primitive shape for flashed items.
void GRFilledRect(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:1117
wxSize m_Drill
dimension of the hole (if any) (draill file)
Definition: dcode.h:101
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
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:833
static const int delta[8][2]
Definition: solve.cpp:112
Definition: dcode.h:51
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
std::vector< wxPoint > m_PolyCorners
Definition: dcode.h:92
void GRFillCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:584
void DrawFlashedPolygon(GERBER_DRAW_ITEM *aParent, EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, bool aFilled, const wxPoint &aPosition)
Function DrawFlashedPolygon a helper function used to draw the polygon stored ion m_PolyCorners Draw ...
Definition: dcode.cpp:269
APERTURE_DEF_HOLETYPE m_DrillShape
shape of the hole (0 = no hole, round = 1, rect = 2) */
Definition: dcode.h:102
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:791
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:158
void ConvertShapeToPolygon()
Function ConvertShapeToPolygon convert a shape to an equivalent polygon.
Definition: dcode.cpp:300
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
APERTURE_MACRO* D_CODE::GetMacro ( ) const
inline

Definition at line 158 of file dcode.h.

References m_Macro.

Referenced by DrawFlashedShape(), AM_PARAM::GetValue(), and GERBER_DRAW_ITEM::ShowGBRShape().

158 { return m_Macro; }
APERTURE_MACRO * m_Macro
no ownership, points to
Definition: dcode.h:84
double D_CODE::GetParam ( unsigned  aIdx) const
inline

GetParam() Returns a parameter stored in parameter list.

Parameters
aIdx= index of parameter

Definition at line 142 of file dcode.h.

Referenced by AM_PARAM::GetValue().

143  {
144  wxASSERT( aIdx <= m_am_params.size() );
145  if( aIdx <= m_am_params.size() )
146  return m_am_params[aIdx - 1];
147  else
148  return 0;
149  }
std::vector< double > m_am_params
parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters wo...
Definition: dcode.h:90
unsigned D_CODE::GetParamCount ( ) const
inline

GetParamCount() Returns the number of parameters stored in parameter list.

Definition at line 132 of file dcode.h.

Referenced by AM_PARAM::GetValue().

133  {
134  return m_am_params.size();
135  }
std::vector< double > m_am_params
parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters wo...
Definition: dcode.h:90
int D_CODE::GetShapeDim ( GERBER_DRAW_ITEM aParent)

Function GetShapeDim calculates a value that can be used to evaluate the size of text when displaying the D-Code of an item due to the complexity of some shapes, one cannot calculate the "size" of a shape (only a bounding box) but here, the "dimension" of the shape is the diameter of the primitive or for lines the width of the line if the shape is a line.

Parameters
aParent= the parent GERBER_DRAW_ITEM which is actually drawn
Returns
a dimension, or -1 if no dim to calculate

Definition at line 122 of file dcode.cpp.

References APT_CIRCLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, APERTURE_MACRO::GetShapeDim(), m_Macro, m_Shape, m_Size, and min.

123 {
124  int dim = -1;
125  switch( m_Shape )
126  {
127  case APT_CIRCLE:
128  dim = m_Size.x;
129  break;
130 
131  case APT_RECT:
132  case APT_OVAL:
133  dim = std::min( m_Size.x, m_Size.y );
134  break;
135 
136  case APT_POLYGON:
137  dim = std::min( m_Size.x, m_Size.y );
138  break;
139 
140  case APT_MACRO:
141  if( m_Macro )
142  dim = m_Macro->GetShapeDim( aParent );
143  break;
144 
145  default:
146  break;
147  }
148 
149  return dim;
150 }
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:98
Definition: dcode.h:52
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
APERTURE_MACRO * m_Macro
no ownership, points to
Definition: dcode.h:84
Definition: dcode.h:51
int GetShapeDim(GERBER_DRAW_ITEM *aParent)
Function GetShapeDim Calculate a value that can be used to evaluate the size of text when displaying ...
#define min(a, b)
Definition: auxiliary.h:85
void D_CODE::SetMacro ( APERTURE_MACRO aMacro)
inline

Definition at line 152 of file dcode.h.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

153  {
154  m_Macro = aMacro;
155  }
APERTURE_MACRO * m_Macro
no ownership, points to
Definition: dcode.h:84
const wxChar * D_CODE::ShowApertureType ( APERTURE_T  aType)
static

Function ShowApertureType returns a character string telling what type of aperture type aType is.

Parameters
aTypeThe aperture type to show.

Definition at line 94 of file dcode.cpp.

References APT_CIRCLE, APT_MACRO, APT_OVAL, APT_POLYGON, and APT_RECT.

Referenced by GERBVIEW_FRAME::Liste_D_Codes(), and GERBVIEW_FRAME::updateDCodeSelectBox().

95 {
96  const wxChar* ret;
97 
98  switch( aType )
99  {
100  case APT_CIRCLE:
101  ret = wxT( "Round" ); break;
102 
103  case APT_RECT:
104  ret = wxT( "Rect" ); break;
105 
106  case APT_OVAL:
107  ret = wxT( "Oval" ); break;
108 
109  case APT_POLYGON:
110  ret = wxT( "Poly" ); break;
111 
112  case APT_MACRO:
113  ret = wxT( "Macro" ); break;
114 
115  default:
116  ret = wxT( "???" ); break;
117  }
118 
119  return ret;
120 }
Definition: dcode.h:52
Definition: dcode.h:51

Member Data Documentation

std::vector<double> D_CODE::m_am_params
private

parameters used only when this D_CODE holds a reference to an aperture macro, and these parameters would customize the macro.

Definition at line 90 of file dcode.h.

wxSize D_CODE::m_Drill

dimension of the hole (if any) (draill file)

Definition at line 101 of file dcode.h.

Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), DrawFlashedShape(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().

APERTURE_DEF_HOLETYPE D_CODE::m_DrillShape

shape of the hole (0 = no hole, round = 1, rect = 2) */

Definition at line 102 of file dcode.h.

Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), DrawFlashedShape(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().

int D_CODE::m_EdgesCount

in aperture definition Polygon only: number of edges for the polygon

Definition at line 104 of file dcode.h.

Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().

APERTURE_MACRO* D_CODE::m_Macro
private

no ownership, points to

Definition at line 84 of file dcode.h.

Referenced by Clear_D_CODE_Data(), GetMacro(), and GetShapeDim().

std::vector<wxPoint> D_CODE::m_PolyCorners
private
double D_CODE::m_Rotation

shape rotation in degrees

Definition at line 103 of file dcode.h.

Referenced by Clear_D_CODE_Data(), ConvertShapeToPolygon(), and GERBER_FILE_IMAGE::ExecuteRS274XCommand().


The documentation for this class was generated from the following files: