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;
242 int LastX = 0, LastY = 0;
243 int FirstX = 0, FirstY = 0;
244 bool IsFirstPoint =
false;
245 bool IsBoardLayer =
false;
246 std::vector<PCAD_LINE*> lines;
249 if(
FindNode( aNode, wxT(
"layerNumRef" ) ) )
250 FindNode( aNode, wxT(
"layerNumRef" ) )->GetNodeContent().ToLong( &num );
252 PCadLayer = (int) num;
253 IsBoardLayer = ( PCadLayer == 3 );
260 aList->Add( plane_layer );
270 if( lNode->GetName() == wxT(
"line" ) )
273 line->
Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
278 lines.push_back( line );
288 if( lNode->GetName() == wxT(
"text" ) )
291 text->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
296 if( lNode->GetName() == wxT(
"attr" ) )
299 lNode->GetAttribute( wxT(
"Name" ), &propValue );
300 propValue.Trim(
false );
301 propValue.Trim(
true );
303 if( propValue == wxT(
"RefDes" ) )
305 tNode =
FindNode( lNode, wxT(
"textStyleRef" ) );
307 if( tNode && aFootprint )
323 if( lNode->GetName() == wxT(
"arc" ) || lNode->GetName() == wxT(
"triplePointArc" ) )
326 arc->
Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
330 if( lNode->GetName() == wxT(
"pcbPoly" ) )
336 plane_layer_polygon =
new VERTICES_ARRAY;
337 plane_layer->
FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
339 plane_layer->
m_Cutouts.Add( plane_layer_polygon );
346 if( polygon->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
347 aList->Add( polygon );
353 if( lNode->GetName() == wxT(
"copperPour95" ) )
357 if( copperPour->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
358 aList->Add( copperPour );
363 if( lNode->GetName() == wxT(
"polyCutOut" ) )
367 if( cutout->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
368 aList->Add( cutout );
373 if( lNode->GetName() == wxT(
"planeObj" ) )
377 if( plane->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
383 if( lNode->GetName() == wxT(
"boardOutlineObj" ) && IsBoardLayer )
391 pNode =
FindNode( lNode, wxT(
"width" ) );
395 SetWidth( pNode->GetNodeContent(), aDefaultMeasurementUnit, &width, aActualConversion );
397 pNode =
FindNode( lNode, wxT(
"enhancedPolygon" ) );
405 if( pNode->GetName() == wxT(
"polyPoint" ) )
407 SetPosition( pNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion );
410 IsFirstPoint =
false;
426 lines.push_back( line );
437 if( LastX != FirstX || LastY != FirstY )
442 line->
m_ToX = FirstX;
443 line->
m_ToY = FirstY;
449 lines.push_back( line );
479 const wxString& aDefaultMeasurementUnit,
480 const wxString& aActualConversion )
482 XNODE* lNode =
nullptr;
483 XNODE* tNode =
nullptr;;
484 XNODE* mNode =
nullptr;
487 wxString propValue, str;
489 FindNode( aNode, wxT(
"originalName" ) )->GetAttribute( wxT(
"Name" ), &propValue );
490 propValue.Trim(
false );
504 if( tNode->GetName() == wxT(
"pad" ) )
507 pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
511 if( tNode->GetName() == wxT(
"via" ) )
514 via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
525 lNode =
FindNode( lNode, wxT(
"layerContents" ) );
529 if( lNode->GetName() == wxT(
"layerContents" ) )
532 aDefaultMeasurementUnit, aActualConversion );
547 if( mNode->GetName() == wxT(
"padNum" ) )
549 str = mNode->GetNodeContent();
555 mNode->GetAttribute( wxT(
"Name" ), &propValue );
576 wxCHECK( aFootprint ==
nullptr, );
604 m_Name.correctedPositionY ) );
629 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