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-10-24 14:45:37 +00:00
|
|
|
#include <macros.h>
|
2021-06-02 23:18:48 +00:00
|
|
|
#include <wx/translation.h>
|
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" ) )
|
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Header.Parse( cNode, &m_context );
|
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
|
|
|
{
|
2021-06-27 23:26:54 +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
|
|
|
{
|
2021-06-27 23:26:54 +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
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Assignments.Parse( cNode, &m_context );
|
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
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Library.Parse( cNode, &m_context );
|
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
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Parts.Parse( cNode, &m_context );
|
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
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
Layout.Parse( cNode, &m_context );
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::ASSIGNMENTS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Layerdefs.Parse( cNode, aContext );
|
2020-07-18 16:44:20 +00:00
|
|
|
else if( cNode->GetName() == wxT( "CODEDEFS" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Codedefs.Parse( cNode, aContext );
|
2020-07-18 16:44:20 +00:00
|
|
|
else if( cNode->GetName() == wxT( "TECHNOLOGY" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Technology.Parse( cNode, aContext );
|
2020-07-18 16:44:20 +00:00
|
|
|
else if( cNode->GetName() == wxT( "GRIDS" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Grids.Parse( cNode, aContext );
|
2020-07-18 16:44:20 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYERDEFS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
material.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
layer.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::RULESET::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
spacingcode.Parse( cNode, aContext );
|
2020-08-31 22:09:29 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::CODEDEFS_PCB::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) ) // 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-12-10 16:13:35 +00:00
|
|
|
coppercode.Parse( cNode, aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
CopperCodes.insert( std::make_pair( coppercode.ID, coppercode ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "SPACINGCODE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SPACINGCODE spacingcode;
|
2020-12-10 16:13:35 +00:00
|
|
|
spacingcode.Parse( cNode, aContext );
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
ruleset.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
padcode.Parse( cNode, aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
PadCodes.insert( std::make_pair( padcode.ID, padcode ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "VIACODE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
VIACODE viacode;
|
2020-12-10 16:13:35 +00:00
|
|
|
viacode.Parse( cNode, aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
ViaCodes.insert( std::make_pair( viacode.ID, viacode ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "LAYERPAIR" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
LAYERPAIR layerpair;
|
2020-12-10 16:13:35 +00:00
|
|
|
layerpair.Parse( cNode, aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
LayerPairs.insert( std::make_pair( layerpair.ID, layerpair ) );
|
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "SPCCLASSSPACE" ) )
|
|
|
|
{
|
2020-07-30 22:42:56 +00:00
|
|
|
SPCCLASSSPACE spcclassspace;
|
2020-12-10 16:13:35 +00:00
|
|
|
spcclassspace.Parse( cNode, aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::MATERIAL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
ParseChildEValue( iNode, aContext, Permittivity );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "LOSSTANGENT" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseChildEValue( iNode, aContext, LossTangent );
|
2020-07-12 16:58:35 +00:00
|
|
|
}
|
|
|
|
else if( nodeName == wxT( "RESISTIVITY" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseChildEValue( iNode, aContext, 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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYER::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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
|
|
|
}
|
2020-10-26 21:15:24 +00:00
|
|
|
else if( sSubType == wxT( "LAYERSUBTYPE_CLEARANCE" ) )
|
|
|
|
{
|
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_CLEARANCE;
|
|
|
|
}
|
|
|
|
else if( sSubType == wxT( "LAYERSUBTYPE_ROUT" ) )
|
|
|
|
{
|
|
|
|
this->SubType = LAYER_SUBTYPE::LAYERSUBTYPE_ROUT;
|
|
|
|
}
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPREASSIGN::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPERCODE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
reassign.Parse( cNode, aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::REASSIGN::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "SPACEREASSIGN" ) );
|
|
|
|
|
|
|
|
LayerID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Spacing = GetXmlAttributeIDLong( aNode, 1 );
|
|
|
|
|
|
|
|
CheckNoChildNodes( aNode );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SPACINGCODE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
reassign.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-01 12:22:35 +00:00
|
|
|
bool CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_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
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-01 12:22:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_PAD_SHAPE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-10-13 23:41:16 +00:00
|
|
|
case PAD_SHAPE_TYPE::DIAMOND:
|
|
|
|
case PAD_SHAPE_TYPE::OCTAGON:
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PADREASSIGN::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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
|
|
|
|
2021-05-01 12:22:35 +00:00
|
|
|
if( CADSTAR_PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( aNode->GetChildren(), aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PADCODE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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();
|
|
|
|
|
2021-05-01 12:22:35 +00:00
|
|
|
if( CADSTAR_PAD_SHAPE::IsPadShape( cNode ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
reassign.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::VIAREASSIGN::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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
|
|
|
|
2021-05-01 12:22:35 +00:00
|
|
|
if( CADSTAR_PAD_SHAPE::IsPadShape( aNode->GetChildren() ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( aNode->GetChildren(), aContext );
|
2020-07-18 09:04:22 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::VIACODE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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();
|
|
|
|
|
2021-05-01 12:22:35 +00:00
|
|
|
if( CADSTAR_PAD_SHAPE::IsPadShape( cNode ) )
|
2020-09-18 10:32:57 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
reassign.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYERPAIR::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SPCCLASSSPACE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TECHNOLOGY_SECTION::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) ) //CADSTAR_ARCHIVE_PARSER::SETTINGS
|
2020-09-10 20:58:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
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
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_COPPER::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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 ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_AREA::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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 ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PAD_EXITS::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT_PAD::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Exits.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
else if( cNodeName == wxT( "PADIDENTIFIER" ) )
|
|
|
|
Identifier = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
else if( cNodeName == wxT( "PCBONLYPAD" ) )
|
|
|
|
PCBonlyPad = true;
|
|
|
|
else if( cNodeName == wxT( "PT" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Position.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, location );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::ARROW::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::TEXTFORMAT::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::EXTENSION_LINE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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 )
|
2020-12-10 16:13:35 +00:00
|
|
|
Start.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
2020-12-10 16:13:35 +00:00
|
|
|
End.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::LINE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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 )
|
2020-12-10 16:13:35 +00:00
|
|
|
Start.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
else if( noOfPoints == 2 )
|
2020-12-10 16:13:35 +00:00
|
|
|
End.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
else
|
2020-12-10 16:13:35 +00:00
|
|
|
Centre.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
}
|
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DIMENSION::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
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-10-15 08:48:02 +00:00
|
|
|
std::map<wxString, SUBTYPE> subTypeMap = {
|
2020-09-27 13:10:59 +00:00
|
|
|
{ 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" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Arrow.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
arrowParsed = true;
|
|
|
|
}
|
|
|
|
else if( !textFormatParsed && cNodeName == wxT( "DIMTEXT" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
TextParams.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
textFormatParsed = true;
|
|
|
|
}
|
|
|
|
else if( !extLineParsed && cNodeName == wxT( "EXTLINE" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ExtensionLineParams.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
extLineParsed = true;
|
|
|
|
}
|
|
|
|
else if( !lineParsed && LINE::IsLine( cNode ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Line.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
lineParsed = true;
|
|
|
|
}
|
|
|
|
else if( !textParsed && cNodeName == wxT( "TEXT" ) )
|
|
|
|
{
|
2020-12-27 17:37:25 +00:00
|
|
|
// Do not parse the fields in dimension text (will be done when loading, if required)
|
|
|
|
Text.Parse( cNode, aContext, false );
|
2020-07-30 22:42:56 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::SYMDEF_PCB::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-07-30 22:42:56 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "SYMDEF" ) );
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
2020-09-10 20:58:20 +00:00
|
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
compcopper.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
ComponentCoppers.push_back( compcopper );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMPAREA" ) )
|
|
|
|
{
|
|
|
|
COMPONENT_AREA area;
|
2020-12-10 16:13:35 +00:00
|
|
|
area.Parse( cNode, aContext );
|
2020-07-30 22:42:56 +00:00
|
|
|
ComponentAreas.insert( std::make_pair( area.ID, area ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PAD" ) )
|
|
|
|
{
|
2020-11-12 21:12:58 +00:00
|
|
|
COMPONENT_PAD pad;
|
2020-12-10 16:13:35 +00:00
|
|
|
pad.Parse( cNode, aContext );
|
2020-11-12 21:12:58 +00:00
|
|
|
ComponentPads.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;
|
2020-12-10 16:13:35 +00:00
|
|
|
dim.Parse( dimensionNode, aContext );
|
2020-09-10 20:58:20 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LIBRARY::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
symdef.Parse( cNode, aContext );
|
2020-09-10 20:58:20 +00:00
|
|
|
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
|
|
|
|
2021-02-13 20:00:17 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::CADSTAR_BOARD::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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 ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
shapeIsInitialised = true;
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
2020-12-10 16:13:35 +00:00
|
|
|
attr.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::AREA::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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 ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
2020-12-10 16:13:35 +00:00
|
|
|
attr.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PIN_ATTRIBUTE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
attrVal.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::PADEXCEPTION::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-09-08 13:01:32 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
2020-10-24 17:00:55 +00:00
|
|
|
else if( cNodeName == wxT( "EXITS" ) )
|
|
|
|
{
|
|
|
|
OverrideExits = true;
|
2020-12-10 16:13:35 +00:00
|
|
|
Exits.Parse( cNode, aContext );
|
2020-10-24 17:00:55 +00:00
|
|
|
}
|
2020-09-08 13:01:32 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Origin.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
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" ) )
|
|
|
|
{
|
2020-11-21 12:55:58 +00:00
|
|
|
VariantParentComponentID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
VariantID = GetXmlAttributeIDString( cNode, 1 );
|
2020-09-07 22:40:33 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "TEXTLOC" ) )
|
|
|
|
{
|
|
|
|
TEXT_LOCATION textloc;
|
2020-12-10 16:13:35 +00:00
|
|
|
textloc.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
TextLocations.insert( std::make_pair( textloc.AttributeID, textloc ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attrVal;
|
2020-12-10 16:13:35 +00:00
|
|
|
attrVal.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
AttributeValues.insert( std::make_pair( attrVal.AttributeID, attrVal ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "PINATTR" ) )
|
|
|
|
{
|
|
|
|
PIN_ATTRIBUTE pinAttr;
|
2020-12-10 16:13:35 +00:00
|
|
|
pinAttr.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
padExcept.Parse( cNode, aContext );
|
2020-09-08 13:01:32 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TRUNK::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-10-13 21:40:44 +00:00
|
|
|
{
|
|
|
|
wxASSERT( aNode->GetName() == wxT( "TRUNK" ) );
|
|
|
|
|
|
|
|
ID = GetXmlAttributeIDString( aNode, 0 );
|
|
|
|
Definition = GetXmlAttributeIDString( aNode, 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::PIN::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::JUNCTION_PCB::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-10-13 21:40:44 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
2020-10-13 21:40:44 +00:00
|
|
|
XNODE* cNode = aNode->GetChildren();
|
|
|
|
|
|
|
|
for( ; cNode; cNode = cNode->GetNext() )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
2020-10-13 21:40:44 +00:00
|
|
|
continue;
|
|
|
|
else if( cNode->GetName() == wxT( "TRUNKREF" ) )
|
|
|
|
TrunkID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNode->GetName(), aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::VIA::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
Location.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "FIX" ) )
|
|
|
|
Fixed = true;
|
|
|
|
else if( cNodeName == wxT( "GROUPREF" ) )
|
|
|
|
GroupID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
else if( cNodeName == wxT( "REUSEBLOCKREF" ) )
|
2020-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "TESTLAND" ) )
|
|
|
|
TestlandSide = ParseTestlandSide( cNode );
|
2020-10-13 21:40:44 +00:00
|
|
|
else if( cNode->GetName() == wxT( "TRUNKREF" ) )
|
|
|
|
TrunkID = GetXmlAttributeIDString( cNode, 0 );
|
2020-08-09 22:01:28 +00:00
|
|
|
else
|
|
|
|
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::COPPER_TERMINAL::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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-12-10 16:13:35 +00:00
|
|
|
XNODE* CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE_VERTEX::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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" ) );
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
Vertex.Parse( nextNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
|
|
|
|
return nextNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
StartPoint.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "ROUTEWIDTH" ) )
|
|
|
|
{
|
|
|
|
ROUTE_VERTEX rtVert;
|
2020-12-10 16:13:35 +00:00
|
|
|
cNode = rtVert.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::CONNECTION_PCB::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
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-12-10 16:13:35 +00:00
|
|
|
if( ParseSubNode( cNode, aContext ) )
|
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
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Route.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
routeParsed = true;
|
|
|
|
}
|
|
|
|
else if( !routeParsed && cNodeName == wxT( "UNROUTE" ) )
|
|
|
|
{
|
|
|
|
Unrouted = true;
|
|
|
|
UnrouteLayerID = GetXmlAttributeIDString( cNode, 0 );
|
|
|
|
}
|
2020-10-13 21:40:44 +00:00
|
|
|
else if( cNode->GetName() == wxT( "TRUNKREF" ) )
|
|
|
|
{
|
|
|
|
TrunkID = 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( "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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
ParseIdentifiers( aNode, aContext );
|
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-10-13 21:40:44 +00:00
|
|
|
if( cNodeName == wxT( "JPT" ) )
|
|
|
|
{
|
|
|
|
JUNCTION_PCB jpt;
|
2020-12-10 16:13:35 +00:00
|
|
|
jpt.Parse( cNode, aContext );
|
2020-10-13 21:40:44 +00:00
|
|
|
Junctions.insert( std::make_pair( jpt.ID, jpt ) );
|
|
|
|
}
|
2020-12-10 16:13:35 +00:00
|
|
|
else if( ParseSubNode( cNode, aContext ) )
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
pin.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Pins.insert( std::make_pair( pin.ID, pin ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "VIA" ) )
|
|
|
|
{
|
|
|
|
VIA via;
|
2020-12-10 16:13:35 +00:00
|
|
|
via.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Vias.insert( std::make_pair( via.ID, via ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COPTERM" ) )
|
|
|
|
{
|
|
|
|
COPPER_TERMINAL cterm;
|
2020-12-10 16:13:35 +00:00
|
|
|
cterm.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
conn.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::POURING::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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-10-15 08:48:02 +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-10-15 08:48:02 +00:00
|
|
|
FillType = COPPER_FILL_TYPE::HATCHED;
|
2020-09-10 20:58:20 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::TEMPLATE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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 ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
shapeParsed = true;
|
|
|
|
}
|
|
|
|
else if( !pouringParsed && cNodeName == wxT( "POURING" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Pouring.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
2020-09-18 10:32:57 +00:00
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "ATTR" ) )
|
|
|
|
{
|
|
|
|
ATTRIBUTE_VALUE attr;
|
2020-12-10 16:13:35 +00:00
|
|
|
attr.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPER::NETREF::COPPER_TERM::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
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" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Location.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPER::NETREF::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
term.Parse( cNode, aContext );
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::COPPER::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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 ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Shape.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
shapeParsed = true;
|
|
|
|
}
|
|
|
|
else if( !netRefParsed && cNodeName == wxT( "NETREF" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
NetRef.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
attr.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::DRILL_TABLE::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
Position.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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-12-10 16:13:35 +00:00
|
|
|
ReuseBlockRef.Parse( cNode, aContext );
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-10 16:13:35 +00:00
|
|
|
void CADSTAR_PCB_ARCHIVE_PARSER::LAYOUT::Parse( XNODE* aNode, PARSER_CONTEXT* aContext )
|
2020-08-09 22:01:28 +00:00
|
|
|
{
|
|
|
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
group.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Groups.insert( std::make_pair( group.ID, group ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "REUSEBLOCK" ) )
|
|
|
|
{
|
|
|
|
REUSEBLOCK reuseblock;
|
2020-12-10 16:13:35 +00:00
|
|
|
reuseblock.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
ReuseBlocks.insert( std::make_pair( reuseblock.ID, reuseblock ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "BOARD" ) )
|
|
|
|
{
|
2021-02-13 20:00:17 +00:00
|
|
|
CADSTAR_BOARD board;
|
2020-12-10 16:13:35 +00:00
|
|
|
board.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Boards.insert( std::make_pair( board.ID, board ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "FIGURE" ) )
|
|
|
|
{
|
|
|
|
FIGURE figure;
|
2020-12-10 16:13:35 +00:00
|
|
|
figure.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Figures.insert( std::make_pair( figure.ID, figure ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "AREA" ) )
|
|
|
|
{
|
|
|
|
AREA area;
|
2020-12-10 16:13:35 +00:00
|
|
|
area.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Areas.insert( std::make_pair( area.ID, area ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COMP" ) )
|
|
|
|
{
|
|
|
|
COMPONENT comp;
|
2020-12-10 16:13:35 +00:00
|
|
|
comp.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Components.insert( std::make_pair( comp.ID, comp ) );
|
|
|
|
}
|
2020-10-13 21:40:44 +00:00
|
|
|
else if( cNodeName == wxT( "TRUNK" ) )
|
|
|
|
{
|
|
|
|
TRUNK trunk;
|
2020-12-10 16:13:35 +00:00
|
|
|
trunk.Parse( cNode, aContext );
|
2020-10-13 21:40:44 +00:00
|
|
|
Trunks.insert( std::make_pair( trunk.ID, trunk ) );
|
|
|
|
}
|
2020-08-09 22:01:28 +00:00
|
|
|
else if( cNodeName == wxT( "NET" ) )
|
|
|
|
{
|
2020-09-10 20:58:20 +00:00
|
|
|
NET_PCB net;
|
2020-12-10 16:13:35 +00:00
|
|
|
net.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Nets.insert( std::make_pair( net.ID, net ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TEMPLATE" ) )
|
|
|
|
{
|
|
|
|
TEMPLATE temp;
|
2020-12-10 16:13:35 +00:00
|
|
|
temp.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Templates.insert( std::make_pair( temp.ID, temp ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "COPPER" ) )
|
|
|
|
{
|
|
|
|
COPPER copper;
|
2020-12-10 16:13:35 +00:00
|
|
|
copper.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Coppers.insert( std::make_pair( copper.ID, copper ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "TEXT" ) )
|
|
|
|
{
|
|
|
|
TEXT txt;
|
2020-12-10 16:13:35 +00:00
|
|
|
txt.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
Texts.insert( std::make_pair( txt.ID, txt ) );
|
|
|
|
}
|
|
|
|
else if( cNodeName == wxT( "DOCSYMBOL" ) )
|
|
|
|
{
|
|
|
|
DOCUMENTATION_SYMBOL docsym;
|
2020-12-10 16:13:35 +00:00
|
|
|
docsym.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
dim.Parse( dimensionNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
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;
|
2020-12-10 16:13:35 +00:00
|
|
|
drilltable.Parse( cNode, aContext );
|
2020-08-09 22:01:28 +00:00
|
|
|
DrillTables.insert( std::make_pair( drilltable.ID, drilltable ) );
|
|
|
|
}
|
2020-09-07 22:40:33 +00:00
|
|
|
else if( cNodeName == wxT( "VHIERARCHY" ) )
|
|
|
|
{
|
2020-12-10 16:13:35 +00:00
|
|
|
VariantHierarchy.Parse( cNode, aContext );
|
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() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|