CADSTAR PCB: Parse Teardrops
Todo: We need to figure out how we will load teardrops. For now just drop them on import. Fixes https://gitlab.com/kicad/code/kicad/-/issues/12349
This commit is contained in:
parent
8d8205d2eb
commit
21b3753e9b
|
@ -2455,6 +2455,15 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks( const NET_ID& aCadstarNe
|
|||
shape->SetLocked( v.Fixed );
|
||||
shapes.push_back( shape );
|
||||
prevEnd = v.Vertex.End;
|
||||
|
||||
if( !m_doneTearDropWarning && ( v.TeardropAtEnd || v.TeardropAtStart ) )
|
||||
{
|
||||
// TODO: load teardrops
|
||||
wxLogError( _( "The CADSTAR design contains teardrops. This importer does not yet "
|
||||
"support them, so the teardrops in the design have been ignored." ) );
|
||||
|
||||
m_doneTearDropWarning = true;
|
||||
}
|
||||
}
|
||||
|
||||
NETINFO_ITEM* net = getKiCadNet( aCadstarNetID );
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
m_doneCopperWarning = false;
|
||||
m_doneSpacingClassWarning = false;
|
||||
m_doneNetClassWarning = false;
|
||||
m_doneTearDropWarning = false;
|
||||
m_numNets = 0;
|
||||
m_numCopperLayers = 0 ;
|
||||
m_progressReporter = aProgressReporter;
|
||||
|
@ -134,6 +135,7 @@ private:
|
|||
///< multiple duplicate warnings
|
||||
bool m_doneNetClassWarning; ///< Used by getKiCadNet() to avoid
|
||||
///< multiple duplicate warnings
|
||||
bool m_doneTearDropWarning;
|
||||
int m_numNets; ///< Number of nets loaded so far
|
||||
int m_numCopperLayers; ///< Number of layers in the design
|
||||
|
||||
|
|
|
@ -2027,20 +2027,42 @@ XNODE* CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE_VERTEX::Parse( XNODE* aNode,
|
|||
wxASSERT( aNode->GetName() == wxT( "ROUTEWIDTH" ) );
|
||||
|
||||
RouteWidth = GetXmlAttributeIDLong( aNode, 0 );
|
||||
XNODE* prevNode = aNode;
|
||||
XNODE* nextNode = aNode->GetNext();
|
||||
|
||||
if( nextNode->GetName() == wxT( "FIX" ) )
|
||||
for( ; nextNode; nextNode = nextNode->GetNext() )
|
||||
{
|
||||
Fixed = true;
|
||||
nextNode = nextNode->GetNext();
|
||||
if( nextNode->GetName() == wxT( "FIX" ) )
|
||||
{
|
||||
Fixed = true;
|
||||
}
|
||||
else if( nextNode->GetName() == wxT( "TDROPATSTART" ) )
|
||||
{
|
||||
TeardropAtStart = true;
|
||||
TeardropAtStartAngle = GetXmlAttributeIDLong( nextNode, 0 );
|
||||
}
|
||||
else if( nextNode->GetName() == wxT( "TDROPATEND" ) )
|
||||
{
|
||||
TeardropAtEnd = true;
|
||||
TeardropAtEndAngle = GetXmlAttributeIDLong( nextNode, 0 );
|
||||
}
|
||||
else if( VERTEX::IsVertex( nextNode ) )
|
||||
{
|
||||
Vertex.Parse( nextNode, aContext );
|
||||
}
|
||||
else if( nextNode->GetName() == wxT( "ROUTEWIDTH" ) )
|
||||
{
|
||||
return prevNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
THROW_UNKNOWN_NODE_IO_ERROR( nextNode->GetName(), wxT( "ROUTE" ) );
|
||||
}
|
||||
|
||||
prevNode = nextNode;
|
||||
}
|
||||
|
||||
if( !VERTEX::IsVertex( nextNode ) )
|
||||
THROW_UNKNOWN_NODE_IO_ERROR( nextNode->GetName(), wxT( "ROUTE_VERTEX" ) );
|
||||
|
||||
Vertex.Parse( nextNode, aContext );
|
||||
|
||||
return nextNode;
|
||||
return prevNode;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2068,6 +2090,8 @@ void CADSTAR_PCB_ARCHIVE_PARSER::NET_PCB::ROUTE::Parse( XNODE* aNode, PARSER_CON
|
|||
ROUTE_VERTEX rtVert;
|
||||
cNode = rtVert.Parse( cNode, aContext );
|
||||
RouteVertices.push_back( rtVert );
|
||||
|
||||
assert( cNode != nullptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -983,6 +983,10 @@ public:
|
|||
///< next node being a VERTEX (e.g. PT, CWARC, etc.)
|
||||
{
|
||||
long RouteWidth;
|
||||
bool TeardropAtStart = false;
|
||||
bool TeardropAtEnd = false;
|
||||
long TeardropAtStartAngle = 0;
|
||||
long TeardropAtEndAngle = 0;
|
||||
bool Fixed = false;
|
||||
VERTEX Vertex;
|
||||
|
||||
|
|
Loading…
Reference in New Issue