altium: Move file loading from altium_pcb into altium_*_plugin
This commit is contained in:
parent
0129e49b79
commit
f92c1341a2
|
@ -27,12 +27,11 @@
|
|||
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
|
||||
*/
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <altium_circuit_maker_plugin.h>
|
||||
#include <altium_pcb.h>
|
||||
#include "plugins/altium/altium_parser.h"
|
||||
|
||||
#include <board.h>
|
||||
|
||||
|
@ -100,7 +99,18 @@ BOARD* ALTIUM_CIRCUIT_MAKER_PLUGIN::Load( const wxString& aFileName, BOARD* aApp
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
ParseAltiumPcb( m_board, aFileName, aProgressReporter, mapping );
|
||||
ALTIUM_COMPOUND_FILE altiumPcbFile( aFileName );
|
||||
|
||||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, aProgressReporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
{
|
||||
THROW_IO_ERROR( exception.what() );
|
||||
}
|
||||
|
||||
return m_board;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,11 @@
|
|||
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
|
||||
*/
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <altium_circuit_studio_plugin.h>
|
||||
#include <altium_pcb.h>
|
||||
#include "plugins/altium/altium_parser.h"
|
||||
|
||||
#include <board.h>
|
||||
|
||||
|
@ -100,7 +99,18 @@ BOARD* ALTIUM_CIRCUIT_STUDIO_PLUGIN::Load( const wxString& aFileName, BOARD* aAp
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
ParseAltiumPcb( m_board, aFileName, aProgressReporter, mapping );
|
||||
ALTIUM_COMPOUND_FILE altiumPcbFile( aFileName );
|
||||
|
||||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, aProgressReporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
{
|
||||
THROW_IO_ERROR( exception.what() );
|
||||
}
|
||||
|
||||
return m_board;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,11 @@
|
|||
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
|
||||
*/
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <altium_designer_plugin.h>
|
||||
#include <altium_pcb.h>
|
||||
#include "plugins/altium/altium_parser.h"
|
||||
|
||||
#include <board.h>
|
||||
|
||||
|
@ -100,7 +99,18 @@ BOARD* ALTIUM_DESIGNER_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendTo
|
|||
};
|
||||
// clang-format on
|
||||
|
||||
ParseAltiumPcb( m_board, aFileName, aProgressReporter, mapping );
|
||||
ALTIUM_COMPOUND_FILE altiumPcbFile( aFileName );
|
||||
|
||||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( m_board, aProgressReporter );
|
||||
pcb.Parse( altiumPcbFile, mapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
{
|
||||
THROW_IO_ERROR( exception.what() );
|
||||
}
|
||||
|
||||
return m_board;
|
||||
}
|
||||
|
|
|
@ -338,7 +338,7 @@ AMODEL::AMODEL( ALTIUM_PARSER& aReader )
|
|||
std::map<wxString, wxString> properties = aReader.ReadProperties();
|
||||
|
||||
if( properties.empty() )
|
||||
THROW_IO_ERROR( "Classes6 stream has no properties!" );
|
||||
THROW_IO_ERROR( "Model stream has no properties!" );
|
||||
|
||||
name = ALTIUM_PARSER::ReadString( properties, "NAME", "" );
|
||||
id = ALTIUM_PARSER::ReadString( properties, "ID", "" );
|
||||
|
@ -349,7 +349,7 @@ AMODEL::AMODEL( ALTIUM_PARSER& aReader )
|
|||
rotation.z = ALTIUM_PARSER::ReadDouble( properties, "ROTZ", 0. );
|
||||
|
||||
if( aReader.HasParsingError() )
|
||||
THROW_IO_ERROR( "Classes6 stream was not parsed correctly" );
|
||||
THROW_IO_ERROR( "Model stream was not parsed correctly" );
|
||||
}
|
||||
|
||||
ANET6::ANET6( ALTIUM_PARSER& aReader )
|
||||
|
|
|
@ -57,23 +57,6 @@
|
|||
|
||||
constexpr double BOLD_FACTOR = 1.75; // CSS font-weight-normal is 400; bold is 700
|
||||
|
||||
void ParseAltiumPcb( BOARD* aBoard, const wxString& aFileName, PROGRESS_REPORTER* aProgressReporter,
|
||||
const std::map<ALTIUM_PCB_DIR, std::string>& aFileMapping )
|
||||
{
|
||||
ALTIUM_COMPOUND_FILE altiumPcbFile( aFileName );
|
||||
|
||||
try
|
||||
{
|
||||
// Parse File
|
||||
ALTIUM_PCB pcb( aBoard, aProgressReporter );
|
||||
pcb.Parse( altiumPcbFile, aFileMapping );
|
||||
}
|
||||
catch( CFB::CFBException& exception )
|
||||
{
|
||||
THROW_IO_ERROR( exception.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParseAltiumPcbLibFootprintNames( wxArrayString& aFootprintNames, const wxString& aLibraryPath )
|
||||
{
|
||||
|
|
|
@ -88,18 +88,6 @@ class ZONE;
|
|||
class PCB_DIM_RADIAL;
|
||||
class PROGRESS_REPORTER;
|
||||
|
||||
|
||||
/**
|
||||
* Helper method which opens a Altium Board File and parses it.
|
||||
*
|
||||
* @param aBoard board the pcb should be appended to
|
||||
* @param aFileName file name of board file
|
||||
* @param aProgressReporter report import progress, might be a nullptr.
|
||||
* @param aFileMapping mapping how altium stream names are mapped
|
||||
*/
|
||||
void ParseAltiumPcb( BOARD* aBoard, const wxString& aFileName, PROGRESS_REPORTER* aProgressReporter,
|
||||
const std::map<ALTIUM_PCB_DIR, std::string>& aFileMapping );
|
||||
|
||||
/**
|
||||
* Helper method to get all footprint names in a given library
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue