Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
57acee0d
Commit
57acee0d
authored
Jun 02, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EAGLE_PLUGIN: finish xpath error reporting mechanism for XML document traversal
parent
a8c71d4a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
312 additions
and
119 deletions
+312
-119
eagle_plugin.cpp
pcbnew/eagle_plugin.cpp
+284
-91
eagle_plugin.h
pcbnew/eagle_plugin.h
+28
-28
No files found.
pcbnew/eagle_plugin.cpp
View file @
57acee0d
This diff is collapsed.
Click to expand it.
pcbnew/eagle_plugin.h
View file @
57acee0d
...
...
@@ -56,28 +56,18 @@ struct ENET
{}
};
typedef
std
::
map
<
std
::
string
,
ENET
>
NET_MAP
;
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
std
::
map
<
std
::
string
,
ENET
>
NET_MAP
;
typedef
NET_MAP
::
const_iterator
NET_MAP_CITER
;
typedef
boost
::
property_tree
::
ptree
PTREE
;
typedef
const
PTREE
CPTREE
;
class
XPATH
;
/**
* 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
{
...
...
@@ -110,38 +100,46 @@ public:
//-----</PUBLIC PLUGIN API>-------------------------------------------------
typedef
int
BIU
;
typedef
int
BIU
;
EAGLE_PLUGIN
();
~
EAGLE_PLUGIN
();
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.
///< lookup key is libname.packagename
PROPERTIES
*
m_props
;
///< passed via Save() or Load(), no ownership, may be NULL.
BOARD
*
m_board
;
///< which BOARD, no ownership here
double
mm_per_biu
;
///< how many mm in each BIU
double
biu_per_mm
;
///< how many bius in a mm
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
double
mm_per_biu
;
///< how many mm in each BIU
double
biu_per_mm
;
///< how many bius in a mm
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void
init
(
PROPERTIES
*
aProperties
);
/// Convert an Eagle distance to a KiCad distance.
int
kicad
(
double
d
)
const
;
int
kicad_y
(
double
y
)
const
{
return
-
kicad
(
y
);
}
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
);
/// Convert a KiCad distance to an Eagle distance.
double
eagle
(
BIU
d
)
const
{
return
mm_per_biu
*
d
;
}
double
eagle_x
(
BIU
x
)
const
{
return
eagle
(
x
);
}
double
eagle_y
(
BIU
y
)
const
{
return
eagle
(
y
);
}
...
...
@@ -174,13 +172,16 @@ private:
// 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
loadPlain
(
CPTREE
&
aPlain
);
void
loadSignals
(
CPTREE
&
aSignals
);
void
loadLibraries
(
CPTREE
&
aLibs
);
void
loadElements
(
CPTREE
&
aElements
);
/// move the BOARD into the center of the page
void
centerBoard
();
/**
* Function fmtDEG
* formats an angle in a way particular to a board file format. This function
...
...
@@ -203,7 +204,6 @@ private:
void
packageCircle
(
MODULE
*
aModule
,
CPTREE
&
aTree
)
const
;
void
packageHole
(
MODULE
*
aModule
,
CPTREE
&
aTree
)
const
;
void
packageSMD
(
MODULE
*
aModule
,
CPTREE
&
aTree
)
const
;
};
#endif // EAGLE_PLUGIN_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment