2020-07-12 16:58:35 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-09-06 17:00:02 +00:00
|
|
|
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
2020-07-12 16:58:35 +00:00
|
|
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file cadstar_pcb_archive_parser.cpp
|
|
|
|
* @brief Parses a CADSTAR PCB Archive file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cadstar_pcb_archive_parser.h>
|
2020-09-14 17:13:09 +00:00
|
|
|
#include <convert_to_biu.h> // PCB_IU_PER_MM
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::Parse()
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
XNODE* fileRootNode = LoadArchiveFile( Filename, wxT( "CADSTARPCB" ) );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 16:44:20 +00:00
|
|
|
XNODE* cNode = fileRootNode->GetChildren();
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 16:44:20 +00:00
|
|
|
if( !cNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "HEADER" ), wxT( "CADSTARPCB" ) );
|
|
|
|
|
2020-07-18 16:44:20 +00:00
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
2020-07-18 16:44:20 +00:00
|
|
|
if( cNode->GetName() == wxT( "HEADER" ) )
|
|
|
|
{
|
|
|
|
Header.Parse( cNode );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 16:44:20 +00:00
|
|
|
switch( Header.Resolution )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
case RESOLUTION::HUNDREDTH_MICRON:
|
2020-09-14 17:13:09 +00:00
|
|
|
KiCadUnitMultiplier = PCB_IU_PER_MM / 1e5;
|
2020-07-18 16:44:20 +00:00
|
|
|
break;
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 16:44:20 +00:00
|
|
|
default:
|
|
|
|
wxASSERT_MSG( true, wxT( "Unknown File Resolution" ) );
|
|
|
|
break;
|
|
|
|
}
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
if( Header.Format.Type != wxT( "LAYOUT" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
if( Header.Format.Type == wxT( "LIBRARY" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_IO_ERROR(
|
|
|
|
"The selected file is a CADSTAR Library file (as opposed to a Layout "
|
|
|
|
"file). CADSTAR libraries cannot yet be imported into KiCad." );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-13 21:42:17 +00:00
|
|
|
else
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
THROW_IO_ERROR(
|
|
|
|
"The selected file is an unknown CADSTAR format so cannot be "
|
|
|
|
"imported into KiCad." );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
2020-07-18 16:44:20 +00:00
|
|
|
}
|
|
|
|
else if( cNode->GetName() == wxT( "ASSIGNMENTS" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 16:44:20 +00:00
|
|
|
Assignments.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
else if( cNode->GetName() == wxT( "LIBRARY" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Library.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-03 22:07:07 +00:00
|
|
|
else if( cNode->GetName() == wxT( "DEFAULTS" ) )
|
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
// No design information here (no need to parse)
|
|
|
|
// Only contains CADSTAR configuration data such as default shapes, text and units
|
|
|
|
// In future some of this could be converted to KiCad but limited value
|
2020-08-03 22:07:07 +00:00
|
|
|
}
|
|
|
|
else if( cNode->GetName() == wxT( "PARTS" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-03 22:07:07 +00:00
|
|
|
Parts.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNode->GetName() == wxT( "LAYOUT" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Layout.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNode->GetName() == wxT( "DISPLAY" ) )
|
|
|
|
{
|
|
|
|
// No design information here (no need to parse)
|
|
|
|
// Contains CADSTAR Display settings such as layer/element colours and visibility.
|
|
|
|
// In the future these settings could be converted to KiCad
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "[root]" ) );
|
|
|
|
}
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
delete fileRootNode;
|
2020-07-18 16:44:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::ASSIGNMENTS::Parse( XNODE* aNode )
|
2020-07-18 16:44:20 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "ASSIGNMENTS" ) );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
if( !cNode )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "TECHNOLOGY" ), wxT( "ASSIGNMENTS" ) );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 16:44:20 +00:00
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "LAYERDEFS" ) )
|
|
|
|
Layerdefs.Parse( cNode );
|
|
|
|
else if( cNode->GetName() == wxT( "CODEDEFS" ) )
|
|
|
|
Codedefs.Parse( cNode );
|
|
|
|
else if( cNode->GetName() == wxT( "TECHNOLOGY" ) )
|
|
|
|
Technology.Parse( cNode );
|
|
|
|
else if( cNode->GetName() == wxT( "GRIDS" ) )
|
|
|
|
Grids.Parse( cNode );
|
|
|
|
else if( cNode->GetName() == wxT( "NETCLASSEDITATTRIBSETTINGS" ) )
|
|
|
|
NetclassEditAttributeSettings = true;
|
|
|
|
else if( cNode->GetName() == wxT( "SPCCLASSEDITATTRIBSETTINGS" ) )
|
|
|
|
SpacingclassEditAttributeSettings = true;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS::Parse( XNODE* aNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "LAYERDEFS" ) );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-12 16:58:35 +00:00
|
|
|
wxXmlAttribute* xmlAttribute = NULL;
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
if( !cNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "LAYERSTACK" ), wxT( "LAYERDEFS" ) );
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
wxString nodeName = cNode->GetName();
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
if( nodeName == wxT( "LAYERSTACK" ) )
|
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
xmlAttribute = cNode->GetAttributes();
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
|
|
|
|
{
|
2020-09-02 21:48:18 +00:00
|
|
|
if( !IsValidAttribute( xmlAttribute ) )
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
LayerStack.push_back( (LAYER_ID) xmlAttribute->GetValue() );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CheckNoChildNodes( cNode );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "MATERIAL" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
MATERIAL material;
|
2020-07-18 09:04:22 +00:00
|
|
|
material.Parse( cNode );
|
2020-07-12 16:58:35 +00:00
|
|
|
Materials.insert( std::make_pair( material.ID, material ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "LAYER" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
LAYER layer;
|
2020-07-18 09:04:22 +00:00
|
|
|
layer.Parse( cNode );
|
2020-07-12 16:58:35 +00:00
|
|
|
Layers.insert( std::make_pair( layer.ID, layer ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "SWAPPAIR" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
LAYER_ID layerId = (LAYER_ID) GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
LAYER_ID swapLayerId = (LAYER_ID) GetXmlAttributeIDString( cNode, 1 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
Layers[layerId].SwapLayerID = swapLayerId;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( nodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::RULESET::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "RULESET" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString nodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( nodeName == wxT( "ROUCODEREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
AreaRouteCodeID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( nodeName == wxT( "VIACODEREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
AreaViaCodeID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( nodeName == wxT( "SPACINGCODE" ) )
|
|
|
|
{
|
2020-08-31 22:09:29 +00:00
|
|
|
SPACINGCODE spacingcode;
|
|
|
|
spacingcode.Parse( cNode );
|
|
|
|
SpacingCodes.insert( std::make_pair( spacingcode.ID, spacingcode ) );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( nodeName, aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::CODEDEFS_PCB::Parse( XNODE* aNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "CODEDEFS" ) );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString nodeName = cNode->GetName();
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( ParseSubNode( cNode ) ) // in CADSTAR_ARCHIVE_PARSER::CODEDEFS
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "COPPERCODE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
COPPERCODE coppercode;
|
2020-07-18 09:04:22 +00:00
|
|
|
coppercode.Parse( cNode );
|
|
|
|
CopperCodes.insert( std::make_pair( coppercode.ID, coppercode ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "SPACINGCODE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SPACINGCODE spacingcode;
|
2020-07-18 09:04:22 +00:00
|
|
|
spacingcode.Parse( cNode );
|
2020-08-31 22:09:29 +00:00
|
|
|
SpacingCodes.insert( std::make_pair( spacingcode.ID, spacingcode ) );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( nodeName == wxT( "RULESET" ) )
|
|
|
|
{
|
|
|
|
RULESET ruleset;
|
|
|
|
ruleset.Parse( cNode );
|
|
|
|
Rulesets.insert( std::make_pair( ruleset.ID, ruleset ) );
|
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( nodeName == wxT( "PADCODE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
PADCODE padcode;
|
2020-07-18 09:04:22 +00:00
|
|
|
padcode.Parse( cNode );
|
|
|
|
PadCodes.insert( std::make_pair( padcode.ID, padcode ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "VIACODE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
VIACODE viacode;
|
2020-07-18 09:04:22 +00:00
|
|
|
viacode.Parse( cNode );
|
|
|
|
ViaCodes.insert( std::make_pair( viacode.ID, viacode ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "LAYERPAIR" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
LAYERPAIR layerpair;
|
2020-07-18 09:04:22 +00:00
|
|
|
layerpair.Parse( cNode );
|
|
|
|
LayerPairs.insert( std::make_pair( layerpair.ID, layerpair ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "SPCCLASSSPACE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SPCCLASSSPACE spcclassspace;
|
2020-07-18 09:04:22 +00:00
|
|
|
spcclassspace.Parse( cNode );
|
|
|
|
SpacingClasses.push_back( spcclassspace );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( nodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::Parse( XNODE* aNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "MATERIAL" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString sType = GetXmlAttributeIDString( aNode, 2 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
if( sType == wxT( "CONSTRUCTION" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = MATERIAL_LAYER_TYPE::CONSTRUCTION;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( sType == wxT( "ELECTRICAL" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = MATERIAL_LAYER_TYPE::ELECTRICAL;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( sType == wxT( "NONELEC" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = MATERIAL_LAYER_TYPE::NON_ELECTRICAL;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( sType, wxString::Format( "MATERIAL %s", Name ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
XNODE* iNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
if( !iNode )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-07-12 16:58:35 +00:00
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR(
|
|
|
|
wxT( "RESISTIVITY" ), wxString::Format( "MATERIAL %s", Name ) );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
for( ; iNode; iNode = iNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString nodeName = iNode->GetName();
|
|
|
|
|
|
|
|
if( nodeName == wxT( "RELPERMIT" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ParseChildEValue( iNode, Permittivity );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "LOSSTANGENT" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ParseChildEValue( iNode, LossTangent );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "RESISTIVITY" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ParseChildEValue( iNode, Resistivity );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( nodeName, wxString::Format( "MATERIAL %s", Name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYER::Parse( XNODE* aNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "LAYER" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
auto processLayerMaterialDetails = [&]() {
|
|
|
|
XNODE* tempNode = cNode->GetChildren();
|
|
|
|
for( ; tempNode; tempNode = tempNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString tempNodeName = tempNode->GetName();
|
|
|
|
|
2020-09-08 13:01:32 +00:00
|
|
|
if( tempNodeName == wxT( "MAKE" ) || tempNodeName == wxT( "LAYERHEIGHT" ) )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
2020-09-08 13:01:32 +00:00
|
|
|
if( tempNodeName == wxT( "LAYERHEIGHT" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-08 13:01:32 +00:00
|
|
|
Thickness = GetXmlAttributeIDLong( tempNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-09-08 13:01:32 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MaterialId = GetXmlAttributeIDString( tempNode, 0 );
|
|
|
|
Thickness = GetXmlAttributeIDLong( tempNode, 1 );
|
|
|
|
}
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
XNODE* childOfTempNode = tempNode->GetChildren();
|
|
|
|
|
|
|
|
if( childOfTempNode )
|
|
|
|
{
|
|
|
|
if( childOfTempNode->GetName() == wxT( "EMBEDS" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString embedsValue = GetXmlAttributeIDString( childOfTempNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
if( embedsValue == wxT( "UPWARDS" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Embedding = EMBEDDING::ABOVE;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( embedsValue == wxT( "DOWNWARDS" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Embedding = EMBEDDING::BELOW;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR(
|
|
|
|
embedsValue, wxString::Format( "LAYER %s -> EMBEDS", Name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( childOfTempNode->GetName(),
|
|
|
|
wxString::Format( "LAYER %s->MAKE", Name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( tempNodeName == wxT( "BIAS" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString bias = GetXmlAttributeIDString( tempNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
if( bias == wxT( "X_BIASED" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
RoutingBias = ROUTING_BIAS::X;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( bias == wxT( "Y_BIASED" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
RoutingBias = ROUTING_BIAS::Y;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( bias == wxT( "ANTITRACK" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
RoutingBias = ROUTING_BIAS::ANTI_ROUTE;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( bias == wxT( "OBSTACLE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
RoutingBias = ROUTING_BIAS::OBSTACLE;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( bias == wxT( "UNBIASED" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
RoutingBias = ROUTING_BIAS::UNBIASED;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR(
|
|
|
|
bias, wxString::Format( "LAYER %s -> BIAS", Name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( tempNodeName, wxString::Format( "LAYER %s", Name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "ALLDOC" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::ALLDOC;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ALLELEC" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::ALLELEC;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ALLLAYER" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::ALLLAYER;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ASSCOMPCOPP" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::ASSCOMPCOPP;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "JUMPERLAYER" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::JUMPERLAYER;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "NOLAYER" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::NOLAYER;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "POWER" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::POWER;
|
|
|
|
PhysicalLayer = GetXmlAttributeIDLong( cNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
processLayerMaterialDetails();
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "DOC" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::DOC;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "CONSTRUCTION" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::CONSTRUCTION;
|
2020-07-12 16:58:35 +00:00
|
|
|
processLayerMaterialDetails();
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ELEC" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::ELEC;
|
|
|
|
PhysicalLayer = GetXmlAttributeIDLong( cNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
processLayerMaterialDetails();
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "NONELEC" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
Type = LAYER_TYPE::NONELEC;
|
|
|
|
PhysicalLayer = GetXmlAttributeIDLong( cNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
processLayerMaterialDetails();
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "DESCRIPTION" ) )
|
|
|
|
{
|
|
|
|
Description = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
2020-09-07 22:40:33 +00:00
|
|
|
else if( cNodeName == wxT( "REFPLANE" ) )
|
|
|
|
{
|
|
|
|
ReferencePlane = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "VLAYER" ) )
|
|
|
|
{
|
|
|
|
VariantLayer = true;
|
|
|
|
}
|
2020-07-12 16:58:35 +00:00
|
|
|
else if( cNodeName == wxT( "LASUBTYP" ) )
|
|
|
|
{
|
|
|
|
//Process subtype
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString sSubType = GetXmlAttributeIDString( cNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
|
|
|
if( sSubType == wxT( "LAYERSUBTYPE_ASSEMBLY" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_ASSEMBLY;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( sSubType == wxT( "LAYERSUBTYPE_PASTE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_PASTE;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( sSubType == wxT( "LAYERSUBTYPE_PLACEMENT" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_PLACEMENT;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( sSubType == wxT( "LAYERSUBTYPE_SILKSCREEN" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_SILKSCREEN;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( sSubType == wxT( "LAYERSUBTYPE_SOLDERRESIST" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_SOLDERRESIST;
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR(
|
|
|
|
sSubType, wxString::Format( "LAYER %s %s", Name, cNodeName ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxString::Format( "LAYER %s", Name ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPREASSIGN::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COPREASSIGN" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CopperWidth = GetXmlAttributeIDLong( aNode, 1 );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPERCODE::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COPPERCODE" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CopperWidth = GetXmlAttributeIDLong( aNode, 2 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( cNode->GetName() == wxT( "COPREASSIGN" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
CADSTAR_PCB_ARCHIVE_PARSER::COPREASSIGN reassign;
|
2020-07-18 09:04:22 +00:00
|
|
|
reassign.Parse( cNode );
|
|
|
|
Reassigns.push_back( reassign );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::REASSIGN::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "SPACEREASSIGN" ) );
|
|
|
|
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Spacing = GetXmlAttributeIDLong( aNode, 1 );
|
|
|
|
|
|
|
|
CheckNoChildNodes( aNode );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "SPACINGCODE" ) );
|
|
|
|
|
2020-08-31 22:09:29 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
2020-07-30 22:42:56 +00:00
|
|
|
Spacing = GetXmlAttributeIDLong( aNode, 1 );
|
2020-08-09 22:01:28 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "SPACEREASSIGN" ) )
|
|
|
|
{
|
|
|
|
REASSIGN reassign;
|
|
|
|
reassign.Parse( cNode );
|
|
|
|
Reassigns.push_back( reassign );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
bool CADSTAR_PCB_ARCHIVE_PARSER::PAD_SHAPE::IsPadShape( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxString aNodeName = aNode->GetName();
|
|
|
|
|
|
|
|
if( aNodeName == wxT( "ANNULUS" ) || aNodeName == wxT( "BULLET" ) || aNodeName == wxT( "ROUND" )
|
|
|
|
|| aNodeName == wxT( "DIAMOND" ) || aNodeName == wxT( "FINGER" )
|
|
|
|
|| aNodeName == wxT( "OCTAGON" ) || aNodeName == wxT( "RECTANGLE" )
|
|
|
|
|| aNodeName == wxT( "ROUNDED" ) || aNodeName == wxT( "SQUARE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
return true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
return false;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PAD_SHAPE::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
wxASSERT( IsPadShape( aNode ) );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
wxString aNodeName = aNode->GetName();
|
|
|
|
|
|
|
|
if( aNodeName == wxT( "ANNULUS" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::ANNULUS;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "BULLET" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::BULLET;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "ROUND" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::CIRCLE;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "DIAMOND" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::DIAMOND;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "FINGER" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::FINGER;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "OCTAGON" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::OCTAGON;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "RECTANGLE" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::RECTANGLE;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "ROUNDED" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::ROUNDED_RECT;
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( aNodeName == wxT( "SQUARE" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
ShapeType = PAD_SHAPE_TYPE::SQUARE;
|
2020-07-18 09:04:22 +00:00
|
|
|
else
|
|
|
|
wxASSERT( true );
|
|
|
|
|
|
|
|
switch( ShapeType )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
case PAD_SHAPE_TYPE::ANNULUS:
|
|
|
|
Size = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
InternalFeature = GetXmlAttributeIDLong( aNode, 1 );
|
2020-07-18 09:04:22 +00:00
|
|
|
break;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
case PAD_SHAPE_TYPE::ROUNDED_RECT:
|
|
|
|
InternalFeature = GetXmlAttributeIDLong( aNode, 3 );
|
2020-09-18 10:32:57 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
case PAD_SHAPE_TYPE::BULLET:
|
|
|
|
case PAD_SHAPE_TYPE::FINGER:
|
|
|
|
case PAD_SHAPE_TYPE::RECTANGLE:
|
|
|
|
RightLength = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
LeftLength = GetXmlAttributeIDLong( aNode, 1 );
|
2020-09-18 10:32:57 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
case PAD_SHAPE_TYPE::SQUARE:
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
if( aNode->GetChildren() )
|
|
|
|
{
|
|
|
|
if( aNode->GetChildren()->GetName() == wxT( "ORIENT" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
OrientAngle = GetXmlAttributeIDLong( aNode->GetChildren(), 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CheckNoNextNodes( aNode->GetChildren() );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
2020-09-18 10:32:57 +00:00
|
|
|
KI_FALLTHROUGH;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
case PAD_SHAPE_TYPE::CIRCLE:
|
|
|
|
Size = GetXmlAttributeIDLong( aNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PADREASSIGN::Parse( XNODE* aNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "PADREASSIGN" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 0 );
|
2020-07-12 16:58:35 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
if( PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
|
2020-07-18 09:04:22 +00:00
|
|
|
Shape.Parse( aNode->GetChildren() );
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CheckNoNextNodes( aNode->GetChildren() );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PADCODE::Parse( XNODE* aNode )
|
2020-07-12 16:58:35 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "PADCODE" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
wxString location = wxString::Format( "PADCODE -> %s", Name );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
if( PAD_SHAPE::IsPadShape( cNode ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
Shape.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "CLEARANCE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ReliefClearance = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "RELIEFWIDTH" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ReliefWidth = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "DRILL" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
DrillDiameter = GetXmlAttributeIDLong( cNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
XNODE* subNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; subNode; subNode = subNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString subNodeName = subNode->GetName();
|
|
|
|
|
|
|
|
if( subNodeName == wxT( "NONPLATED" ) )
|
|
|
|
Plated = false;
|
|
|
|
else if( subNodeName == wxT( "OVERSIZE" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
DrillOversize = GetXmlAttributeIDLong( subNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( subNode->GetName(), location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "DRILLLENGTH" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SlotLength = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "DRILLORIENTATION" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SlotOrientation = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "DRILLXOFFSET" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
DrillXoffset = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "DRILLYOFFSET" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
DrillYoffset = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "PADREASSIGN" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
PADREASSIGN reassign;
|
2020-07-18 09:04:22 +00:00
|
|
|
reassign.Parse( cNode );
|
2020-07-30 22:42:56 +00:00
|
|
|
Reassigns.insert( std::make_pair( reassign.LayerID, reassign.Shape ) );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::VIAREASSIGN::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "VIAREASSIGN" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
if( PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
|
2020-07-18 09:04:22 +00:00
|
|
|
Shape.Parse( aNode->GetChildren() );
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), aNode->GetName() );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CheckNoNextNodes( aNode->GetChildren() );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::VIACODE::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "VIACODE" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
wxString location = wxString::Format( "VIACODE -> %s", Name );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
if( PAD_SHAPE::IsPadShape( cNode ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
Shape.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "CLEARANCE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ReliefClearance = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "RELIEFWIDTH" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ReliefWidth = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
else if( cNodeName == wxT( "DRILL" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
DrillDiameter = GetXmlAttributeIDLong( cNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
XNODE* subNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; subNode; subNode = subNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString subNodeName = subNode->GetName();
|
|
|
|
|
|
|
|
if( subNodeName == wxT( "OVERSIZE" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
DrillOversize = GetXmlAttributeIDLong( subNode, 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( subNode->GetName(), location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "VIAREASSIGN" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
VIAREASSIGN reassign;
|
2020-07-18 09:04:22 +00:00
|
|
|
reassign.Parse( cNode );
|
2020-07-30 22:42:56 +00:00
|
|
|
Reassigns.insert( std::make_pair( reassign.LayerID, reassign.Shape ) );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYERPAIR::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "LAYERPAIR" ) );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
PhysicalLayerStart = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
PhysicalLayerEnd = GetXmlAttributeIDLong( aNode, 3 );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
wxString location = wxString::Format( "LAYERPAIR -> %s", Name );
|
|
|
|
|
|
|
|
if( aNode->GetChildren() )
|
|
|
|
{
|
|
|
|
if( aNode->GetChildren()->GetName() == wxT( "VIACODEREF" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
ViacodeID = GetXmlAttributeIDString( aNode->GetChildren(), 0 );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 09:04:22 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
CheckNoNextNodes( aNode->GetChildren() );
|
2020-07-18 09:04:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SPCCLASSSPACE::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "SPCCLASSSPACE" ) );
|
2020-08-09 22:01:28 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
SpacingClassID1 = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
SpacingClassID2 = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
Spacing = GetXmlAttributeIDLong( aNode, 3 );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TECHNOLOGY_SECTION::Parse( XNODE* aNode )
|
2020-07-18 09:04:22 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "TECHNOLOGY" ) );
|
2020-07-18 09:04:22 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-07-18 09:04:22 +00:00
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( ParseSubNode( cNode ) ) //CADSTAR_ARCHIVE_PARSER::SETTINGS
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "MINROUTEWIDTH" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
MinRouteWidth = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "MINNECKED" ) )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
MinNeckedLength = GetXmlAttributeIDLong( cNode, 0 );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "MINUNNECKED" ) )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
MinUnneckedLength = GetXmlAttributeIDLong( cNode, 0 );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "MINMITER" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
MinMitre = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "MAXMITER" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
MaxMitre = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "MAXPHYSLAYER" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
MaxPhysicalLayer = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "TRACKGRID" ) )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
TrackGrid = GetXmlAttributeIDLong( cNode, 0 );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "VIAGRID" ) )
|
|
|
|
{
|
|
|
|
ViaGrid = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-19 22:05:02 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "BACKOFFJCTS" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
BackOffJunctions = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 16:44:20 +00:00
|
|
|
else if( cNodeName == wxT( "BCKOFFWIDCHANGE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 16:44:20 +00:00
|
|
|
BackOffWidthChange = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 16:44:20 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-18 16:44:20 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TECHNOLOGY" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-18 16:44:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-08 13:01:32 +00:00
|
|
|
CADSTAR_PCB_ARCHIVE_PARSER::PAD_SIDE CADSTAR_PCB_ARCHIVE_PARSER::GetPadSide(
|
|
|
|
const wxString& aPadSideString )
|
|
|
|
{
|
|
|
|
if( aPadSideString == wxT( "THRU" ) )
|
|
|
|
return PAD_SIDE::THROUGH_HOLE;
|
|
|
|
else if( aPadSideString == wxT( "BOTTOM" ) )
|
|
|
|
return PAD_SIDE::MAXIMUM;
|
|
|
|
else if( aPadSideString == wxT( "TOP" ) )
|
|
|
|
return PAD_SIDE::MINIMUM;
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
return PAD_SIDE::THROUGH_HOLE; // Assume through hole as default
|
2020-09-08 13:01:32 +00:00
|
|
|
}
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COMPCOPPER" ) );
|
|
|
|
|
|
|
|
CopperCodeID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-08-09 22:01:28 +00:00
|
|
|
bool shapeIsInitialised = false; // Stop more than one Shape Object
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString location = wxT( "COMPCOPPER" );
|
|
|
|
|
|
|
|
if( !cNode )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !shapeIsInitialised && Shape.IsShape( cNode ) )
|
|
|
|
{
|
|
|
|
Shape.Parse( cNode );
|
|
|
|
shapeIsInitialised = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "SWAPRULE" ) )
|
|
|
|
{
|
|
|
|
SwapRule = ParseSwapRule( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ASSOCPIN" ) )
|
|
|
|
{
|
|
|
|
wxXmlAttribute* xmlAttribute = cNode->GetAttributes();
|
|
|
|
|
|
|
|
for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
|
|
|
|
{
|
2020-09-02 21:48:18 +00:00
|
|
|
if( !IsValidAttribute( xmlAttribute ) )
|
|
|
|
continue;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
long padId;
|
|
|
|
|
|
|
|
if( !xmlAttribute->GetValue().ToLong( &padId ) )
|
|
|
|
THROW_PARSING_IO_ERROR( wxT( "ASSOCPIN" ), location );
|
|
|
|
|
|
|
|
AssociatedPadIDs.push_back( (PAD_ID) padId );
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckNoChildNodes( cNode );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_AREA::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COMPAREA" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 3 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-08-09 22:01:28 +00:00
|
|
|
bool shapeIsInitialised = false; // Stop more than one Shape Object
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString location = wxString::Format( "COMPAREA %s", ID );
|
|
|
|
|
|
|
|
if( !cNode )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !shapeIsInitialised && SHAPE::IsShape( cNode ) )
|
|
|
|
{
|
|
|
|
Shape.Parse( cNode );
|
|
|
|
shapeIsInitialised = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "SWAPRULE" ) )
|
|
|
|
{
|
|
|
|
SwapRule = ParseSwapRule( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "USAGE" ) )
|
|
|
|
{
|
|
|
|
wxXmlAttribute* xmlAttribute = cNode->GetAttributes();
|
|
|
|
|
|
|
|
for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
|
|
|
|
{
|
2020-09-02 21:48:18 +00:00
|
|
|
if( !IsValidAttribute( xmlAttribute ) )
|
|
|
|
continue;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
if( xmlAttribute->GetValue() == wxT( "NO_TRACKS" ) )
|
|
|
|
NoTracks = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "NO_VIAS" ) )
|
|
|
|
NoVias = true;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( xmlAttribute->GetValue(), location );
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckNoChildNodes( cNode );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PAD_EXITS::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "EXITS" ) );
|
|
|
|
|
|
|
|
wxXmlAttribute* xmlAttribute = aNode->GetAttributes();
|
|
|
|
|
|
|
|
for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
|
|
|
|
{
|
2020-09-02 21:48:18 +00:00
|
|
|
if( !IsValidAttribute( xmlAttribute ) )
|
|
|
|
continue;
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
if( xmlAttribute->GetValue() == wxT( "FREE" ) )
|
|
|
|
FreeAngle = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "N" ) )
|
|
|
|
North = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "S" ) )
|
|
|
|
South = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "E" ) )
|
|
|
|
East = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "W" ) )
|
|
|
|
West = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "NE" ) )
|
|
|
|
NorthEast = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "NW" ) )
|
|
|
|
NorthWest = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "SE" ) )
|
|
|
|
SouthEast = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "SW" ) )
|
|
|
|
SouthWest = true;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( xmlAttribute->GetValue(), wxT( "EXITS" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckNoChildNodes( aNode );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PAD::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "PAD" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
PadCodeID = GetXmlAttributeIDString( aNode, 2 );
|
2020-09-16 10:27:15 +00:00
|
|
|
Side = GetPadSide( GetXmlAttributeIDString( aNode, 3 ) );
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-09-27 21:09:16 +00:00
|
|
|
wxString location = wxString::Format( "PAD %ld", ID );
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
if( !cNode )
|
2020-08-03 22:07:07 +00:00
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "PT" ), location );
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "ORIENT" ) )
|
|
|
|
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
else if( cNodeName == wxT( "FIRSTPAD" ) )
|
|
|
|
FirstPad = true;
|
|
|
|
else if( cNodeName == wxT( "EXITS" ) )
|
|
|
|
Exits.Parse( cNode );
|
|
|
|
else if( cNodeName == wxT( "PADIDENTIFIER" ) )
|
|
|
|
Identifier = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
else if( cNodeName == wxT( "PCBONLYPAD" ) )
|
|
|
|
PCBonlyPad = true;
|
|
|
|
else if( cNodeName == wxT( "PT" ) )
|
|
|
|
Position.Parse( cNode );
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::ARROW::Parse( XNODE* aNode )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "DIMARROW" ) );
|
|
|
|
bool arrowStyleInitialised = false;
|
|
|
|
bool upperAngleInitialised = false;
|
|
|
|
bool lowerAngleInitialised = false;
|
2020-07-30 22:42:56 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
ArrowLength = GetXmlAttributeIDLong( aNode, 3 );
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( cNodeName == wxT( "ARROWSTYLE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
wxString arrowStyleStr = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
arrowStyleInitialised = true;
|
|
|
|
|
|
|
|
if( arrowStyleStr == wxT( "DIMENSION_ARROWOPEN" ) )
|
|
|
|
ArrowStyle = STYLE::OPEN;
|
|
|
|
else if( arrowStyleStr == wxT( "DIMENSION_ARROWCLOSED" ) )
|
|
|
|
ArrowStyle = STYLE::CLOSED;
|
|
|
|
else if( arrowStyleStr == wxT( "DIMENSION_ARROWCLEAR" ) )
|
|
|
|
ArrowStyle = STYLE::CLEAR;
|
|
|
|
else if( arrowStyleStr == wxT( "DIMENSION_ARROWCLOSEDFILLED" ) )
|
|
|
|
ArrowStyle = STYLE::CLOSED_FILLED;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( arrowStyleStr, cNodeName );
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ARROWANGLEA" ) )
|
|
|
|
{
|
|
|
|
UpperAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
upperAngleInitialised = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ARROWANGLEB" ) )
|
|
|
|
{
|
|
|
|
UpperAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
lowerAngleInitialised = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( cNodeName, wxT( "DIMARROW" ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !arrowStyleInitialised )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "ARROWSTYLE" ), wxT( "DIMARROW" ) );
|
|
|
|
|
|
|
|
if( !upperAngleInitialised )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "ARROWANGLEA" ), wxT( "DIMARROW" ) );
|
|
|
|
|
|
|
|
if( !lowerAngleInitialised )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "ARROWANGLEB" ), wxT( "DIMARROW" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::TEXTFORMAT::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "DIMTEXT" ) );
|
|
|
|
|
|
|
|
TextGap = GetXmlAttributeIDLong( aNode, 1 );
|
|
|
|
TextOffset = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
if( cNode->GetName() != wxT( "TXTSTYLE" ) )
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), wxT( "DIMTEXT" ) );
|
|
|
|
|
|
|
|
wxString styleStr = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
|
|
|
|
if( styleStr == wxT( "DIMENSION_INTERNAL" ) )
|
|
|
|
Style = STYLE::INSIDE;
|
|
|
|
else if( styleStr == wxT( "DIMENSION_EXTERNAL" ) )
|
|
|
|
Style = STYLE::OUTSIDE;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( styleStr, wxT( "TXTSTYLE" ) );
|
|
|
|
|
|
|
|
CheckNoNextNodes( cNode );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::EXTENSION_LINE::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "EXTLINE" ) );
|
|
|
|
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Overshoot = GetXmlAttributeIDLong( aNode, 3 );
|
|
|
|
Offset = GetXmlAttributeIDLong( aNode, 4 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
int noOfPoints = 0;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( noOfPoints < 2 && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
++noOfPoints;
|
|
|
|
|
|
|
|
if( noOfPoints == 1 )
|
|
|
|
Start.Parse( cNode );
|
|
|
|
else
|
|
|
|
End.Parse( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "SUPPRESSFIRST" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SuppressFirst = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "EXTLINE" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( noOfPoints != 2 )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), wxT( "EXTLINE" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::IsLine( XNODE* aNode )
|
|
|
|
{
|
|
|
|
if( aNode->GetName() == wxT( "LEADERLINE" ) || aNode->GetName() == wxT( "LINEARLINE" )
|
|
|
|
|| aNode->GetName() == wxT( "ANGULARLINE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
return true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
return false;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( IsLine( aNode ) );
|
|
|
|
|
|
|
|
if( aNode->GetName() == wxT( "LINEARLINE" ) )
|
|
|
|
Type = TYPE::LINEARLINE;
|
|
|
|
else if( aNode->GetName() == wxT( "LEADERLINE" ) )
|
|
|
|
Type = TYPE::LEADERLINE;
|
|
|
|
else if( aNode->GetName() == wxT( "ANGULARLINE" ) )
|
|
|
|
Type = TYPE::ANGULARLINE;
|
|
|
|
else
|
|
|
|
wxASSERT_MSG( true, "Not a valid type. What happened to the node Name?" );
|
|
|
|
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
if( Type == TYPE::LEADERLINE )
|
|
|
|
{
|
|
|
|
LeaderLineLength = GetXmlAttributeIDLong( aNode, 5 );
|
|
|
|
LeaderLineExtensionLength = GetXmlAttributeIDLong( aNode, 6 );
|
|
|
|
}
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
int noOfPoints = 0;
|
|
|
|
int requiredNoOfPoints = 2;
|
|
|
|
|
|
|
|
if( Type == TYPE::ANGULARLINE )
|
|
|
|
requiredNoOfPoints = 3;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "DIMLINETYPE" ) )
|
|
|
|
{
|
|
|
|
wxString styleStr = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
|
|
|
|
if( styleStr == wxT( "DIMENSION_INTERNAL" ) )
|
|
|
|
Style = STYLE::INTERNAL;
|
|
|
|
else if( styleStr == wxT( "DIMENSION_EXTERNAL" ) )
|
|
|
|
Style = STYLE::EXTERNAL;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( styleStr, cNodeName );
|
|
|
|
}
|
|
|
|
else if( noOfPoints < requiredNoOfPoints && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
++noOfPoints;
|
|
|
|
|
|
|
|
if( noOfPoints == 1 )
|
|
|
|
Start.Parse( cNode );
|
|
|
|
else if( noOfPoints == 2 )
|
|
|
|
End.Parse( cNode );
|
|
|
|
else
|
|
|
|
Centre.Parse( cNode );
|
|
|
|
}
|
|
|
|
else if( Type == TYPE::LEADERLINE && cNodeName == wxT( "LEADERANG" ) )
|
|
|
|
{
|
|
|
|
LeaderAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( noOfPoints != requiredNoOfPoints )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::IsDimension( XNODE* aNode )
|
|
|
|
{
|
|
|
|
if( aNode->GetName() == wxT( "LINEARDIM" ) || aNode->GetName() == wxT( "LEADERDIM" )
|
|
|
|
|| aNode->GetName() == wxT( "ANGLEDIM" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
return true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
return false;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( IsDimension( aNode ) );
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
std::map<wxString, TYPE> typeMap = { { wxT( "LINEARDIM" ), TYPE::LINEARDIM },
|
|
|
|
{ wxT( "LEADERDIM" ), TYPE::LEADERDIM }, { wxT( "ANGLEDIM" ), TYPE::ANGLEDIM } };
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
//make sure aNode is valid TYPE
|
|
|
|
wxASSERT_MSG( typeMap.find( aNode->GetName() ) != typeMap.end(),
|
|
|
|
"Not a valid type. What happened to the node Name?" );
|
|
|
|
|
|
|
|
Type = typeMap[aNode->GetName()];
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
wxString subTypeStr = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
2020-09-27 13:10:59 +00:00
|
|
|
std::map<wxString, SUBTYPE> subTypeMap = {
|
|
|
|
{ wxT( "DIMENSION_ORTHOGONAL" ), SUBTYPE::ORTHOGONAL },
|
|
|
|
{ wxT( "DIMENSION_DIRECT" ), SUBTYPE::DIRECT },
|
|
|
|
{ wxT( "DIMENSION_ANGLED" ), SUBTYPE::ANGLED },
|
|
|
|
{ wxT( "DIMENSION_DIAMETER" ), SUBTYPE::DIAMETER },
|
|
|
|
{ wxT( "DIMENSION_RADIUS" ), SUBTYPE::RADIUS },
|
|
|
|
{ wxT( "DIMENSION_ANGULAR" ), SUBTYPE::ANGULAR } };
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
if( subTypeMap.find( subTypeStr ) == subTypeMap.end() )
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( subTypeStr, aNode->GetName() );
|
|
|
|
|
|
|
|
Subtype = subTypeMap[subTypeStr];
|
|
|
|
Precision = GetXmlAttributeIDLong( aNode, 3 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
bool idParsed = false;
|
|
|
|
bool unitsParsed = false; //UNITS or ANGUNITS
|
|
|
|
bool arrowParsed = false;
|
|
|
|
bool textFormatParsed = false;
|
|
|
|
bool extLineParsed = false;
|
|
|
|
bool lineParsed = false;
|
|
|
|
bool textParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !idParsed && cNodeName == wxT( "DIMREF" ) )
|
|
|
|
{
|
|
|
|
ID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
idParsed = true;
|
|
|
|
}
|
|
|
|
else if( !unitsParsed && cNodeName == wxT( "UNITS" ) )
|
|
|
|
{
|
|
|
|
LinearUnits = ParseUnits( cNode );
|
|
|
|
unitsParsed = true;
|
|
|
|
}
|
|
|
|
else if( !unitsParsed && cNodeName == wxT( "ANGUNITS" ) )
|
|
|
|
{
|
|
|
|
AngularUnits = ParseAngunits( cNode );
|
|
|
|
unitsParsed = true;
|
|
|
|
}
|
|
|
|
else if( !arrowParsed && cNodeName == wxT( "DIMARROW" ) )
|
|
|
|
{
|
|
|
|
Arrow.Parse( cNode );
|
|
|
|
arrowParsed = true;
|
|
|
|
}
|
|
|
|
else if( !textFormatParsed && cNodeName == wxT( "DIMTEXT" ) )
|
|
|
|
{
|
|
|
|
TextParams.Parse( cNode );
|
|
|
|
textFormatParsed = true;
|
|
|
|
}
|
|
|
|
else if( !extLineParsed && cNodeName == wxT( "EXTLINE" ) )
|
|
|
|
{
|
|
|
|
ExtensionLineParams.Parse( cNode );
|
|
|
|
extLineParsed = true;
|
|
|
|
}
|
|
|
|
else if( !lineParsed && LINE::IsLine( cNode ) )
|
|
|
|
{
|
|
|
|
Line.Parse( cNode );
|
|
|
|
lineParsed = true;
|
|
|
|
}
|
|
|
|
else if( !textParsed && cNodeName == wxT( "TEXT" ) )
|
|
|
|
{
|
|
|
|
Text.Parse( cNode );
|
|
|
|
textParsed = true;
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse( XNODE* aNode )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "SYMDEF" ) );
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
ParseIdentifiers( aNode );
|
|
|
|
|
2020-07-30 22:42:56 +00:00
|
|
|
wxString rest;
|
|
|
|
|
|
|
|
if( ReferenceName.StartsWith( wxT( "JUMPERNF" ), &rest ) )
|
|
|
|
Type = SYMDEF_TYPE::JUMPER;
|
|
|
|
else if( ReferenceName.StartsWith( wxT( "STARPOINTNF" ), &rest ) )
|
|
|
|
Type = SYMDEF_TYPE::STARPOINT;
|
|
|
|
else if( ReferenceName == wxT( "TESTPOINT" ) )
|
|
|
|
Type = SYMDEF_TYPE::TESTPOINT;
|
|
|
|
else
|
|
|
|
Type = SYMDEF_TYPE::COMPONENT;
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-07-30 22:42:56 +00:00
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( ParseSubNode( cNode ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
continue;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "SYMHEIGHT" ) )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
SymHeight = GetXmlAttributeIDLong( cNode, 0 );
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMPCOPPER" ) )
|
|
|
|
{
|
|
|
|
COMPONENT_COPPER compcopper;
|
|
|
|
compcopper.Parse( cNode );
|
|
|
|
ComponentCoppers.push_back( compcopper );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMPAREA" ) )
|
|
|
|
{
|
|
|
|
COMPONENT_AREA area;
|
|
|
|
area.Parse( cNode );
|
|
|
|
ComponentAreas.insert( std::make_pair( area.ID, area ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PAD" ) )
|
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
PAD pad;
|
|
|
|
pad.Parse( cNode );
|
|
|
|
Pads.insert( std::make_pair( pad.ID, pad ) );
|
2020-08-03 22:07:07 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "DIMENSIONS" ) )
|
2020-08-03 22:07:07 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
XNODE* dimensionNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; dimensionNode; dimensionNode = dimensionNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( DIMENSION::IsDimension( dimensionNode ) )
|
|
|
|
{
|
|
|
|
DIMENSION dim;
|
|
|
|
dim.Parse( dimensionNode );
|
|
|
|
Dimensions.insert( std::make_pair( dim.ID, dim ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( dimensionNode->GetName(), cNodeName );
|
|
|
|
}
|
|
|
|
}
|
2020-08-03 22:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-03 22:07:07 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-03 22:07:07 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
if( !Stub && !Origin.IsFullySpecified() )
|
2020-09-10 20:58:20 +00:00
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
2020-08-03 22:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LIBRARY::Parse( XNODE* aNode )
|
2020-08-03 22:07:07 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
wxASSERT( aNode->GetName() == wxT( "LIBRARY" ) );
|
2020-08-03 22:07:07 +00:00
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( cNodeName == wxT( "SYMDEF" ) )
|
2020-08-03 22:07:07 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
SYMDEF_PCB symdef;
|
|
|
|
symdef.Parse( cNode );
|
|
|
|
ComponentDefinitions.insert( std::make_pair( symdef.ID, symdef ) );
|
2020-08-03 22:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::BOARD::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "BOARD" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool shapeIsInitialised = false; // Stop more than one Shape Object
|
|
|
|
wxString location = wxString::Format( "BOARD %s", ID );
|
|
|
|
|
|
|
|
if( !cNode )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !shapeIsInitialised && SHAPE::IsShape( cNode ) )
|
|
|
|
{
|
|
|
|
Shape.Parse( cNode );
|
|
|
|
shapeIsInitialised = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
|
|
|
attr.Parse( cNode );
|
|
|
|
AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::AREA::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "AREA" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 4 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool shapeIsInitialised = false; // Stop more than one Shape Object
|
|
|
|
wxString location = wxString::Format( "AREA %s", ID );
|
|
|
|
|
|
|
|
if( !cNode )
|
|
|
|
THROW_MISSING_NODE_IO_ERROR( wxT( "Shape" ), location );
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !shapeIsInitialised && SHAPE::IsShape( cNode ) )
|
|
|
|
{
|
|
|
|
Shape.Parse( cNode );
|
|
|
|
shapeIsInitialised = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
|
|
|
{
|
|
|
|
Fixed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "USAGE" ) )
|
|
|
|
{
|
|
|
|
wxXmlAttribute* xmlAttribute = cNode->GetAttributes();
|
|
|
|
|
|
|
|
for( ; xmlAttribute; xmlAttribute = xmlAttribute->GetNext() )
|
|
|
|
{
|
2020-09-02 21:48:18 +00:00
|
|
|
if( !IsValidAttribute( xmlAttribute ) )
|
|
|
|
continue;
|
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
if( xmlAttribute->GetValue() == wxT( "PLACEMENT" ) )
|
|
|
|
Placement = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "ROUTING" ) )
|
|
|
|
Routing = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "KEEPOUT" ) )
|
|
|
|
Keepout = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "NO_TRACKS" ) )
|
|
|
|
NoTracks = true;
|
|
|
|
else if( xmlAttribute->GetValue() == wxT( "NO_VIAS" ) )
|
|
|
|
NoVias = true;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( xmlAttribute->GetValue(), location );
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckNoChildNodes( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "AREAHEIGHT" ) )
|
|
|
|
{
|
|
|
|
AreaHeight = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
|
|
|
attr.Parse( cNode );
|
|
|
|
AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PIN_ATTRIBUTE::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "PINATTR" ) );
|
|
|
|
|
|
|
|
Pin = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attrVal;
|
|
|
|
attrVal.Parse( cNode );
|
|
|
|
AttributeValues.insert( std::make_pair( attrVal.AttributeID, attrVal ) );
|
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( cNodeName == wxT( "TESTLAND" ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
TestlandSide = ParseTestlandSide( cNode );
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-08 13:01:32 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PADEXCEPTION::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "PADEXCEPTION" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "PADCODEREF" ) )
|
|
|
|
{
|
|
|
|
PadCode = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "SIDE" ) )
|
|
|
|
{
|
|
|
|
OverrideSide = true;
|
|
|
|
Side = GetPadSide( GetXmlAttributeIDString( cNode, 0 ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ORIENT" ) )
|
|
|
|
{
|
|
|
|
OverrideOrientation = true;
|
|
|
|
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-09 22:01:28 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COMP" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
PartID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
SymdefID = GetXmlAttributeIDString( aNode, 3 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool originParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !originParsed && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
Origin.Parse( cNode );
|
|
|
|
originParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "TESTPOINT" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
TestPoint = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "MIRROR" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Mirror = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "READABILITY" ) )
|
|
|
|
{
|
|
|
|
Readability = ParseReadability( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ORIENT" ) )
|
|
|
|
{
|
|
|
|
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
}
|
2020-09-07 22:40:33 +00:00
|
|
|
else if( cNodeName == wxT( "VCOMPMASTER" ) )
|
|
|
|
{
|
|
|
|
VariantParentComponentID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
VariantID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "TEXTLOC" ) )
|
|
|
|
{
|
|
|
|
TEXT_LOCATION textloc;
|
|
|
|
textloc.Parse( cNode );
|
|
|
|
TextLocations.insert( std::make_pair( textloc.AttributeID, textloc ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attrVal;
|
|
|
|
attrVal.Parse( cNode );
|
|
|
|
AttributeValues.insert( std::make_pair( attrVal.AttributeID, attrVal ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PINATTR" ) )
|
|
|
|
{
|
|
|
|
PIN_ATTRIBUTE pinAttr;
|
|
|
|
pinAttr.Parse( cNode );
|
|
|
|
PinAttributes.insert( std::make_pair( pinAttr.Pin, pinAttr ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMPPINLABEL" ) )
|
|
|
|
{
|
|
|
|
PART_DEFINITION_PIN_ID pinID = GetXmlAttributeIDLong( cNode, 0 );
|
|
|
|
wxString pinLabel = GetXmlAttributeIDString( cNode, 1 );
|
|
|
|
PinLabels.insert( std::make_pair( pinID, pinLabel ) );
|
|
|
|
}
|
2020-09-08 13:01:32 +00:00
|
|
|
else if( cNodeName == wxT( "PADEXCEPTION" ) )
|
|
|
|
{
|
|
|
|
PADEXCEPTION padExcept;
|
|
|
|
padExcept.Parse( cNode );
|
|
|
|
PadExceptions.insert( std::make_pair( padExcept.ID, padExcept ) );
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !originParsed )
|
|
|
|
THROW_MISSING_PARAMETER_IO_ERROR( wxT( "PT" ), aNode->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CADSTAR_PCB_ARCHIVE_PARSER::TESTLAND_SIDE CADSTAR_PCB_ARCHIVE_PARSER::ParseTestlandSide(
|
|
|
|
XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "TESTLAND" ) );
|
|
|
|
|
|
|
|
wxString side = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
if( side == wxT( "MIN_SIDE" ) )
|
|
|
|
return TESTLAND_SIDE::MIN;
|
|
|
|
else if( side == wxT( "MAX_SIDE" ) )
|
|
|
|
return TESTLAND_SIDE::MAX;
|
|
|
|
else if( side == wxT( "BOTH_SIDES" ) )
|
|
|
|
return TESTLAND_SIDE::BOTH;
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( side, aNode->GetName() );
|
|
|
|
|
|
|
|
return TESTLAND_SIDE::NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::PIN::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "PIN" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
ComponentID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
PadID = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
CheckNoChildNodes( aNode );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::VIA::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "VIA" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
ViaCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerPairID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "PT" ) )
|
|
|
|
Location.Parse( cNode );
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
|
|
|
Fixed = true;
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
|
|
|
ReuseBlockRef.Parse( cNode );
|
|
|
|
else if( cNodeName == wxT( "TESTLAND" ) )
|
|
|
|
TestlandSide = ParseTestlandSide( cNode );
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::COPPER_TERMINAL::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COPTERM" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
CopperID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
CopperTermNum = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
}
|
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
XNODE* CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE_VERTEX::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "ROUTEWIDTH" ) );
|
|
|
|
|
|
|
|
RouteWidth = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
XNODE* nextNode = aNode->GetNext();
|
|
|
|
|
|
|
|
if( nextNode->GetName() == wxT( "FIX" ) )
|
|
|
|
{
|
|
|
|
Fixed = true;
|
|
|
|
nextNode = nextNode->GetNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !VERTEX::IsVertex( nextNode ) )
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( nextNode->GetName(), wxT( "ROUTE_VERTEX" ) );
|
|
|
|
|
|
|
|
Vertex.Parse( nextNode );
|
|
|
|
|
|
|
|
return nextNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "ROUTE" ) );
|
|
|
|
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool startPointParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !startPointParsed && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
startPointParsed = true;
|
|
|
|
StartPoint.Parse( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ROUTEWIDTH" ) )
|
|
|
|
{
|
|
|
|
ROUTE_VERTEX rtVert;
|
|
|
|
cNode = rtVert.Parse( cNode );
|
|
|
|
RouteVertices.push_back( rtVert );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "ROUTE" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::CONNECTION_PCB::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
ParseIdentifiers( aNode );
|
2020-08-09 22:01:28 +00:00
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool routeParsed = false; //assume only one route per connection
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( ParseSubNode( cNode ) )
|
2020-09-27 13:10:59 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
continue;
|
2020-09-27 13:10:59 +00:00
|
|
|
}
|
2020-09-10 20:58:20 +00:00
|
|
|
else if( !Unrouted && !routeParsed && cNodeName == wxT( "ROUTE" ) )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
Route.Parse( cNode );
|
|
|
|
routeParsed = true;
|
|
|
|
}
|
|
|
|
else if( !routeParsed && cNodeName == wxT( "UNROUTE" ) )
|
|
|
|
{
|
|
|
|
Unrouted = true;
|
|
|
|
UnrouteLayerID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "CONN" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 17:00:02 +00:00
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
ParseIdentifiers( aNode );
|
2020-08-09 22:01:28 +00:00
|
|
|
|
|
|
|
//Parse child nodes
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
if( ParseSubNode( cNode ) )
|
2020-09-05 15:31:57 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
continue;
|
2020-09-05 15:31:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "PIN" ) )
|
|
|
|
{
|
|
|
|
PIN pin;
|
|
|
|
pin.Parse( cNode );
|
|
|
|
Pins.insert( std::make_pair( pin.ID, pin ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "VIA" ) )
|
|
|
|
{
|
|
|
|
VIA via;
|
|
|
|
via.Parse( cNode );
|
|
|
|
Vias.insert( std::make_pair( via.ID, via ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COPTERM" ) )
|
|
|
|
{
|
|
|
|
COPPER_TERMINAL cterm;
|
|
|
|
cterm.Parse( cNode );
|
|
|
|
CopperTerminals.insert( std::make_pair( cterm.ID, cterm ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "CONN" ) )
|
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
CONNECTION_PCB conn;
|
2020-08-09 22:01:28 +00:00
|
|
|
conn.Parse( cNode );
|
|
|
|
Connections.push_back( conn );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "NET" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::POURING::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "POURING" ) );
|
|
|
|
|
|
|
|
CopperCodeID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
ReliefCopperCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
ClearanceWidth = GetXmlAttributeIDLong( aNode, 2 );
|
|
|
|
SliverWidth = GetXmlAttributeIDLong( aNode, 3 );
|
|
|
|
AdditionalIsolation = GetXmlAttributeIDLong( aNode, 4 );
|
|
|
|
ThermalReliefPadsAngle = GetXmlAttributeIDLong( aNode, 5 );
|
|
|
|
ThermalReliefViasAngle = GetXmlAttributeIDLong( aNode, 6 );
|
|
|
|
|
|
|
|
wxString MinIsolCopStr = GetXmlAttributeIDString( aNode, 7 );
|
|
|
|
|
|
|
|
if( MinIsolCopStr == wxT( "NONE" ) )
|
|
|
|
MinIsolatedCopper = UNDEFINED_VALUE;
|
|
|
|
else
|
|
|
|
MinIsolatedCopper = GetXmlAttributeIDLong( aNode, 7 );
|
|
|
|
|
|
|
|
wxString MinDisjCopStr = GetXmlAttributeIDString( aNode, 8 );
|
|
|
|
|
|
|
|
if( MinDisjCopStr == wxT( "NONE" ) )
|
|
|
|
MinDisjointCopper = UNDEFINED_VALUE;
|
|
|
|
else
|
|
|
|
MinDisjointCopper = GetXmlAttributeIDLong( aNode, 8 );
|
|
|
|
|
2020-09-10 20:58:20 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
2020-08-09 22:01:28 +00:00
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "NOPINRELIEF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ThermalReliefOnPads = false;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "NOVIARELIEF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ThermalReliefOnVias = false;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "IGNORETRN" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
AllowInNoRouting = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "BOXPINS" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
BoxIsolatedPins = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REGENERATE" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
AutomaticRepour = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "AUTOROUTETARGET" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
TargetForAutorouting = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "THERMALCUTOUT" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReliefType = RELIEF_TYPE::CUTOUTS;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-09-07 22:40:33 +00:00
|
|
|
else if( cNodeName == wxT( "FILLED" ) )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
FillType = COPPER_FILL_TYPE::FILLED;
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
2020-09-07 22:40:33 +00:00
|
|
|
else if( cNodeName == wxT( "HATCHCODEREF" ) )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
FillType = COPPER_FILL_TYPE::HATCHED;
|
|
|
|
HatchCodeID = GetXmlAttributeIDString( cNode, 0 );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "POURING" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "TEMPLATE" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LineCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
Name = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
NetID = GetXmlAttributeIDString( aNode, 3 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 4 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool shapeParsed = false;
|
|
|
|
bool pouringParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !shapeParsed && SHAPE::IsShape( cNode ) )
|
|
|
|
{
|
|
|
|
Shape.Parse( cNode );
|
|
|
|
shapeParsed = true;
|
|
|
|
}
|
|
|
|
else if( !pouringParsed && cNodeName == wxT( "POURING" ) )
|
|
|
|
{
|
|
|
|
Pouring.Parse( cNode );
|
|
|
|
pouringParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
|
|
|
attr.Parse( cNode );
|
|
|
|
AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEMPLATE" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-13 21:42:17 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPER::NETREF::COPPER_TERM::Parse( XNODE* aNode )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "TERM" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDLong( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool locationParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !locationParsed && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
Location.Parse( cNode );
|
|
|
|
locationParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPER::NETREF::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "NETREF" ) );
|
|
|
|
|
|
|
|
NetID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( cNodeName == wxT( "TERM" ) )
|
|
|
|
{
|
2020-09-13 21:42:17 +00:00
|
|
|
COPPER_TERM term;
|
2020-08-09 22:01:28 +00:00
|
|
|
term.Parse( cNode );
|
2020-09-10 20:58:20 +00:00
|
|
|
CopperTerminals.insert( std::make_pair( term.ID, term ) );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "NETREF" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPER::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "COPPER" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
CopperCodeID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 2 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool shapeParsed = false;
|
|
|
|
bool netRefParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !shapeParsed && SHAPE::IsShape( cNode ) )
|
|
|
|
{
|
|
|
|
Shape.Parse( cNode );
|
|
|
|
shapeParsed = true;
|
|
|
|
}
|
|
|
|
else if( !netRefParsed && cNodeName == wxT( "NETREF" ) )
|
|
|
|
{
|
|
|
|
NetRef.Parse( cNode );
|
|
|
|
netRefParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "POURED" ) )
|
|
|
|
{
|
|
|
|
PouredTemplateID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
|
|
|
attr.Parse( cNode );
|
|
|
|
AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, wxT( "TEMPLATE" ) );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DRILL_TABLE::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "DRILLTABLE" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool positionParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !positionParsed && cNodeName == wxT( "PT" ) )
|
|
|
|
{
|
|
|
|
Position.Parse( cNode );
|
|
|
|
positionParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ORIENT" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
OrientAngle = GetXmlAttributeIDLong( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "MIRROR" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Mirror = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
Fixed = true;
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "READABILITY" ) )
|
|
|
|
{
|
|
|
|
Readability = ParseReadability( cNode );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlockRef.Parse( cNode );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYOUT::Parse( XNODE* aNode )
|
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "LAYOUT" ) );
|
|
|
|
|
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
bool netSynchParsed = false;
|
|
|
|
bool dimensionsParsed = false;
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
|
|
|
wxString cNodeName = cNode->GetName();
|
|
|
|
|
|
|
|
if( !netSynchParsed && cNodeName == wxT( "NETSYNCH" ) )
|
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
std::map<wxString, NETSYNCH> netSynchMap = { { wxT( "WARNING" ), NETSYNCH::WARNING },
|
|
|
|
{ wxT( "FULL" ), NETSYNCH::FULL } };
|
2020-08-09 22:01:28 +00:00
|
|
|
|
|
|
|
wxString nsString = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
|
|
|
|
if( netSynchMap.find( nsString ) == netSynchMap.end() )
|
|
|
|
THROW_UNKNOWN_PARAMETER_IO_ERROR( nsString, aNode->GetName() );
|
|
|
|
|
|
|
|
NetSynch = netSynchMap[nsString];
|
|
|
|
netSynchParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "GROUP" ) )
|
|
|
|
{
|
|
|
|
GROUP group;
|
|
|
|
group.Parse( cNode );
|
|
|
|
Groups.insert( std::make_pair( group.ID, group ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "REUSEBLOCK" ) )
|
|
|
|
{
|
|
|
|
REUSEBLOCK reuseblock;
|
|
|
|
reuseblock.Parse( cNode );
|
|
|
|
ReuseBlocks.insert( std::make_pair( reuseblock.ID, reuseblock ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BOARD" ) )
|
|
|
|
{
|
|
|
|
BOARD board;
|
|
|
|
board.Parse( cNode );
|
|
|
|
Boards.insert( std::make_pair( board.ID, board ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIGURE" ) )
|
|
|
|
{
|
|
|
|
FIGURE figure;
|
|
|
|
figure.Parse( cNode );
|
|
|
|
Figures.insert( std::make_pair( figure.ID, figure ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "AREA" ) )
|
|
|
|
{
|
|
|
|
AREA area;
|
|
|
|
area.Parse( cNode );
|
|
|
|
Areas.insert( std::make_pair( area.ID, area ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMP" ) )
|
|
|
|
{
|
|
|
|
COMPONENT comp;
|
|
|
|
comp.Parse( cNode );
|
|
|
|
Components.insert( std::make_pair( comp.ID, comp ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "NET" ) )
|
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
NET_PCB net;
|
2020-08-09 22:01:28 +00:00
|
|
|
net.Parse( cNode );
|
|
|
|
Nets.insert( std::make_pair( net.ID, net ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TEMPLATE" ) )
|
|
|
|
{
|
|
|
|
TEMPLATE temp;
|
|
|
|
temp.Parse( cNode );
|
|
|
|
Templates.insert( std::make_pair( temp.ID, temp ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COPPER" ) )
|
|
|
|
{
|
|
|
|
COPPER copper;
|
|
|
|
copper.Parse( cNode );
|
|
|
|
Coppers.insert( std::make_pair( copper.ID, copper ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TEXT" ) )
|
|
|
|
{
|
|
|
|
TEXT txt;
|
|
|
|
txt.Parse( cNode );
|
|
|
|
Texts.insert( std::make_pair( txt.ID, txt ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "DOCSYMBOL" ) )
|
|
|
|
{
|
|
|
|
DOCUMENTATION_SYMBOL docsym;
|
|
|
|
docsym.Parse( cNode );
|
|
|
|
DocumentationSymbols.insert( std::make_pair( docsym.ID, docsym ) );
|
|
|
|
}
|
|
|
|
else if( !dimensionsParsed && cNodeName == wxT( "DIMENSIONS" ) )
|
|
|
|
{
|
|
|
|
XNODE* dimensionNode = cNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; dimensionNode; dimensionNode = dimensionNode->GetNext() )
|
|
|
|
{
|
|
|
|
if( DIMENSION::IsDimension( dimensionNode ) )
|
|
|
|
{
|
|
|
|
DIMENSION dim;
|
|
|
|
dim.Parse( dimensionNode );
|
|
|
|
Dimensions.insert( std::make_pair( dim.ID, dim ) );
|
|
|
|
}
|
|
|
|
else
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-08-09 22:01:28 +00:00
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( dimensionNode->GetName(), cNodeName );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dimensionsParsed = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "DRILLTABLE" ) )
|
|
|
|
{
|
|
|
|
DRILL_TABLE drilltable;
|
|
|
|
drilltable.Parse( cNode );
|
|
|
|
DrillTables.insert( std::make_pair( drilltable.ID, drilltable ) );
|
|
|
|
}
|
2020-09-07 22:40:33 +00:00
|
|
|
else if( cNodeName == wxT( "VHIERARCHY" ) )
|
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
VariantHierarchy.Parse( cNode );
|
2020-09-07 22:40:33 +00:00
|
|
|
}
|
2020-09-05 15:31:57 +00:00
|
|
|
else if( cNodeName == wxT( "ERRORMARK" ) )
|
|
|
|
{
|
|
|
|
//ignore (this is a DRC error marker in cadstar)
|
|
|
|
continue;
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|