KiCad PCB EDA Suite
class_aperture_macro.cpp File Reference
#include <fctsys.h>
#include <common.h>
#include <macros.h>
#include <trigo.h>
#include <convert_basic_shapes_to_polygon.h>
#include <gr_basic.h>
#include <gerbview.h>
#include <class_gerber_file_image.h>

Go to the source code of this file.

Macros

#define TO_POLY_SHAPE
 

Functions

int scaletoIU (double aCoord, bool isMetric)
 Function scaletoIU converts a distance given in floating point to our internal units. More...
 
static wxPoint mapPt (double x, double y, bool isMetric)
 Function mapPt translates a point from the aperture macro coordinate system to our deci-mils coordinate system. More...
 

Macro Definition Documentation

#define TO_POLY_SHAPE
Value:
{ aShapeBuffer.NewOutline(); \
for( unsigned jj = 0; jj < polybuffer.size(); jj++ )\
aShapeBuffer.Append( polybuffer[jj].x, polybuffer[jj].y );}

Referenced by AM_PRIMITIVE::DrawBasicShape().

Function Documentation

static wxPoint mapPt ( double  x,
double  y,
bool  isMetric 
)
static

Function mapPt translates a point from the aperture macro coordinate system to our deci-mils coordinate system.

Returns
wxPoint - The GerbView coordinate system vector.

Definition at line 54 of file class_aperture_macro.cpp.

References scaletoIU().

Referenced by AM_PRIMITIVE::ConvertShapeToPolygon(), AM_PRIMITIVE::DrawBasicShape(), and AM_PRIMITIVE::GetShapeDim().

55 {
56  wxPoint ret( scaletoIU( x, isMetric ), scaletoIU( y, isMetric ) );
57 
58  return ret;
59 }
int scaletoIU(double aCoord, bool isMetric)
Function scaletoIU converts a distance given in floating point to our internal units.
int scaletoIU ( double  aCoord,
bool  isMetric 
)

Function scaletoIU converts a distance given in floating point to our internal units.

Definition at line 59 of file rs274_read_XY_and_IJ_coordinates.cpp.

Referenced by AM_PRIMITIVE::ConvertShapeToPolygon(), AM_PRIMITIVE::DrawBasicShape(), AM_PRIMITIVE::GetShapeDim(), and mapPt().

60 {
61  int ret;
62 
63  if( isMetric ) // gerber are units in mm
64  ret = KiROUND( aCoord * IU_PER_MM );
65  else // gerber are units in inches
66  ret = KiROUND( aCoord * IU_PER_MILS * 1000.0 );
67 
68  return ret;
69 }
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