Eeschema Eagle Import: Parse polyline symbol elements.

This commit is contained in:
Russell Oliver 2017-07-17 22:47:49 +10:00 committed by Maciej Suminski
parent 7f8ac1cf02
commit 7af2a21891
2 changed files with 17 additions and 10 deletions

View File

@ -1234,8 +1234,9 @@ void SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
}
else if( nodeName == "polygon" )
{
// loadPolygon( aPart, currentNode );
// aPart->AddDrawItem();
LIB_POLYLINE* libpoly = loadSymbolPolyLine( aPart, currentNode );
libpoly->SetUnit( gateNumber );
aPart->AddDrawItem(libpoly);
}
else if( nodeName == "rectangle" )
{
@ -1350,17 +1351,23 @@ LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode*
// TODO: Layer map
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart ) );
NODE_MAP polygonChildren = mapChildren( aPolygonNode );
wxXmlNode* vertex = getChildrenNodes( polygonChildren, "vertex" );
EPOLYGON epoly( aPolygonNode );
wxXmlNode* vertex = aPolygonNode->GetChildren();
wxPoint pt;
while( vertex )
{
auto evertex = EVERTEX( vertex );
auto v = wxPoint( evertex.x * EUNIT_TO_MIL, evertex.y * EUNIT_TO_MIL );
polyLine->AddPoint( v );
vertex->GetNext();
if( vertex->GetName() == "vertex" ) // skip <xmlattr> node
{
EVERTEX evertex( vertex );
pt = wxPoint( evertex.x * EUNIT_TO_MIL, evertex.y * EUNIT_TO_MIL );
polyLine->AddPoint( pt );
}
vertex = vertex->GetNext();
}
polyLine->SetFillMode( FILLED_SHAPE );
return polyLine.release();
}

View File

@ -149,7 +149,7 @@ private:
void loadSymbol(wxXmlNode *aSymbolNode, LIB_PART* aPart, EDEVICE* aDevice, int gateNumber, string gateName);
LIB_CIRCLE* loadSymbolCircle( LIB_PART* aPart, wxXmlNode* aCircleNode );
LIB_RECTANGLE* loadSymbolRectangle( LIB_PART* aPart, wxXmlNode* aRectNode );
LIB_POLYLINE* loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode* aRectNode );
LIB_POLYLINE* loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode* aPolygonNode );
LIB_POLYLINE* loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNode );
LIB_PIN* loadPin( LIB_PART*, wxXmlNode* );
LIB_TEXT* loadSymboltext( LIB_PART* aPart, wxXmlNode* aLibText );