KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_import_reconciler.cpp File Reference
#include "footprint_import_reconciler.h"
#include <algorithm>
#include <map>
#include <memory>
#include <set>
#include <tuple>
#include <utility>
#include <wx/dir.h>
#include <wx/filename.h>
#include <board.h>
#include <footprint.h>
#include <import_proj_properties.h>
#include <lib_id.h>
#include <pad.h>
#include <project.h>
#include <project_pcb.h>
#include <reporter.h>
#include <string_utils.h>
#include <wildcards_and_files_ext.h>
#include <io/io_mgr.h>
#include <pcb_io/pcb_io.h>
#include <pcb_io/pcb_io_mgr.h>
#include <footprint_library_adapter.h>
#include <libraries/library_table.h>

Go to the source code of this file.

Functions

FOOTPRINT_IMPORT_RECONCILE_RESULT ReconcileImportedFootprints (std::vector< std::unique_ptr< FOOTPRINT > > aDefinitions, BOARD &aBoard, PROJECT &aProject, const wxString &aBoardPath, const std::map< std::string, UTF8 > *aProperties, REPORTER &aReporter)
 Reconcile aBoard against the definitions an importer retained while loading it.
 
FOOTPRINT_IMPORT_RECONCILE_RESULT ReconcileImportedFootprints (PCB_IO &aPlugin, BOARD &aBoard, PROJECT &aProject, const wxString &aBoardPath, const std::map< std::string, UTF8 > *aProperties, REPORTER &aReporter)
 Overload taking the definitions straight from aPlugin, for callers that still hold it.
 
std::map< wxString, wxString > ImportedFootprintIds (const BOARD &aBoard)
 Map each board reference to the full LIB_ID of its footprint.
 

Function Documentation

◆ ImportedFootprintIds()

std::map< wxString, wxString > ImportedFootprintIds ( const BOARD & aBoard)

Map each board reference to the full LIB_ID of its footprint.

A footprint with no name, and a reference used more than once, are left out.

Definition at line 731 of file footprint_import_reconciler.cpp.

References BOARD::Footprints().

Referenced by PCB_EDIT_FRAME::KiwayMailIn().

◆ ReconcileImportedFootprints() [1/2]

FOOTPRINT_IMPORT_RECONCILE_RESULT ReconcileImportedFootprints ( PCB_IO & aPlugin,
BOARD & aBoard,
PROJECT & aProject,
const wxString & aBoardPath,
const std::map< std::string, UTF8 > * aProperties,
REPORTER & aReporter )

Overload taking the definitions straight from aPlugin, for callers that still hold it.

Definition at line 710 of file footprint_import_reconciler.cpp.

References PCB_IO::GetImportedCachedLibraryFootprints(), and ReconcileImportedFootprints().

◆ ReconcileImportedFootprints() [2/2]

FOOTPRINT_IMPORT_RECONCILE_RESULT ReconcileImportedFootprints ( std::vector< std::unique_ptr< FOOTPRINT > > aDefinitions,
BOARD & aBoard,
PROJECT & aProject,
const wxString & aBoardPath,
const std::map< std::string, UTF8 > * aProperties,
REPORTER & aReporter )

Reconcile aBoard against the definitions an importer retained while loading it.

Shared by the interactive import and the kicad-cli pcb import job so both materialize the project footprint library and re-point FPIDs. A reconciliation failure is reported rather than thrown so an import is never aborted by it.

Parameters
aDefinitions
aBoardis the BOARD to reconcile the footprints.
aProjectis the PROJECT aBoard belongs to.
aBoardPath
aPropertiescarries the manager-chosen cache nickname and provenance source libraries; a standalone import passes nullptr and the nickname is derived from aBoardPath.
[in]aReporteris the REPORTER object to write messages to.

Definition at line 672 of file footprint_import_reconciler.cpp.

References _, PROJECT_PCB::FootprintLibAdapter(), PROJECT::GetProjectPath(), IMPORT_PROJ_PROPS::MakeCacheNickname(), IMPORT_PROJ_PROPS::ReadFootprintProps(), FOOTPRINT_IMPORT_RECONCILER::Reconcile(), REPORTER::Report(), result, RPT_SEVERITY_ERROR, and IO_ERROR::What().

Referenced by PCBNEW_JOBS_HANDLER::JobImport(), PCB_EDIT_FRAME::reconcileImportedFootprintLibraries(), and ReconcileImportedFootprints().