64 wxString propValue1, propValue2;
67 lNode =
FindNode( aNode, wxT(
"patternDef" ) );
71 if( lNode->GetName() == wxT(
"patternDef" ) )
73 lNode->GetAttribute( wxT(
"Name" ), &propValue1 );
74 if(
XNODE* originalNameNode =
FindNode( lNode, wxT(
"originalName" ) ) )
75 originalNameNode->GetAttribute( wxT(
"Name" ), &propValue2 );
90 lNode =
FindNode( aNode, wxT(
"patternDefExtended" ) );
94 if( lNode->GetName() == wxT(
"patternDefExtended" ) )
96 lNode->GetAttribute( wxT(
"Name" ), &propValue1 );
117 wxString propValue, patName;
124 if( lNode->GetName() == wxT(
"compDef" ) )
126 lNode->GetAttribute( wxT(
"Name" ), &propValue );
127 propValue.Trim(
false );
130 if(
XNODE* patternNode =
FindNode( lNode, wxT(
"attachedPattern" ) ) )
132 if(
XNODE* patternNameNode =
FindNode( patternNode, wxT(
"patternName" ) ) )
133 patternNameNode->GetAttribute( wxT(
"Name" ), &propValue );
135 propValue.Trim(
false );
136 propValue.Trim(
true );
147 lNode =
FindNode( pNode, wxT(
"multiLayer" ) );
151 *aPatGraphRefName = wxEmptyString;
158 if( *aPatGraphRefName == wxEmptyString )
160 if(
XNODE* nameRefNode =
FindNode( aNode, wxT(
"patternGraphicsNameRef" ) ) )
161 nameRefNode->GetAttribute( wxT(
"Name" ), aPatGraphRefName );
164 if(
FindNode( aNode, wxT(
"patternGraphicsDef" ) ) )
165 lNode =
FindNode( aNode, wxT(
"patternGraphicsDef" ) );
167 lNode =
FindNode( pNode, wxT(
"patternGraphicsDef" ) );
169 if( *aPatGraphRefName == wxEmptyString )
180 if( lNode->GetName() == wxT(
"patternGraphicsDef" ) )
182 if(
XNODE* nameDefNode =
FindNode( lNode, wxT(
"patternGraphicsNameDef" ) ) )
183 nameDefNode->GetAttribute( wxT(
"Name" ), &propValue );
185 if( propValue == *aPatGraphRefName )
207 auto it = std::find_if( vector.begin(), vector.end(),
210 return line->m_PositionX == l2->m_PositionX && line->m_PositionY == l2->m_PositionY
211 && line->m_ToX == l2->m_ToX && line->m_ToY == l2->m_ToY;
213 return it != vector.end();
217 PCAD_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
218 const wxString& aDefaultMeasurementUnit,
219 const wxString& aActualConversion )
227 VERTICES_ARRAY* plane_layer_polygon =
nullptr;
230 XNODE* lNode =
nullptr;
231 XNODE* tNode =
nullptr;
232 XNODE* pNode =
nullptr;
238 int LastX = 0, LastY = 0;
239 int FirstX = 0, FirstY = 0;
240 bool IsFirstPoint =
false;
241 bool IsBoardLayer =
false;
242 std::vector<PCAD_LINE*> lines;
245 if(
FindNode( aNode, wxT(
"layerNumRef" ) ) )
246 FindNode( aNode, wxT(
"layerNumRef" ) )->GetNodeContent().ToLong( &num );
248 PCadLayer = (int) num;
249 IsBoardLayer = ( PCadLayer == 3 );
256 aList->Add( plane_layer );
266 if( lNode->GetName() == wxT(
"line" ) )
269 line->
Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
274 lines.push_back( line );
284 if( lNode->GetName() == wxT(
"text" ) )
287 text->Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
292 if( lNode->GetName() == wxT(
"attr" ) )
295 lNode->GetAttribute( wxT(
"Name" ), &propValue );
296 propValue.Trim(
false );
297 propValue.Trim(
true );
299 if( propValue == wxT(
"RefDes" ) )
301 tNode =
FindNode( lNode, wxT(
"textStyleRef" ) );
303 if( tNode && aFootprint )
319 if( lNode->GetName() == wxT(
"arc" ) || lNode->GetName() == wxT(
"triplePointArc" ) )
322 arc->
Parse( lNode, PCadLayer, aDefaultMeasurementUnit, aActualConversion );
326 if( lNode->GetName() == wxT(
"pcbPoly" ) )
332 plane_layer_polygon =
new VERTICES_ARRAY;
333 plane_layer->
FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
335 plane_layer->
m_Cutouts.Add( plane_layer_polygon );
342 if( polygon->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
343 aList->Add( polygon );
349 if( lNode->GetName() == wxT(
"copperPour95" ) )
353 if( copperPour->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
354 aList->Add( copperPour );
359 if( lNode->GetName() == wxT(
"polyCutOut" ) )
363 if( cutout->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
364 aList->Add( cutout );
369 if( lNode->GetName() == wxT(
"planeObj" ) )
373 if( plane->
Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
379 if( lNode->GetName() == wxT(
"boardOutlineObj" ) && IsBoardLayer )
387 pNode =
FindNode( lNode, wxT(
"width" ) );
391 SetWidth( pNode->GetNodeContent(), aDefaultMeasurementUnit, &width, aActualConversion );
393 pNode =
FindNode( lNode, wxT(
"enhancedPolygon" ) );
401 if( pNode->GetName() == wxT(
"polyPoint" ) )
403 SetPosition( pNode->GetNodeContent(), aDefaultMeasurementUnit, &x, &y, aActualConversion );
406 IsFirstPoint =
false;
422 lines.push_back( line );
433 if( LastX != FirstX || LastY != FirstY )
438 line->
m_ToX = FirstX;
439 line->
m_ToY = FirstY;
445 lines.push_back( line );
475 const wxString& aDefaultMeasurementUnit,
476 const wxString& aActualConversion )
478 XNODE* lNode =
nullptr;
479 XNODE* tNode =
nullptr;;
480 XNODE* mNode =
nullptr;
483 wxString propValue, str;
485 FindNode( aNode, wxT(
"originalName" ) )->GetAttribute( wxT(
"Name" ), &propValue );
486 propValue.Trim(
false );
500 if( tNode->GetName() == wxT(
"pad" ) )
503 pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
507 if( tNode->GetName() == wxT(
"via" ) )
510 via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
521 lNode =
FindNode( lNode, wxT(
"layerContents" ) );
525 if( lNode->GetName() == wxT(
"layerContents" ) )
528 aDefaultMeasurementUnit, aActualConversion );
543 if( mNode->GetName() == wxT(
"padNum" ) )
545 str = mNode->GetNodeContent();
551 mNode->GetAttribute( wxT(
"Name" ), &propValue );
572 wxCHECK( aFootprint ==
nullptr, );
600 m_Name.correctedPositionY ) );
625 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 SetKeepUpright(bool aKeepUpright)
virtual void SetText(const wxString &aText)
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)
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
void SetTextAngle(const EDA_ANGLE &aAngle) override
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