KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_io_autotrax.cpp File Reference
#include "pcb_io_autotrax.h"
#include "autotrax_parser.h"
#include <board.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <pad.h>
#include <pcb_track.h>
#include <pcb_shape.h>
#include <pcb_text.h>
#include <zone.h>
#include <netinfo.h>
#include <convert_basic_shapes_to_polygon.h>
#include <geometry/eda_angle.h>
#include <geometry/shape_poly_set.h>
#include <reporter.h>
#include <math/util.h>
#include <math/vector2d.h>
#include <geometry/shape_line_chain.h>
#include <math/box2.h>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <set>
#include <sstream>

Go to the source code of this file.

Classes

struct  ARC_SPAN
 One arc as a (start angle, counterclockwise sweep) pair in the file's native Y-up frame. More...
 
struct  ARC
 Free or component arc (FA / CA). More...
 
struct  BOARD_DATA
 Everything parsed out of an Autotrax/Easytrax file, before any KiCad object is created. More...
 
struct  FILL
 Free or component rectangular fill (FF / CF), Autotrax's only pour. More...
 
struct  NET_NODE
 One refdes -> net membership row collected from the NETDEF section. More...
 
struct  TEXT
 Free or component string (FS / CS). More...
 
struct  TRACK
 Free or component track segment (FT / CT). All coordinates are in mils. More...
 
struct  VIA
 Free or component via (FV / CV). More...
 

Functions

static bool readFile (const wxString &aFileName, wxString &aOut, size_t aLimit=0)
 Read a file into aOut.
 
static BOX2D spanBox (double aX1, double aY1, double aX2, double aY2)
 Bounding box of two points, in mils.
 
static std::vector< ARC_SPAN > arcSpansFromSegments (int aSegments)
 Translate an Autotrax arc quadrant bitmask into the arc spans it represents.
 
static BOX2D arcBox (const ARC &aArc)
 Bounding box of an arc's drawn quadrants, in mils.
 

Function Documentation

◆ arcBox()

static BOX2D arcBox ( const ARC & aArc)
static

Bounding box of an arc's drawn quadrants, in mils.

Definition at line 321 of file pcb_io_autotrax.cpp.

References arcSpansFromSegments(), AUTOTRAX::ARC::centerX, AUTOTRAX::ARC::centerY, M_PI, BOX2< Vec >::Merge(), AUTOTRAX::ARC::radius, and AUTOTRAX::ARC::segments.

Referenced by PCB_IO_AUTOTRAX::buildBoard().

◆ arcSpansFromSegments()

static std::vector< ARC_SPAN > arcSpansFromSegments ( int aSegments)
static

Translate an Autotrax arc quadrant bitmask into the arc spans it represents.

Bits 0..3 select the upper right, upper left, lower left and lower right quadrants. Each contiguous run of set bits becomes one arc, so masks 5 and 10 yield two.

Definition at line 291 of file pcb_io_autotrax.cpp.

Referenced by arcBox(), and PCB_IO_AUTOTRAX::emitArc().

◆ readFile()

static bool readFile ( const wxString & aFileName,
wxString & aOut,
size_t aLimit = 0 )
static

Read a file into aOut.

A non-zero aLimit reads at most that many bytes, which CanReadBoard() uses to sniff the header without slurping a whole board.

The raw bytes are decoded as UTF-8, falling back to Latin-1 for the DOS-era 8-bit encodings these legacy files often use; Latin-1 never fails, so the whole board is never lost to a single stray high byte.

Definition at line 83 of file pcb_io_autotrax.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PCB_IO_AUTOTRAX::CanReadBoard(), and PCB_IO_AUTOTRAX::loadBoard().

◆ spanBox()

static BOX2D spanBox ( double aX1,
double aY1,
double aX2,
double aY2 )
static

Bounding box of two points, in mils.

Definition at line 269 of file pcb_io_autotrax.cpp.

References BOX2< Vec >::Merge().

Referenced by PCB_IO_AUTOTRAX::buildBoard().