68 wxString propValue1, propValue2;
71 lNode =
FindNode( aNode, wxT(
"patternDef" ) );
75 if( lNode->GetName() == wxT(
"patternDef" ) )
77 lNode->GetAttribute( wxT(
"Name" ), &propValue1 );
78 if(
XNODE* originalNameNode =
FindNode( lNode, wxT(
"originalName" ) ) )
79 originalNameNode->GetAttribute( wxT(
"Name" ), &propValue2 );
94 lNode =
FindNode( aNode, wxT(
"patternDefExtended" ) );
98 if( lNode->GetName() == wxT(
"patternDefExtended" ) )
100 lNode->GetAttribute( wxT(
"Name" ), &propValue1 );
121 wxString propValue, patName;
128 if( lNode->GetName() == wxT(
"compDef" ) )
130 lNode->GetAttribute( wxT(
"Name" ), &propValue );
131 propValue.Trim(
false );
134 if(
XNODE* patternNode =
FindNode( lNode, wxT(
"attachedPattern" ) ) )
136 if(
XNODE* patternNameNode =
FindNode( patternNode, wxT(
"patternName" ) ) )
137 patternNameNode->GetAttribute( wxT(
"Name" ), &propValue );
139 propValue.Trim(
false );
140 propValue.Trim(
true );
151 lNode =
FindNode( pNode, wxT(
"multiLayer" ) );
155 *aPatGraphRefName = wxEmptyString;
162 if( *aPatGraphRefName == wxEmptyString )
164 if(
XNODE* nameRefNode =
FindNode( aNode, wxT(
"patternGraphicsNameRef" ) ) )
165 nameRefNode->GetAttribute( wxT(
"Name" ), aPatGraphRefName );
168 if(
FindNode( aNode, wxT(
"patternGraphicsDef" ) ) )
169 lNode =
FindNode( aNode, wxT(
"patternGraphicsDef" ) );
171 lNode =
FindNode( pNode, wxT(
"patternGraphicsDef" ) );
173 if( *aPatGraphRefName == wxEmptyString )
184 if( lNode->GetName() == wxT(
"patternGraphicsDef" ) )
186 if(
XNODE* nameDefNode =
FindNode( lNode, wxT(
"patternGraphicsNameDef" ) ) )
187 nameDefNode->GetAttribute( wxT(
"Name" ), &propValue );
189 if( propValue == *aPatGraphRefName )
211 auto it = std::find_if( vector.begin(), vector.end(),
214 return line->m_PositionX == l2->m_PositionX && line->m_PositionY == l2->m_PositionY
215 && line->m_ToX == l2->m_ToX && line->m_ToY == l2->m_ToY;
217 return it != vector.end();
221 PCAD_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
222 const wxString& aDefaultMeasurementUnit,
223 const wxString& aActualConversion )
231 VERTICES_ARRAY* plane_layer_polygon =
nullptr;
234 XNODE* lNode =
nullptr;
235 XNODE* tNode =
nullptr;
236 XNODE* pNode =
nullptr;
243 int LastX = 0, LastY = 0;
244 int FirstX = 0, FirstY = 0;
245 bool IsFirstPoint =
false;
246 bool IsBoardLayer =
false;
247 std::vector<PCAD_LINE*> lines;
250 if(
FindNode( aNode, wxT(
"layerNumRef" ) ) )
251 FindNode( aNode, wxT(
"layerNumRef" ) )->GetNodeContent().ToLong( &num );
253 PCadLayer = (int) num;
254 IsBoardLayer = ( PCadLayer == 3 );
261 aList->Add( plane_layer );
273 if( lNode->GetName() == wxT(
"line" ) )
276 line->
Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
281 lines.push_back( line );
291 if( lNode->GetName() == wxT(
"text" ) )
294 text->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
299 if( lNode->GetName() == wxT(
"attr" ) )
302 lNode->GetAttribute( wxT(
"Name" ), &propValue );
303 propValue.Trim(
false );
304 propValue.Trim(
true );
306 if( propValue == wxT(
"RefDes" ) )
308 tNode =
FindNode( lNode, wxT(
"textStyleRef" ) );
310 if( tNode && aFootprint )
326 if( lNode->GetName() == wxT(
"arc" ) || lNode->GetName() == wxT(
"triplePointArc" ) )
329 arc->
Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
333 if( lNode->GetName() == wxT(
"pcbPoly" ) )
339 plane_layer_polygon =
new VERTICES_ARRAY;
340 plane_layer->
FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
342 plane_layer->
m_Cutouts.Add( plane_layer_polygon );
349 if( polygon->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
350 aList->Add( polygon );
356 if( lNode->GetName() == wxT(
"copperPour95" ) )
360 if( copperPour->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
361 aList->Add( copperPour );
366 if( lNode->GetName() == wxT(
"polyCutOut" ) )
370 if( cutout->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
371 aList->Add( cutout );
376 if( lNode->GetName() == wxT(
"planeObj" ) )
380 if( plane->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
386 if( lNode->GetName() == wxT(
"boardOutlineObj" ) && IsBoardLayer )
394 pNode =
FindNode( lNode, wxT(
"width" ) );
398 SetWidth( pNode->GetNodeContent(), aDefaultMeasurementUnit, &width, aActualConversion );
400 pNode =
FindNode( lNode, wxT(
"enhancedPolygon" ) );
408 if( pNode->GetName() == wxT(
"polyPoint" ) )
410 SetPosition( pNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion );
413 IsFirstPoint =
false;
429 lines.push_back( line );
440 if( LastX != FirstX || LastY != FirstY )
445 line->
m_ToX = FirstX;
446 line->
m_ToY = FirstY;
452 lines.push_back( line );
482 const wxString& aDefaultMeasurementUnit,
483 const wxString& aActualConversion )
485 XNODE* lNode =
nullptr;
486 XNODE* tNode =
nullptr;;
487 XNODE* mNode =
nullptr;
490 wxString propValue, str;
492 FindNode( aNode, wxT(
"originalName" ) )->GetAttribute( wxT(
"Name" ), &propValue );
493 propValue.Trim(
false );
507 if( tNode->GetName() == wxT(
"pad" ) )
510 pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
514 if( tNode->GetName() == wxT(
"via" ) )
517 via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
528 lNode =
FindNode( lNode, wxT(
"layerContents" ) );
532 if( lNode->GetName() == wxT(
"layerContents" ) )
535 aDefaultMeasurementUnit, aActualConversion );
550 if( mNode->GetName() == wxT(
"padNum" ) )
552 str = mNode->GetNodeContent();
558 mNode->GetAttribute( wxT(
"Name" ), &propValue );
579 wxCHECK( aFootprint ==
nullptr, );
607 m_Name.correctedPositionY ) );
632 m_Value.correctedPositionY ) );
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
void SetFPRelativePosition(const VECTOR2I &aPos)
Information pertinent to a Pcbnew printed circuit board.
void SetMirrored(bool isMirrored)
virtual void SetVisible(bool aVisible)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetKeepUpright(bool aKeepUpright)
virtual void SetText(const wxString &aText)
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
A logical library item identifier and consists of various portions much like a URI.
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
virtual void Parse(XNODE *aNode, int aLayer, const wxString &aDefaultUnits, const wxString &aActualConversion)
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion) override
virtual bool Parse(XNODE *aNode, const wxString &aDefaultMeasurementUnit, const wxString &actualConversion) override
virtual void Parse(XNODE *aNode, int aLayer, const wxString &aDefaultUnits, const wxString &aActualConversion)
PCAD_CALLBACKS * m_callbacks
PCB_LAYER_ID GetKiCadLayer() const
wxString m_PatGraphRefName
PCAD_PCB_COMPONENT(PCAD_CALLBACKS *aCallbacks, BOARD *aBoard)
PCB_LAYER_ID m_KiCadLayer
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion) override
void SetOutline(VERTICES_ARRAY *aOutline)
virtual bool Parse(XNODE *aNode, const wxString &aDefaultUnits, const wxString &aActualConversion)
void FormPolygon(XNODE *aNode, VERTICES_ARRAY *aPolygon, const wxString &aDefaultUnits, const wxString &actualConversion)
void AssignNet(const wxString &aNetName)
An extension of wxXmlNode that can format its contents as KiCad-style s-expressions.
XNODE * GetParent() const
XNODE * GetChildren() const
wxString ValidateName(const wxString &aName)
void SetWidth(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aWidth, const wxString &aActualConversion)
static bool HasLine(std::vector< PCAD_LINE * > &vector, PCAD_LINE *line)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
wxString ValidateReference(const wxString &aRef)
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
XNODE * FindPinMap(XNODE *aNode)
void CorrectTextPosition(TTEXTVALUE *aValue)
void SetFontProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
void InitTTextValue(TTEXTVALUE *aTextValue)
void SetTextSizeFromTrueTypeFontHeight(EDA_TEXT *aText, int aTextHeight)
wxString result
Test unit parsing edge cases and error handling.
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