KiCad PCB EDA Suite
ADIMENSION6 Struct Reference

#include <altium_parser_pcb.h>

Public Member Functions

 ADIMENSION6 (ALTIUM_PARSER &aReader)
 

Public Attributes

ALTIUM_LAYER layer
 
ALTIUM_DIMENSION_KIND kind
 
wxString textformat
 
wxString textprefix
 
wxString textsuffix
 
int32_t height
 
double angle
 
uint32_t linewidth
 
uint32_t textheight
 
uint32_t textlinewidth
 
int32_t textprecision
 
uint32_t textgap
 
bool textbold
 
bool textitalic
 
int32_t arrowsize
 
ALTIUM_UNIT textunit
 
wxPoint xy1
 
std::vector< wxPoint > referencePoint
 
std::vector< wxPoint > textPoint
 

Detailed Description

Definition at line 391 of file altium_parser_pcb.h.

Constructor & Destructor Documentation

◆ ADIMENSION6()

ADIMENSION6::ADIMENSION6 ( ALTIUM_PARSER aReader)
explicit

Definition at line 268 of file altium_parser_pcb.cpp.

269 {
270  aReader.Skip( 2 );
271 
272  std::map<wxString, wxString> props = aReader.ReadProperties();
273 
274  if( props.empty() )
275  THROW_IO_ERROR( "Dimensions6 stream has no props" );
276 
277  layer = altium_layer_from_name( ALTIUM_PARSER::ReadString( props, "LAYER", "" ) );
278  kind = static_cast<ALTIUM_DIMENSION_KIND>( ALTIUM_PARSER::ReadInt( props, "DIMENSIONKIND", 0 ) );
279 
280  textformat = ALTIUM_PARSER::ReadString( props, "TEXTFORMAT", "" );
281  textprefix = ALTIUM_PARSER::ReadString( props, "TEXTPREFIX", "" );
282  textsuffix = ALTIUM_PARSER::ReadString( props, "TEXTSUFFIX", "" );
283 
284  height = ALTIUM_PARSER::ReadKicadUnit( props, "HEIGHT", "0mil" );
285  angle = ALTIUM_PARSER::ReadDouble( props, "ANGLE", 0. );
286 
287  linewidth = ALTIUM_PARSER::ReadKicadUnit( props, "LINEWIDTH", "10mil" );
288  textheight = ALTIUM_PARSER::ReadKicadUnit( props, "TEXTHEIGHT", "10mil" );
289  textlinewidth = ALTIUM_PARSER::ReadKicadUnit( props, "TEXTLINEWIDTH", "6mil" );
290  textprecision = ALTIUM_PARSER::ReadInt( props, "TEXTPRECISION", 2 );
291  textbold = ALTIUM_PARSER::ReadBool( props, "TEXTLINEWIDTH", false );
292  textitalic = ALTIUM_PARSER::ReadBool( props, "ITALIC", false );
293  textgap = ALTIUM_PARSER::ReadKicadUnit( props, "TEXTGAP", "10mil" );
294 
295  arrowsize = ALTIUM_PARSER::ReadKicadUnit( props, "ARROWSIZE", "60mil" );
296 
297  wxString text_position_raw = ALTIUM_PARSER::ReadString( props, "TEXTPOSITION", "" );
298 
299  xy1 = wxPoint( ALTIUM_PARSER::ReadKicadUnit( props, "X1", "0mil" ),
300  -ALTIUM_PARSER::ReadKicadUnit( props, "Y1", "0mil" ) );
301 
302  int refcount = ALTIUM_PARSER::ReadInt( props, "REFERENCES_COUNT", 0 );
303 
304  for( int i = 0; i < refcount; i++ )
305  {
306  const std::string refi = "REFERENCE" + std::to_string( i ) + "POINT";
307  referencePoint.emplace_back( ALTIUM_PARSER::ReadKicadUnit( props, refi + "X", "0mil" ),
308  -ALTIUM_PARSER::ReadKicadUnit( props, refi + "Y", "0mil" ) );
309  }
310 
311  for( size_t i = 1; i < std::numeric_limits<size_t>::max(); i++ )
312  {
313  const std::string texti = "TEXT" + std::to_string( i );
314  const std::string textix = texti + "X";
315  const std::string textiy = texti + "Y";
316 
317  if( props.find( textix ) == props.end() || props.find( textiy ) == props.end() )
318  break; // it doesn't seem like we know beforehand how many vertices are inside a polygon
319 
320  textPoint.emplace_back( ALTIUM_PARSER::ReadKicadUnit( props, textix, "0mil" ),
321  -ALTIUM_PARSER::ReadKicadUnit( props, textiy, "0mil" ) );
322  }
323 
324  wxString dimensionunit = ALTIUM_PARSER::ReadString( props, "TEXTDIMENSIONUNIT", "Millimeters" );
325 
326  if( dimensionunit == "Inches" ) textunit = ALTIUM_UNIT::INCHES;
327  else if( dimensionunit == "Mils" ) textunit = ALTIUM_UNIT::MILS;
328  else if( dimensionunit == "Millimeters" ) textunit = ALTIUM_UNIT::MILLIMETERS;
329  else if( dimensionunit == "Centimeters" ) textunit = ALTIUM_UNIT::CENTIMETER;
331 
332  if( aReader.HasParsingError() )
333  THROW_IO_ERROR( "Dimensions6 stream was not parsed correctly" );
334 }
uint32_t textlinewidth
uint32_t linewidth
ALTIUM_LAYER layer
ALTIUM_DIMENSION_KIND kind
void Skip(size_t aLength)
static double ReadDouble(const std::map< wxString, wxString > &aProps, const wxString &aKey, double aDefault)
std::vector< wxPoint > textPoint
wxString textformat
static int ReadInt(const std::map< wxString, wxString > &aProps, const wxString &aKey, int aDefault)
std::map< wxString, wxString > ReadProperties()
wxString textsuffix
static bool ReadBool(const std::map< wxString, wxString > &aProps, const wxString &aKey, bool aDefault)
wxString textprefix
int32_t ReadKicadUnit()
ALTIUM_UNIT textunit
static wxString ReadString(const std::map< wxString, wxString > &aProps, const wxString &aKey, const wxString &aDefault)
std::vector< wxPoint > referencePoint
ALTIUM_LAYER altium_layer_from_name(const wxString &aName)
uint32_t textheight
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
bool HasParsingError()
int32_t textprecision

