Commit 57acee0d authored by Dick Hollenbeck's avatar Dick Hollenbeck

EAGLE_PLUGIN: finish xpath error reporting mechanism for XML document traversal

parent a8c71d4a
This diff is collapsed.
...@@ -56,28 +56,18 @@ struct ENET ...@@ -56,28 +56,18 @@ struct ENET
{} {}
}; };
typedef std::map< std::string, ENET > NET_MAP; typedef std::map< std::string, ENET > NET_MAP;
typedef NET_MAP::const_iterator NET_MAP_CITER; typedef NET_MAP::const_iterator NET_MAP_CITER;
/*
#include
namespace boost {
namespace property_tree
{
template < class Key, class Data, class KeyCompare = std::less<Key> >
class basic_ptree;
typedef basic_ptree< std::string, std::string > ptree;
}
}
*/
typedef boost::property_tree::ptree PTREE; typedef boost::property_tree::ptree PTREE;
typedef const PTREE CPTREE; typedef const PTREE CPTREE;
class XPATH;
/** /**
* Class EAGLE_PLUGIN * Class EAGLE_PLUGIN
* works with Eagle 6.x XML board files and footprints. * works with Eagle 6.x XML board files and footprints to implement the
* Pcbnew PLUGIN API, or a portion of it.
*/ */
class EAGLE_PLUGIN : public PLUGIN class EAGLE_PLUGIN : public PLUGIN
{ {
...@@ -110,38 +100,46 @@ public: ...@@ -110,38 +100,46 @@ public:
//-----</PUBLIC PLUGIN API>------------------------------------------------- //-----</PUBLIC PLUGIN API>-------------------------------------------------
typedef int BIU; typedef int BIU;
EAGLE_PLUGIN(); EAGLE_PLUGIN();
~EAGLE_PLUGIN(); ~EAGLE_PLUGIN();
private: private:
int m_hole_count; ///< generates unique module names from eagle "hole"s. XPATH* m_xpath; ///< keeps track of what we are working on within
///< XML document during a Load().
NET_MAP m_pads_to_nets; std::string m_err_path; ///< snapshot m_xpath contentx into here on exception
MODULE_MAP m_templates; ///< is part of a MODULE factory that operates int m_hole_count; ///< generates unique module names from eagle "hole"s.
NET_MAP m_pads_to_nets; ///< net list
MODULE_MAP m_templates; ///< is part of a MODULE factory that operates
///< using copy construction. ///< using copy construction.
///< lookup key is libname.packagename ///< lookup key is libname.packagename
PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL.
BOARD* m_board; ///< which BOARD is being worked on, no ownership here
BOARD* m_board; ///< which BOARD, no ownership here double mm_per_biu; ///< how many mm in each BIU
double mm_per_biu; ///< how many mm in each BIU double biu_per_mm; ///< how many bius in a mm
double biu_per_mm; ///< how many bius in a mm
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void init( PROPERTIES* aProperties ); void init( PROPERTIES* aProperties );
/// Convert an Eagle distance to a KiCad distance.
int kicad( double d ) const; int kicad( double d ) const;
int kicad_y( double y ) const { return -kicad( y ); } int kicad_y( double y ) const { return -kicad( y ); }
int kicad_x( double x ) const { return kicad( x ); } int kicad_x( double x ) const { return kicad( x ); }
wxSize kicad_fontz( double d ) const;
/// create a font size (fontz) from an eagle font size scalar
wxSize kicad_fontz( double d ) const;
/// Convert an Eagle layer to a KiCad layer.
static int kicad_layer( int aLayer ); static int kicad_layer( int aLayer );
/// Convert a KiCad distance to an Eagle distance.
double eagle( BIU d ) const { return mm_per_biu * d; } double eagle( BIU d ) const { return mm_per_biu * d; }
double eagle_x( BIU x ) const { return eagle( x ); } double eagle_x( BIU x ) const { return eagle( x ); }
double eagle_y( BIU y ) const { return eagle( y ); } double eagle_y( BIU y ) const { return eagle( y ); }
...@@ -174,13 +172,16 @@ private: ...@@ -174,13 +172,16 @@ private:
// all these loadXXX() throw IO_ERROR or ptree_error exceptions: // all these loadXXX() throw IO_ERROR or ptree_error exceptions:
void loadAllSections( CPTREE& aDocument, bool aAppendToMe ); void loadAllSections( CPTREE& aDocument );
void loadLayerDefs( CPTREE& aLayers ); void loadLayerDefs( CPTREE& aLayers );
void loadPlain( CPTREE& aPlain ); void loadPlain( CPTREE& aPlain );
void loadSignals( CPTREE& aSignals ); void loadSignals( CPTREE& aSignals );
void loadLibraries( CPTREE& aLibs ); void loadLibraries( CPTREE& aLibs );
void loadElements( CPTREE& aElements ); void loadElements( CPTREE& aElements );
/// move the BOARD into the center of the page
void centerBoard();
/** /**
* Function fmtDEG * Function fmtDEG
* formats an angle in a way particular to a board file format. This function * formats an angle in a way particular to a board file format. This function
...@@ -203,7 +204,6 @@ private: ...@@ -203,7 +204,6 @@ private:
void packageCircle( MODULE* aModule, CPTREE& aTree ) const; void packageCircle( MODULE* aModule, CPTREE& aTree ) const;
void packageHole( MODULE* aModule, CPTREE& aTree ) const; void packageHole( MODULE* aModule, CPTREE& aTree ) const;
void packageSMD( MODULE* aModule, CPTREE& aTree ) const; void packageSMD( MODULE* aModule, CPTREE& aTree ) const;
}; };
#endif // EAGLE_PLUGIN_H_ #endif // EAGLE_PLUGIN_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment