KiCad PCB EDA Suite
CADSTAR_PCB_ARCHIVE_PLUGIN Class Reference

#include <cadstar_pcb_archive_plugin.h>

Inheritance diagram for CADSTAR_PCB_ARCHIVE_PLUGIN:
PLUGIN LAYER_REMAPPABLE_PLUGIN

Public Member Functions

const wxString PluginName () const override
 Return a brief hard coded name for this PLUGIN. More...
 
BOARDLoad (const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
 Load information from some input file format that this PLUGIN implementation knows about into either a new BOARD or an existing one. More...
 
const wxString GetFileExtension () const override
 Returns the file extension for the PLUGIN. More...
 
long long GetLibraryTimestamp (const wxString &aLibraryPath) const override
 Generate a timestamp representing all the files in the library (including the library directory). More...
 
std::vector< FOOTPRINT * > GetImportedCachedLibraryFootprints () override
 Return a container with the cached library footprints generated in the last call to Load. More...
 
void RegisterLayerMappingCallback (LAYER_MAPPING_HANDLER aLayerMappingHandler) override
 Register a different handler to be called when mapping of Cadstar to KiCad layers occurs. More...
 
 CADSTAR_PCB_ARCHIVE_PLUGIN ()
 
 ~CADSTAR_PCB_ARCHIVE_PLUGIN ()
 
virtual void SetQueryUserCallback (std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)> aCallback)
 Registers a KIDIALOG callback for collecting info from the user. More...
 
virtual void Save (const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr)
 Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be used to write a portion of aBoard to a special kind of export file. More...
 
virtual void FootprintEnumerate (wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr)
 Return a list of footprint names contained within the library at aLibraryPath. More...
 
virtual void PrefetchLib (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
 If possible, prefetches the specified library (e.g. More...
 
virtual FOOTPRINTFootprintLoad (const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr)
 Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PLUGIN knows about. More...
 
virtual const FOOTPRINTGetEnumeratedFootprint (const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
 A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management. More...
 
virtual bool FootprintExists (const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
 Check for the existence of a footprint. More...
 
virtual void FootprintSave (const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
 Write aFootprint to an existing library located at aLibraryPath. More...
 
virtual void FootprintDelete (const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
 Delete aFootprintName from the library at aLibraryPath. More...
 
virtual void FootprintLibCreate (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
 Create a new empty footprint library at aLibraryPath empty. More...
 
virtual bool FootprintLibDelete (const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
 Delete an existing footprint library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason. More...
 
virtual bool IsFootprintLibWritable (const wxString &aLibraryPath)
 Return true if the library at aLibraryPath is writable. More...
 
virtual void FootprintLibOptions (STRING_UTF8_MAP *aListToAppendTo) const
 Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions. More...
 

Static Public Member Functions

static std::map< wxString, PCB_LAYER_IDDefaultLayerMappingCallback (const std::vector< INPUT_LAYER_DESC > &aInputLayerDescriptionVector)
 Return the automapped layers. More...
 

Protected Attributes

LAYER_MAPPING_HANDLER m_layer_mapping_handler
 Callback to get layer mapping. More...
 

Private Member Functions

void clearLoadedFootprints ()
 

Private Attributes

const STRING_UTF8_MAPm_props
 
BOARDm_board
 
std::vector< FOOTPRINT * > m_loaded_footprints
 
bool m_show_layer_mapping_warnings
 

Detailed Description

Definition at line 36 of file cadstar_pcb_archive_plugin.h.

Constructor & Destructor Documentation

◆ CADSTAR_PCB_ARCHIVE_PLUGIN()

CADSTAR_PCB_ARCHIVE_PLUGIN::CADSTAR_PCB_ARCHIVE_PLUGIN ( )

Definition at line 57 of file cadstar_pcb_archive_plugin.cpp.

58{
59 m_board = nullptr;
60 m_props = nullptr;
64}
static std::map< wxString, PCB_LAYER_ID > DefaultLayerMappingCallback(const std::vector< INPUT_LAYER_DESC > &aInputLayerDescriptionVector)
Return the automapped layers.
virtual void RegisterLayerMappingCallback(LAYER_MAPPING_HANDLER aLayerMappingHandler)
Register a different handler to be called when mapping of input layers to KiCad layers occurs.

References DefaultLayerMappingCallback(), m_board, m_props, m_show_layer_mapping_warnings, and LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback().

◆ ~CADSTAR_PCB_ARCHIVE_PLUGIN()

CADSTAR_PCB_ARCHIVE_PLUGIN::~CADSTAR_PCB_ARCHIVE_PLUGIN ( )

Definition at line 67 of file cadstar_pcb_archive_plugin.cpp.

68{
69}

Member Function Documentation

◆ clearLoadedFootprints()

void CADSTAR_PCB_ARCHIVE_PLUGIN::clearLoadedFootprints ( )
private

Definition at line 72 of file cadstar_pcb_archive_plugin.cpp.

73{
75 {
76 delete fp;
77 }
78
79 m_loaded_footprints.clear();
80}
std::vector< FOOTPRINT * > m_loaded_footprints

References m_loaded_footprints.

Referenced by Load().

◆ DefaultLayerMappingCallback()

std::map< wxString, PCB_LAYER_ID > CADSTAR_PCB_ARCHIVE_PLUGIN::DefaultLayerMappingCallback ( const std::vector< INPUT_LAYER_DESC > &  aInputLayerDescriptionVector)
static

Return the automapped layers.

Parameters
aInputLayerDescriptionVector
Returns
Auto-mapped layers

Definition at line 34 of file cadstar_pcb_archive_plugin.cpp.

36{
37 std::map<wxString, PCB_LAYER_ID> retval;
38
39 // Just return a the auto-mapped layers
40 for( INPUT_LAYER_DESC layerDesc : aInputLayerDescriptionVector )
41 {
42 retval.insert( { layerDesc.Name, layerDesc.AutoMapLayer } );
43 }
44
45 return retval;
46}
Describes an imported layer and how it could be mapped to KiCad Layers.

Referenced by CADSTAR_PCB_ARCHIVE_PLUGIN().

◆ FootprintDelete()

void PLUGIN::FootprintDelete ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Delete aFootprintName from the library at aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aFootprintNameis the name of a footprint to delete from the specified library.
aPropertiesis an associative array that can be used to tell the library delete function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the footprint or the library, or deleting it.

Reimplemented in GPCB_PLUGIN, and PCB_PLUGIN.

Definition at line 114 of file plugin.cpp.

116{
117 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
118 not_implemented( this, __FUNCTION__ );
119}
static void not_implemented(PLUGIN *aPlugin, const char *aCaller)
Throw an IO_ERROR and complains of an API function not being implemented.
Definition: plugin.cpp:38

References not_implemented().

Referenced by FP_LIB_TABLE::FootprintDelete().

◆ FootprintEnumerate()

void PLUGIN::FootprintEnumerate ( wxArrayString &  aFootprintNames,
const wxString &  aLibraryPath,
bool  aBestEfforts,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Return a list of footprint names contained within the library at aLibraryPath.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
aFootprintNamesis the array of available footprint names inside a library.
aBestEffortsif true, don't throw on errors, just return an empty list.
Exceptions
IO_ERRORif the library cannot be found, or footprint cannot be loaded.

Reimplemented in ALTIUM_DESIGNER_PLUGIN, EAGLE_PLUGIN, GPCB_PLUGIN, PCB_PLUGIN, and LEGACY_PLUGIN.

Definition at line 67 of file plugin.cpp.

69{
70 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
71 not_implemented( this, __FUNCTION__ );
72}

References not_implemented().

Referenced by FP_LIB_TABLE::FootprintEnumerate(), and FOOTPRINT_EDIT_FRAME::SaveLibraryAs().

◆ FootprintExists()

bool PLUGIN::FootprintExists ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Check for the existence of a footprint.

Reimplemented in PCB_PLUGIN.

Definition at line 89 of file plugin.cpp.

91{
92 // default implementation
93 return FootprintLoad( aLibraryPath, aFootprintName, true, aProperties ) != nullptr;
94}
virtual FOOTPRINT * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, bool aKeepUUID=false, const STRING_UTF8_MAP *aProperties=nullptr)
Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PL...
Definition: plugin.cpp:97

References PLUGIN::FootprintLoad().

Referenced by FP_LIB_TABLE::FootprintExists().

◆ FootprintLibCreate()

void PLUGIN::FootprintLibCreate ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Create a new empty footprint library at aLibraryPath empty.

It is an error to attempt to create an existing library or to attempt to create on a "read only" location.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aPropertiesis an associative array that can be used to tell the library create function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem finding the library, or creating it.

Reimplemented in PCB_PLUGIN.

Definition at line 122 of file plugin.cpp.

123{
124 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
125 not_implemented( this, __FUNCTION__ );
126}

References not_implemented().

Referenced by PCB_BASE_EDIT_FRAME::createNewLibrary(), and FP_LIB_TABLE::FootprintLibCreate().

◆ FootprintLibDelete()

bool PLUGIN::FootprintLibDelete ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Delete an existing footprint library and returns true, or if library does not exist returns false, or throws an exception if library exists but is read only or cannot be deleted for some other reason.

Parameters
aLibraryPathis a locator for the "library", usually a directory or file which will contain footprints.
aPropertiesis an associative array that can be used to tell the library delete implementation function anything special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Returns
true if library deleted, false if library did not exist.
Exceptions
IO_ERRORif there is a problem deleting an existing library.

Reimplemented in GPCB_PLUGIN, PCB_PLUGIN, and LEGACY_PLUGIN.

Definition at line 129 of file plugin.cpp.

130{
131 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
132 not_implemented( this, __FUNCTION__ );
133 return false;
134}

References not_implemented().

Referenced by PCB_BASE_EDIT_FRAME::createNewLibrary(), and FP_LIB_TABLE::FootprintLibDelete().

◆ FootprintLibOptions()

void PLUGIN::FootprintLibOptions ( STRING_UTF8_MAP aListToAppendTo) const
virtualinherited

Append supported PLUGIN options to aListToAppenTo along with internationalized descriptions.

Options are typically appended so that a derived PLUGIN can call its base class function by the same name first, thus inheriting options declared there. Some base class options could pertain to all Footprint*() functions in all derived PLUGINs.

Note
Since aListToAppendTo is a #PROPERTIES object, all options will be unique and last guy wins.
Parameters
aListToAppendToholds a tuple of
option
This eventually is what shows up into the fp-lib-table "options" field, possibly combined with others.
internationalized description
The internationalized description is displayed in DIALOG_FP_PLUGIN_OPTIONS. It may be multi-line and be quite explanatory of the option.

In the future perhaps aListToAppendTo evolves to something capable of also holding a wxValidator for the cells in said dialog: http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180. This would require a 3 column list, and introducing wx GUI knowledge to PLUGIN, which has been avoided to date.

Reimplemented in EAGLE_PLUGIN.

Definition at line 145 of file plugin.cpp.

146{
147 // disable all these in another couple of months, after everyone has seen them:
148#if 1
149 (*aListToAppendTo)["debug_level"] = UTF8( _( "Enable <b>debug</b> logging for Footprint*() "
150 "functions in this PLUGIN." ) );
151
152 (*aListToAppendTo)["read_filter_regex"] = UTF8( _( "Regular expression <b>footprint name</b> "
153 "filter." ) );
154
155 (*aListToAppendTo)["enable_transaction_logging"] = UTF8( _( "Enable transaction logging. The "
156 "mere presence of this option "
157 "turns on the logging, no need to "
158 "set a Value." ) );
159
160 (*aListToAppendTo)["username"] = UTF8( _( "User name for <b>login</b> to some special library "
161 "server." ) );
162
163 (*aListToAppendTo)["password"] = UTF8( _( "Password for <b>login</b> to some special library "
164 "server." ) );
165#endif
166
167#if 1
168 // Suitable for a C++ to python PLUGIN::Footprint*() adapter, move it to the adapter
169 // if and when implemented.
170 (*aListToAppendTo)["python_footprint_plugin"] = UTF8( _( "Enter the python module which "
171 "implements the PLUGIN::Footprint*() "
172 "functions." ) );
173#endif
174}
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
Definition: utf8.h:71
#define _(s)

References _.

Referenced by DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), and EAGLE_PLUGIN::FootprintLibOptions().

◆ FootprintLoad()

FOOTPRINT * PLUGIN::FootprintLoad ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
bool  aKeepUUID = false,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Load a footprint having aFootprintName from the aLibraryPath containing a library format that this PLUGIN knows about.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aFootprintNameis the name of the footprint to load.
aPropertiesis an associative array that can be used to tell the loader implementation to do something special, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
aKeepUUID= true to keep initial items UUID, false to set new UUID normally true if loaded in the footprint editor, false if loaded in the board editor. Make sense only in kicad_plugin
Returns
the FOOTPRINT object if found caller owns it, else NULL if not found.
Exceptions
IO_ERRORif the library cannot be found or read. No exception is thrown in the case where aFootprintName cannot be found.

Reimplemented in ALTIUM_DESIGNER_PLUGIN, EAGLE_PLUGIN, GPCB_PLUGIN, PCB_PLUGIN, and LEGACY_PLUGIN.

Definition at line 97 of file plugin.cpp.

99{
100 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
101 not_implemented( this, __FUNCTION__ );
102 return nullptr;
103}

References not_implemented().

Referenced by PLUGIN::FootprintExists(), FP_LIB_TABLE::FootprintLoad(), FP_LIB_TABLE::FootprintSave(), PLUGIN::GetEnumeratedFootprint(), and parse_footprint_with_plugin().

◆ FootprintSave()

void PLUGIN::FootprintSave ( const wxString &  aLibraryPath,
const FOOTPRINT aFootprint,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Write aFootprint to an existing library located at aLibraryPath.

If a footprint by the same name already exists, it is replaced.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aFootprintis what to store in the library. The caller continues to own the footprint after this call.
aPropertiesis an associative array that can be used to tell the saver how to save the footprint, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem saving.

Reimplemented in PCB_PLUGIN.

Definition at line 106 of file plugin.cpp.

108{
109 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
110 not_implemented( this, __FUNCTION__ );
111}

References not_implemented().

Referenced by PCB_EDIT_FRAME::ExportFootprintsToLibrary(), FP_LIB_TABLE::FootprintSave(), PCB_EDIT_FRAME::OpenProjectFiles(), and FOOTPRINT_EDIT_FRAME::SaveLibraryAs().

◆ GetEnumeratedFootprint()

const FOOTPRINT * PLUGIN::GetEnumeratedFootprint ( const wxString &  aLibraryPath,
const wxString &  aFootprintName,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.

Reimplemented in GPCB_PLUGIN, and PCB_PLUGIN.

Definition at line 80 of file plugin.cpp.

83{
84 // default implementation
85 return FootprintLoad( aLibraryPath, aFootprintName, false, aProperties );
86}

References PLUGIN::FootprintLoad().

Referenced by FP_LIB_TABLE::GetEnumeratedFootprint(), and FOOTPRINT_EDIT_FRAME::SaveLibraryAs().

◆ GetFileExtension()

const wxString CADSTAR_PCB_ARCHIVE_PLUGIN::GetFileExtension ( ) const
overridevirtual

Returns the file extension for the PLUGIN.

Implements PLUGIN.

Definition at line 89 of file cadstar_pcb_archive_plugin.cpp.

90{
91 return wxT( "cpa" );
92}

◆ GetImportedCachedLibraryFootprints()

std::vector< FOOTPRINT * > CADSTAR_PCB_ARCHIVE_PLUGIN::GetImportedCachedLibraryFootprints ( )
overridevirtual

Return a container with the cached library footprints generated in the last call to Load.

This function is intended to be used ONLY by the non-KiCad board importers for the purpose of obtaining the footprint library of the design and creating a project-specific library.

Returns
Footprints (caller owns the objects)

Reimplemented from PLUGIN.

Definition at line 95 of file cadstar_pcb_archive_plugin.cpp.

96{
97 std::vector<FOOTPRINT*> retval;
98
100 {
101 retval.push_back( static_cast<FOOTPRINT*>( fp->Clone() ) );
102 }
103
104 return retval;
105}

References m_loaded_footprints.

◆ GetLibraryTimestamp()

long long CADSTAR_PCB_ARCHIVE_PLUGIN::GetLibraryTimestamp ( const wxString &  aLibraryPath) const
inlineoverridevirtual

Generate a timestamp representing all the files in the library (including the library directory).

Timestamps should not be considered ordered, they either match or they don't.

Implements PLUGIN.

Definition at line 47 of file cadstar_pcb_archive_plugin.h.

48 {
49 // No support for libraries....
50 return 0;
51 }

◆ IsFootprintLibWritable()

bool PLUGIN::IsFootprintLibWritable ( const wxString &  aLibraryPath)
virtualinherited

Return true if the library at aLibraryPath is writable.

The system libraries are typically read only because of where they are installed..

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
Exceptions
IO_ERRORif no library at aLibraryPath exists.

Reimplemented in ALTIUM_DESIGNER_PLUGIN, EAGLE_PLUGIN, GPCB_PLUGIN, PCB_PLUGIN, and LEGACY_PLUGIN.

Definition at line 137 of file plugin.cpp.

138{
139 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
140 not_implemented( this, __FUNCTION__ );
141 return false;
142}

References not_implemented().

Referenced by PCB_BASE_EDIT_FRAME::createNewLibrary(), and FP_LIB_TABLE::IsFootprintLibWritable().

◆ Load()

BOARD * CADSTAR_PCB_ARCHIVE_PLUGIN::Load ( const wxString &  aFileName,
BOARD aAppendToMe,
const STRING_UTF8_MAP aProperties = nullptr,
PROJECT aProject = nullptr,
PROGRESS_REPORTER aProgressReporter = nullptr 
)
overridevirtual

Load information from some input file format that this PLUGIN implementation knows about into either a new BOARD or an existing one.

This may be used to load an entire new BOARD, or to augment an existing one if aAppendToMe is not NULL.

Parameters
aFileNameis the name of the file to use as input and may be foreign in nature or native in nature.
aAppendToMeis an existing BOARD to append to, but if NULL then this means "do not append, rather load anew".
aPropertiesis an associative array that can be used to tell the loader how to load the file, because it can take any number of additional named arguments that the plugin is known to support. These are tuning parameters for the import or load. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
aProjectis the optional PROJECT object primarily used by third party importers.
aProgressReporteran optional progress reporter
aLineCounta line count (necessary if a progress reporter is supplied)
Returns
the successfully loaded board, or the same one as aAppendToMe if aAppendToMe was not NULL, and caller owns it.
Exceptions
IO_ERRORif there is a problem loading, and its contents should say what went wrong, using line number and character offsets of the input file if possible.

Reimplemented from PLUGIN.

Definition at line 108 of file cadstar_pcb_archive_plugin.cpp.

111{
112 m_props = aProperties;
113 m_board = aAppendToMe ? aAppendToMe : new BOARD();
115
117 m_show_layer_mapping_warnings, aProgressReporter );
118 tempPCB.Load( m_board, aProject );
119
120 //center the board:
121 if( aProperties )
122 {
123 UTF8 page_width;
124 UTF8 page_height;
125
126 if( aProperties->Value( "page_width", &page_width )
127 && aProperties->Value( "page_height", &page_height ) )
128 {
130
131 int w = atoi( page_width.c_str() );
132 int h = atoi( page_height.c_str() );
133
134 int desired_x = ( w - bbbox.GetWidth() ) / 2;
135 int desired_y = ( h - bbbox.GetHeight() ) / 2;
136
137 m_board->Move( VECTOR2I( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
138 }
139 }
140
141 // Need to set legacy loading so that netclassess and design rules are loaded correctly
144
145 m_loaded_footprints = tempPCB.GetLoadedLibraryFootpints();
146
147 return m_board;
148}
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:269
bool m_LegacyDesignSettingsLoaded
True if the legacy board design settings were loaded from a file.
Definition: board.h:348
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:842
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: board.cpp:401
bool m_LegacyNetclassesLoaded
True if netclasses were loaded from the file.
Definition: board.h:352
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetY() const
Definition: box2.h:181
coord_type GetWidth() const
Definition: box2.h:187
coord_type GetX() const
Definition: box2.h:180
LAYER_MAPPING_HANDLER m_layer_mapping_handler
Callback to get layer mapping.
bool Value(const char *aName, UTF8 *aFetchedValue=nullptr) const
Fetch a property by aName and returns true if that property was found, else false.
const char * c_str() const
Definition: utf8.h:102
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

References UTF8::c_str(), clearLoadedFootprints(), BOARD::GetBoardEdgesBoundingBox(), BOX2< Vec >::GetHeight(), CADSTAR_PCB_ARCHIVE_LOADER::GetLoadedLibraryFootpints(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), CADSTAR_PCB_ARCHIVE_LOADER::Load(), m_board, LAYER_REMAPPABLE_PLUGIN::m_layer_mapping_handler, BOARD::m_LegacyDesignSettingsLoaded, BOARD::m_LegacyNetclassesLoaded, m_loaded_footprints, m_props, m_show_layer_mapping_warnings, BOARD::Move(), and STRING_UTF8_MAP::Value().

◆ PluginName()

const wxString CADSTAR_PCB_ARCHIVE_PLUGIN::PluginName ( ) const
overridevirtual

Return a brief hard coded name for this PLUGIN.

Implements PLUGIN.

Definition at line 83 of file cadstar_pcb_archive_plugin.cpp.

84{
85 return wxT( "CADSTAR PCB Archive" );
86}

◆ PrefetchLib()

void PLUGIN::PrefetchLib ( const wxString &  aLibraryPath,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

If possible, prefetches the specified library (e.g.

performing downloads). Does not parse. Threadsafe.

This is a no-op for libraries that cannot be prefetched. Plugins that cannot prefetch need not override this; a default no-op is provided.

Parameters
aLibraryPathis a locator for the "library", usually a directory, file, or URL containing several footprints.
aPropertiesis an associative array that can be used to tell the plugin anything needed about how to perform with respect to aLibraryPath. The caller continues to own this object (plugin may not delete it), and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is an error prefetching the library.

Definition at line 75 of file plugin.cpp.

76{
77}

Referenced by FP_LIB_TABLE::PrefetchLib().

◆ RegisterLayerMappingCallback()

void CADSTAR_PCB_ARCHIVE_PLUGIN::RegisterLayerMappingCallback ( LAYER_MAPPING_HANDLER  aLayerMappingHandler)
overridevirtual

Register a different handler to be called when mapping of Cadstar to KiCad layers occurs.

Parameters
aLayerMappingHandler

Reimplemented from LAYER_REMAPPABLE_PLUGIN.

Definition at line 49 of file cadstar_pcb_archive_plugin.cpp.

51{
53 m_show_layer_mapping_warnings = false; // only show warnings with default callback
54}

References m_show_layer_mapping_warnings, and LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback().

◆ Save()

void PLUGIN::Save ( const wxString &  aFileName,
BOARD aBoard,
const STRING_UTF8_MAP aProperties = nullptr 
)
virtualinherited

Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be used to write a portion of aBoard to a special kind of export file.

Parameters
aFileNameis the name of a file to save to on disk.
aBoardis the class BOARD in memory document tree from which to extract information when writing to aFileName. The caller continues to own the BOARD, and the plugin should refrain from modifying the BOARD if possible.
aPropertiesis an associative array that can be used to tell the saver how to save the file, because it can take any number of additional named tuning arguments that the plugin is known to support. The caller continues to own this object (plugin may not delete it) and plugins should expect it to be optionally NULL.
Exceptions
IO_ERRORif there is a problem saving or exporting.

Reimplemented in CLIPBOARD_IO, and PCB_PLUGIN.

Definition at line 60 of file plugin.cpp.

61{
62 // not pure virtual so that plugins only have to implement subset of the PLUGIN interface.
63 not_implemented( this, __FUNCTION__ );
64}

References not_implemented().

Referenced by IO_MGR::Save(), PCB_EDIT_FRAME::SavePcbCopy(), and PCB_EDIT_FRAME::SavePcbFile().

◆ SetQueryUserCallback()

virtual void PLUGIN::SetQueryUserCallback ( std::function< bool(wxString aTitle, int aIcon, wxString aMessage, wxString aAction)>  aCallback)
inlinevirtualinherited

Registers a KIDIALOG callback for collecting info from the user.

Definition at line 285 of file io_mgr.h.

288 { }

Referenced by PCB_CONTROL::AppendBoard(), and PCB_EDIT_FRAME::OpenProjectFiles().

Member Data Documentation

◆ m_board

BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::m_board
private

Definition at line 78 of file cadstar_pcb_archive_plugin.h.

Referenced by CADSTAR_PCB_ARCHIVE_PLUGIN(), and Load().

◆ m_layer_mapping_handler

LAYER_MAPPING_HANDLER LAYER_REMAPPABLE_PLUGIN::m_layer_mapping_handler
protectedinherited

Callback to get layer mapping.

Definition at line 80 of file plugin_common_layer_mapping.h.

Referenced by Load(), EAGLE_PLUGIN::mapEagleLayersToKicad(), and LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback().

◆ m_loaded_footprints

std::vector<FOOTPRINT*> CADSTAR_PCB_ARCHIVE_PLUGIN::m_loaded_footprints
private

◆ m_props

const STRING_UTF8_MAP* CADSTAR_PCB_ARCHIVE_PLUGIN::m_props
private

Definition at line 77 of file cadstar_pcb_archive_plugin.h.

Referenced by CADSTAR_PCB_ARCHIVE_PLUGIN(), and Load().

◆ m_show_layer_mapping_warnings

bool CADSTAR_PCB_ARCHIVE_PLUGIN::m_show_layer_mapping_warnings
private

The documentation for this class was generated from the following files: