51 return it->second.KiCadLayer;
61 return it->second.layerType;
71 return it->second.netNameRef;
79 for(
size_t i = 0; i < 8; ++i )
124 for(
int i = 0; i < (int)
m_PcbNetlist.GetCount(); i++ )
128 if( net->
m_Name == aNetName )
142 lNode =
FindNode( aNode, wxT(
"compDef" ) );
146 if( lNode->GetName() == wxT(
"compDef" ) )
148 lNode->GetAttribute( wxT(
"Name" ), &propValue );
150 if( propValue == aName )
158 lNode = lNode->GetNext();
166 const wxString& aPatGraphRefName,
167 const wxString& aXmlName,
168 const wxString& aActualConversion )
170 XNODE* tNode, * t1Node;
171 wxString n, nnew, pn, propValue, str;
179 if(
FindNode( tNode, wxT(
"patternGraphicsNameRef" ) ) )
182 wxT(
"patternGraphicsNameRef" ) )->GetAttribute( wxT(
"Name" ),
186 tNode =
FindNode( tNode, wxT(
"patternGraphicsRef" ) );
190 if( tNode->GetName() == wxT(
"patternGraphicsRef" ) )
192 if(
FindNode( tNode, wxT(
"patternGraphicsNameRef" ) ) )
195 wxT(
"patternGraphicsNameRef" ) )->GetAttribute( wxT(
"Name" ),
198 if( propValue == pn )
201 str = aTextValue->
text;
205 n = n + wxT(
' ' ) + str;
217 tNode =
FindNode( t1Node, wxT(
"attr" ) );
221 tNode->GetAttribute( wxT(
"Name" ), &propValue );
222 propValue.Trim(
false );
223 propValue.Trim(
true );
225 if( propValue == n || propValue == nnew )
237 wxXmlDocument* aXmlDoc,
238 const wxString& aActualConversion,
239 wxStatusBar* aStatusBar )
241 XNODE* lNode, * tNode, * mNode;
246 wxString cn, str, propValue;
254 if( lNode->GetName() == wxT(
"pattern" ) )
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" ) );
280 tNode =
FindNode( lNode, wxT(
"refDesRef" ) );
284 tNode->GetAttribute( wxT(
"Name" ), &fp->
m_name.
text );
291 tNode =
FindNode( lNode, wxT(
"pt" ) );
299 tNode =
FindNode( lNode, wxT(
"rotation" ) );
303 str = tNode->GetNodeContent();
310 if( str == wxT(
"True" ) )
315 while( tNode->GetName() != wxT(
"www.lura.sk" ) )
318 tNode =
FindNode( tNode, wxT(
"netlist" ) );
322 tNode =
FindNode( tNode, wxT(
"compInst" ) );
326 tNode->GetAttribute( wxT(
"Name" ), &propValue );
330 if(
FindNode( tNode, wxT(
"compValue" ) ) )
333 wxT(
"compValue" ) )->GetAttribute( wxT(
"Name" ),
339 if(
FindNode( tNode, wxT(
"compRef" ) ) )
342 wxT(
"compRef" ) )->GetAttribute( wxT(
"Name" ),
356 tNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"library" ) );
369 if( mNode->GetName() == wxT(
"padNum" ) )
371 str = mNode->GetNodeContent();
377 mNode->GetAttribute( wxT(
"Name" ), &propValue );
397 else if( lNode->GetName() == wxT(
"pad" ) )
403 else if( lNode->GetName() == wxT(
"via" ) )
409 else if( lNode->GetName() == wxT(
"polyKeepOut" ) )
425 const wxString& aNetName )
444 cp->
m_net = aNetName;
484 wxString lName, layerType;
488 aNode->GetAttribute( wxT(
"Name" ), &lName );
489 lName = lName.MakeUpper();
491 if( lName == wxT(
"TOP ASSY" ) )
493 else if( lName == wxT(
"TOP SILK" ) )
495 else if( lName == wxT(
"TOP PASTE" ) )
497 else if( lName == wxT(
"TOP MASK" ) )
499 else if( lName == wxT(
"TOP" ) )
501 else if( lName == wxT(
"BOTTOM" ) )
503 else if( lName == wxT(
"BOT MASK" ) )
505 else if( lName == wxT(
"BOT PASTE" ) )
507 else if( lName == wxT(
"BOT SILK" ) )
509 else if( lName == wxT(
"BOT ASSY" ) )
511 else if( lName == wxT(
"BOARD" ) )
527 if(
FindNode( aNode, wxT(
"layerNum" ) ) )
528 FindNode( aNode, wxT(
"layerNum" ) )->GetNodeContent().ToLong( &num );
536 if(
FindNode( aNode, wxT(
"layerType" ) ) )
538 layerType =
FindNode( aNode, wxT(
"layerType" ) )->GetNodeContent().Trim(
false );
540 if( layerType == wxT(
"NonSignal" ) )
542 if( layerType == wxT(
"Signal" ) )
544 if( layerType == wxT(
"Plane" ) )
548 m_LayersMap.insert( std::make_pair( num, newlayer ) );
550 if(
FindNode( aNode, wxT(
"netNameRef" ) ) )
552 FindNode( aNode, wxT(
"netNameRef" ) )->GetAttribute( wxT(
"Name" ),
561 for( i = 0; i < (int) aOutline->GetCount(); i++ )
562 if( *((*aOutline)[i]) == aPoint )
577 return sqrt( ( aPoint1->x - aPoint2->x ) *
578 ( aPoint1->x - aPoint2->x ) +
579 ( aPoint1->y - aPoint2->y ) *
580 ( aPoint1->y - aPoint2->y ) );
585 XNODE* iNode, *lNode, *pNode;
587 int x, y, i, j, targetInd;
588 wxRealPoint* xchgPoint;
591 iNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
601 if( iNode->GetName() == wxT(
"layerContents" ) )
603 if(
FindNode( iNode, wxT(
"layerNumRef" ) ) )
604 FindNode( iNode, wxT(
"layerNumRef" ) )->GetNodeContent().ToLong( &PCadLayer );
611 if( lNode->GetName() == wxT(
"line" ) )
613 pNode =
FindNode( lNode, wxT(
"pt" ) );
618 &x, &y, aActualConversion );
630 &x, &y, aActualConversion );
674 void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
const wxString& aActualConversion )
680 wxString compRef, pinRef, layerName, layerType;
684 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"asciiHeader" ) );
688 aNode =
FindNode( aNode, wxT(
"fileUnits" ) );
699 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
729 aNode =
FindNode( aNode, wxT(
"layerDef" ) );
733 if( aNode->GetName() == wxT(
"layerDef" ) )
735 if(
FindNode( aNode, wxT(
"layerType" ) ) )
738 wxT(
"layerType" ) )->GetNodeContent().Trim(
false );
740 if( layerType == wxT(
"Signal" ) || layerType == wxT(
"Plane" ) )
742 aNode->GetAttribute( wxT(
"Name" ), &layerName );
743 layerName = layerName.MakeUpper();
757 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
761 aNode =
FindNode( aNode, wxT(
"layerDef" ) );
765 if( aNode->GetName() == wxT(
"layerDef" ) )
777 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"netlist" ) );
781 aNode =
FindNode( aNode, wxT(
"net" ) );
787 net =
new PCB_NET( netCode++ );
798 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"pcbDesign" ) );
808 if( aNode->GetName() == wxT(
"multiLayer" ) )
812 if( aNode->GetName() == wxT(
"layerContents" ) )
826 for( j = 0; j < (int) net->
m_NetNodes.GetCount(); j++ )
829 compRef.Trim(
false );
830 compRef.Trim(
true );
832 pinRef.Trim(
false );
900 aNode =
FindNode( (
XNODE *)aXmlDoc->GetRoot(), wxT(
"library" ) );
904 aNode =
FindNode( aNode, wxT(
"compDef" ) );
910 if( aNode->GetName() == wxT(
"compDef" ) )
int GetNetCode(const wxString &aNetName) const override
LAYER_TYPE_T GetLayerType(int aPCadLayer) const override
void ParseBoard(wxStatusBar *aStatusBar, wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
int FindOutlinePoint(const VERTICES_ARRAY *aOutline, wxRealPoint aPoint) const
void SetCopperLayerCount(int aCount)
virtual void Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
PCB_NET_NODES_ARRAY m_NetNodes
PCB_COMPONENTS_ARRAY m_PcbComponents
void SetTextProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aPatGraphRefName, const wxString &aXmlName, const wxString &aActualConversion)
int FindLayer(const wxString &aLayerName) const
PCB_NETS_ARRAY m_PcbNetlist
virtual void SetPosOffset(int aX_offs, int aY_offs)
void ConnectPinToNet(const wxString &aCr, const wxString &aPr, const wxString &aNetName)
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
std::map< int, TLAYER > m_LayersMap
wxString ValidateName(wxString aName)
PCB_LAYER_ID
A quick note on layer IDs:
void AddToBoard() override
wxString m_DefaultMeasurementUnit
XNODE * GetChildren() const
wxArrayString m_layersStackup
void DoPCBComponents(XNODE *aNode, wxXmlDocument *aXmlDoc, const wxString &aActualConversion, wxStatusBar *aStatusBar)
XNODE * GetParent() const
wxString FindNodeGetContent(XNODE *aChild, const wxString &aTag)
void SetTextParameters(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
double GetDistance(const wxRealPoint *aPoint1, const wxRealPoint *aPoint2) const
XNODE * FindCompDefName(XNODE *aNode, const wxString &aName) const
void GetBoardOutline(wxXmlDocument *aXmlDoc, const wxString &aActualConversion)
wxString GetLayerNetNameRef(int aPCadLayer) const override
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
int LAYER_NUM
This can be replaced with int and removed.
PCB_LAYER_ID GetKiCadLayer() const
virtual bool Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion) override
Hold an XML or S-expression element.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Handle the data for a net.
Information pertinent to a Pcbnew printed circuit board.
void MapLayer(XNODE *aNode)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
PCB_CALLBACKS * m_callbacks
virtual void Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion) override
XNODE * FindPinMap(XNODE *aNode)
#define FIRST_COPPER_LAYER
int StrToInt1Units(const wxString &aStr)
#define THROW_IO_ERROR(msg)
PCB_LAYER_ID ToLAYER_ID(int aLayer)
wxString m_patGraphRefName