KiCad PCB EDA Suite
Loading...
Searching...
No Matches
rs274_read_XY_and_IJ_coordinates.cpp File Reference
#include <math/util.h>
#include <gerber_file_image.h>
#include <base_units.h>

Go to the source code of this file.

Macros

#define SCALE_LIST_SIZE   9
 

Functions

int scaletoIU (double aCoord, bool isMetric)
 Convert a coordinate given in floating point to GerbView's internal units (currently = 10 nanometers).
 
static bool IsNumber (char x)
 
int ReadInt (char *&text, bool aSkipSeparator=true)
 Read an integer from an ASCII character buffer.
 
double ReadDouble (char *&text, bool aSkipSeparator=true)
 Read a double precision floating point number from an ASCII character buffer.
 

Variables

static double scale_list [SCALE_LIST_SIZE]
 

Macro Definition Documentation

◆ SCALE_LIST_SIZE

#define SCALE_LIST_SIZE   9

Definition at line 39 of file rs274_read_XY_and_IJ_coordinates.cpp.

Function Documentation

◆ IsNumber()

static bool IsNumber ( char  x)
static

◆ ReadDouble()

double ReadDouble ( char *&  text,
bool  aSkipSeparator = true 
)

Read a double precision floating point number from an ASCII character buffer.

If there is a comma after the number, then skip over that.

Parameters
textis a reference to a character pointer from which the ASCII double is read from and the pointer advanced for each character read.
aSkipSeparatorset to true (default) to skip comma.
Returns
number read.

Definition at line 303 of file rs274_read_XY_and_IJ_coordinates.cpp.

References text.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), AM_PARAM::ReadParamFromAmDef(), and EXCELLON_IMAGE::readToolInformation().

◆ ReadInt()

int ReadInt ( char *&  text,
bool  aSkipSeparator = true 
)

Read an integer from an ASCII character buffer.

If there is a comma after the integer, then skip over that.

Parameters
textis a reference to a character pointer from which bytes are read and the pointer is advanced for each byte read.
aSkipSeparatorset to true (default) to skip comma.
Returns
The integer read in.

Definition at line 266 of file rs274_read_XY_and_IJ_coordinates.cpp.

References text.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GERBER_FILE_IMAGE::ReadApertureMacro(), AM_PARAM::ReadParamFromAmDef(), and EXCELLON_IMAGE::readToolInformation().

◆ scaletoIU()

int scaletoIU ( double  aCoord,
bool  isMetric 
)

Convert a coordinate given in floating point to GerbView's internal units (currently = 10 nanometers).

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

Convert a distance given in floating point to our internal units.

Definition at line 58 of file rs274_read_XY_and_IJ_coordinates.cpp.

References GERB_IU_PER_MM, and KiROUND().

Referenced by AM_PRIMITIVE::ConvertBasicShapeToPolygon(), AM_PRIMITIVE::ConvertShapeToPolygon(), mapPt(), GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadXYCoord(), and GERBER_FILE_IMAGE::StepAndRepeatItem().

Variable Documentation

◆ scale_list

double scale_list[SCALE_LIST_SIZE]
static
Initial value:
=
{
1000.0 * GERB_IU_PER_MM * 0.0254,
100.0 * GERB_IU_PER_MM * 0.0254,
10.0 * GERB_IU_PER_MM * 0.0254,
1.0 * GERB_IU_PER_MM * 0.0254,
0.1 * GERB_IU_PER_MM * 0.0254,
0.01 * GERB_IU_PER_MM * 0.0254,
0.001 * GERB_IU_PER_MM * 0.0254,
0.0001 * GERB_IU_PER_MM * 0.0254,
0.00001 * GERB_IU_PER_MM * 0.0254,
}
constexpr double GERB_IU_PER_MM
some macros and functions to convert a value in mils, decimils or mm to the internal unit used in pcb...
Definition: base_units.h:69

Definition at line 40 of file rs274_read_XY_and_IJ_coordinates.cpp.

Referenced by GERBER_FILE_IMAGE::ReadIJCoord(), and GERBER_FILE_IMAGE::ReadXYCoord().