Eeschema Eagle Import: Update layer handling
This commit is contained in:
parent
2adc3d48b4
commit
bc23c55cec
|
@ -103,8 +103,23 @@ static int countChildren( wxXmlNode* aCurrentNode, const std::string& aName )
|
|||
return count;
|
||||
}
|
||||
|
||||
void SCH_EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
|
||||
{
|
||||
std::vector<ELAYER> eagleLayers;
|
||||
|
||||
static SCH_LAYER_ID kicadLayer( int aEagleLayer )
|
||||
// Get the first layer and iterate
|
||||
wxXmlNode* layerNode = aLayers->GetChildren();
|
||||
|
||||
// find the subset of layers that are copper, and active
|
||||
while( layerNode )
|
||||
{
|
||||
ELAYER elayer( layerNode );
|
||||
eagleLayers.push_back(elayer);
|
||||
|
||||
layerNode = layerNode->GetNext();
|
||||
}
|
||||
|
||||
for( const auto &elayer : eagleLayers )
|
||||
{
|
||||
/**
|
||||
* Layers in Kicad schematics are not actually layers, but abstract groups mainly used to
|
||||
|
@ -123,37 +138,33 @@ static SCH_LAYER_ID kicadLayer( int aEagleLayer )
|
|||
* </layers>
|
||||
*/
|
||||
|
||||
switch( aEagleLayer )
|
||||
if(elayer.name == "Nets")
|
||||
{
|
||||
case 90:
|
||||
break;
|
||||
|
||||
case 91:
|
||||
return LAYER_WIRE;
|
||||
|
||||
case 92:
|
||||
return LAYER_BUS;
|
||||
|
||||
case 93:
|
||||
break;
|
||||
|
||||
case 94:
|
||||
break;
|
||||
|
||||
case 95:
|
||||
break;
|
||||
|
||||
case 96:
|
||||
break;
|
||||
|
||||
case 97:
|
||||
return LAYER_NOTES;
|
||||
|
||||
case 98:
|
||||
break;
|
||||
m_LayerMap[elayer.number] = LAYER_WIRE;
|
||||
}
|
||||
else if(elayer.name == "Info" || elayer.name == "Guide")
|
||||
{
|
||||
m_LayerMap[elayer.number] = LAYER_NOTES;
|
||||
}
|
||||
else if(elayer.name == "Busses")
|
||||
{
|
||||
m_LayerMap[elayer.number] = LAYER_BUS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_LAYER_ID SCH_EAGLE_PLUGIN::kicadLayer( int aEagleLayer )
|
||||
{
|
||||
if(m_LayerMap.find(aEagleLayer) == m_LayerMap.end() )
|
||||
{
|
||||
return LAYER_NOTES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_LayerMap[aEagleLayer];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static COMPONENT_ORIENTATION_T kicadComponentRotation( float eagleDegrees )
|
||||
|
@ -363,7 +374,8 @@ void SCH_EAGLE_PLUGIN::loadDrawing( wxXmlNode* aDrawingNode )
|
|||
// wxXmlNode* grid = drawingChildren["grid"]
|
||||
|
||||
// TODO: handle layers nodes
|
||||
// wxXmlNode* layers = drawingChildren["layers"]
|
||||
wxXmlNode* layers = drawingChildren["layers"];
|
||||
loadLayerDefs(layers);
|
||||
|
||||
// TODO: handle library nodes
|
||||
// wxXmlNode* library = drawingChildren["library"]
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
|
||||
private:
|
||||
void loadDrawing( wxXmlNode* aDrawingNode );
|
||||
void loadLayerDefs( wxXmlNode* aLayers );
|
||||
void loadSchematic( wxXmlNode* aSchematicNode );
|
||||
void loadSheet( wxXmlNode* aSheetNode );
|
||||
void loadInstance( wxXmlNode* aInstanceNode );
|
||||
|
@ -137,6 +138,7 @@ private:
|
|||
void countNets( wxXmlNode* aSchematicNode );
|
||||
void addBusEntries();
|
||||
|
||||
SCH_LAYER_ID kicadLayer( int aEagleLayer );
|
||||
wxPoint findNearestLinePoint(wxPoint aPoint, const DLIST< SCH_LINE >& lines);
|
||||
|
||||
void loadSegments( wxXmlNode* aSegmentsNode, const wxString& aNetName,
|
||||
|
@ -166,7 +168,7 @@ private:
|
|||
|
||||
EDA_RECT sheetBoundingBox;
|
||||
std::map<std::string, int > m_NetCounts;
|
||||
|
||||
std::map<int, SCH_LAYER_ID> m_LayerMap;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue