25#ifndef SCH_IO_EAGLE_H_
26#define SCH_IO_EAGLE_H_
34#include <boost/ptr_container/ptr_map.hpp>
64 std::unordered_map<wxString, wxString>
package;
102 void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
const wxString& aLibraryPath,
105 void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
const wxString& aLibraryPath,
116 bool checkHeader(
const wxString& aFileName )
const;
124 void loadSheet( wxXmlNode* aSheetNode,
int sheetcount );
127 void countNets( wxXmlNode* aSchematicNode );
140 const std::vector<SEG>& aLines )
const;
142 void loadSegments( wxXmlNode* aSegmentsNode,
const wxString& aNetName,
143 const wxString& aNetClass );
151 void loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>& aItems );
153 bool loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_SYMBOL>& aSymbol,
154 EDEVICE* aDevice,
int aGateNumber,
const wxString& aGateName );
162 void loadSymbolFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>& aLines );
constexpr double SCH_IU_PER_MM
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Define a library symbol object.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Holds all the data relating to one schematic.
Object to handle a bitmap image that can be inserted in a schematic.
Base class for a bus or wire entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
A SCH_IO derivation for loading 6.x+ Eagle schematic files.
SCH_SHAPE * loadSymbolRectangle(wxXmlNode *aRectNode, int aGateNumber)
SCH_PIN * loadPin(std::unique_ptr< LIB_SYMBOL > &aSymbol, wxXmlNode *, EPIN *epin, int aGateNumber)
SCH_SHAPE * loadSymbolCircle(wxXmlNode *aCircleNode, int aGateNumber)
void ensureLoadedLibrary(const wxString &aLibraryPath)
bool netHasPowerDriver(SCH_LINE *aLine, const wxString &aNetName) const
SCH_JUNCTION * loadJunction(wxXmlNode *aJunction)
void loadSegments(wxXmlNode *aSegmentsNode, const wxString &aNetName, const wxString &aNetClass)
EAGLE_LIBRARY * loadLibrary(wxXmlNode *aLibraryNode, EAGLE_LIBRARY *aEagleLib)
std::unique_ptr< STRING_UTF8_MAP > m_properties
Library plugin properties.
wxXmlDocument loadXmlDocument(const wxString &aFileName)
void loadSheet(wxXmlNode *aSheetNode, int sheetcount)
wxString translateEagleBusName(const wxString &aEagleName) const
Translate an Eagle-style bus name into one that is KiCad-compatible.
void loadFieldAttributes(SCH_FIELD *aField, const SCH_TEXT *aText) const
Move net labels that are detached from any wire to the nearest wire.
std::map< wxString, wxString > m_powerPorts
map from symbol reference to global label equivalent
SCH_SHEET_PATH m_sheetPath
The current sheet path of the schematic being loaded.
wxString m_libName
Library name to save symbols.
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const STRING_UTF8_MAP *aProperties) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
void loadInstance(wxXmlNode *aInstanceNode)
std::pair< VECTOR2I, const SEG * > findNearestLinePoint(const VECTOR2I &aPoint, const std::vector< SEG > &aLines) const
SCH_SHAPE * loadCircle(wxXmlNode *aCircleNode)
SCH_TEXT * loadLabel(wxXmlNode *aLabelNode, const wxString &aNetName)
const double ARC_ACCURACY
std::map< wxString, long long > m_timestamps
SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr) override
Load information from some input file format that this SCH_IO implementation knows about,...
void loadSymbolFrame(wxXmlNode *aFrameNode, std::vector< SCH_ITEM * > &aLines)
std::unordered_map< wxString, bool > m_userValue
deviceset/@uservalue for device.
int GetModifyHash() const override
Return the modification hash from the library cache.
std::map< wxString, int > m_netCounts
SCH_ITEM * loadWire(wxXmlNode *aWireNode, SEG &endpoints)
std::map< wxString, EAGLE_LIBRARY > m_eagleLibs
SCH_SHAPE * loadPolyLine(wxXmlNode *aPolygonNode)
std::map< wxString, ENET > m_nets
Positions of pins and wire endings mapped to its parent.
void countNets(wxXmlNode *aSchematicNode)
SCH_SHEET * getCurrentSheet()
std::vector< VECTOR2I > m_wireIntersections
Wires and labels of a single connection (segment in Eagle nomenclature)
void loadSchematic(wxXmlNode *aSchematicNode)
std::map< VECTOR2I, std::set< const EDA_ITEM * > > m_connPoints
bool checkConnections(const SCH_SYMBOL *aSymbol, const SCH_PIN *aPin) const
IO_RELEASER< SCH_IO > m_pi
PI to create KiCad symbol library.
void addBusEntries()
This function finds best way to place a bus entry symbol for when an Eagle wire segment ends on an Ea...
SCH_SHAPE * loadSymbolPolyLine(wxXmlNode *aPolygonNode, int aGateNumber)
bool CanReadSchematicFile(const wxString &aFileName) const override
Checks if this SCH_IO can read the specified schematic file.
void addImplicitConnections(SCH_SYMBOL *aSymbol, SCH_SCREEN *aScreen, bool aUpdateSet)
Create net labels to emulate implicit connections in Eagle.
std::map< int, SCH_LAYER_ID > m_layerMap
SCH_LAYER_ID kiCadLayer(int aEagleLayer)
Return the matching layer or return LAYER_NOTES.
wxFileName getLibFileName()
Checks if there are other wires or pins at the position of the tested pin.
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
Returns schematic file description for the SCH_IO.
SCH_ITEM * loadSymbolWire(wxXmlNode *aWireNode, int aGateNumber)
wxString m_version
Eagle file version.
void loadTextAttributes(EDA_TEXT *aText, const ETEXT &aAttribs) const
SCH_SHAPE * loadRectangle(wxXmlNode *aRectNode)
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
void moveLabels(SCH_LINE *aWire, const VECTOR2I &aNewEndPoint)
Move any labels on the wire to the new end point of the wire.
bool checkHeader(const wxString &aFileName) const
SCHEMATIC * m_schematic
Passed to Load(), the schematic object being loaded.
bool loadSymbol(wxXmlNode *aSymbolNode, std::unique_ptr< LIB_SYMBOL > &aSymbol, EDEVICE *aDevice, int aGateNumber, const wxString &aGateName)
bool IsLibraryWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
SCH_SHEET * m_rootSheet
The root sheet of the schematic being loaded.
SCH_SCREEN * getCurrentScreen()
unsigned m_lastProgressCount
bool CanReadLibrary(const wxString &aFileName) const override
Checks if this IO object can read the specified library file/directory.
std::map< wxString, EAGLE_MISSING_CMP > m_missingCmps
SCH_TEXT * loadPlainText(wxXmlNode *aSchText)
void loadFrame(wxXmlNode *aFrameNode, std::vector< SCH_ITEM * > &aItems)
SCH_TEXT * loadSymbolText(wxXmlNode *aLibText, int aGateNumber)
void loadLayerDefs(wxXmlNode *aLayers)
std::vector< SEG_DESC > m_segments
Nets as defined in the <nets> sections of an Eagle schematic file.
void loadDrawing(wxXmlNode *aDrawingNode)
unsigned m_totalCount
for progress reporting
long long getLibraryTimestamp(const wxString &aLibraryPath) const
Base class that schematic file and library loading and saving plugins should derive from.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Segment description base class to describe items which have 2 end points (track, wire,...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
A name/value tuple with unique names and optional values.
Object used to load, save, search, and otherwise manipulate symbol library files.
std::map< wxString, std::unique_ptr< EPART > > EPART_MAP
Translates Eagle special characters to their counterparts in KiCad.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
SCH_LAYER_ID
Eeschema drawing layers.
boost::ptr_map< wxString, EPART > EPART_LIST
std::unordered_map< wxString, int > GateUnit
std::unordered_map< wxString, wxString > package
boost::ptr_map< wxString, LIB_SYMBOL > KiCadSymbols
std::unordered_map< wxString, wxXmlNode * > SymbolNodes
Container that describes file type info.
Map references to missing symbol units data.
EAGLE_MISSING_CMP(const SCH_SYMBOL *aSymbol=nullptr)
Link to the parent symbol.
std::map< int, bool > units
Segments representing wires for intersection checking.
std::vector< SCH_TEXT * > labels
const SEG * LabelAttached(const SCH_TEXT *aLabel) const
< Test if a particular label is attached to any of the stored segments