References altium_layer_from_name(), angle, arrowsize, CENTIMETER, ALTIUM_PARSER::HasParsingError(), height, INCHES, kind, layer, linewidth, MILLIMETERS, MILS, ALTIUM_PARSER::ReadBool(), ALTIUM_PARSER::ReadDouble(), ALTIUM_PARSER::ReadInt(), ALTIUM_PARSER::ReadKicadUnit(), ALTIUM_PARSER::ReadProperties(), ALTIUM_PARSER::ReadString(), referencePoint, ALTIUM_PARSER::Skip(), textbold, textformat, textgap, textheight, textitalic, textlinewidth, textPoint, textprecision, textprefix, textsuffix, textunit, THROW_IO_ERROR, UNKNOWN, and xy1.

Member Data Documentation

◆ angle

double ADIMENSION6::angle

Definition at line 401 of file altium_parser_pcb.h.

Referenced by ADIMENSION6(), and ALTIUM_PCB::HelperParseDimensions6Center().

◆ arrowsize

int32_t ADIMENSION6::arrowsize

Definition at line 411 of file altium_parser_pcb.h.

Referenced by ADIMENSION6(), and ALTIUM_PCB::HelperParseDimensions6Leader().

◆ height

int32_t ADIMENSION6::height

Definition at line 400 of file altium_parser_pcb.h.

Referenced by ADIMENSION6(), and ALTIUM_PCB::HelperParseDimensions6Center().

◆ kind

ALTIUM_DIMENSION_KIND ADIMENSION6::kind

Definition at line 394 of file altium_parser_pcb.h.

Referenced by ADIMENSION6(), and ALTIUM_PCB::ParseDimensions6Data().

◆ layer

◆ linewidth

◆ referencePoint

◆ textbold

bool ADIMENSION6::textbold

◆ textformat

wxString ADIMENSION6::textformat

Definition at line 396 of file altium_parser_pcb.h.

Referenced by ADIMENSION6(), and ALTIUM_PCB::HelperParseDimensions6Leader().

◆ textgap

uint32_t ADIMENSION6::textgap

Definition at line 407 of file altium_parser_pcb.h.

Referenced by ADIMENSION6(), and ALTIUM_PCB::HelperParseDimensions6Radial().

◆ textheight

◆ textitalic

bool ADIMENSION6::textitalic

◆ textlinewidth

◆ textPoint

std::vector<wxPoint> ADIMENSION6::textPoint

◆ textprecision

int32_t ADIMENSION6::textprecision

◆ textprefix

wxString ADIMENSION6::textprefix

◆ textsuffix

wxString ADIMENSION6::textsuffix

◆ textunit

◆ xy1


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