2017-04-07 11:40:34 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2021-02-15 21:44:58 +00:00
|
|
|
* Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-04-07 11:40:34 +00:00
|
|
|
* Copyright (C) 2017 CERN.
|
2021-02-15 21:44:58 +00:00
|
|
|
*
|
2017-04-07 11:40:34 +00:00
|
|
|
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-10-03 20:48:58 +00:00
|
|
|
#include <plugins/eagle/eagle_parser.h>
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h>
|
2020-10-24 12:44:03 +00:00
|
|
|
#include <richio.h>
|
2021-06-01 05:17:57 +00:00
|
|
|
#include <wx/log.h>
|
2020-10-24 12:44:03 +00:00
|
|
|
|
2017-07-17 12:09:01 +00:00
|
|
|
#include <functional>
|
2017-10-17 08:18:54 +00:00
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT;
|
|
|
|
|
|
|
|
|
2018-02-16 23:01:43 +00:00
|
|
|
wxString escapeName( const wxString& aNetName )
|
|
|
|
{
|
|
|
|
wxString ret( aNetName );
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
ret.Replace( wxT( "!" ), wxT( "~" ) );
|
2018-02-16 23:01:43 +00:00
|
|
|
|
2021-09-01 18:24:42 +00:00
|
|
|
return ConvertToNewOverbarNotation( ret );
|
2018-02-16 23:01:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-14 09:37:32 +00:00
|
|
|
template<> template<>
|
|
|
|
OPTIONAL_XML_ATTRIBUTE<wxString>::OPTIONAL_XML_ATTRIBUTE( wxString aData )
|
|
|
|
{
|
|
|
|
m_isAvailable = !aData.IsEmpty();
|
|
|
|
|
|
|
|
if( m_isAvailable )
|
|
|
|
Set( aData );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-23 13:37:24 +00:00
|
|
|
ECOORD::ECOORD( const wxString& aValue, enum ECOORD::EAGLE_UNIT aUnit )
|
2017-10-17 08:18:54 +00:00
|
|
|
{
|
2021-02-15 21:44:58 +00:00
|
|
|
// This array is used to adjust the fraction part value basing on the number of digits
|
|
|
|
// in the fraction.
|
2017-10-17 08:18:54 +00:00
|
|
|
constexpr int DIVIDERS[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000 };
|
|
|
|
constexpr unsigned int DIVIDERS_MAX_IDX = sizeof( DIVIDERS ) / sizeof( DIVIDERS[0] ) - 1;
|
|
|
|
|
|
|
|
int integer, fraction, pre_fraction, post_fraction;
|
|
|
|
|
2021-02-15 21:44:58 +00:00
|
|
|
// The following check is needed to handle correctly negative fractions where the integer
|
|
|
|
// part == 0.
|
2017-10-17 08:18:54 +00:00
|
|
|
bool negative = ( aValue[0] == '-' );
|
|
|
|
|
2021-02-15 21:44:58 +00:00
|
|
|
// %n is used to find out how many digits contains the fraction part, e.g. 0.001 contains 3
|
|
|
|
// digits.
|
|
|
|
int ret = sscanf( aValue.c_str(), "%d.%n%d%n", &integer, &pre_fraction, &fraction,
|
|
|
|
&post_fraction );
|
2017-10-17 08:18:54 +00:00
|
|
|
|
|
|
|
if( ret == 0 )
|
|
|
|
throw XML_PARSER_ERROR( "Invalid coordinate" );
|
|
|
|
|
|
|
|
// process the integer part
|
2018-03-13 12:54:08 +00:00
|
|
|
value = ConvertToNm( integer, aUnit );
|
2017-10-17 08:18:54 +00:00
|
|
|
|
|
|
|
// process the fraction part
|
|
|
|
if( ret == 2 )
|
|
|
|
{
|
|
|
|
int digits = post_fraction - pre_fraction;
|
|
|
|
|
2021-02-15 21:44:58 +00:00
|
|
|
// adjust the number of digits if necessary as we cannot handle anything smaller than
|
|
|
|
// nanometers (rounding).
|
2017-10-17 08:18:54 +00:00
|
|
|
if( (unsigned) digits > DIVIDERS_MAX_IDX )
|
|
|
|
{
|
|
|
|
int diff = digits - DIVIDERS_MAX_IDX;
|
|
|
|
digits = DIVIDERS_MAX_IDX;
|
|
|
|
fraction /= DIVIDERS[diff];
|
|
|
|
}
|
|
|
|
|
2018-03-13 12:54:08 +00:00
|
|
|
int frac_value = ConvertToNm( fraction, aUnit ) / DIVIDERS[digits];
|
2017-10-17 08:18:54 +00:00
|
|
|
|
|
|
|
// keep the sign in mind
|
|
|
|
value = negative ? value - frac_value : value + frac_value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-13 12:54:08 +00:00
|
|
|
long long int ECOORD::ConvertToNm( int aValue, enum EAGLE_UNIT aUnit )
|
2017-10-17 08:18:54 +00:00
|
|
|
{
|
|
|
|
long long int ret;
|
|
|
|
|
|
|
|
switch( aUnit )
|
|
|
|
{
|
2017-10-23 13:37:24 +00:00
|
|
|
default:
|
2018-03-13 12:54:08 +00:00
|
|
|
case EU_NM: ret = aValue; break;
|
|
|
|
case EU_MM: ret = (long long) aValue * 1000000; break;
|
|
|
|
case EU_INCH: ret = (long long) aValue * 25400000; break;
|
|
|
|
case EU_MIL: ret = (long long) aValue * 25400; break;
|
2017-10-17 08:18:54 +00:00
|
|
|
}
|
|
|
|
|
2019-05-27 03:12:27 +00:00
|
|
|
if( ( ret > 0 ) != ( aValue > 0 ) )
|
|
|
|
wxLogError( _( "Invalid size %lld: too large" ), aValue );
|
|
|
|
|
2017-10-17 08:18:54 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
// Template specializations below parse wxString to the used types:
|
2017-12-14 09:37:32 +00:00
|
|
|
// - wxString (preferred)
|
2017-04-07 11:40:34 +00:00
|
|
|
// - string
|
|
|
|
// - double
|
|
|
|
// - int
|
|
|
|
// - bool
|
|
|
|
// - EROT
|
2017-10-17 08:18:54 +00:00
|
|
|
// - ECOORD
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2017-12-14 09:37:32 +00:00
|
|
|
template <>
|
|
|
|
wxString Convert<wxString>( const wxString& aValue )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
2017-12-14 09:37:32 +00:00
|
|
|
return aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
std::string Convert<std::string>( const wxString& aValue )
|
|
|
|
{
|
|
|
|
return std::string( aValue.ToUTF8() );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <>
|
2017-09-02 01:04:25 +00:00
|
|
|
double Convert<double>( const wxString& aValue )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
double value;
|
|
|
|
|
2020-07-12 13:26:36 +00:00
|
|
|
if( aValue.ToCDouble( &value ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
return value;
|
|
|
|
else
|
|
|
|
throw XML_PARSER_ERROR( "Conversion to double failed. Original value: '" +
|
|
|
|
aValue.ToStdString() + "'." );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <>
|
2017-09-02 01:04:25 +00:00
|
|
|
int Convert<int>( const wxString& aValue )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
if( aValue.IsEmpty() )
|
|
|
|
throw XML_PARSER_ERROR( "Conversion to int failed. Original value is empty." );
|
|
|
|
|
|
|
|
return wxAtoi( aValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <>
|
2017-09-02 01:04:25 +00:00
|
|
|
bool Convert<bool>( const wxString& aValue )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
if( aValue != wxT( "yes" ) && aValue != wxT( "no" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
throw XML_PARSER_ERROR( "Conversion to bool failed. Original value, '" +
|
|
|
|
aValue.ToStdString() +
|
|
|
|
"', is neither 'yes' nor 'no'." );
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
return aValue == wxT( "yes" );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
2017-05-04 13:37:01 +00:00
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
/// parse an Eagle XML "rot" field. Unfortunately the DTD seems not to explain
|
|
|
|
/// this format very well. [S][M]R<degrees>. Examples: "R90", "MR180", "SR180"
|
|
|
|
template<>
|
2017-09-02 01:04:25 +00:00
|
|
|
EROT Convert<EROT>( const wxString& aRot )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
EROT value;
|
|
|
|
|
|
|
|
value.spin = aRot.find( 'S' ) != aRot.npos;
|
|
|
|
value.mirror = aRot.find( 'M' ) != aRot.npos;
|
|
|
|
value.degrees = strtod( aRot.c_str()
|
|
|
|
+ 1 // skip leading 'R'
|
|
|
|
+ int( value.spin ) // skip optional leading 'S'
|
|
|
|
+ int( value.mirror ), // skip optional leading 'M'
|
2021-07-15 19:26:35 +00:00
|
|
|
nullptr );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2017-10-17 08:18:54 +00:00
|
|
|
|
|
|
|
template<>
|
|
|
|
ECOORD Convert<ECOORD>( const wxString& aCoord )
|
|
|
|
{
|
|
|
|
// Eagle uses millimeters as the default unit
|
2018-03-13 12:54:08 +00:00
|
|
|
return ECOORD( aCoord, ECOORD::EAGLE_UNIT::EU_MM );
|
2017-10-17 08:18:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
/**
|
2021-02-15 21:44:58 +00:00
|
|
|
* Parse \a aAttribute of the XML node \a aNode.
|
|
|
|
*
|
2017-04-07 11:40:34 +00:00
|
|
|
* @param aNode is the node whose attribute will be parsed.
|
|
|
|
* @param aAttribute is the attribute that will be parsed.
|
|
|
|
* @throw XML_PARSER_ERROR - exception thrown if the required attribute is missing
|
|
|
|
* @return T - the attributed parsed as the specified type.
|
|
|
|
*/
|
|
|
|
template<typename T>
|
2017-12-14 09:37:32 +00:00
|
|
|
T parseRequiredAttribute( wxXmlNode* aNode, const wxString& aAttribute )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
wxString value;
|
|
|
|
|
|
|
|
if( aNode->GetAttribute( aAttribute, &value ) )
|
|
|
|
return Convert<T>( value );
|
|
|
|
else
|
|
|
|
throw XML_PARSER_ERROR( "The required attribute " + aAttribute + " is missing." );
|
|
|
|
}
|
|
|
|
|
2017-12-14 09:37:32 +00:00
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
/**
|
2021-02-15 21:44:58 +00:00
|
|
|
* Parse option \a aAttribute of the XML node \a aNode.
|
|
|
|
*
|
2017-04-07 11:40:34 +00:00
|
|
|
* @param aNode is the node whose attribute will be parsed.
|
|
|
|
* @param aAttribute is the attribute that will be parsed.
|
|
|
|
* @return OPTIONAL_XML_ATTRIBUTE<T> - an optional XML attribute, parsed as the specified type if
|
2021-02-15 21:44:58 +00:00
|
|
|
* found.
|
2017-04-07 11:40:34 +00:00
|
|
|
*/
|
|
|
|
template<typename T>
|
2017-12-14 09:37:32 +00:00
|
|
|
OPTIONAL_XML_ATTRIBUTE<T> parseOptionalAttribute( wxXmlNode* aNode, const wxString& aAttribute )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
return OPTIONAL_XML_ATTRIBUTE<T>( aNode->GetAttribute( aAttribute ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-03 10:30:23 +00:00
|
|
|
NODE_MAP MapChildren( wxXmlNode* aCurrentNode )
|
2017-06-26 07:51:51 +00:00
|
|
|
{
|
|
|
|
// Map node_name -> node_pointer
|
|
|
|
NODE_MAP nodesMap;
|
|
|
|
|
|
|
|
// Loop through all children mapping them in nodesMap
|
2017-10-03 10:30:23 +00:00
|
|
|
if( aCurrentNode )
|
|
|
|
aCurrentNode = aCurrentNode->GetChildren();
|
2017-06-26 07:51:51 +00:00
|
|
|
|
2017-10-03 10:30:23 +00:00
|
|
|
while( aCurrentNode )
|
2017-06-26 07:51:51 +00:00
|
|
|
{
|
|
|
|
// Create a new pair in the map
|
|
|
|
// key: current node name
|
|
|
|
// value: current node pointer
|
2017-12-14 09:37:32 +00:00
|
|
|
nodesMap[aCurrentNode->GetName()] = aCurrentNode;
|
2017-10-03 10:23:52 +00:00
|
|
|
|
|
|
|
// Get next child
|
|
|
|
aCurrentNode = aCurrentNode->GetNext();
|
|
|
|
}
|
|
|
|
|
2017-10-03 10:30:23 +00:00
|
|
|
return nodesMap;
|
2017-06-26 07:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-03 10:30:23 +00:00
|
|
|
wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle )
|
2017-06-26 07:51:51 +00:00
|
|
|
{
|
|
|
|
// Eagle give us start and end.
|
|
|
|
// S_ARC wants start to give the center, and end to give the start.
|
|
|
|
double dx = aEnd.x - aStart.x, dy = aEnd.y - aStart.y;
|
|
|
|
wxPoint mid = ( aStart + aEnd ) / 2;
|
|
|
|
|
|
|
|
double dlen = sqrt( dx*dx + dy*dy );
|
2019-05-27 03:12:27 +00:00
|
|
|
|
|
|
|
if( !std::isnormal( dlen ) || !std::isnormal( aAngle ) )
|
|
|
|
{
|
2021-09-20 11:36:57 +00:00
|
|
|
THROW_IO_ERROR( wxString::Format( _( "Invalid Arc with radius %f and angle %f" ),
|
|
|
|
dlen,
|
|
|
|
aAngle ) );
|
2019-05-27 03:12:27 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 07:51:51 +00:00
|
|
|
double dist = dlen / ( 2 * tan( DEG2RAD( aAngle ) / 2 ) );
|
|
|
|
|
|
|
|
wxPoint center(
|
|
|
|
mid.x + dist * ( dy / dlen ),
|
|
|
|
mid.y - dist * ( dx / dlen )
|
|
|
|
);
|
|
|
|
|
|
|
|
return center;
|
|
|
|
}
|
|
|
|
|
2017-10-03 10:30:23 +00:00
|
|
|
|
|
|
|
static int parseAlignment( const wxString& aAlignment )
|
2017-07-16 16:12:05 +00:00
|
|
|
{
|
|
|
|
// (bottom-left | bottom-center | bottom-right | center-left |
|
2017-10-03 10:23:52 +00:00
|
|
|
// center | center-right | top-left | top-center | top-right)
|
2022-02-05 00:24:26 +00:00
|
|
|
if( aAlignment == wxT( "center" ) )
|
2017-07-16 16:12:05 +00:00
|
|
|
return ETEXT::CENTER;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "center-right" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::CENTER_RIGHT;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "top-left" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::TOP_LEFT;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "top-center" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::TOP_CENTER;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "top-right" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::TOP_RIGHT;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "bottom-left" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::BOTTOM_LEFT;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "bottom-center" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::BOTTOM_CENTER;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "bottom-right" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::BOTTOM_RIGHT;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( aAlignment == wxT( "center-left" ) )
|
2017-10-03 10:23:52 +00:00
|
|
|
return ETEXT::CENTER_LEFT;
|
2017-07-16 16:12:05 +00:00
|
|
|
|
2017-07-17 10:17:23 +00:00
|
|
|
return DEFAULT_ALIGNMENT;
|
2017-07-16 16:12:05 +00:00
|
|
|
}
|
|
|
|
|
2017-10-03 10:23:52 +00:00
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
EWIRE::EWIRE( wxXmlNode* aWire )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT wire EMPTY>
|
|
|
|
<!ATTLIST wire
|
|
|
|
x1 %Coord; #REQUIRED
|
|
|
|
y1 %Coord; #REQUIRED
|
|
|
|
x2 %Coord; #REQUIRED
|
|
|
|
y2 %Coord; #REQUIRED
|
|
|
|
width %Dimension; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
extent %Extent; #IMPLIED -- only applicable for airwires --
|
|
|
|
style %WireStyle; "continuous"
|
|
|
|
curve %WireCurve; "0"
|
|
|
|
cap %WireCap; "round" -- only applicable if 'curve' is not zero --
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x1 = parseRequiredAttribute<ECOORD>( aWire, wxT( "x1" ) );
|
|
|
|
y1 = parseRequiredAttribute<ECOORD>( aWire, wxT( "y1" ) );
|
|
|
|
x2 = parseRequiredAttribute<ECOORD>( aWire, wxT( "x2" ) );
|
|
|
|
y2 = parseRequiredAttribute<ECOORD>( aWire, wxT( "y2" ) );
|
|
|
|
width = parseRequiredAttribute<ECOORD>( aWire, wxT( "width" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aWire, wxT( "layer" ) );
|
|
|
|
curve = parseOptionalAttribute<double>( aWire, wxT( "curve" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
opt_wxString s = parseOptionalAttribute<wxString>( aWire, wxT( "style" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
if( s == wxT( "continuous" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
style = EWIRE::CONTINUOUS;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "longdash" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
style = EWIRE::LONGDASH;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "shortdash" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
style = EWIRE::SHORTDASH;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "dashdot" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
style = EWIRE::DASHDOT;
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
s = parseOptionalAttribute<wxString>( aWire, wxT( "cap" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
if( s == wxT( "round" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
cap = EWIRE::ROUND;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "flat" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
cap = EWIRE::FLAT;
|
|
|
|
}
|
|
|
|
|
2017-06-19 13:43:55 +00:00
|
|
|
|
|
|
|
EJUNCTION::EJUNCTION( wxXmlNode* aJunction )
|
2017-06-18 11:31:11 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT junction EMPTY>
|
|
|
|
<!ATTLIST junction
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aJunction, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aJunction, wxT( "y" ) );
|
2017-06-18 11:31:11 +00:00
|
|
|
}
|
|
|
|
|
2017-06-19 13:43:55 +00:00
|
|
|
|
2017-06-19 13:43:25 +00:00
|
|
|
ELABEL::ELABEL( wxXmlNode* aLabel, const wxString& aNetName )
|
2017-06-18 11:31:11 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT label EMPTY>
|
|
|
|
<!ATTLIST label
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
size %Dimension; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
font %TextFont; "proportional"
|
|
|
|
ratio %Int; "8"
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
xref %Bool; "no"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aLabel, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aLabel, wxT( "y" ) );
|
|
|
|
size = parseRequiredAttribute<ECOORD>( aLabel, wxT( "size" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aLabel, wxT( "layer" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aLabel, wxT( "rot" ) );
|
|
|
|
xref = parseOptionalAttribute<wxString>( aLabel, wxT( "xref" ) );
|
2017-06-18 11:31:11 +00:00
|
|
|
netname = aNetName;
|
|
|
|
}
|
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
EVIA::EVIA( wxXmlNode* aVia )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT via EMPTY>
|
|
|
|
<!ATTLIST via
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
extent %Extent; #REQUIRED
|
|
|
|
drill %Dimension; #REQUIRED
|
|
|
|
diameter %Dimension; "0"
|
|
|
|
shape %ViaShape; "round"
|
|
|
|
alwaysstop %Bool; "no"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aVia, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aVia, wxT( "y" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
wxString ext = parseRequiredAttribute<wxString>( aVia, wxT( "extent" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
sscanf( ext.c_str(), "%d-%d", &layer_front_most, &layer_back_most );
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
drill = parseRequiredAttribute<ECOORD>( aVia, wxT( "drill" ) );
|
|
|
|
diam = parseOptionalAttribute<ECOORD>( aVia, wxT( "diameter" ) );
|
|
|
|
shape = parseOptionalAttribute<wxString>( aVia, wxT( "shape" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ECIRCLE::ECIRCLE( wxXmlNode* aCircle )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT circle EMPTY>
|
|
|
|
<!ATTLIST circle
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
radius %Coord; #REQUIRED
|
|
|
|
width %Dimension; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aCircle, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aCircle, wxT( "y" ) );
|
|
|
|
radius = parseRequiredAttribute<ECOORD>( aCircle, wxT( "radius" ) );
|
|
|
|
width = parseRequiredAttribute<ECOORD>( aCircle, wxT( "width" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aCircle, wxT( "layer" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ERECT::ERECT( wxXmlNode* aRect )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT rectangle EMPTY>
|
|
|
|
<!ATTLIST rectangle
|
|
|
|
x1 %Coord; #REQUIRED
|
|
|
|
y1 %Coord; #REQUIRED
|
|
|
|
x2 %Coord; #REQUIRED
|
|
|
|
y2 %Coord; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x1 = parseRequiredAttribute<ECOORD>( aRect, wxT( "x1" ) );
|
|
|
|
y1 = parseRequiredAttribute<ECOORD>( aRect, wxT( "y1" ) );
|
|
|
|
x2 = parseRequiredAttribute<ECOORD>( aRect, wxT( "x2" ) );
|
|
|
|
y2 = parseRequiredAttribute<ECOORD>( aRect, wxT( "y2" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aRect, wxT( "layer" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aRect, wxT( "rot" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EATTR::EATTR( wxXmlNode* aTree )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT attribute EMPTY>
|
|
|
|
<!ATTLIST attribute
|
|
|
|
name %String; #REQUIRED
|
|
|
|
value %String; #IMPLIED
|
|
|
|
x %Coord; #IMPLIED
|
|
|
|
y %Coord; #IMPLIED
|
|
|
|
size %Dimension; #IMPLIED
|
|
|
|
layer %Layer; #IMPLIED
|
|
|
|
font %TextFont; #IMPLIED
|
|
|
|
ratio %Int; #IMPLIED
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
display %AttributeDisplay; "value" -- only in <element> or <instance> context --
|
|
|
|
constant %Bool; "no" -- only in <device> context --
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aTree, wxT( "name" ) );
|
|
|
|
value = parseOptionalAttribute<wxString>( aTree, wxT( "value" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseOptionalAttribute<ECOORD>( aTree, wxT( "x" ) );
|
|
|
|
y = parseOptionalAttribute<ECOORD>( aTree, wxT( "y" ) );
|
|
|
|
size = parseOptionalAttribute<ECOORD>( aTree, wxT( "size" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
layer = parseOptionalAttribute<int>( aTree, wxT( "layer" ) );
|
|
|
|
ratio = parseOptionalAttribute<double>( aTree, wxT( "ratio" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aTree, wxT( "rot" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
opt_wxString stemp = parseOptionalAttribute<wxString>( aTree, wxT( "display" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
// (off | value | name | both)
|
2022-02-05 00:24:26 +00:00
|
|
|
if( stemp == wxT( "off" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
display = EATTR::Off;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( stemp == wxT( "name" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
display = EATTR::NAME;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( stemp == wxT( "both" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
display = EATTR::BOTH;
|
2018-05-11 13:44:36 +00:00
|
|
|
else // "value" is the default
|
|
|
|
display = EATTR::VALUE;
|
2017-07-16 16:12:05 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
stemp = parseOptionalAttribute<wxString>( aTree, wxT( "align" ) );
|
2017-07-16 16:12:05 +00:00
|
|
|
|
2017-07-17 10:17:23 +00:00
|
|
|
align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EDIMENSION::EDIMENSION( wxXmlNode* aDimension )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT dimension EMPTY>
|
|
|
|
<!ATTLIST dimension
|
|
|
|
x1 %Coord; #REQUIRED
|
|
|
|
y1 %Coord; #REQUIRED
|
|
|
|
x2 %Coord; #REQUIRED
|
|
|
|
y2 %Coord; #REQUIRED
|
|
|
|
x3 %Coord; #REQUIRED
|
|
|
|
y3 %Coord; #REQUIRED
|
2022-04-12 12:21:27 +00:00
|
|
|
textsize %Coord;
|
2017-04-07 11:40:34 +00:00
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
dtype %DimensionType; "parallel"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-04-12 12:21:27 +00:00
|
|
|
x1 = parseRequiredAttribute<ECOORD>( aDimension, wxT( "x1" ) );
|
|
|
|
y1 = parseRequiredAttribute<ECOORD>( aDimension, wxT( "y1" ) );
|
|
|
|
x2 = parseRequiredAttribute<ECOORD>( aDimension, wxT( "x2" ) );
|
|
|
|
y2 = parseRequiredAttribute<ECOORD>( aDimension, wxT( "y2" ) );
|
|
|
|
x3 = parseRequiredAttribute<ECOORD>( aDimension, wxT( "x3" ) );
|
|
|
|
y3 = parseRequiredAttribute<ECOORD>( aDimension, wxT( "y3" ) );
|
|
|
|
textsize = parseOptionalAttribute<ECOORD>( aDimension, wxT( "textsize" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aDimension, wxT( "layer" ) );
|
2022-02-05 00:24:26 +00:00
|
|
|
dimensionType = parseOptionalAttribute<wxString>( aDimension, wxT( "dtype" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ETEXT::ETEXT( wxXmlNode* aText )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT text (#PCDATA)>
|
|
|
|
<!ATTLIST text
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
size %Dimension; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
font %TextFont; "proportional"
|
|
|
|
ratio %Int; "8"
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
align %Align; "bottom-left"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
|
|
|
text = aText->GetNodeContent();
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aText, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aText, wxT( "y" ) );
|
|
|
|
size = parseRequiredAttribute<ECOORD>( aText, wxT( "size" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aText, wxT( "layer" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
font = parseOptionalAttribute<wxString>( aText, wxT( "font" ) );
|
|
|
|
ratio = parseOptionalAttribute<double>( aText, wxT( "ratio" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aText, wxT( "rot" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
opt_wxString stemp = parseOptionalAttribute<wxString>( aText, wxT( "align" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2017-07-17 10:17:23 +00:00
|
|
|
align = stemp ? parseAlignment( *stemp ) : DEFAULT_ALIGNMENT;
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-12 14:06:54 +00:00
|
|
|
wxSize ETEXT::ConvertSize() const
|
|
|
|
{
|
|
|
|
wxSize textsize;
|
|
|
|
|
|
|
|
if( font )
|
|
|
|
{
|
|
|
|
const wxString& fontName = font.CGet();
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
if( fontName == wxT( "vector" ) )
|
2017-09-12 14:06:54 +00:00
|
|
|
{
|
2017-10-17 08:18:54 +00:00
|
|
|
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
|
2017-09-12 14:06:54 +00:00
|
|
|
}
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( fontName == wxT( "fixed" ) )
|
2017-09-12 14:06:54 +00:00
|
|
|
{
|
2017-10-17 08:18:54 +00:00
|
|
|
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() * 0.80 );
|
2017-09-12 14:06:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-17 08:18:54 +00:00
|
|
|
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
|
2017-09-12 14:06:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-17 08:18:54 +00:00
|
|
|
textsize = wxSize( size.ToSchUnits() * 0.85, size.ToSchUnits() );
|
2017-09-12 14:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return textsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-02-15 21:44:58 +00:00
|
|
|
EFRAME::EFRAME( wxXmlNode* aFrameNode )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* <!ELEMENT frame EMPTY>
|
|
|
|
* <!ATTLIST frame
|
|
|
|
* x1 %Coord; #REQUIRED
|
|
|
|
* y1 %Coord; #REQUIRED
|
|
|
|
* x2 %Coord; #REQUIRED
|
|
|
|
* y2 %Coord; #REQUIRED
|
|
|
|
* columns %Int; #REQUIRED
|
|
|
|
* rows %Int; #REQUIRED
|
|
|
|
* layer %Layer; #REQUIRED
|
|
|
|
* border-left %Bool; "yes"
|
|
|
|
* border-top %Bool; "yes"
|
|
|
|
* border-right %Bool; "yes"
|
|
|
|
* border-bottom %Bool; "yes"
|
|
|
|
* >
|
|
|
|
*/
|
|
|
|
border_left = true;
|
|
|
|
border_top = true;
|
|
|
|
border_right = true;
|
|
|
|
border_bottom = true;
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x1 = parseRequiredAttribute<ECOORD>( aFrameNode, wxT( "x1" ) );
|
|
|
|
y1 = parseRequiredAttribute<ECOORD>( aFrameNode, wxT( "y1" ) );
|
|
|
|
x2 = parseRequiredAttribute<ECOORD>( aFrameNode, wxT( "x2" ) );
|
|
|
|
y2 = parseRequiredAttribute<ECOORD>( aFrameNode, wxT( "y2" ) );
|
|
|
|
columns = parseRequiredAttribute<int>( aFrameNode, wxT( "columns" ) );
|
|
|
|
rows = parseRequiredAttribute<int>( aFrameNode, wxT( "rows" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aFrameNode, wxT( "layer" ) );
|
|
|
|
border_left = parseOptionalAttribute<bool>( aFrameNode, wxT( "border-left" ) );
|
|
|
|
border_top = parseOptionalAttribute<bool>( aFrameNode, wxT( "border-top" ) );
|
|
|
|
border_right = parseOptionalAttribute<bool>( aFrameNode, wxT( "border-right" ) );
|
|
|
|
border_bottom = parseOptionalAttribute<bool>( aFrameNode, wxT( "border-bottom" ) );
|
2021-02-15 21:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-13 13:34:53 +00:00
|
|
|
EPAD_COMMON::EPAD_COMMON( wxXmlNode* aPad )
|
|
|
|
{
|
|
|
|
// #REQUIRED says DTD, throw exception if not found
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aPad, wxT( "name" ) );
|
|
|
|
x = parseRequiredAttribute<ECOORD>( aPad, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aPad, wxT( "y" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aPad, wxT( "rot" ) );
|
|
|
|
stop = parseOptionalAttribute<bool>( aPad, wxT( "stop" ) );
|
|
|
|
thermals = parseOptionalAttribute<bool>( aPad, wxT( "thermals" ) );
|
2018-03-13 13:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
EPAD::EPAD( wxXmlNode* aPad )
|
2018-03-13 13:34:53 +00:00
|
|
|
: EPAD_COMMON( aPad )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT pad EMPTY>
|
|
|
|
<!ATTLIST pad
|
|
|
|
name %String; #REQUIRED
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
drill %Dimension; #REQUIRED
|
|
|
|
diameter %Dimension; "0"
|
|
|
|
shape %PadShape; "round"
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
stop %Bool; "yes"
|
|
|
|
thermals %Bool; "yes"
|
|
|
|
first %Bool; "no"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
|
|
|
// #REQUIRED says DTD, throw exception if not found
|
2022-02-05 00:24:26 +00:00
|
|
|
drill = parseRequiredAttribute<ECOORD>( aPad, wxT( "drill" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
// Optional attributes
|
2022-02-05 00:24:26 +00:00
|
|
|
diameter = parseOptionalAttribute<ECOORD>( aPad, wxT( "diameter" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
opt_wxString s = parseOptionalAttribute<wxString>( aPad, wxT( "shape" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
// (square | round | octagon | long | offset)
|
2022-02-05 00:24:26 +00:00
|
|
|
if( s == wxT( "square" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
shape = EPAD::SQUARE;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "round" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
shape = EPAD::ROUND;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "octagon" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
shape = EPAD::OCTAGON;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "long" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
shape = EPAD::LONG;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "offset" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
shape = EPAD::OFFSET;
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
first = parseOptionalAttribute<bool>( aPad, wxT( "first" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ESMD::ESMD( wxXmlNode* aSMD )
|
2018-03-13 13:34:53 +00:00
|
|
|
: EPAD_COMMON( aSMD )
|
2017-04-07 11:40:34 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ATTLIST smd
|
|
|
|
name %String; #REQUIRED
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
dx %Dimension; #REQUIRED
|
|
|
|
dy %Dimension; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
roundness %Int; "0"
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
stop %Bool; "yes"
|
|
|
|
thermals %Bool; "yes"
|
|
|
|
cream %Bool; "yes"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
|
|
|
// DTD #REQUIRED, throw exception if not found
|
2022-02-05 00:24:26 +00:00
|
|
|
dx = parseRequiredAttribute<ECOORD>( aSMD, wxT( "dx" ) );
|
|
|
|
dy = parseRequiredAttribute<ECOORD>( aSMD, wxT( "dy" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aSMD, wxT( "layer" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
roundness = parseOptionalAttribute<int>( aSMD, wxT( "roundness" ) );
|
|
|
|
cream = parseOptionalAttribute<bool>( aSMD, wxT( "cream" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
2017-06-19 13:43:55 +00:00
|
|
|
|
|
|
|
EPIN::EPIN( wxXmlNode* aPin )
|
|
|
|
{
|
2017-06-18 11:31:11 +00:00
|
|
|
/*
|
|
|
|
<!ELEMENT pin EMPTY>
|
|
|
|
<!ATTLIST pin
|
|
|
|
name %String; #REQUIRED
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
visible %PinVisible; "both"
|
|
|
|
length %PinLength; "long"
|
|
|
|
direction %PinDirection; "io"
|
|
|
|
function %PinFunction; "none"
|
|
|
|
swaplevel %Int; "0"
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
|
|
|
// DTD #REQUIRED, throw exception if not found
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aPin, wxT( "name" ) );
|
|
|
|
x = parseRequiredAttribute<ECOORD>( aPin, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aPin, wxT( "y" ) );
|
|
|
|
|
|
|
|
visible = parseOptionalAttribute<wxString>( aPin, wxT( "visible" ) );
|
|
|
|
length = parseOptionalAttribute<wxString>( aPin, wxT( "length" ) );
|
|
|
|
direction = parseOptionalAttribute<wxString>( aPin, wxT( "direction" ) );
|
|
|
|
function = parseOptionalAttribute<wxString>( aPin, wxT( "function" ) );
|
|
|
|
swaplevel = parseOptionalAttribute<int>( aPin, wxT( "swaplevel" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aPin, wxT( "rot" ) );
|
2017-06-18 11:31:11 +00:00
|
|
|
}
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2017-06-19 13:43:55 +00:00
|
|
|
|
2017-04-07 11:40:34 +00:00
|
|
|
EVERTEX::EVERTEX( wxXmlNode* aVertex )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT vertex EMPTY>
|
|
|
|
<!ATTLIST vertex
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
curve %WireCurve; "0" -- the curvature from this vertex to the next one --
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aVertex, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aVertex, wxT( "y" ) );
|
|
|
|
curve = parseOptionalAttribute<double>( aVertex, wxT( "curve" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EPOLYGON::EPOLYGON( wxXmlNode* aPolygon )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ATTLIST polygon
|
|
|
|
width %Dimension; #REQUIRED
|
|
|
|
layer %Layer; #REQUIRED
|
|
|
|
spacing %Dimension; #IMPLIED
|
|
|
|
pour %PolygonPour; "solid"
|
|
|
|
isolate %Dimension; #IMPLIED -- only in <signal> or <package> context --
|
|
|
|
orphans %Bool; "no" -- only in <signal> context --
|
|
|
|
thermals %Bool; "yes" -- only in <signal> context --
|
2021-02-15 21:44:58 +00:00
|
|
|
rank %Int; "0" -- 1..6 in <signal> context, 0 or 7 in
|
|
|
|
<package> context --
|
2017-04-07 11:40:34 +00:00
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
width = parseRequiredAttribute<ECOORD>( aPolygon, wxT( "width" ) );
|
|
|
|
layer = parseRequiredAttribute<int>( aPolygon, wxT( "layer" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
spacing = parseOptionalAttribute<ECOORD>( aPolygon, wxT( "spacing" ) );
|
|
|
|
isolate = parseOptionalAttribute<ECOORD>( aPolygon, wxT( "isolate" ) );
|
|
|
|
opt_wxString s = parseOptionalAttribute<wxString>( aPolygon, wxT( "pour" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
// default pour to solid fill
|
|
|
|
pour = EPOLYGON::SOLID;
|
|
|
|
|
|
|
|
// (solid | hatch | cutout)
|
2022-02-05 00:24:26 +00:00
|
|
|
if( s == wxT( "hatch" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
pour = EPOLYGON::HATCH;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( s == wxT( "cutout" ) )
|
2017-04-07 11:40:34 +00:00
|
|
|
pour = EPOLYGON::CUTOUT;
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
orphans = parseOptionalAttribute<bool>( aPolygon, wxT( "orphans" ) );
|
|
|
|
thermals = parseOptionalAttribute<bool>( aPolygon, wxT( "thermals" ) );
|
|
|
|
rank = parseOptionalAttribute<int>( aPolygon, wxT( "rank" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EHOLE::EHOLE( wxXmlNode* aHole )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT hole EMPTY>
|
|
|
|
<!ATTLIST hole
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
drill %Dimension; #REQUIRED
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
|
|
|
// #REQUIRED:
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aHole, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aHole, wxT( "y" ) );
|
|
|
|
drill = parseRequiredAttribute<ECOORD>( aHole, wxT( "drill" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EELEMENT::EELEMENT( wxXmlNode* aElement )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT element (attribute*, variant*)>
|
|
|
|
<!ATTLIST element
|
|
|
|
name %String; #REQUIRED
|
|
|
|
library %String; #REQUIRED
|
|
|
|
package %String; #REQUIRED
|
|
|
|
value %String; #REQUIRED
|
|
|
|
x %Coord; #REQUIRED
|
|
|
|
y %Coord; #REQUIRED
|
|
|
|
locked %Bool; "no"
|
|
|
|
smashed %Bool; "no"
|
|
|
|
rot %Rotation; "R0"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
|
|
|
// #REQUIRED
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aElement, wxT( "name" ) );
|
|
|
|
library = parseRequiredAttribute<wxString>( aElement, wxT( "library" ) );
|
|
|
|
value = parseRequiredAttribute<wxString>( aElement, wxT( "value" ) );
|
|
|
|
std::string p = parseRequiredAttribute<std::string>( aElement, wxT( "package" ) );
|
2018-02-16 14:53:25 +00:00
|
|
|
ReplaceIllegalFileNameChars( &p, '_' );
|
2017-12-14 09:37:32 +00:00
|
|
|
package = wxString::FromUTF8( p.c_str() );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aElement, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aElement, wxT( "y" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
|
|
|
|
// optional
|
2022-02-05 00:24:26 +00:00
|
|
|
locked = parseOptionalAttribute<bool>( aElement, wxT( "locked" ) );
|
|
|
|
smashed = parseOptionalAttribute<bool>( aElement, wxT( "smashed" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aElement, wxT( "rot" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ELAYER::ELAYER( wxXmlNode* aLayer )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
<!ELEMENT layer EMPTY>
|
|
|
|
<!ATTLIST layer
|
|
|
|
number %Layer; #REQUIRED
|
|
|
|
name %String; #REQUIRED
|
|
|
|
color %Int; #REQUIRED
|
|
|
|
fill %Int; #REQUIRED
|
|
|
|
visible %Bool; "yes"
|
|
|
|
active %Bool; "yes"
|
|
|
|
>
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
number = parseRequiredAttribute<int>( aLayer, wxT( "number" ) );
|
|
|
|
name = parseRequiredAttribute<wxString>( aLayer, wxT( "name" ) );
|
|
|
|
color = parseRequiredAttribute<int>( aLayer, wxT( "color" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
fill = 1; // Temporary value.
|
2022-02-05 00:24:26 +00:00
|
|
|
visible = parseOptionalAttribute<bool>( aLayer, wxT( "visible" ) );
|
|
|
|
active = parseOptionalAttribute<bool>( aLayer, wxT( "active" ) );
|
2017-04-07 11:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-26 07:53:57 +00:00
|
|
|
EPART::EPART( wxXmlNode* aPart )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* <!ELEMENT part (attribute*, variant*)>
|
|
|
|
* <!ATTLIST part
|
|
|
|
* name %String; #REQUIRED
|
|
|
|
* library %String; #REQUIRED
|
|
|
|
* deviceset %String; #REQUIRED
|
|
|
|
* device %String; #REQUIRED
|
|
|
|
* technology %String; ""
|
|
|
|
* value %String; #IMPLIED
|
|
|
|
* >
|
|
|
|
*/
|
|
|
|
// #REQUIRED
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aPart, wxT( "name" ) );
|
|
|
|
library = parseRequiredAttribute<wxString>( aPart, wxT( "library" ) );
|
|
|
|
deviceset = parseRequiredAttribute<wxString>( aPart, wxT( "deviceset" ) );
|
|
|
|
device = parseRequiredAttribute<wxString>( aPart, wxT( "device" ) );
|
|
|
|
technology = parseOptionalAttribute<wxString>( aPart, wxT( "technology" ) );
|
|
|
|
value = parseOptionalAttribute<wxString>( aPart, wxT( "value" ) );
|
2018-07-10 14:32:10 +00:00
|
|
|
|
2021-09-20 11:36:57 +00:00
|
|
|
for( wxXmlNode* child = aPart->GetChildren(); child; child = child->GetNext() )
|
2018-07-10 14:32:10 +00:00
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
if( child->GetName() == wxT( "attribute" ) )
|
2018-07-10 14:32:10 +00:00
|
|
|
{
|
|
|
|
std::string aname, avalue;
|
|
|
|
|
2021-09-20 11:36:57 +00:00
|
|
|
for( wxXmlAttribute* x = child->GetAttributes(); x; x = x->GetNext() )
|
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
if( x->GetName() == wxT( "name" ) )
|
2018-07-10 14:32:10 +00:00
|
|
|
aname = x->GetValue();
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( x->GetName() == wxT( "value" ) )
|
2018-07-10 14:32:10 +00:00
|
|
|
avalue = x->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aname.size() && avalue.size() )
|
|
|
|
attribute[aname] = avalue;
|
|
|
|
}
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( child->GetName() == wxT( "variant" ) )
|
2018-07-10 14:32:10 +00:00
|
|
|
{
|
|
|
|
std::string aname, avalue;
|
|
|
|
|
2021-09-20 11:36:57 +00:00
|
|
|
for( wxXmlAttribute* x = child->GetAttributes(); x; x = x->GetNext() )
|
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
if( x->GetName() == wxT( "name" ) )
|
2018-07-10 14:32:10 +00:00
|
|
|
aname = x->GetValue();
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( x->GetName() == wxT( "value" ) )
|
2018-07-10 14:32:10 +00:00
|
|
|
avalue = x->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aname.size() && avalue.size() )
|
|
|
|
variant[aname] = avalue;
|
|
|
|
}
|
|
|
|
}
|
2017-06-26 07:53:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EINSTANCE::EINSTANCE( wxXmlNode* aInstance )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* <!ELEMENT instance (attribute)*>
|
|
|
|
* <!ATTLIST instance
|
|
|
|
* part %String; #REQUIRED
|
|
|
|
* gate %String; #REQUIRED
|
|
|
|
* x %Coord; #REQUIRED
|
|
|
|
* y %Coord; #REQUIRED
|
|
|
|
* smashed %Bool; "no"
|
|
|
|
* rot %Rotation; "R0"
|
|
|
|
* >
|
|
|
|
*/
|
2022-02-05 00:24:26 +00:00
|
|
|
part = parseRequiredAttribute<wxString>( aInstance, wxT( "part" ) );
|
|
|
|
gate = parseRequiredAttribute<wxString>( aInstance, wxT( "gate" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aInstance, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aInstance, wxT( "y" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
// optional
|
2022-02-05 00:24:26 +00:00
|
|
|
smashed = parseOptionalAttribute<bool>( aInstance, wxT( "smashed" ) );
|
|
|
|
rot = parseOptionalAttribute<EROT>( aInstance, wxT( "rot" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EGATE::EGATE( wxXmlNode* aGate )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* <!ELEMENT gate EMPTY>
|
|
|
|
* <!ATTLIST gate
|
|
|
|
* name %String; #REQUIRED
|
|
|
|
* symbol %String; #REQUIRED
|
|
|
|
* x %Coord; #REQUIRED
|
|
|
|
* y %Coord; #REQUIRED
|
|
|
|
* addlevel %GateAddLevel; "next"
|
|
|
|
* swaplevel %Int; "0"
|
|
|
|
* >
|
|
|
|
*/
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aGate, wxT( "name" ) );
|
|
|
|
symbol = parseRequiredAttribute<wxString>( aGate, wxT( "symbol" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
x = parseRequiredAttribute<ECOORD>( aGate, wxT( "x" ) );
|
|
|
|
y = parseRequiredAttribute<ECOORD>( aGate, wxT( "y" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
opt_wxString stemp = parseOptionalAttribute<wxString>( aGate, wxT( "addlevel" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
// (off | value | name | both)
|
2022-02-05 00:24:26 +00:00
|
|
|
if( stemp == wxT( "must" ) )
|
2017-06-26 07:53:57 +00:00
|
|
|
addlevel = EGATE::MUST;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( stemp == wxT( "can" ) )
|
2017-06-26 07:53:57 +00:00
|
|
|
addlevel = EGATE::CAN;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( stemp == wxT( "next" ) )
|
2017-06-26 07:53:57 +00:00
|
|
|
addlevel = EGATE::NEXT;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( stemp == wxT( "request" ) )
|
2017-06-26 07:53:57 +00:00
|
|
|
addlevel = EGATE::REQUEST;
|
2022-02-05 00:24:26 +00:00
|
|
|
else if( stemp == wxT( "always" ) )
|
2017-06-26 07:53:57 +00:00
|
|
|
addlevel = EGATE::ALWAYS;
|
|
|
|
else
|
|
|
|
addlevel = EGATE::NEXT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ECONNECT::ECONNECT( wxXmlNode* aConnect )
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* <!ELEMENT connect EMPTY>
|
|
|
|
* <!ATTLIST connect
|
|
|
|
* gate %String; #REQUIRED
|
|
|
|
* pin %String; #REQUIRED
|
|
|
|
* pad %String; #REQUIRED
|
|
|
|
* route %ContactRoute; "all"
|
|
|
|
* >
|
|
|
|
*/
|
2022-02-05 00:24:26 +00:00
|
|
|
gate = parseRequiredAttribute<wxString>( aConnect, wxT( "gate" ) );
|
|
|
|
pin = parseRequiredAttribute<wxString>( aConnect, wxT( "pin" ) );
|
|
|
|
pad = parseRequiredAttribute<wxString>( aConnect, wxT( "pad" ) );
|
2017-11-02 20:41:29 +00:00
|
|
|
}
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
EDEVICE::EDEVICE( wxXmlNode* aDevice )
|
|
|
|
{
|
|
|
|
/*
|
2021-02-15 21:44:58 +00:00
|
|
|
<!ELEMENT device (connects?, technologies?)>
|
|
|
|
<!ATTLIST device
|
|
|
|
name %String; ""
|
|
|
|
package %String; #IMPLIED
|
|
|
|
>
|
|
|
|
*/
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aDevice, wxT( "name" ) );
|
|
|
|
opt_wxString pack = parseOptionalAttribute<wxString>( aDevice, wxT( "package" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2018-02-16 14:53:25 +00:00
|
|
|
if( pack )
|
|
|
|
{
|
|
|
|
std::string p( pack->c_str() );
|
|
|
|
ReplaceIllegalFileNameChars( &p, '_' );
|
|
|
|
package.Set( wxString::FromUTF8( p.c_str() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
NODE_MAP aDeviceChildren = MapChildren( aDevice );
|
2022-02-05 00:24:26 +00:00
|
|
|
wxXmlNode* connectNode = getChildrenNodes( aDeviceChildren, wxT( "connects" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2018-02-16 14:53:25 +00:00
|
|
|
while( connectNode )
|
|
|
|
{
|
2019-12-05 15:41:21 +00:00
|
|
|
connects.emplace_back( connectNode );
|
2017-06-30 01:52:05 +00:00
|
|
|
connectNode = connectNode->GetNext();
|
2017-06-26 07:53:57 +00:00
|
|
|
}
|
2017-11-02 20:41:29 +00:00
|
|
|
}
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
|
2017-10-03 10:23:52 +00:00
|
|
|
EDEVICE_SET::EDEVICE_SET( wxXmlNode* aDeviceSet )
|
2017-06-26 07:53:57 +00:00
|
|
|
{
|
|
|
|
/*
|
2021-02-15 21:44:58 +00:00
|
|
|
<!ELEMENT deviceset (description?, gates, devices)>
|
|
|
|
<!ATTLIST deviceset
|
2017-06-26 07:53:57 +00:00
|
|
|
name %String; #REQUIRED
|
|
|
|
prefix %String; ""
|
|
|
|
uservalue %Bool; "no"
|
|
|
|
>
|
2021-02-15 21:44:58 +00:00
|
|
|
*/
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
name = parseRequiredAttribute<wxString>( aDeviceSet, wxT( "name" ) );
|
|
|
|
prefix = parseOptionalAttribute<wxString>( aDeviceSet, wxT( "prefix" ) );
|
|
|
|
uservalue = parseOptionalAttribute<bool>( aDeviceSet, wxT( "uservalue" ) );
|
2017-06-26 07:53:57 +00:00
|
|
|
|
2017-06-30 01:52:05 +00:00
|
|
|
/* Russell: Parsing of devices and gates moved to sch_eagle_plugin.cpp
|
2017-07-02 12:26:23 +00:00
|
|
|
*
|
2017-06-26 07:53:57 +00:00
|
|
|
//TODO: description
|
|
|
|
|
|
|
|
NODE_MAP aDeviceSetChildren = MapChildren(aDeviceSet);
|
2022-02-05 00:24:26 +00:00
|
|
|
wxXmlNode* deviceNode = getChildrenNodes(aDeviceSetChildren, wxT( "device" ));
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
while(deviceNode){
|
|
|
|
devices.push_back(EDEVICE(deviceNode));
|
|
|
|
deviceNode->GetNext();
|
|
|
|
}
|
|
|
|
|
2022-02-05 00:24:26 +00:00
|
|
|
wxXmlNode* gateNode = getChildrenNodes(aDeviceSetChildren, wxT( "gate" ));
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
while(gateNode){
|
|
|
|
gates.push_back(EGATE(gateNode));
|
|
|
|
gateNode->GetNext();
|
|
|
|
}
|
2017-06-30 01:52:05 +00:00
|
|
|
*/
|
2017-06-26 07:53:57 +00:00
|
|
|
|
|
|
|
}
|
2021-09-20 11:36:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
ECLASS::ECLASS( wxXmlNode* aClass )
|
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
number = parseRequiredAttribute<wxString>( aClass, wxT( "number" ) );
|
|
|
|
name = parseRequiredAttribute<wxString>( aClass, wxT( "name" ) );
|
2021-09-20 11:36:57 +00:00
|
|
|
|
|
|
|
for( wxXmlNode* child = aClass->GetChildren(); child; child = child->GetNext() )
|
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
if( child->GetName() == wxT( "clearance" ) )
|
2021-09-20 11:36:57 +00:00
|
|
|
{
|
2022-02-05 00:24:26 +00:00
|
|
|
wxString to = parseRequiredAttribute<wxString>( child, wxT( "class" ) );
|
|
|
|
ECOORD value = parseRequiredAttribute<ECOORD>( child, wxT( "value" ) );
|
2021-09-20 11:36:57 +00:00
|
|
|
|
|
|
|
clearanceMap[to] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|