|
KiCad PCB EDA Suite
|
#include <sprint_layout_parser.h>
Public Member Functions | |
| SPRINT_LAYOUT_PARSER () | |
| ~SPRINT_LAYOUT_PARSER () | |
| bool | Parse (const wxString &aFileName) |
| BOARD * | CreateBoard (std::map< wxString, std::unique_ptr< FOOTPRINT > > &aFootprintMap, size_t aBoardIndex=0) |
| const SPRINT_LAYOUT::FILE_DATA & | GetFileData () const |
Private Member Functions | |
| uint8_t | readUint8 () |
| uint16_t | readUint16 () |
| uint32_t | readUint32 () |
| int32_t | readInt32 () |
| float | readFloat () |
| double | readDouble () |
| std::string | readFixedString (size_t aMaxLen) |
| std::string | readVarString () |
| void | skip (size_t aBytes) |
| void | parseBoardHeader (SPRINT_LAYOUT::BOARD_DATA &aBoard) |
| void | parseObject (SPRINT_LAYOUT::OBJECT &aObject, bool aIsTextChild=false) |
| void | parseTrailer () |
| PCB_LAYER_ID | mapLayer (uint8_t aSprintLayer) const |
| int | sprintToKicadCoord (float aValue) const |
| VECTOR2I | sprintToKicadPos (float aX, float aY) const |
| wxString | convertString (const std::string &aStr) const |
| void | processPad (BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj) |
| void | processCircle (BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments) |
| void | processLine (BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments) |
| void | processPoly (BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments) |
| void | processText (BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj) |
| void | buildOutline (BOARD *aBoard, std::vector< std::vector< VECTOR2I > > &aOutlineSegments, const SPRINT_LAYOUT::BOARD_DATA &aBoardData) |
Private Attributes | |
| SPRINT_LAYOUT::FILE_DATA | m_fileData |
| const uint8_t * | m_pos = nullptr |
| const uint8_t * | m_start = nullptr |
| const uint8_t * | m_end = nullptr |
| std::vector< uint8_t > | m_buffer |
Definition at line 158 of file sprint_layout_parser.h.
|
default |
|
default |
|
private |
Definition at line 1244 of file sprint_layout_parser.cpp.
References std::abs(), BOARD::Add(), delta, Edge_Cuts, pcbIUScale, SEGMENT, EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetShape(), EDA_SHAPE::SetStart(), EDA_SHAPE::SetWidth(), SPRINT_LAYOUT::BOARD_DATA::size_x, SPRINT_LAYOUT::BOARD_DATA::size_y, sprintToKicadCoord(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by CreateBoard().
|
private |
Definition at line 483 of file sprint_layout_parser.cpp.
Referenced by CreateBoard(), processPad(), processPoly(), and processText().
| BOARD * SPRINT_LAYOUT_PARSER::CreateBoard | ( | std::map< wxString, std::unique_ptr< FOOTPRINT > > & | aFootprintMap, |
| size_t | aBoardIndex = 0 ) |
Definition at line 499 of file sprint_layout_parser.cpp.
References ZONE::AddPolygon(), anchor, SHAPE_POLY_SET::Append(), B_Cu, B_SilkS, buildOutline(), convertString(), SHAPE_POLY_SET::COutline(), DESCRIPTION, F_Cu, FOOTPRINT, BOX2< Vec >::GetCenter(), FOOTPRINT::GetField(), FOOTPRINT::GetFields(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), SPRINT_LAYOUT::BOARD_DATA::ground_plane, In1_Cu, In2_Cu, index, SPRINT_LAYOUT::BOARD_DATA::is_multilayer, SPRINT_LAYOUT::LAYER_I1, SPRINT_LAYOUT::LAYER_I2, m_fileData, mapLayer(), SHAPE_POLY_SET::NewOutline(), SPRINT_LAYOUT::OBJ_CIRCLE, SPRINT_LAYOUT::OBJ_LINE, SPRINT_LAYOUT::OBJ_POLY, SPRINT_LAYOUT::OBJ_SMD_PAD, SPRINT_LAYOUT::OBJ_TEXT, SPRINT_LAYOUT::OBJ_THT_PAD, SPRINT_LAYOUT::BOARD_DATA::objects, pcbIUScale, processCircle(), processLine(), processPad(), processPoly(), processText(), RotatePoint(), ZONE::SetAssignedPriority(), ZONE::SetIsRuleArea(), BOARD_ITEM::SetLayer(), ZONE::SetLayer(), FOOTPRINT::SetLibDescription(), ZONE::SetLocalClearance(), FOOTPRINT::SetOrientationDegrees(), EDA_ITEM::SetParent(), FOOTPRINT::SetReference(), EDA_TEXT::SetText(), ZONE::SetThermalReliefGap(), ZONE::SetThermalReliefSpokeWidth(), ZONE::SetZoneName(), SPRINT_LAYOUT::BOARD_DATA::size_x, SPRINT_LAYOUT::BOARD_DATA::size_y, sprintToKicadCoord(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PCB_IO_SPRINT_LAYOUT::LoadBoard().
|
inline |
Definition at line 169 of file sprint_layout_parser.h.
References m_fileData.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_IO_SPRINT_LAYOUT::LoadBoard().
|
private |
Definition at line 441 of file sprint_layout_parser.cpp.
References B_Cu, B_SilkS, Edge_Cuts, F_Cu, F_SilkS, In1_Cu, In2_Cu, SPRINT_LAYOUT::LAYER_C1, SPRINT_LAYOUT::LAYER_C2, SPRINT_LAYOUT::LAYER_I1, SPRINT_LAYOUT::LAYER_I2, SPRINT_LAYOUT::LAYER_O, SPRINT_LAYOUT::LAYER_S1, and SPRINT_LAYOUT::LAYER_S2.
Referenced by CreateBoard(), processCircle(), processLine(), processPad(), processPoly(), and processText().
| bool SPRINT_LAYOUT_PARSER::Parse | ( | const wxString & | aFileName | ) |
Definition at line 187 of file sprint_layout_parser.cpp.
References _, m_buffer, m_end, m_fileData, m_pos, m_start, SPRINT_LAYOUT::OBJ_SMD_PAD, SPRINT_LAYOUT::OBJ_THT_PAD, parseBoardHeader(), parseTrailer(), readUint32(), readUint8(), skip(), and THROW_IO_ERROR.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_IO_SPRINT_LAYOUT::LoadBoard().
|
private |
Definition at line 253 of file sprint_layout_parser.cpp.
References _, SPRINT_LAYOUT::BOARD_DATA::center_x, SPRINT_LAYOUT::BOARD_DATA::center_y, SPRINT_LAYOUT::BOARD_DATA::ground_plane, SPRINT_LAYOUT::BOARD_DATA::is_multilayer, MAX_OBJECTS, SPRINT_LAYOUT::BOARD_DATA::name, SPRINT_LAYOUT::BOARD_DATA::objects, parseObject(), readDouble(), readFixedString(), readInt32(), readUint32(), readUint8(), SPRINT_LAYOUT::BOARD_DATA::size_x, SPRINT_LAYOUT::BOARD_DATA::size_y, skip(), and THROW_IO_ERROR.
Referenced by Parse().
|
private |
Definition at line 309 of file sprint_layout_parser.cpp.
References _, SPRINT_LAYOUT::COMPONENT_DATA::center_mode, SPRINT_LAYOUT::OBJECT::clearance, SPRINT_LAYOUT::COMPONENT_DATA::comment, SPRINT_LAYOUT::OBJECT::component, SPRINT_LAYOUT::OBJECT::component_id, SPRINT_LAYOUT::OBJECT::filled, SPRINT_LAYOUT::OBJECT::groups, SPRINT_LAYOUT::OBJECT::inner, SPRINT_LAYOUT::OBJECT::keepout, SPRINT_LAYOUT::OBJECT::layer, SPRINT_LAYOUT::OBJECT::line_width, MAX_CHILDREN, MAX_GROUPS, MAX_POINTS, SPRINT_LAYOUT::OBJECT::mirror, SPRINT_LAYOUT::OBJECT::net_name, SPRINT_LAYOUT::OBJ_CIRCLE, SPRINT_LAYOUT::OBJ_LINE, SPRINT_LAYOUT::OBJ_POLY, SPRINT_LAYOUT::OBJ_SMD_PAD, SPRINT_LAYOUT::OBJ_TEXT, SPRINT_LAYOUT::OBJ_THT_PAD, SPRINT_LAYOUT::COMPONENT_DATA::off_x, SPRINT_LAYOUT::COMPONENT_DATA::off_y, SPRINT_LAYOUT::OBJECT::outer, SPRINT_LAYOUT::COMPONENT_DATA::package, parseObject(), SPRINT_LAYOUT::OBJECT::plated, SPRINT_LAYOUT::OBJECT::points, readDouble(), readFloat(), readInt32(), readUint16(), readUint32(), readUint8(), readVarString(), SPRINT_LAYOUT::COMPONENT_DATA::rotation, SPRINT_LAYOUT::OBJECT::rotation, skip(), SPRINT_LAYOUT::OBJECT::soldermask, SPRINT_LAYOUT::OBJECT::start_angle, SPRINT_LAYOUT::OBJECT::text, SPRINT_LAYOUT::OBJECT::text_children, SPRINT_LAYOUT::OBJECT::thermal_width, THROW_IO_ERROR, SPRINT_LAYOUT::OBJECT::tht_shape, SPRINT_LAYOUT::OBJECT::type, SPRINT_LAYOUT::COMPONENT_DATA::use, SPRINT_LAYOUT::COMPONENT_DATA::valid, SPRINT_LAYOUT::OBJECT::x, and SPRINT_LAYOUT::OBJECT::y.
Referenced by parseBoardHeader(), and parseObject().
|
private |
Definition at line 427 of file sprint_layout_parser.cpp.
References m_fileData, readFixedString(), readUint32(), and readVarString().
Referenced by Parse().
|
private |
Definition at line 1079 of file sprint_layout_parser.cpp.
References BOARD_ITEM_CONTAINER::Add(), ARC, center, CIRCLE, DEGREES_T, Edge_Cuts, SPRINT_LAYOUT::OBJECT::inner, SPRINT_LAYOUT::OBJECT::layer, SPRINT_LAYOUT::OBJECT::line_width, M_PI, mapLayer(), SPRINT_LAYOUT::OBJECT::outer, pcbIUScale, radius, EDA_SHAPE::SetArcAngleAndEnd(), EDA_SHAPE::SetCenter(), EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetShape(), EDA_SHAPE::SetStart(), EDA_SHAPE::SetWidth(), sprintToKicadCoord(), sprintToKicadPos(), SPRINT_LAYOUT::OBJECT::start_angle, SPRINT_LAYOUT::OBJECT::x, and SPRINT_LAYOUT::OBJECT::y.
Referenced by CreateBoard().
|
private |
Definition at line 917 of file sprint_layout_parser.cpp.
References BOARD_ITEM_CONTAINER::Add(), Edge_Cuts, SPRINT_LAYOUT::OBJECT::layer, SPRINT_LAYOUT::OBJECT::line_width, mapLayer(), pcbIUScale, SPRINT_LAYOUT::OBJECT::points, SEGMENT, EDA_SHAPE::SetEnd(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetShape(), EDA_SHAPE::SetStart(), EDA_SHAPE::SetWidth(), sprintToKicadCoord(), and sprintToKicadPos().
Referenced by CreateBoard().
|
private |
Definition at line 706 of file sprint_layout_parser.cpp.
References BOARD::Add(), BOARD_ITEM_CONTAINER::Add(), FOOTPRINT::Add(), PADSTACK::ALL_LAYERS, B_Cu, B_Mask, B_Paste, B_SilkS, CHAMFERED_RECT, CIRCLE, clearance, SPRINT_LAYOUT::OBJECT::clearance, convertString(), F_Cu, F_Mask, BOARD::FindNet(), FOOTPRINT, BOARD::Footprints(), FULL, BOARD_ITEM::GetBoard(), SPRINT_LAYOUT::OBJECT::inner, SPRINT_LAYOUT::OBJECT::layer, mapLayer(), SPRINT_LAYOUT::OBJECT::net_name, NONE, NPTH, SPRINT_LAYOUT::OBJ_SMD_PAD, SPRINT_LAYOUT::OBJ_THT_PAD, SPRINT_LAYOUT::OBJECT::outer, OVAL, PAD, pad, FOOTPRINT::Pads(), SPRINT_LAYOUT::OBJECT::plated, SPRINT_LAYOUT::OBJECT::points, PTH, PAD::PTHMask(), RECT_CHAMFER_ALL, RECTANGLE, FOOTPRINT::Reference(), BOARD_ITEM::SetLayer(), FOOTPRINT::SetReference(), EDA_TEXT::SetVisible(), SMD, PAD::SMDMask(), SPRINT_LAYOUT::OBJECT::soldermask, sprintToKicadCoord(), sprintToKicadPos(), SPRINT_LAYOUT::OBJECT::start_angle, THERMAL, SPRINT_LAYOUT::OBJECT::thermal_width, SPRINT_LAYOUT::OBJECT::tht_shape, SPRINT_LAYOUT::THT_SHAPE_CIRCLE, SPRINT_LAYOUT::THT_SHAPE_H_CHAMFER, SPRINT_LAYOUT::THT_SHAPE_H_RECT, SPRINT_LAYOUT::THT_SHAPE_H_ROUND, SPRINT_LAYOUT::THT_SHAPE_OCT, SPRINT_LAYOUT::THT_SHAPE_SQUARE, SPRINT_LAYOUT::THT_SHAPE_V_CHAMFER, SPRINT_LAYOUT::THT_SHAPE_V_RECT, SPRINT_LAYOUT::THT_SHAPE_V_ROUND, SPRINT_LAYOUT::OBJECT::type, SPRINT_LAYOUT::OBJECT::x, VECTOR2< T >::x, SPRINT_LAYOUT::OBJECT::y, and VECTOR2< T >::y.
Referenced by CreateBoard().
|
private |
Definition at line 954 of file sprint_layout_parser.cpp.
References BOARD::Add(), BOARD_ITEM_CONTAINER::Add(), ZONE::AddPolygon(), LSET::AllCuMask(), SHAPE_POLY_SET::Append(), convertString(), SHAPE_POLY_SET::COutline(), Edge_Cuts, SPRINT_LAYOUT::OBJECT::filled, BOARD::FindNet(), BOARD_ITEM::GetBoard(), SPRINT_LAYOUT::OBJECT::keepout, SPRINT_LAYOUT::OBJECT::layer, SPRINT_LAYOUT::OBJECT::line_width, mapLayer(), SPRINT_LAYOUT::OBJECT::net_name, SHAPE_POLY_SET::NewOutline(), pcbIUScale, SPRINT_LAYOUT::OBJECT::points, POLY, SEGMENT, ZONE::SetDoNotAllowFootprints(), ZONE::SetDoNotAllowPads(), ZONE::SetDoNotAllowTracks(), ZONE::SetDoNotAllowVias(), ZONE::SetDoNotAllowZoneFills(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFilled(), ZONE::SetIsRuleArea(), PCB_SHAPE::SetLayer(), ZONE::SetLayer(), BOARD_CONNECTED_ITEM::SetNet(), EDA_SHAPE::SetPolyShape(), EDA_SHAPE::SetShape(), EDA_SHAPE::SetStart(), EDA_SHAPE::SetWidth(), sprintToKicadCoord(), sprintToKicadPos(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by CreateBoard().
|
private |
Definition at line 1177 of file sprint_layout_parser.cpp.
References BOARD_ITEM_CONTAINER::Add(), SPRINT_LAYOUT::OBJECT::component_id, convertString(), DEGREES_T, Edge_Cuts, SPRINT_LAYOUT::OBJECT::filled, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_BOTTOM, SPRINT_LAYOUT::OBJECT::inner, SPRINT_LAYOUT::OBJECT::layer, SPRINT_LAYOUT::OBJECT::line_width, mapLayer(), SPRINT_LAYOUT::OBJECT::mirror, SPRINT_LAYOUT::OBJECT::outer, pcbIUScale, FOOTPRINT::Reference(), SPRINT_LAYOUT::OBJECT::rotation, sprintToKicadCoord(), sprintToKicadPos(), text, SPRINT_LAYOUT::OBJECT::text, SPRINT_LAYOUT::OBJECT::thermal_width, SPRINT_LAYOUT::OBJECT::tht_shape, FOOTPRINT::Value(), SPRINT_LAYOUT::OBJECT::x, and SPRINT_LAYOUT::OBJECT::y.
Referenced by CreateBoard().
|
private |
Definition at line 123 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by parseBoardHeader(), and parseObject().
|
private |
Definition at line 144 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, readUint8(), and THROW_IO_ERROR.
Referenced by parseBoardHeader(), and parseTrailer().
|
private |
Definition at line 114 of file sprint_layout_parser.cpp.
References readUint32().
Referenced by parseObject().
|
private |
Definition at line 108 of file sprint_layout_parser.cpp.
References readUint32().
Referenced by parseBoardHeader(), and parseObject().
|
private |
Definition at line 82 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by parseObject().
|
private |
Definition at line 94 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by Parse(), parseBoardHeader(), parseObject(), parseTrailer(), readFloat(), readInt32(), and readVarString().
|
private |
Definition at line 73 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by Parse(), parseBoardHeader(), parseObject(), and readFixedString().
|
private |
Definition at line 158 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, readUint32(), and THROW_IO_ERROR.
Referenced by parseObject(), and parseTrailer().
|
private |
Definition at line 174 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by Parse(), parseBoardHeader(), and parseObject().
|
private |
Definition at line 457 of file sprint_layout_parser.cpp.
References _, KiROUND(), m_fileData, and THROW_IO_ERROR.
Referenced by buildOutline(), CreateBoard(), processCircle(), processLine(), processPad(), processPoly(), processText(), and sprintToKicadPos().
|
private |
Definition at line 476 of file sprint_layout_parser.cpp.
References sprintToKicadCoord().
Referenced by processCircle(), processLine(), processPad(), processPoly(), and processText().
|
private |
Definition at line 213 of file sprint_layout_parser.h.
Referenced by Parse().
|
private |
Definition at line 212 of file sprint_layout_parser.h.
Referenced by Parse(), readDouble(), readFixedString(), readUint16(), readUint32(), readUint8(), readVarString(), and skip().
|
private |
Definition at line 209 of file sprint_layout_parser.h.
Referenced by CreateBoard(), GetFileData(), Parse(), parseTrailer(), and sprintToKicadCoord().
|
private |
Definition at line 210 of file sprint_layout_parser.h.
Referenced by Parse(), readDouble(), readFixedString(), readUint16(), readUint32(), readUint8(), readVarString(), and skip().
|
private |
Definition at line 211 of file sprint_layout_parser.h.
Referenced by Parse().