Browse Source

Be explicit about avoiding catastrophic O(n^2) pretty printing we had in Altium importer.

pull/18/head
Jeff Young 4 months ago
parent
commit
d0f0c4022f
  1. 22
      eeschema/sch_io/eagle/sch_io_eagle.cpp
  2. 14
      eeschema/sch_io/eagle/sch_io_eagle.h

22
eeschema/sch_io/eagle/sch_io_eagle.cpp

@ -44,7 +44,7 @@
#include <project_sch.h>
#include <sch_bus_entry.h>
#include <sch_edit_frame.h>
#include <sch_io/kicad_legacy/sch_io_kicad_legacy.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
#include <sch_junction.h>
#include <sch_label.h>
#include <sch_marker.h>
@ -429,8 +429,6 @@ SCH_SHEET* SCH_IO_EAGLE::LoadSchematicFile( const wxString& aFileName, SCHEMATIC
wxCHECK_MSG( libTable, nullptr, wxT( "Could not load symbol lib table." ) );
m_pi.reset( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
m_properties = std::make_unique<std::map<std::string, UTF8>>();
( *m_properties )[SCH_IO_KICAD_LEGACY::PropBuffering] = "";
/// @note No check is being done here to see if the existing symbol library exists so this
/// will overwrite the existing one.
@ -1789,13 +1787,15 @@ void SCH_IO_EAGLE::loadInstance( const std::unique_ptr<EINSTANCE>& aInstance,
if( p != elib->package.end() )
package = p->second;
LIB_SYMBOL* part = m_pi->LoadSymbol( getLibFileName().GetFullPath(), altSymbolName,
m_properties.get() );
// set properties to prevent save file on every symbol save
std::map<std::string, UTF8> properties;
properties.emplace( SCH_IO_KICAD_SEXPR::PropBuffering, wxEmptyString );
LIB_SYMBOL* part = m_pi->LoadSymbol( getLibFileName().GetFullPath(), altSymbolName, &properties );
if( !part )
{
part = m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname,
m_properties.get() );
part = m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname, &properties );
libIdSymbolName = kisymbolname;
}
@ -2119,8 +2119,12 @@ EAGLE_LIBRARY* SCH_IO_EAGLE::loadLibrary( const ELIBRARY* aLibrary, EAGLE_LIBRAR
libSymbol->SetName( libName );
}
m_pi->SaveSymbol( getLibFileName().GetFullPath(),
new LIB_SYMBOL( *libSymbol.get() ), m_properties.get() );
// set properties to prevent save file on every symbol save
std::map<std::string, UTF8> properties;
properties.emplace( SCH_IO_KICAD_SEXPR::PropBuffering, wxEmptyString );
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_SYMBOL( *libSymbol.get() ),
&properties );
}
catch(...)
{

14
eeschema/sch_io/eagle/sch_io_eagle.h

@ -262,15 +262,13 @@ private:
std::unordered_map<wxString, bool> m_userValue; ///< deviceset/@uservalue for device.
IO_RELEASER<SCH_IO> m_pi; ///< PI to create KiCad symbol library.
std::unique_ptr<std::map<std::string, UTF8>> m_properties; ///< Library plugin properties.
IO_RELEASER<SCH_IO> m_pi; ///< PI to create KiCad symbol library.
int m_sheetIndex;
std::map<wxString, int> m_netCounts;
std::map<int, SCH_LAYER_ID> m_layerMap;
std::map<wxString, wxString> m_powerPorts; ///< map from symbol reference to global
///< label equivalent
int m_sheetIndex;
std::map<wxString, int> m_netCounts;
std::map<int, SCH_LAYER_ID> m_layerMap;
std::map<wxString, wxString> m_powerPorts; ///< map from symbol reference to global
///< label equivalent
///< Wire intersection points, used for quick checks whether placing a net label in a particular
///< place would short two nets.

Loading…
Cancel
Save