|
KiCad PCB EDA Suite
|
#include <algorithm>#include <set>#include <trace_helpers.h>#include <sch_pin.h>#include <lib_symbol.h>#include <schematic.h>#include <sch_symbol.h>#include <sch_bitmap.h>#include <sch_bus_entry.h>#include <sch_field.h>#include <sch_group.h>#include <sch_junction.h>#include <sch_label.h>#include <sch_line.h>#include <sch_no_connect.h>#include <sch_rule_area.h>#include <sch_shape.h>#include <sch_sheet.h>#include <sch_sheet_path.h>#include <sch_screen.h>#include <sch_sheet_pin.h>#include <sch_table.h>#include <sch_tablecell.h>#include <sch_text.h>#include <sch_textbox.h>#include "api_sch_utils.h"#include <api/api_utils.h>#include <api/api_enums.h>Go to the source code of this file.
Functions | |
| std::unique_ptr< EDA_ITEM > | CreateItemForType (KICAD_T aType, EDA_ITEM *aContainer) |
| void | PackPinMapOverride (kiapi::schematic::types::PinMapInstanceOverride *aOutput, const PIN_MAP_INSTANCE_OVERRIDE &aOverride) |
| Pack/unpack a pin-to-pad map instance override to/from its protobuf form (issue #2282). | |
| PIN_MAP_INSTANCE_OVERRIDE | UnpackPinMapOverride (const kiapi::schematic::types::PinMapInstanceOverride &aInput) |
| bool | PackSymbol (kiapi::schematic::types::SchematicSymbolInstance *aOutput, const SCH_SYMBOL *aInput, const SCH_SHEET_PATH &aPath) |
| bool | UnpackSymbol (SCH_SYMBOL *aOutput, const kiapi::schematic::types::SchematicSymbolInstance &aInput) |
| Unpack the geometry, the library definition, fields, and the default-variant attributes that are shared between every placement. | |
| template<typename VariantProto> | |
| static void | registerVariant (SCHEMATIC *aSchematic, const wxString &aName, const VariantProto &aInput) |
| Make the schematic aware of a variant a request named. Accepts either variant message. | |
| static void | applySymbolVariants (SCH_SYMBOL *aSymbol, const kiapi::schematic::types::SchematicSymbolVariants &aInput, const SCH_SHEET_PATH &aPath, SCHEMATIC *aSchematic) |
| Make the set of variant records on one placement of a symbol match aInput, by name. | |
| void | ApplySymbolInstance (SCH_SYMBOL *aSymbol, const kiapi::schematic::types::SchematicSymbolInstance &aInput, const SCH_SHEET_PATH &aPath, SCHEMATIC *aSchematic) |
| Apply placement-specific data to an aSymbol at aPath: reference, unit, and the per-placement attribute and field differentials. | |
| bool | PackSheet (kiapi::schematic::types::SheetSymbol *aOutput, const SCH_SHEET *aInput, const SCH_SHEET_PATH &aPath) |
| static void | applySheetVariants (SCH_SHEET *aSheet, const kiapi::schematic::types::SheetVariants &aInput, const SCH_SHEET_PATH &aParentPath, SCHEMATIC *aSchematic) |
| Make the set of variant records on one placement of a sheet match aInput, by name. | |
| void | ApplySheetInstance (SCH_SHEET *aSheet, const kiapi::schematic::types::SheetSymbol &aInput, const SCH_SHEET_PATH &aParentPath, SCHEMATIC *aSchematic) |
| Apply the placement data in a sheet message to aSheet: page number and the variants the message carries. | |
| tl::expected< bool, ApiResponseStatus > | UnpackSheet (SCH_SHEET *aOutput, const kiapi::schematic::types::SheetSymbol &aInput) |
| Unpack the every placement data from the input. | |
| void | PackSheetPath (types::SheetPath &aOutput, const SCH_SHEET_PATH &aInput) |
| void ApplySheetInstance | ( | SCH_SHEET * | aSheet, |
| const kiapi::schematic::types::SheetSymbol & | aInput, | ||
| const SCH_SHEET_PATH & | aParentPath, | ||
| SCHEMATIC * | aSchematic ) |
Apply the placement data in a sheet message to aSheet: page number and the variants the message carries.
aParentPath is the path of the sheet that contains aSheet, which is how a sheet's placement records are keyed.
Definition at line 525 of file api_sch_utils.cpp.
References applySheetVariants(), and path.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and API_HANDLER_SCH::handleCreateUpdateItemsInternal().
|
static |
Make the set of variant records on one placement of a sheet match aInput, by name.
Each surviving record keeps the attributes the message leaves unset.
Definition at line 456 of file api_sch_utils.cpp.
References SCH_SHEET::ClearVariantField(), SCH_SHEET::DeleteVariant(), SCH_SHEET::GetInstance(), SCH_SHEET_INSTANCE::m_Variants, name, SCH_SHEET_PATH::Path(), registerVariant(), SCH_SHEET::SetDNP(), SCH_SHEET::SetExcludedFromBOM(), SCH_SHEET::SetExcludedFromSim(), and SCH_SHEET::SetFieldText().
Referenced by ApplySheetInstance().
| void ApplySymbolInstance | ( | SCH_SYMBOL * | aSymbol, |
| const kiapi::schematic::types::SchematicSymbolInstance & | aInput, | ||
| const SCH_SHEET_PATH & | aPath, | ||
| SCHEMATIC * | aSchematic ) |
Apply placement-specific data to an aSymbol at aPath: reference, unit, and the per-placement attribute and field differentials.
Variant names are registered with aSchematic so that the UI offers them for selection. aSymbol must already be in the schematic; the other placements of the symbol are untouched.
Definition at line 379 of file api_sch_utils.cpp.
References SCH_SYMBOL::AddHierarchicalReference(), applySymbolVariants(), SCH_SYMBOL::GetInstance(), SCH_SYMBOL_INSTANCE::m_Path, SCH_SYMBOL_INSTANCE::m_Reference, SCH_SYMBOL_INSTANCE::m_Unit, SCH_SHEET_PATH::Path(), SCH_SYMBOL::SetRef(), SCH_ITEM::SetUnit(), and SCH_SYMBOL::SetUnitSelection().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and API_HANDLER_SCH::handleCreateUpdateItemsInternal().
|
static |
Make the set of variant records on one placement of a symbol match aInput, by name.
Definition at line 302 of file api_sch_utils.cpp.
References SCH_SYMBOL::ClearVariantField(), SCH_SYMBOL::ClearVariantSymbolOverride(), SCH_SYMBOL::DeleteVariant(), SCH_SYMBOL::GetInstance(), SCH_SYMBOL_INSTANCE::m_Variants, name, SCH_SHEET_PATH::Path(), registerVariant(), SCH_SYMBOL::SetDNP(), SCH_SYMBOL::SetExcludedFromBoard(), SCH_SYMBOL::SetExcludedFromBOM(), SCH_SYMBOL::SetExcludedFromPosFiles(), SCH_SYMBOL::SetExcludedFromSim(), SCH_SYMBOL::SetFieldText(), SCH_SYMBOL::SetPinMapOverride(), SCH_SYMBOL::SetVariantSymbolOverride(), kiapi::common::UnpackLibId(), and UnpackPinMapOverride().
Referenced by ApplySymbolInstance().
Definition at line 57 of file api_sch_utils.cpp.
References LIB_SYMBOL_T, SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_GROUP_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_NO_CONNECT_T, SCH_PIN_T, SCH_RULE_AREA_T, SCH_SCREEN_T, SCH_SHAPE_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, SCH_TABLE_T, SCH_TABLECELL_T, SCH_TEXT_T, SCH_TEXTBOX_T, and EDA_ITEM::Type().
Referenced by API_HANDLER_BOARD::createItemForType(), API_HANDLER_SCH::createItemForType(), LIB_SYMBOL::Deserialize(), and FOOTPRINT::DeserializeDefinition().
| void PackPinMapOverride | ( | kiapi::schematic::types::PinMapInstanceOverride * | aOutput, |
| const PIN_MAP_INSTANCE_OVERRIDE & | aOverride ) |
Pack/unpack a pin-to-pad map instance override to/from its protobuf form (issue #2282).
Definition at line 110 of file api_sch_utils.cpp.
References edit, PIN_MAP_INSTANCE_OVERRIDE::m_ActiveMapName, PIN_MAP_INSTANCE_OVERRIDE::m_Edits, PIN_MAP_INSTANCE_OVERRIDE::m_Mode, and ToProtoEnum().
Referenced by PackSymbol().
| bool PackSheet | ( | kiapi::schematic::types::SheetSymbol * | aOutput, |
| const SCH_SHEET * | aInput, | ||
| const SCH_SHEET_PATH & | aPath ) |
Definition at line 413 of file api_sch_utils.cpp.
References SCH_SHEET::GetInstance(), name, kiapi::common::PackSheetPath(), SCH_SHEET_PATH::Path(), SCH_ITEM::Schematic(), and SCH_SHEET::Serialize().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), API_HANDLER_SCH::handleCreateUpdateItemsInternal(), API_HANDLER_SCH::handleGetItemsById(), and API_HANDLER_SCH::packSchItem().
| void PackSheetPath | ( | types::SheetPath & | aOutput, |
| const SCH_SHEET_PATH & | aInput ) |
Definition at line 560 of file api_sch_utils.cpp.
References kiapi::common::PackSheetPath(), SCH_SHEET_PATH::Path(), and SCH_SHEET_PATH::PathHumanReadable().
Referenced by ToProto().
| bool PackSymbol | ( | kiapi::schematic::types::SchematicSymbolInstance * | aOutput, |
| const SCH_SYMBOL * | aInput, | ||
| const SCH_SHEET_PATH & | aPath ) |
Definition at line 142 of file api_sch_utils.cpp.
References KIID::AsString(), SCH_ITEM::GetBodyStyle(), SCH_SYMBOL::GetDNP(), SCH_SYMBOL::GetExcludedFromBoard(), SCH_SYMBOL::GetExcludedFromBOM(), SCH_SYMBOL::GetExcludedFromPosFiles(), SCH_SYMBOL::GetExcludedFromSim(), SCH_SYMBOL::GetInstance(), SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetPinMapOverride(), SCH_SYMBOL::GetPins(), SCH_SYMBOL_INSTANCE::m_Reference, SCH_SYMBOL_INSTANCE::m_Unit, EDA_ITEM::m_Uuid, SCH_SYMBOL_INSTANCE::m_Variants, name, kiapi::common::PackLibId(), PackPinMapOverride(), kiapi::common::PackSheetPath(), SCH_SHEET_PATH::Path(), path, SCH_SHEET_PATH::PathHumanReadable(), pin, SCH_ITEM::Schematic(), SCH_SYMBOL::Serialize(), and traceApi.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), API_HANDLER_SCH::handleCreateUpdateItemsInternal(), API_HANDLER_SCH::handleGetItemsById(), API_HANDLER_SCH::handlePlaceSymbolFromLibrary(), and API_HANDLER_SCH::packSchItem().
|
static |
Make the schematic aware of a variant a request named. Accepts either variant message.
Definition at line 287 of file api_sch_utils.cpp.
References SCHEMATIC::AddVariant(), and SCHEMATIC::SetVariantDescription().
Referenced by applySheetVariants(), and applySymbolVariants().
| PIN_MAP_INSTANCE_OVERRIDE UnpackPinMapOverride | ( | const kiapi::schematic::types::PinMapInstanceOverride & | aInput | ) |
Definition at line 127 of file api_sch_utils.cpp.
References FromProtoEnum(), and PIN_MAP_INSTANCE_OVERRIDE::m_Mode.
Referenced by applySymbolVariants(), and UnpackSymbol().
| tl::expected< bool, ApiResponseStatus > UnpackSheet | ( | SCH_SHEET * | aOutput, |
| const kiapi::schematic::types::SheetSymbol & | aInput ) |
Unpack the every placement data from the input.
Placement data is applied separately by ApplySheetInstance.
Definition at line 543 of file api_sch_utils.cpp.
References SCH_SHEET::Deserialize().
Referenced by BOOST_AUTO_TEST_CASE(), and API_HANDLER_SCH::handleCreateUpdateItemsInternal().
| bool UnpackSymbol | ( | SCH_SYMBOL * | aOutput, |
| const kiapi::schematic::types::SchematicSymbolInstance & | aInput ) |
Unpack the geometry, the library definition, fields, and the default-variant attributes that are shared between every placement.
Single-placement data is handled by ApplySymbolInstance.
Definition at line 259 of file api_sch_utils.cpp.
References SCH_SYMBOL::Deserialize(), SCH_SYMBOL::SetDNP(), SCH_SYMBOL::SetExcludedFromBoard(), SCH_SYMBOL::SetExcludedFromBOM(), SCH_SYMBOL::SetExcludedFromPosFiles(), SCH_SYMBOL::SetExcludedFromSim(), SCH_SYMBOL::SetPinMapOverride(), and UnpackPinMapOverride().
Referenced by BOOST_AUTO_TEST_CASE(), and API_HANDLER_SCH::handleCreateUpdateItemsInternal().