|
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 |
| void | addPadToBoard (BOARD *aBoard, const SPRINT_LAYOUT::OBJECT &aObj, std::map< uint16_t, FOOTPRINT * > &aComponentMap, std::map< wxString, std::unique_ptr< FOOTPRINT > > &aFootprintMap) |
| void | addCircleToBoard (BOARD *aBoard, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments) |
| void | addLineToBoard (BOARD *aBoard, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments) |
| void | addPolyToBoard (BOARD *aBoard, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments) |
| void | addTextToBoard (BOARD *aBoard, 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 149 of file sprint_layout_parser.h.
|
default |
|
default |
|
private |
Definition at line 996 of file sprint_layout_parser.cpp.
References BOARD::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 833 of file sprint_layout_parser.cpp.
References BOARD::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 643 of file sprint_layout_parser.cpp.
References BOARD::Add(), FOOTPRINT::Add(), PADSTACK::ALL_LAYERS, B_Cu, B_Mask, B_Paste, B_SilkS, CHAMFERED_RECT, CIRCLE, clearance, SPRINT_LAYOUT::OBJECT::clearance, SPRINT_LAYOUT::OBJECT::component_id, F_Cu, BOARD::FindNet(), FOOTPRINT, BOARD::Footprints(), FULL, 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, PAD, pad, FOOTPRINT::Pads(), SPRINT_LAYOUT::OBJECT::plated, SPRINT_LAYOUT::OBJECT::points, PTH, PAD::PTHMask(), RECT_CHAMFER_ALL, RECTANGLE, BOARD_ITEM::SetLayer(), FOOTPRINT::SetPosition(), FOOTPRINT::SetReference(), 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_OCT, SPRINT_LAYOUT::THT_SHAPE_SQUARE, SPRINT_LAYOUT::OBJECT::type, SPRINT_LAYOUT::OBJECT::x, and SPRINT_LAYOUT::OBJECT::y.
Referenced by CreateBoard().
|
private |
Definition at line 871 of file sprint_layout_parser.cpp.
References BOARD::Add(), ZONE::AddPolygon(), LSET::AllCuMask(), SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::COutline(), Edge_Cuts, SPRINT_LAYOUT::OBJECT::filled, BOARD::FindNet(), 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 1095 of file sprint_layout_parser.cpp.
References BOARD::Add(), SPRINT_LAYOUT::OBJECT::component_id, DEGREES_T, Edge_Cuts, SPRINT_LAYOUT::OBJECT::inner, SPRINT_LAYOUT::OBJECT::layer, mapLayer(), SPRINT_LAYOUT::OBJECT::mirror, SPRINT_LAYOUT::OBJECT::outer, pcbIUScale, SPRINT_LAYOUT::OBJECT::rotation, sprintToKicadCoord(), sprintToKicadPos(), text, SPRINT_LAYOUT::OBJECT::text, SPRINT_LAYOUT::OBJECT::x, and SPRINT_LAYOUT::OBJECT::y.
Referenced by CreateBoard().
|
private |
Definition at line 1144 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().
| BOARD * SPRINT_LAYOUT_PARSER::CreateBoard | ( | std::map< wxString, std::unique_ptr< FOOTPRINT > > & | aFootprintMap, |
| size_t | aBoardIndex = 0 ) |
Definition at line 474 of file sprint_layout_parser.cpp.
References addCircleToBoard(), addLineToBoard(), addPadToBoard(), ZONE::AddPolygon(), addPolyToBoard(), addTextToBoard(), SHAPE_POLY_SET::Append(), B_Cu, B_SilkS, buildOutline(), FOOTPRINT::Clone(), SHAPE_POLY_SET::COutline(), F_Cu, FOOTPRINT, BOX2< Vec >::GetCenter(), 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, ZONE::SetAssignedPriority(), ZONE::SetIsRuleArea(), BOARD_ITEM::SetLayer(), ZONE::SetLayer(), FOOTPRINT::SetLibDescription(), ZONE::SetLocalClearance(), FOOTPRINT::SetOrientationDegrees(), FOOTPRINT::SetReference(), ZONE::SetThermalReliefGap(), ZONE::SetThermalReliefSpokeWidth(), FOOTPRINT::SetValue(), 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 160 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 438 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 addCircleToBoard(), addLineToBoard(), addPadToBoard(), addPolyToBoard(), addTextToBoard(), and CreateBoard().
| bool SPRINT_LAYOUT_PARSER::Parse | ( | const wxString & | aFileName | ) |
Definition at line 184 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 250 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 306 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 424 of file sprint_layout_parser.cpp.
References m_fileData, readFixedString(), readUint32(), and readVarString().
Referenced by Parse().
|
private |
Definition at line 120 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by parseBoardHeader(), and parseObject().
|
private |
Definition at line 141 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 111 of file sprint_layout_parser.cpp.
References readUint32().
Referenced by parseObject().
|
private |
Definition at line 105 of file sprint_layout_parser.cpp.
References readUint32().
Referenced by parseBoardHeader(), and parseObject().
|
private |
Definition at line 79 of file sprint_layout_parser.cpp.
References _, m_end, m_pos, and THROW_IO_ERROR.
Referenced by parseObject().
|
private |
Definition at line 91 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 70 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 155 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 171 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 454 of file sprint_layout_parser.cpp.
References _, KiROUND(), and THROW_IO_ERROR.
Referenced by addCircleToBoard(), addLineToBoard(), addPadToBoard(), addPolyToBoard(), addTextToBoard(), buildOutline(), CreateBoard(), and sprintToKicadPos().
|
private |
Definition at line 467 of file sprint_layout_parser.cpp.
References sprintToKicadCoord().
Referenced by addCircleToBoard(), addLineToBoard(), addPadToBoard(), addPolyToBoard(), and addTextToBoard().
|
private |
Definition at line 206 of file sprint_layout_parser.h.
Referenced by Parse().
|
private |
Definition at line 205 of file sprint_layout_parser.h.
Referenced by Parse(), readDouble(), readFixedString(), readUint16(), readUint32(), readUint8(), readVarString(), and skip().
|
private |
Definition at line 202 of file sprint_layout_parser.h.
Referenced by CreateBoard(), GetFileData(), Parse(), and parseTrailer().
|
private |
Definition at line 203 of file sprint_layout_parser.h.
Referenced by Parse(), readDouble(), readFixedString(), readUint16(), readUint32(), readUint8(), readVarString(), and skip().
|
private |
Definition at line 204 of file sprint_layout_parser.h.
Referenced by Parse().