CADSTAR Archive Importer: Parse missing ROUTEREASSIGN node in ROUTECODE

This commit is contained in:
Roberto Fernandez Bautista 2020-10-12 20:24:11 +01:00 committed by Jon Evans
parent 7a624d8d44
commit 8b13140122
2 changed files with 62 additions and 8 deletions

View File

@ -279,13 +279,12 @@ void CADSTAR_ARCHIVE_PARSER::TEXTCODE::Parse( XNODE* aNode )
}
void CADSTAR_ARCHIVE_PARSER::ROUTECODE::Parse( XNODE* aNode )
void CADSTAR_ARCHIVE_PARSER::ROUTEREASSIGN::Parse( XNODE* aNode )
{
wxASSERT( aNode->GetName() == wxT( "ROUTECODE" ) );
wxASSERT( aNode->GetName() == wxT( "ROUTEREASSIGN" ) );
ID = GetXmlAttributeIDString( aNode, 0 );
Name = GetXmlAttributeIDString( aNode, 1 );
OptimalWidth = GetXmlAttributeIDLong( aNode, 2, false );
LayerID = GetXmlAttributeIDString( aNode, 0 );
OptimalWidth = GetXmlAttributeIDLong( aNode, 1, false );
XNODE* cNode = aNode->GetChildren();
@ -307,6 +306,50 @@ void CADSTAR_ARCHIVE_PARSER::ROUTECODE::Parse( XNODE* aNode )
}
void CADSTAR_ARCHIVE_PARSER::ROUTECODE::Parse( XNODE* aNode )
{
wxASSERT( aNode->GetName() == wxT( "ROUTECODE" ) );
ID = GetXmlAttributeIDString( aNode, 0 );
Name = GetXmlAttributeIDString( aNode, 1 );
OptimalWidth = GetXmlAttributeIDLong( aNode, 2, false );
XNODE* cNode = aNode->GetChildren();
for( ; cNode; cNode = cNode->GetNext() )
{
wxString cNodeName = cNode->GetName();
if( cNodeName == wxT( "NECKWIDTH" ) )
{
NeckedWidth = GetXmlAttributeIDLong( cNode, 0 );
}
else if( cNodeName == wxT( "SROUTEWIDTH" ) )
{
OptimalWidth = GetXmlAttributeIDLong( cNode, 0 );
}
else if( cNodeName == wxT( "MINWIDTH" ) )
{
MinWidth = GetXmlAttributeIDLong( cNode, 0 );
}
else if( cNodeName == wxT( "MAXWIDTH" ) )
{
MaxWidth = GetXmlAttributeIDLong( cNode, 0 );
}
else if( cNodeName == wxT( "ROUTEREASSIGN" ) )
{
ROUTEREASSIGN routereassign;
routereassign.Parse( cNode );
RouteReassigns.push_back( routereassign );
}
else
{
THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
}
}
}
double CADSTAR_ARCHIVE_PARSER::EVALUE::GetDouble()
{
return Base * std::pow( 10.0, Exponent );

View File

@ -245,11 +245,20 @@ public:
};
struct ROUTEREASSIGN
{
LAYER_ID LayerID;
long OptimalWidth;
long MinWidth;
long MaxWidth;
long NeckedWidth;
void Parse( XNODE* aNode );
};
struct ROUTECODE
{
//TODO: Generalise this so it can also be used with CSA files
// (CSA files use "SROUTEWIDTH" subnode, instead of attribute)
ROUTECODE_ID ID;
wxString Name;
long OptimalWidth;
@ -257,6 +266,8 @@ public:
long MaxWidth;
long NeckedWidth;
std::vector<ROUTEREASSIGN> RouteReassigns;
void Parse( XNODE* aNode );
};