KiCad PCB EDA Suite
dcode.cpp File Reference

D_CODE class implementation. More...

#include <fctsys.h>
#include <common.h>
#include <class_drawpanel.h>
#include <trigo.h>
#include <gerbview_frame.h>
#include <class_gerber_file_image.h>
#include <convert_to_biu.h>

Go to the source code of this file.

Macros

#define DCODE_DEFAULT_SIZE   Millimeter2iu( 0.1 )
 
#define SEGS_CNT   32
 

Functions

static void addHoleToPolygon (std::vector< wxPoint > &aBuffer, APERTURE_DEF_HOLETYPE aHoleShape, wxSize aSize, wxPoint aAnchorPos)
 

Detailed Description

D_CODE class implementation.

Definition in file dcode.cpp.

Macro Definition Documentation

#define DCODE_DEFAULT_SIZE   Millimeter2iu( 0.1 )

Definition at line 40 of file dcode.cpp.

Referenced by D_CODE::Clear_D_CODE_Data().

#define SEGS_CNT   32

Definition at line 290 of file dcode.cpp.

Referenced by addHoleToPolygon(), and D_CODE::ConvertShapeToPolygon().

Function Documentation

static void addHoleToPolygon ( std::vector< wxPoint > &  aBuffer,
APERTURE_DEF_HOLETYPE  aHoleShape,
wxSize  aSize,
wxPoint  aAnchorPos 
)
static

Definition at line 434 of file dcode.cpp.

References APT_DEF_RECT_HOLE, APT_DEF_ROUND_HOLE, RotatePoint(), SEGS_CNT, wxPoint::x, and wxPoint::y.

Referenced by D_CODE::ConvertShapeToPolygon().

438 {
439  wxPoint currpos;
440 
441  if( aHoleShape == APT_DEF_ROUND_HOLE ) // build a round hole
442  {
443  for( int ii = 0; ii <= SEGS_CNT; ii++ )
444  {
445  currpos.x = 0;
446  currpos.y = aSize.x / 2; // aSize.x / 2 is the radius of the hole
447  RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
448  aBuffer.push_back( currpos );
449  }
450 
451  aBuffer.push_back( aAnchorPos ); // link to outline
452  }
453 
454  if( aHoleShape == APT_DEF_RECT_HOLE ) // Create rectangular hole
455  {
456  currpos.x = aSize.x / 2;
457  currpos.y = aSize.y / 2;
458  aBuffer.push_back( currpos ); // link to hole and begin hole
459  currpos.x -= aSize.x;
460  aBuffer.push_back( currpos );
461  currpos.y -= aSize.y;
462  aBuffer.push_back( currpos );
463  currpos.x += aSize.x;
464  aBuffer.push_back( currpos );
465  currpos.y += aSize.y;
466  aBuffer.push_back( currpos ); // close hole
467  aBuffer.push_back( aAnchorPos ); // link to outline
468  }
469 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
#define SEGS_CNT
Definition: dcode.cpp:290