45#include <wx/filename.h>
46#include <wx/wfstream.h>
48#include <wx/strconv.h>
49#include <wx/fontenc.h>
89 uint16_t v =
static_cast<uint16_t
>(
m_pos[0] )
90 | (
static_cast<uint16_t
>(
m_pos[1] ) << 8 );
125 uint32_t v =
static_cast<uint32_t
>(
m_pos[0] )
126 | (
static_cast<uint32_t
>(
m_pos[1] ) << 8 )
127 | (
static_cast<uint32_t
>(
m_pos[2] ) << 16 )
128 | (
static_cast<uint32_t
>(
m_pos[3] ) << 24 );
144 std::memcpy( &v, &bits,
sizeof( v ) );
154 uint64_t bits =
static_cast<uint64_t
>(
m_pos[0] )
155 | (
static_cast<uint64_t
>(
m_pos[1] ) << 8 )
156 | (
static_cast<uint64_t
>(
m_pos[2] ) << 16 )
157 | (
static_cast<uint64_t
>(
m_pos[3] ) << 24 )
158 | (
static_cast<uint64_t
>(
m_pos[4] ) << 32 )
159 | (
static_cast<uint64_t
>(
m_pos[5] ) << 40 )
160 | (
static_cast<uint64_t
>(
m_pos[6] ) << 48 )
161 | (
static_cast<uint64_t
>(
m_pos[7] ) << 56 );
165 std::memcpy( &v, &bits,
sizeof( v ) );
175 return static_cast<float>(
readInt32() );
177 return static_cast<float>(
readInt16() );
184 size_t len = std::min( rawLen, aMaxLen );
189 std::string s(
reinterpret_cast<const char*
>(
m_pos ), len );
205 std::string s(
reinterpret_cast<const char*
>(
m_pos ), len );
222 const uint8_t* seekTo =
m_pos + aBytes;
245 if( numBoards == 0 || numBoards > 100 )
255 for( uint32_t b = 0; b <
m_fileData.boards.size(); b++ )
265 boardData.
objects.resize( numObjects );
267 for( uint32_t i = 0; i < numObjects; i++ )
272 uint32_t numConnections = 0;
274 for(
auto& obj : boardData.
objects )
281 for( uint32_t c = 0; c < numConnections; c++ )
286 for( uint32_t i = 0; i < connCount; i++ )
302 data.
name = wxFileNameFromPath( aFileName ).BeforeLast(
'.' );
316 wxFFileInputStream stream( aFileName );
319 THROW_IO_ERROR( wxString::Format(
_(
"Cannot open file '%s'" ), aFileName ) );
321 size_t fileSize = stream.GetLength();
324 THROW_IO_ERROR( wxString::Format(
_(
"File '%s' is too small to be a Sprint Layout file" ), aFileName ) );
327 stream.Read(
m_buffer.data(), fileSize );
329 if( stream.LastRead() != fileSize )
330 THROW_IO_ERROR( wxString::Format(
_(
"Failed to read file '%s'" ), aFileName ) );
342 if(
m_fileData.version > 6 || magic1 != 0x33 || magic2 != 0xAA || magic3 != 0xFF )
361 for(
int i = 0; i < 7; i++ )
430 aBoard.
objects.resize( numObjects );
432 for( uint32_t i = 0; i < numObjects; i++ )
444 aObj.
groups.resize( groupCount );
446 for( uint32_t i = 0; i < groupCount; i++ )
458 for( uint32_t i = 0; i < pointCount; i++ )
464 if( pt.
x == 0.0f || std::isnormal( pt.
x ) )
466 aObj.
points.emplace_back( pt );
485 THROW_IO_ERROR( wxString::Format(
_(
"Unknown object type %d in Sprint Layout file" ), aObj.
type ) );
578 if(
m_fileData.version >= 2 && !aIsTextChild )
621 THROW_IO_ERROR(
_(
"Too many text children in Sprint Layout object" ) );
625 for( uint32_t i = 0; i < childCount; i++ )
646 THROW_IO_ERROR( wxString::Format(
_(
"Unknown object type %d in Sprint Layout file" ), aObj.
type ) );
673 switch( aSprintLayer )
682 default:
return F_Cu;
688 switch( aSprintLayer )
698 default:
return F_Cu;
712 nm =
static_cast<double>( aValue ) * 100.0;
714 nm =
static_cast<double>( aValue ) * 10000.0;
716 nm = std::clamp( nm,
static_cast<double>( -
pcbIUScale.mmToIU( 500 ) ),
717 static_cast<double>(
pcbIUScale.mmToIU( 500 ) ) );
732 static wxCSConv convCP1251( wxFONTENCODING_CP1251 );
733 static wxCSConv convCP1252( wxFONTENCODING_CP1252 );
736 return wxEmptyString;
738 wxString ret = wxString::FromUTF8( aStr );
740 if( ret.empty() && convCP1251.IsOk() && convCP1252.IsOk() )
743 size_t extNonGermanCount = 0;
745 for(
unsigned char c : aStr )
766 if( extNonGermanCount > 0 )
767 ret = wxString( aStr.c_str(), convCP1251 );
769 ret = wxString( aStr.c_str(), convCP1252 );
783 case F_Cu:
return aGroundPlane[0] != 0;
784 case B_Cu:
return aGroundPlane[2] != 0;
785 case In1_Cu:
return aGroundPlane[4] != 0;
786 case In2_Cu:
return aGroundPlane[5] != 0;
787 default:
return false;
794 case F_Cu:
return aGroundPlane[0] != 0;
795 case B_Cu:
return aGroundPlane[1] != 0;
796 default:
return false;
850 std::unique_ptr<BOARD> board = std::make_unique<BOARD>();
854 bool hasInnerLayers =
false;
860 hasInnerLayers =
true;
866 board->SetCopperLayerCount( 4 );
868 board->SetCopperLayerCount( 2 );
872 const wxString gndPlaneNetName(
"GND_PLANE" );
873 std::map<int, PCB_LAYER_ID> groundPlaneMap;
874 LSET groundPlaneLayerSet;
894 for(
const auto& [
index, layer] : groundPlaneMap )
897 groundPlaneLayerSet.
set( layer );
900 if( !groundPlaneLayerSet.empty() )
905 gndPlaneNet =
new NETINFO_ITEM( board.get(), gndPlaneNetName );
906 board->Add( gndPlaneNet );
908 ZONE* zone =
new ZONE( board.get() );
917 zone->
SetNet( gndPlaneNet );
927 std::map<uint16_t, FOOTPRINT*> componentMap;
928 std::vector<std::vector<VECTOR2I>> outlineSegments;
932 if( aObj.component_id == 0 )
935 auto it = componentMap.find( aObj.component_id );
937 if( it != componentMap.end() )
948 fp->
SetReference( wxString::Format( wxS(
"U%d" ), aObj.component_id ) );
951 fd->SetVisible(
false );
956 if( !aObj.component.comment.empty() )
962 else if( !aObj.identifier.empty() )
967 if( !aObj.component.package.empty() )
976 componentMap[aObj.component_id] = fp;
985 getOrCreateComponentFootprint( obj );
988 std::map<uint32_t, std::set<BOARD_ITEM*>> gidToItems;
995 if(
FOOTPRINT* fp = getOrCreateComponentFootprint( obj ) )
1036 for(
FOOTPRINT* fp : board->Footprints() )
1038 BOX2I fpBbox = fp->GetBoundingHull().BBox();
1041 fp->SetPosition(
anchor );
1045 fp->MoveAnchorPosition( anchorShift );
1049 for(
const auto& [componentId, fp] : componentMap )
1051 wxString fpKey = wxString::Format( wxS(
"SprintLayout_%s" ), fp->GetReference() );
1054 aFootprintMap[fpKey] = std::unique_ptr<FOOTPRINT>( fpCopy );
1057 buildOutline( board.get(), outlineSegments, boardData );
1060 BOX2I bbox = board->ComputeBoundingBox(
true );
1067 for(
FOOTPRINT* fp : board->Footprints() )
1068 fp->Move( centerOffset );
1070 for(
ZONE* zone : board->Zones() )
1071 zone->Move( centerOffset );
1074 item->Move( centerOffset );
1077 return board.release();
1088 std::unique_ptr<FOOTPRINT> fp = std::make_unique<FOOTPRINT>(
nullptr );
1092 fp->SetFPID(
LIB_ID( wxEmptyString, fpName ) );
1093 fp->SetReference( wxT(
"REF**" ) );
1094 fp->SetValue( fpName );
1095 fp->Reference().SetVisible(
true );
1096 fp->Value().SetVisible(
true );
1098 std::vector<std::vector<VECTOR2I>> outlineSegments;
1099 uint8_t groundPlane[7] = {};
1100 std::map<uint32_t, std::set<BOARD_ITEM*>> gidToItems;
1111 processPad( container, obj, groundPlane,
nullptr, gidToItems );
1115 processSegment( container, obj, outlineSegments, groundPlane,
nullptr, gidToItems );
1119 processLine( container, obj, outlineSegments, groundPlane,
nullptr, gidToItems );
1123 processPoly( container, obj, outlineSegments, groundPlane,
nullptr, gidToItems );
1127 processCircle( container, obj, outlineSegments, groundPlane,
nullptr, gidToItems );
1143 fp->AutoPositionFields();
1146 BOX2I bbox = fp->GetBoundingHull().BBox();
1149 std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( fp.get(),
SHAPE_T::RECTANGLE );
1153 shape->SetEnd( bbox.
GetEnd() );
1157 return fp.release();
1162 const uint8_t aGroundPlane[7],
NETINFO_ITEM* aGndPlaneNet,
1163 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1165 BOARD* board = aContainer ? aContainer->
GetBoard() :
nullptr;
1167 bool standaloneFp =
false;
1172 standaloneFp =
true;
1177 aContainer->
Add( fp );
1191 if( !aObj.
points.empty() )
1193 double cx = 0, cy = 0;
1195 for(
const auto& pt : aObj.
points )
1201 cx /=
static_cast<double>( aObj.
points.size() );
1202 cy /=
static_cast<double>( aObj.
points.size() );
1203 ptsCenter =
sprintToKicadPos(
static_cast<float>( cx ),
static_cast<float>( cy ) );
1205 std::vector<VECTOR2I> pts;
1210 if( pts.size() == 2 )
1212 ptsAngle =
EDA_ANGLE( pts[1] - pts[0] );
1217 else if( pts.size() == 4 )
1219 ptsAngle =
EDA_ANGLE( pts[1] - pts[0] );
1221 else if( pts.size() == 8 )
1223 ptsAngle =
EDA_ANGLE( pts[2] - pts[1] );
1227 wxFAIL_MSG( wxString::Format(
"Unknown pad type %d shape %d with %zu points",
int( aObj.
type ),
1231 ptsAngle = ptsAngle.
Round( 2 );
1253 if( padLayer ==
F_Cu )
1255 else if( padLayer ==
B_Cu )
1258 pad->SetLayerSet(
LSET( { padLayer } ) );
1264 VECTOR2I padSize( outerDia, outerDia );
1265 VECTOR2I drillSize( drillDia, drillDia );
1285 pad->SetDrillSize( drillSize );
1318 pad->SetPosition( padPos );
1319 pad->Rotate( padPos, -ptsAngle );
1325 if( padLayer ==
F_Cu )
1327 else if( padLayer ==
B_Cu )
1330 pad->SetLayerSet(
LSET( { padLayer } ) );
1343 if( !aObj.
points.empty() )
1347 pad->SetPosition( padPos );
1348 pad->Rotate( padPos, -ptsAngle );
1354 pad->Padstack().FrontOuterLayers().has_solder_mask =
false;
1355 pad->Padstack().BackOuterLayers().has_solder_mask =
false;
1362 pad->SetLocalClearance( std::optional<int>(
clearance ) );
1363 pad->SetLocalThermalGapOverride( std::optional<int>(
clearance ) );
1369 int spokeWidth = aObj.
rotation * 10000 / 2;
1370 pad->SetLocalThermalSpokeWidthOverride( spokeWidth );
1374 uint32_t spokeMask =
static_cast<uint32_t
>( aObj.
start_angle );
1376 if( spokeMask != 0 )
1380 if( spokeMask & 0x55555555 )
1382 else if( spokeMask & 0xAAAAAAAA )
1404 if( aGroundPlane[0] )
1406 else if( aGroundPlane[2] )
1408 else if( aGroundPlane[4] )
1410 else if( aGroundPlane[5] )
1417 pad->SetNumber( wxString::Format( wxS(
"%d" ),
static_cast<int>( fp->
Pads().size() + 1 ) ) );
1424 fd->SetTextPos(
pad->GetPosition() );
1436 std::vector<std::vector<VECTOR2I>>& aOutlineSegments,
1437 const uint8_t aGroundPlane[7],
NETINFO_ITEM* aGndPlaneNet,
1438 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1440 if( aObj.
points.size() < 2 )
1443 BOARD* board = aContainer ? aContainer->
GetBoard() :
nullptr;
1448 std::vector<VECTOR2I> segment;
1450 for(
const auto& pt : aObj.
points )
1453 aOutlineSegments.push_back( std::move( segment ) );
1462 for(
size_t i = 0; i + 1 < aObj.
points.size(); i++ )
1477 aContainer->
Add( shape );
1484 std::vector<std::vector<VECTOR2I>>& aOutlineSegments,
1485 const uint8_t aGroundPlane[7],
NETINFO_ITEM* aGndPlaneNet,
1486 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1492 std::vector<VECTOR2I> seg;
1495 aOutlineSegments.push_back( std::move( seg ) );
1514 aContainer->
Add( shape );
1520 std::vector<std::vector<VECTOR2I>>& aOutlineSegments,
1521 const uint8_t aGroundPlane[7],
NETINFO_ITEM* aGndPlaneNet,
1522 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1524 if( aObj.
points.size() < 2 )
1527 BOARD* board = aContainer ? aContainer->
GetBoard() :
nullptr;
1532 std::vector<VECTOR2I> points;
1534 for(
const auto& pt : aObj.
points )
1537 points.push_back( points[0] );
1539 aOutlineSegments.push_back( std::move( points ) );
1544 bool isCutout = ( aObj.
keepout != 0 );
1553 for(
const auto& pt : aObj.
points )
1564 ZONE* zone =
new ZONE( aContainer );
1574 aContainer->
Add( zone );
1577 else if( aObj.
points.size() >= 3 )
1591 aContainer->
Add( shape );
1598 std::vector<std::vector<VECTOR2I>>& aOutlineSegments,
1599 const uint8_t aGroundPlane[7],
NETINFO_ITEM* aGndPlaneNet,
1600 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1602 BOARD* board = aContainer ? aContainer->
GetBoard() :
nullptr;
1612 bool isFullCircle =
true;
1613 double startAngleDeg = 0, endAngleDeg = 0;
1624 if( startAngleDeg > 1000 || startAngleDeg < -1000 || endAngleDeg > 1000 || endAngleDeg < -1000 )
1626 startAngleDeg /= 1000;
1627 endAngleDeg /= 1000;
1632 isFullCircle = ( startAngleDeg == 0 && endAngleDeg == 0 )
1633 || ( endAngleDeg - startAngleDeg >= 360 )
1634 || ( startAngleDeg == endAngleDeg );
1641 std::vector<VECTOR2I> segment;
1645 for(
int i = 0; i <= 24; i++ )
1647 double angle = (
static_cast<double>( i ) / 24.0 ) * 2.0 *
M_PI;
1648 int px =
center.x +
static_cast<int>( std::cos( angle ) * kiRadius );
1649 int py =
center.y -
static_cast<int>( std::sin( angle ) * kiRadius );
1650 segment.emplace_back( px, py );
1655 int32_t sa = startAngleDeg * 1000;
1656 int32_t ea = endAngleDeg * 1000;
1661 for( int32_t a = sa; a <= ea; a += 15000 )
1663 double rad = (
static_cast<double>( a ) / 1000.0 ) *
M_PI / 180.0;
1664 int px =
center.x +
static_cast<int>( std::cos( rad ) * kiRadius );
1665 int py =
center.y -
static_cast<int>( std::sin( rad ) * kiRadius );
1666 segment.emplace_back( px, py );
1669 double endRad = (
static_cast<double>( ea ) / 1000.0 ) *
M_PI / 180.0;
1670 int epx =
center.x +
static_cast<int>( std::cos( endRad ) * kiRadius );
1671 int epy =
center.y -
static_cast<int>( std::sin( endRad ) * kiRadius );
1672 segment.emplace_back( epx, epy );
1675 aOutlineSegments.push_back( std::move( segment ) );
1695 double startRad = startAngleDeg *
M_PI / 180.0;
1696 int sx =
center.x +
static_cast<int>( std::cos( startRad ) * kiRadius );
1697 int sy =
center.y -
static_cast<int>( std::sin( startRad ) * kiRadius );
1700 double newEndAngle = endAngleDeg;
1702 if( newEndAngle < startAngleDeg )
1706 double arcAngle = startAngleDeg - newEndAngle;
1716 aContainer->
Add( shape );
1722 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1748 if( aObj.
text.empty() )
1765 double cx = 0, cy = 0;
1766 size_t ptsCount = 0;
1789 cx /=
static_cast<double>( ptsCount );
1790 cy /=
static_cast<double>( ptsCount );
1791 ptsCenter =
sprintToKicadPos(
static_cast<float>( cx ),
static_cast<float>( cy ) );
1794 text->SetLayer( layer );
1798 text->SetKeepUpright(
false );
1808 double widthScale = 0.8 + 0.2 * aObj.
line_width;
1809 text->SetTextSize(
VECTOR2I( height * widthScale, height ) );
1811 double thicknessScale = 0.06 + 0.05 * aObj.
inner;
1812 int thickness = height * thicknessScale;
1814 if( thickness <= 0 )
1815 thickness = std::max( 1, height / 8 );
1817 text->SetTextThickness( thickness );
1829 text->SetTextThickness( height / 8 );
1833 text->SetTextPos( untransformedPos );
1839 text->SetTextPos( newCenter );
1851 if( mirrorH ^ mirrorV )
1853 text->SetMirrored(
true );
1855 rotation = -rotation;
1872 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1874 for( uint32_t gid : aObj.
groups )
1875 aGidToItems[gid].insert( aItem );
1880 std::map<uint32_t, std::set<BOARD_ITEM*>>& aGidToItems )
1882 std::map<uint32_t, PCB_GROUP*> gidGroupMap;
1883 std::vector<uint32_t> gidAscBySize;
1885 for(
const auto& [gid,
_] : aGidToItems )
1889 gidGroupMap[gid] =
group;
1890 gidAscBySize.push_back( gid );
1898 std::sort( gidAscBySize.begin(), gidAscBySize.end(),
1899 [&]( uint32_t gidA, uint32_t gidB )
1901 size_t sa = aGidToItems.at( gidA ).size();
1902 size_t sb = aGidToItems.at( gidB ).size();
1910 for( uint32_t gid : gidAscBySize )
1918 if( itemGroup != grp )
1924 if( item->GetParent() == grp->
GetParent() )
1937 static const int PROXIMITY_DELTA = 100;
1946 for(
size_t iterations = 0; iterations < aOutlineSegments.size(); iterations++ )
1948 bool joined =
false;
1950 for(
auto& seg : aOutlineSegments )
1952 if( seg.size() < 2 )
1955 for(
auto& other : aOutlineSegments )
1957 if( &seg == &other || other.empty() )
1960 bool frontMatch = closeEnough( seg.back(), other.front(), PROXIMITY_DELTA );
1961 bool backMatch = !frontMatch
1962 && closeEnough( seg.back(), other.back(), PROXIMITY_DELTA );
1966 std::reverse( other.begin(), other.end() );
1973 if( seg.back() == other.front() )
1974 seg.insert( seg.end(), other.begin() + 1, other.end() );
1976 seg.insert( seg.end(), other.begin(), other.end() );
1988 bool hasOutline =
false;
1990 for(
const auto& seg : aOutlineSegments )
1992 if( seg.size() < 2 )
1997 for(
size_t i = 0; i + 1 < seg.size(); i++ )
2004 shape->
SetEnd( seg[i + 1] );
2005 aBoard->
Add( shape );
2015 if( w > 0 && h > 0 )
2024 for(
int i = 0; i < 4; i++ )
2031 shape->
SetEnd( corners[( i + 1 ) % 4] );
2032 aBoard->
Add( shape );
constexpr EDA_IU_SCALE pcbIUScale
#define DEFAULT_COURTYARD_WIDTH
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
BASE_SET & set(size_t pos)
virtual void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false)=0
Adds an item to the container.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD_ITEM_CONTAINER * GetParent() const
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const FOOTPRINTS & Footprints() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr size_type GetWidth() const
constexpr const Vec GetCenter() const
constexpr size_type GetHeight() const
constexpr const Vec & GetOrigin() const
EDA_ANGLE Round(int digits) const
void AddItem(EDA_ITEM *aItem)
Add item to group.
virtual void SetParent(EDA_ITEM *aParent)
void SetCenter(const VECTOR2I &aCenter)
void SetPolyShape(const SHAPE_POLY_SET &aShape)
virtual void SetFilled(bool aFlag)
void SetStart(const VECTOR2I &aStart)
void SetShape(SHAPE_T aShape)
void SetEnd(const VECTOR2I &aEnd)
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
void SetWidth(int aWidth)
virtual void SetVisible(bool aVisible)
virtual void SetText(const wxString &aText)
A logical library item identifier and consists of various portions much like a URI.
LSET is a set of PCB_LAYER_IDs.
Handle the data for a net.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
static LSET PTHMask()
layer set for a through hole pad
A set of BOARD_ITEMs (i.e., without duplicates).
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void processPoly(BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments, const uint8_t aGroundPlane[7], NETINFO_ITEM *aGndPlaneNet, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
void parsePoints(SPRINT_LAYOUT::OBJECT &aObj)
wxString convertString(const std::string &aStr) const
void processCircle(BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments, const uint8_t aGroundPlane[7], NETINFO_ITEM *aGndPlaneNet, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
SPRINT_LAYOUT::FILE_DATA m_fileData
PCB_LAYER_ID mapLayer(uint8_t aSprintLayer) const
void parseFileStart(const wxString &aFileName)
std::string readFixedString(size_t aMaxLen)
void processItemGroups(BOARD_ITEM *aItem, const SPRINT_LAYOUT::OBJECT &aObj, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
NETINFO_ITEM * resolveItemNet(BOARD *aBoard, const SPRINT_LAYOUT::OBJECT &aObj, PCB_LAYER_ID aLayer, const uint8_t aGroundPlane[7], NETINFO_ITEM *aGndPlaneNet) const
void processSegment(BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments, const uint8_t aGroundPlane[7], NETINFO_ITEM *aGndPlaneNet, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
void buildOutline(BOARD *aBoard, std::vector< std::vector< VECTOR2I > > &aOutlineSegments, const SPRINT_LAYOUT::BOARD_DATA &aBoardData)
void processText(BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
void parseGroups(SPRINT_LAYOUT::OBJECT &aObj)
void resolveGroups(BOARD_ITEM_CONTAINER *aContainer, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
void parseObject(SPRINT_LAYOUT::OBJECT &aObject, bool aIsTextChild=false)
BOARD * CreateBoard(std::map< wxString, std::unique_ptr< FOOTPRINT > > &aFootprintMap, size_t aBoardIndex=0)
void parseBoardHeader(SPRINT_LAYOUT::BOARD_DATA &aBoard)
void processPad(BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, const uint8_t aGroundPlane[7], NETINFO_ITEM *aGndPlaneNet, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
VECTOR2I sprintToKicadPos(float aX, float aY) const
FOOTPRINT * CreateFootprint()
int sprintToKicadCoord(float aValue) const
void parseObjectsList(SPRINT_LAYOUT::BOARD_DATA &aBoard)
bool ParseMacroFile(const wxString &aFileName)
std::vector< uint8_t > m_buffer
bool layerHasGroundPlane(PCB_LAYER_ID aLayer, const uint8_t aGroundPlane[7]) const
std::string readVarString()
void processLine(BOARD_ITEM_CONTAINER *aContainer, const SPRINT_LAYOUT::OBJECT &aObj, std::vector< std::vector< VECTOR2I > > &aOutlineSegments, const uint8_t aGroundPlane[7], NETINFO_ITEM *aGndPlaneNet, std::map< uint32_t, std::set< BOARD_ITEM * > > &aGidToItems)
bool ParseBoard(const wxString &aFileName)
Handle a list of polygons defining a copper zone.
void SetDoNotAllowPads(bool aEnable)
void SetLocalClearance(std::optional< int > aClearance)
void AddPolygon(std::vector< VECTOR2I > &aPolygon)
Add a polygon to the zone outline.
void SetBorderDisplayStyle(ZONE_BORDER_DISPLAY_STYLE aBorderHatchStyle, int aBorderHatchPitch, bool aRebuilBorderdHatch)
Set all hatch parameters for the zone.
void SetThermalReliefSpokeWidth(int aThermalReliefSpokeWidth)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetIsRuleArea(bool aEnable)
void SetDoNotAllowTracks(bool aEnable)
void SetLayerSet(const LSET &aLayerSet) override
void SetDoNotAllowVias(bool aEnable)
void SetNet(NETINFO_ITEM *aNetInfo) override
Override that drops aNetInfo when this zone is in copper-thieving fill mode.
void SetThermalReliefGap(int aThermalReliefGap)
void SetDoNotAllowFootprints(bool aEnable)
void SetDoNotAllowZoneFills(bool aEnable)
void SetAssignedPriority(unsigned aPriority)
void SetZoneName(const wxString &aName)
void SetIslandRemovalMode(ISLAND_REMOVAL_MODE aRemove)
static int GetDefaultHatchPitch()
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_45
static constexpr EDA_ANGLE ANGLE_180
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
Class to handle a set of BOARD_ITEMs.
static constexpr uint32_t MAX_CHILDREN
static constexpr uint32_t MAX_GROUPS
static constexpr uint32_t MAX_OBJECTS
static constexpr uint32_t MAX_POINTS
std::vector< OBJECT > objects
std::vector< POINT > points
std::vector< OBJECT > text_children
std::vector< uint32_t > groups
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
@ THERMAL
Use thermal relief for pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper