KiCad PCB EDA Suite
Loading...
Searching...
No Matches
backannotate.cpp File Reference
#include <backannotate.h>
#include <boost/property_tree/ptree.hpp>
#include <confirm.h>
#include <common.h>
#include <dsnlexer.h>
#include <ptree.h>
#include <reporter.h>
#include <sch_edit_frame.h>
#include <sch_sheet_path.h>
#include <sch_label.h>
#include <lib_symbol.h>
#include <schematic.h>
#include <advanced_config.h>
#include <connectivity/conn_facade.h>
#include <sch_commit.h>
#include <string_utils.h>
#include <kiface_base.h>
#include <wildcards_and_files_ext.h>
#include <connection_graph.h>
#include <limits>
#include <set>
#include <tool/tool_manager.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <tools/sch_selection.h>
#include <tools/sch_tool_utils.h>
#include <wx/log.h>
#include <fmt.h>
#include <fmt/ranges.h>
#include <fmt/xchar.h>

Go to the source code of this file.

Functions

static std::vector< wxString > netsInUnitOrder (const std::vector< wxString > &aPins, const std::map< wxString, wxString > &aNetByPin)
 
bool CollectBackannotatePcbNets (const SCH_SYMBOL &aSymbol, const SCH_SHEET_PATH &aSheetPath, const wxString &aVariantName, const std::map< wxString, wxString > &aPcbNetsByPad, std::map< wxString, wxString > &aPcbNetsByLogicalPin)
 Append this unit's PCB nets to a map keyed by logical pin number, resolving pin-to-pad mappings.
 
BACKANNOTATE_UNIT_SWAP_PLAN PlanBackannotateUnitSwaps (const std::vector< BACKANNOTATE_UNIT_SWAP_CANDIDATE > &aCandidates, const std::map< wxString, wxString > &aPcbPinMap)
 Compute a pure unit-swap plan from schematic-side unit definitions and PCB nets keyed by logical pin number.
 
static SPIN_STYLE orientLabel (SCH_PIN *aPin)
 
void addConnections (SCH_ITEM *aItem, const SCH_SHEET_PATH &aSheetPath, std::set< SCH_ITEM * > &connectedItems)
 

Function Documentation

◆ addConnections()

◆ CollectBackannotatePcbNets()

bool CollectBackannotatePcbNets ( const SCH_SYMBOL & aSymbol,
const SCH_SHEET_PATH & aSheetPath,
const wxString & aVariantName,
const std::map< wxString, wxString > & aPcbNetsByPad,
std::map< wxString, wxString > & aPcbNetsByLogicalPin )

Append this unit's PCB nets to a map keyed by logical pin number, resolving pin-to-pad mappings.

Return false if a pin's pads disagree or units assign different nets to a shared logical pin. The output may be partially populated on failure and must not be used for swap planning.

Definition at line 77 of file backannotate.cpp.

References ExpandStackedPinNotation(), SCH_SYMBOL::GetPins(), pad, and pin.

Referenced by BACK_ANNOTATE::applyChangelist(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), and MAPPED_UNIT_SWAP_FIXTURE::Plan().

◆ netsInUnitOrder()

static std::vector< wxString > netsInUnitOrder ( const std::vector< wxString > & aPins,
const std::map< wxString, wxString > & aNetByPin )
static

Definition at line 53 of file backannotate.cpp.

References kv.

Referenced by BACK_ANNOTATE::applyChangelist(), and PlanBackannotateUnitSwaps().

◆ orientLabel()

◆ PlanBackannotateUnitSwaps()

BACKANNOTATE_UNIT_SWAP_PLAN PlanBackannotateUnitSwaps ( const std::vector< BACKANNOTATE_UNIT_SWAP_CANDIDATE > & aCandidates,
const std::map< wxString, wxString > & aPcbPinMap )

Compute a pure unit-swap plan from schematic-side unit definitions and PCB nets keyed by logical pin number.

The caller must resolve pin-to-pad mappings before constructing the PCB net map. This is shared by backannotation and unit tests so swap inference can be exercised without constructing a full schematic editor test harness.

Definition at line 129 of file backannotate.cpp.

References BACKANNOTATE_UNIT_SWAP_CANDIDATE::m_schNetsByPin, BACKANNOTATE_UNIT_SWAP_CANDIDATE::m_unitPinNumbers, netsInUnitOrder(), and plan().

Referenced by BACK_ANNOTATE::applyChangelist(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and MAPPED_UNIT_SWAP_FIXTURE::Plan().