52 return it->second.KiCadLayer;
63 return it->second.layerType;
74 return it->second.netNameRef;
83 for(
size_t i = 0; i < 8; ++i )
128 for(
int i = 0; i < (int)
m_PcbNetlist.GetCount(); i++ )
132 if( net->
m_Name == aNetName )
143 XNODE* result =
nullptr, * lNode;
146 lNode =
FindNode( aNode, wxT(
"compDef" ) );
150 if( lNode->GetName().IsSameAs( wxT(
"compDef" ),
false ) )
152 lNode->GetAttribute( wxT(
"Name" ), &propValue );
154 if( propValue == aName )
170 const wxString& aXmlName,
const wxString& aActualConversion )
172 XNODE* tNode, * t1Node;
173 wxString n, nnew, pn, propValue, str;
181 if(
FindNode( tNode, wxT(
"patternGraphicsNameRef" ) ) )
184 wxT(
"patternGraphicsNameRef" ) )->GetAttribute( wxT(
"Name" ),
188 tNode =
FindNode( tNode, wxT(
"patternGraphicsRef" ) );
192 if( tNode->GetName().IsSameAs( wxT(
"patternGraphicsRef" ),
false ) )
194 if(
FindNode( tNode, wxT(
"patternGraphicsNameRef" ) ) )
197 wxT(
"patternGraphicsNameRef" ) )->GetAttribute( wxT(
"Name" ),
200 if( propValue == pn )
203 str = aTextValue->
text;
207 n = n + wxT(
' ' ) + str;
219 tNode =
FindNode( t1Node, wxT(
"attr" ) );
223 tNode->GetAttribute( wxT(
"Name" ), &propValue );
224 propValue.Trim(
false );
225 propValue.Trim(
true );
227 if( propValue == n || propValue == nnew )
239 wxStatusBar* aStatusBar )
241 XNODE* lNode, * tNode, * mNode;
246 wxString cn, str, propValue;
254 if( lNode->GetName().IsSameAs( wxT(
"pattern" ),
false ) )
256 FindNode( lNode, wxT(
"patternRef" ) )->GetAttribute( wxT(
"Name" ),
259 tNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"library" ) );
261 if( tNode && cn.Len() > 0 )
269 mNode =
FindNode( lNode, wxT(
"patternGraphicsNameRef" ) );
281 tNode =
FindNode( lNode, wxT(
"refDesRef" ) );
285 tNode->GetAttribute( wxT(
"Name" ), &fp->
m_name.
text );
292 tNode =
FindNode( lNode, wxT(
"pt" ) );
300 tNode =
FindNode( lNode, wxT(
"rotation" ) );
304 str = tNode->GetNodeContent();
311 if( str.IsSameAs( wxT(
"True" ),
false ) )
316 while( tNode->GetName() != wxT(
"www.lura.sk" ) )
319 tNode =
FindNode( tNode, wxT(
"netlist" ) );
323 tNode =
FindNode( tNode, wxT(
"compInst" ) );
327 tNode->GetAttribute( wxT(
"Name" ), &propValue );
331 if(
FindNode( tNode, wxT(
"compValue" ) ) )
334 wxT(
"compValue" ) )->GetAttribute( wxT(
"Name" ),
340 if(
FindNode( tNode, wxT(
"compRef" ) ) )
343 wxT(
"compRef" ) )->GetAttribute( wxT(
"Name" ),
359 tNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"library" ) );
372 if( mNode->GetName().IsSameAs( wxT(
"padNum" ),
false ) )
374 str = mNode->GetNodeContent();
380 mNode->GetAttribute( wxT(
"Name" ), &propValue );
400 else if( lNode->GetName().IsSameAs( wxT(
"pad" ),
false ) )
406 else if( lNode->GetName().IsSameAs( wxT(
"via" ),
false ) )
412 else if( lNode->GetName().IsSameAs( wxT(
"polyKeepOut" ),
false ) )
428 const wxString& aNetName )
447 cp->
m_net = aNetName;
469 wxString lName, layerType;
473 aNode->GetAttribute( wxT(
"Name" ), &lName );
474 lName = lName.MakeUpper();
476 if( lName == wxT(
"TOP ASSY" ) )
480 else if( lName == wxT(
"TOP SILK" ) )
484 else if( lName == wxT(
"TOP PASTE" ) )
488 else if( lName == wxT(
"TOP MASK" ) )
492 else if( lName == wxT(
"TOP" ) )
496 else if( lName == wxT(
"BOTTOM" ) )
500 else if( lName == wxT(
"BOT MASK" ) )
504 else if( lName == wxT(
"BOT PASTE" ) )
508 else if( lName == wxT(
"BOT SILK" ) )
512 else if( lName == wxT(
"BOT ASSY" ) )
516 else if( lName == wxT(
"BOARD" ) )
530 if(
FindNode( aNode, wxT(
"layerNum" ) ) )
531 FindNode( aNode, wxT(
"layerNum" ) )->GetNodeContent().ToLong( &num );
539 if(
FindNode( aNode, wxT(
"layerType" ) ) )
541 layerType =
FindNode( aNode, wxT(
"layerType" ) )->GetNodeContent().Trim(
false );
543 if( layerType.IsSameAs( wxT(
"NonSignal" ),
false ) )
546 if( layerType.IsSameAs( wxT(
"Signal" ),
false ) )
549 if( layerType.IsSameAs( wxT(
"Plane" ),
false ) )
553 m_LayersMap.insert( std::make_pair( num, newlayer ) );
555 if(
FindNode( aNode, wxT(
"netNameRef" ) ) )
557 FindNode( aNode, wxT(
"netNameRef" ) )->GetAttribute( wxT(
"Name" ),
566 for( i = 0; i < (int) aOutline->GetCount(); i++ )
568 if( *((*aOutline)[i]) == aPoint )
578 return sqrt( ( aPoint1->x - aPoint2->x ) * ( aPoint1->x - aPoint2->x ) +
579 ( aPoint1->y - aPoint2->y ) * ( aPoint1->y - aPoint2->y ) );
584 XNODE* iNode, *lNode, *pNode;
586 int x, y, i, j, targetInd;
587 wxRealPoint* xchgPoint;
590 iNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
600 if( iNode->GetName().IsSameAs( wxT(
"layerContents" ),
false ) )
602 if(
FindNode( iNode, wxT(
"layerNumRef" ) ) )
603 FindNode( iNode, wxT(
"layerNumRef" ) )->GetNodeContent().ToLong( &PCadLayer );
611 if( lNode->GetName().IsSameAs( wxT(
"line" ),
false ) )
613 pNode =
FindNode( lNode, wxT(
"pt" ) );
618 &x, &y, aActualConversion );
630 &x, &y, aActualConversion );
677 const wxString& aActualConversion )
683 wxString compRef, pinRef, layerName, layerType;
687 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"asciiHeader" ) );
691 aNode =
FindNode( aNode, wxT(
"fileUnits" ) );
702 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
732 aNode =
FindNode( aNode, wxT(
"layerDef" ) );
736 if( aNode->GetName().IsSameAs( wxT(
"layerDef" ),
false ) )
738 if(
FindNode( aNode, wxT(
"layerType" ) ) )
742 if(
FindNode( aNode, wxT(
"layerNum" ) ) )
743 FindNode( aNode, wxT(
"layerNum" ) )->GetNodeContent().ToLong( &num );
745 layerType =
FindNode( aNode, wxT(
"layerType" ) )->GetNodeContent().Trim(
748 if( num > 0 && ( layerType.IsSameAs( wxT(
"Signal" ),
false )
749 || layerType.IsSameAs( wxT(
"Plane" ),
false ) ) )
751 aNode->GetAttribute( wxT(
"Name" ), &layerName );
752 layerName = layerName.MakeUpper();
767 [&](
const std::pair<wxString, long>& a,
const std::pair<wxString, long>& b ) {
768 long lhs = a.second == 2 ? std::numeric_limits<long>::max() : a.second;
769 long rhs = b.second == 2 ? std::numeric_limits<long>::max() : b.second;
776 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
780 aNode =
FindNode( aNode, wxT(
"layerDef" ) );
784 if( aNode->GetName().IsSameAs( wxT(
"layerDef" ),
false ) )
796 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"netlist" ) );
800 aNode =
FindNode( aNode, wxT(
"net" ) );
806 net =
new PCB_NET( netCode++ );
817 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
827 if( aNode->GetName().IsSameAs( wxT(
"multiLayer" ),
false ) )
831 if( aNode->GetName().IsSameAs( wxT(
"layerContents" ),
false ) )
845 for( j = 0; j < (int) net->
m_NetNodes.GetCount(); j++ )
848 compRef.Trim(
false );
849 compRef.Trim(
true );
851 pinRef.Trim(
false );
919 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"library" ) );
923 aNode =
FindNode( aNode, wxT(
"compDef" ) );
929 if( aNode->GetName().IsSameAs( wxT(
"compDef" ),
false ) )
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.
void SetCopperLayerCount(int aCount)
Handle the data for a net.
wxString m_patGraphRefName
PCB_LAYER_ID GetKiCadLayer() const
virtual void SetPosOffset(int aX_offs, int aY_offs)
PCB_CALLBACKS * m_callbacks
virtual bool Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion) override
PCB_NET_NODES_ARRAY m_NetNodes
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aPatGraphRefName, const wxString &aXmlName, const wxString &aActualConversion)
wxString GetLayerNetNameRef(int aPCadLayer) const override
int FindLayer(const wxString &aLayerName) const
void ParseBoard(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
int FindOutlinePoint(const VERTICES_ARRAY *aOutline, wxRealPoint aPoint) const
void ConnectPinToNet(const wxString &aCr, const wxString &aPr, const wxString &aNetName)
void AddToBoard() override
int GetNetCode(const wxString &aNetName) const override
double GetDistance(const wxRealPoint *aPoint1, const wxRealPoint *aPoint2) const
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, const wxString &aActualConversion, wxStatusBar *aStatusBar)
void GetBoardOutline(wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
void MapLayer(XNODE *aNode)
std::vector< std::pair< wxString, long > > m_layersStackup
PCB_NETS_ARRAY m_PcbNetlist
wxString m_DefaultMeasurementUnit
XNODE * FindCompDefName(XNODE *aNode, const wxString &aName) const
std::map< int, TLAYER > m_LayersMap
PCB_COMPONENTS_ARRAY m_PcbComponents
LAYER_TYPE_T GetLayerType(int aPCadLayer) const override
Hold an XML or S-expression element.
XNODE * GetParent() const
XNODE * GetChildren() const
#define THROW_IO_ERROR(msg)
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
wxString ValidateName(const wxString &aName)
int StrToInt1Units(const wxString &aStr)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
XNODE * FindPinMap(XNODE *aNode)
wxString FindNodeGetContent(XNODE *aChild, const wxString &aTag)
void SetTextParameters(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)