![]() |
KiCad PCB EDA Suite
|
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened schematic hierarchy. More...
#include <sch_sheet_path.h>
Public Member Functions | |
SCH_SHEET_PATH () | |
SCH_SHEET_PATH (const SCH_SHEET_PATH &aOther) | |
SCH_SHEET_PATH & | operator= (const SCH_SHEET_PATH &aOther) |
~SCH_SHEET_PATH ()=default | |
SCH_SHEET * | at (size_t aIndex) const |
Forwarded method from std::vector. More... | |
void | clear () |
Forwarded method from std::vector. More... | |
bool | empty () const |
Forwarded method from std::vector. More... | |
void | pop_back () |
Forwarded method from std::vector. More... | |
void | push_back (SCH_SHEET *aSheet) |
Forwarded method from std::vector. More... | |
size_t | size () const |
Forwarded method from std::vector. More... | |
void | Rehash () |
size_t | GetCurrentHash () const |
void | SetVirtualPageNumber (int aPageNumber) |
Set the sheet instance virtual page number. More... | |
int | GetVirtualPageNumber () const |
void | SetPageNumber (const wxString &aPageNumber) |
Set the sheet instance user definable page number. More... | |
wxString | GetPageNumber () const |
const SCH_SHEET * | GetSheet (unsigned aIndex) const |
int | Cmp (const SCH_SHEET_PATH &aSheetPathToTest) const |
Compare if this is the same sheet path as aSheetPathToTest. More... | |
SCH_SHEET * | Last () const |
Return a pointer to the last SCH_SHEET of the list. More... | |
SCH_SCREEN * | LastScreen () |
SCH_SCREEN * | LastScreen () const |
More... | |
wxString | PathAsString () const |
Return the path of time stamps which do not changes even when editing sheet parameters. More... | |
KIID_PATH | Path () const |
Get the sheet path as an KIID_PATH. More... | |
KIID_PATH | PathWithoutRootUuid () const |
Get the sheet path as an KIID_PATH without the root sheet UUID prefix. More... | |
wxString | PathHumanReadable (bool aUseShortRootName=true) const |
Return the sheet path in a human readable form made from thesheet names. More... | |
void | UpdateAllScreenReferences () |
Update all the symbol references for this sheet path. More... | |
void | GetSymbols (SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const |
Adds SCH_REFERENCE object to aReferences for each component in the sheet. More... | |
void | GetMultiUnitComponents (SCH_MULTI_UNIT_REFERENCE_MAP &aRefList, bool aIncludePowerSymbols=true) const |
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sheet. More... | |
bool | TestForRecursion (const wxString &aSrcFileName, const wxString &aDestFileName) |
Test the SCH_SHEET_PATH file names to check adding the sheet stored in the file aSrcFileName to the sheet stored in file aDestFileName will cause a sheet path recursion. More... | |
bool | operator== (const SCH_SHEET_PATH &d1) const |
bool | operator!= (const SCH_SHEET_PATH &d1) const |
bool | operator< (const SCH_SHEET_PATH &d1) const |
Protected Attributes | |
std::vector< SCH_SHEET * > | m_sheets |
size_t | m_current_hash |
int | m_virtualPageNumber |
std::map< std::pair< wxString, wxString >, bool > | m_recursion_test_cache |
Page numbers are maintained by the sheet load order. More... | |
Private Member Functions | |
void | initFromOther (const SCH_SHEET_PATH &aOther) |
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened schematic hierarchy.
The SCH_SHEET objects are stored in a list from first (usually the root sheet) to a given sheet in last position. The last sheet is usually the sheet we want to select or reach (which is what the function Last() returns). Others sheets constitute the "path" from the first to the last sheet.
Definition at line 130 of file sch_sheet_path.h.
SCH_SHEET_PATH::SCH_SHEET_PATH | ( | ) |
Definition at line 97 of file sch_sheet_path.cpp.
References m_current_hash, and m_virtualPageNumber.
SCH_SHEET_PATH::SCH_SHEET_PATH | ( | const SCH_SHEET_PATH & | aOther | ) |
Definition at line 104 of file sch_sheet_path.cpp.
References initFromOther().
|
default |
|
inline |
Forwarded method from std::vector.
Definition at line 151 of file sch_sheet_path.h.
References m_sheets.
Referenced by Cmp(), GetSheet(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PathAsString(), PathHumanReadable(), PathWithoutRootUuid(), and TestForRecursion().
|
inline |
Forwarded method from std::vector.
Definition at line 154 of file sch_sheet_path.h.
References m_sheets, and Rehash().
Referenced by SCH_EDIT_FRAME::doCloseWindow(), SCHEMATIC::Reset(), SCHEMATIC::SetRoot(), and HIERARCHY_NAVIG_DLG::UpdateHierarchyTree().
int SCH_SHEET_PATH::Cmp | ( | const SCH_SHEET_PATH & | aSheetPathToTest | ) | const |
Compare if this is the same sheet path as aSheetPathToTest.
aSheetPathToTest | = sheet path to compare |
Definition at line 137 of file sch_sheet_path.cpp.
References at(), EDA_ITEM::m_Uuid, and size().
Referenced by SCH_REFERENCE_LIST::sortByTimeStamp().
|
inline |
Forwarded method from std::vector.
Definition at line 161 of file sch_sheet_path.h.
References m_sheets.
Referenced by Last(), and PathHumanReadable().
|
inline |
Definition at line 182 of file sch_sheet_path.h.
References m_current_hash.
Referenced by std::hash< SCH_SHEET_PATH >::operator()(), and operator==().
void SCH_SHEET_PATH::GetMultiUnitComponents | ( | SCH_MULTI_UNIT_REFERENCE_MAP & | aRefList, |
bool | aIncludePowerSymbols = true |
||
) | const |
Add a SCH_REFERENCE_LIST object to aRefList for each same-reference set of multi-unit parts in the sheet.
The map key for each element will be the reference designator.
aRefList | Map of reference designators to reference lists |
aIncludePowerSymbols | : false to only get normal components. |
Definition at line 289 of file sch_sheet_path.cpp.
References SCH_REFERENCE::GetRef(), LIB_PART::GetUnitCount(), LastScreen(), m_virtualPageNumber, SCH_COMPONENT_T, and SCH_REFERENCE::SetSheetNumber().
Referenced by SCH_EDIT_FRAME::AnnotateComponents().
wxString SCH_SHEET_PATH::GetPageNumber | ( | ) | const |
Definition at line 406 of file sch_sheet_path.cpp.
References SCH_SHEET::GetPageNumber(), and Last().
Referenced by SCH_EDIT_TOOL::EditPageNumber(), SCH_NAVIGATE_TOOL::HypertextCommand(), SCH_GLOBALLABEL::ResolveTextVar(), and SCH_SHEET_LIST::SortByPageNumbers().
|
inline |
Definition at line 206 of file sch_sheet_path.h.
References at(), NULL, and size().
Referenced by SCH_SHEET_LIST::TestForRecursion().
void SCH_SHEET_PATH::GetSymbols | ( | SCH_REFERENCE_LIST & | aReferences, |
bool | aIncludePowerSymbols = true , |
||
bool | aForceIncludeOrphanComponents = false |
||
) | const |
Adds SCH_REFERENCE object to aReferences for each component in the sheet.
aReferences | List of references to populate. |
aIncludePowerSymbols | : false to only get normal components. |
aForceIncludeOrphanComponents | : true to include components having no symbol found in lib. ( orphan components) The normal option is false, and set to true only to build the full list of components. |
Definition at line 264 of file sch_sheet_path.cpp.
References SCH_REFERENCE_LIST::AddItem(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetRef(), LastScreen(), m_virtualPageNumber, SCH_COMPONENT_T, and SCH_REFERENCE::SetSheetNumber().
Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::CheckAnnotate(), CollectOtherUnits(), and SCH_SHEET_LIST::GetSymbols().
|
inline |
|
private |
Definition at line 117 of file sch_sheet_path.cpp.
References m_current_hash, m_sheets, and m_virtualPageNumber.
Referenced by operator=(), and SCH_SHEET_PATH().
SCH_SHEET * SCH_SHEET_PATH::Last | ( | ) | const |
Return a pointer to the last SCH_SHEET of the list.
One can see the others sheet as the "path" to reach this last sheet.
Definition at line 159 of file sch_sheet_path.cpp.
References empty(), and m_sheets.
Referenced by SCH_SHEET_LIST::AllSheetPageNumbersEmpty(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditPageNumber(), GetPageNumber(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), SCH_DRAWING_TOOLS::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), LastScreen(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_SHEET_LIST::NameExists(), HIERARCHY_TREE::OnCompareItems(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), SCH_EDITOR_CONTROL::Paste(), SCH_EDIT_FRAME::SaveEEFile(), SCH_SHEET_LIST::SetInitialPageNumbers(), SetPageNumber(), SCH_EDIT_FRAME::setupUIConditions(), HIERARCHY_NAVIG_DLG::UpdateHierarchyTree(), and SCH_SHEET_LIST::UpdateSheetInstances().
SCH_SCREEN * SCH_SHEET_PATH::LastScreen | ( | ) |
Definition at line 168 of file sch_sheet_path.cpp.
References SCH_SHEET::GetScreen(), and Last().
Referenced by SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_SHEET_LIST::AnnotatePowerSymbols(), BACK_ANNOTATE::applyChangelist(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CheckSheetForRecursion(), SCH_SHEET_LIST::ClearModifyStatus(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::createPSFile(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDIT_TOOL::EditPageNumber(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), SCH_SHEET_LIST::FillItemMap(), SCH_SHEET_LIST::FindSheetForScreen(), SCH_EDIT_FRAME::FixupJunctions(), SCH_SHEET_LIST::GetItem(), GetMultiUnitComponents(), SCH_EDIT_FRAME::GetScreen(), GetSymbols(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), SCH_SHEET_LIST::IsModified(), SCH_EDIT_FRAME::LoadSheetFromFile(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_PRINTOUT::OnPrintPage(), DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), BACK_ANNOTATE::processNetNameChange(), DIALOG_CHANGE_SYMBOLS::processSymbol(), RESCUER::RESCUER(), SCH_EDIT_FRAME::ResolveERCExclusions(), SCH_EDIT_FRAME::SetCurrentSheet(), TestForRecursion(), ERC_TESTER::TestMultiunitFootprints(), ERC_TESTER::TestMultUnitPinConflicts(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), UpdateAllScreenReferences(), CONNECTION_GRAPH::updateItemConnectivity(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().
SCH_SCREEN * SCH_SHEET_PATH::LastScreen | ( | ) | const |
Definition at line 179 of file sch_sheet_path.cpp.
References SCH_SHEET::GetScreen(), and Last().
|
inline |
Definition at line 319 of file sch_sheet_path.h.
|
inline |
SCH_SHEET_PATH & SCH_SHEET_PATH::operator= | ( | const SCH_SHEET_PATH & | aOther | ) |
Definition at line 110 of file sch_sheet_path.cpp.
References initFromOther().
bool SCH_SHEET_PATH::operator== | ( | const SCH_SHEET_PATH & | d1 | ) | const |
KIID_PATH SCH_SHEET_PATH::Path | ( | ) | const |
Get the sheet path as an KIID_PATH.
Definition at line 205 of file sch_sheet_path.cpp.
References m_sheets.
Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_COMPONENT::ClearAnnotation(), SCH_EDIT_FRAME::CreateScreens(), SCH_EDITOR_CONTROL::doCopy(), SCH_COMPONENT::GetFootprint(), SCH_SHEET::GetPageNumber(), SCH_SHEET_LIST::GetPaths(), SCH_COMPONENT::GetRef(), SCH_COMPONENT::GetUnitSelection(), SCH_COMPONENT::GetValue(), SCH_COMPONENT::IsAnnotated(), SCH_REFERENCE::IsSameInstance(), SCH_EAGLE_PLUGIN::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheets(), SCH_EDIT_FRAME::mapExistingAnnotation(), SCH_COMPONENT::SetFootprint(), SCH_SHEET_LIST::SetInitialPageNumbers(), SCH_SHEET::SetPageNumber(), SCH_COMPONENT::SetRef(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_COMPONENT::SetUnitSelection(), SCH_COMPONENT::SetValue(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), and SCH_SHEET_LIST::UpdateSheetInstances().
wxString SCH_SHEET_PATH::PathAsString | ( | ) | const |
Return the path of time stamps which do not changes even when editing sheet parameters.
A path is something like / (root) or /34005677 or /34005677/00AE4523.
Definition at line 190 of file sch_sheet_path.cpp.
References KIID::AsString(), at(), EDA_ITEM::m_Uuid, and size().
Referenced by SCH_REFERENCE::GetPath(), SCH_EAGLE_PLUGIN::loadInstance(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), NETLIST_EXPORTER_XML::makeSymbols(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().
wxString SCH_SHEET_PATH::PathHumanReadable | ( | bool | aUseShortRootName = true | ) | const |
Return the sheet path in a human readable form made from thesheet names.
The the "normal" path instead uses the KIID objects in the path that do not change even when editing sheet parameters.
Definition at line 227 of file sch_sheet_path.cpp.
References at(), empty(), SCH_SHEET::GetFields(), SCH_SCREEN::GetFileName(), SCH_SHEET::GetScreen(), SHEETNAME, and size().
Referenced by SCH_EDIT_TOOL::EditPageNumber(), SCH_SHEET::GetMsgPanelInfo(), SCH_EDIT_FRAME::GetScreenDesc(), inheritNetclass(), NETLIST_EXPORTER_XML::makeSymbols(), DIALOG_SHEET_PROPERTIES::OnUpdateUI(), SCH_CONNECTION::recacheName(), and SCH_EDIT_FRAME::UpdateTitle().
KIID_PATH SCH_SHEET_PATH::PathWithoutRootUuid | ( | ) | const |
Get the sheet path as an KIID_PATH without the root sheet UUID prefix.
Definition at line 216 of file sch_sheet_path.cpp.
Referenced by SCH_SHEET_LIST::UpdateSheetInstances().
|
inline |
Forwarded method from std::vector.
Definition at line 164 of file sch_sheet_path.h.
References m_sheets, and Rehash().
Referenced by HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_TOOL::EditPageNumber(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), SCH_SHEET::LocatePathOfScreen(), and CONNECTION_GRAPH::propagateToNeighbors().
|
inline |
Forwarded method from std::vector.
Definition at line 171 of file sch_sheet_path.h.
References m_sheets, and Rehash().
Referenced by CONNECTION_GRAPH::buildConnectionGraph(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CreateScreens(), SCH_EDIT_TOOL::EditPageNumber(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), SCH_COMPONENT::GetMsgPanelInfo(), SCH_SHEET::GetMsgPanelInfo(), HIERARCHY_NAVIG_DLG::getRootString(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), TEST_SCH_SHEET_LIST_FIXTURE::loadSchematic(), TEST_NETLISTS_FIXTURE::loadSchematic(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheets(), SCH_SHEET::LocatePathOfScreen(), SCH_EDITOR_CONTROL::Paste(), CONNECTION_GRAPH::propagateToNeighbors(), SCHEMATIC::SetRoot(), TEST_SCH_SHEET_PATH_FIXTURE::TEST_SCH_SHEET_PATH_FIXTURE(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataToWindow(), HIERARCHY_NAVIG_DLG::UpdateHierarchyTree(), and SCH_EDITOR_CONTROL::updatePastedInstances().
void SCH_SHEET_PATH::Rehash | ( | ) |
Definition at line 128 of file sch_sheet_path.cpp.
References hash_combine(), m_current_hash, and m_sheets.
Referenced by clear(), pop_back(), and push_back().
void SCH_SHEET_PATH::SetPageNumber | ( | const wxString & | aPageNumber | ) |
Set the sheet instance user definable page number.
Definition at line 416 of file sch_sheet_path.cpp.
References Last(), and SCH_SHEET::SetPageNumber().
Referenced by SCH_EDIT_TOOL::EditPageNumber().
|
inline |
Set the sheet instance virtual page number.
Virtual page numbers are incremental integers set automatically when the sheet path hierarchy is created (
Definition at line 193 of file sch_sheet_path.h.
References m_virtualPageNumber.
Referenced by SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), and SCH_SHEET_LIST::SortByPageNumbers().
|
inline |
Forwarded method from std::vector.
Definition at line 178 of file sch_sheet_path.h.
References m_sheets.
Referenced by Cmp(), SCH_EDIT_TOOL::EditPageNumber(), GetSheet(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PathAsString(), PathHumanReadable(), PathWithoutRootUuid(), CONNECTION_GRAPH::propagateToNeighbors(), TestForRecursion(), and SCH_SHEET_LIST::TestForRecursion().
bool SCH_SHEET_PATH::TestForRecursion | ( | const wxString & | aSrcFileName, |
const wxString & | aDestFileName | ||
) |
Test the SCH_SHEET_PATH file names to check adding the sheet stored in the file aSrcFileName to the sheet stored in file aDestFileName will cause a sheet path recursion.
aSrcFileName | is the source file name of the sheet add to aDestFileName. |
aDestFileName | is the file name of the destination sheet for aSrcFileName. |
Definition at line 325 of file sch_sheet_path.cpp.
References at(), SCHEMATIC::GetFileName(), SCH_SHEET::GetFileName(), LastScreen(), m_recursion_test_cache, SCH_SCREEN::Schematic(), and size().
Referenced by SCH_SHEET_LIST::BuildSheetList().
void SCH_SHEET_PATH::UpdateAllScreenReferences | ( | ) |
Update all the symbol references for this sheet path.
Mandatory in complex hierarchies because sheets may use the same screen (basic schematic) more than once but with different references and units according to the displayed sheet.
Definition at line 250 of file sch_sheet_path.cpp.
References FOOTPRINT_FIELD, SCH_COMPONENT::GetField(), SCH_COMPONENT::GetFootprint(), SCH_COMPONENT::GetRef(), SCH_COMPONENT::GetUnitSelection(), SCH_COMPONENT::GetValue(), LastScreen(), REFERENCE_FIELD, SCH_COMPONENT_T, EDA_TEXT::SetText(), SCH_COMPONENT::UpdateUnit(), and VALUE_FIELD.
Referenced by SCH_EDIT_FRAME::AnnotateComponents(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::createPSFile(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDITOR_CONTROL::FindNext(), SCH_EDIT_FRAME::FixupJunctions(), DIALOG_MIGRATE_BUSES::onItemSelected(), SCH_PRINTOUT::OnPrintPage(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), DIALOG_CHANGE_SYMBOLS::processMatchingSymbols(), ReannotateFromPCBNew(), and DIALOG_PLOT_SCHEMATIC::restoreEnvironment().
|
protected |
Definition at line 135 of file sch_sheet_path.h.
Referenced by GetCurrentHash(), initFromOther(), operator==(), Rehash(), and SCH_SHEET_PATH().
|
protected |
Page numbers are maintained by the sheet load order.
Definition at line 139 of file sch_sheet_path.h.
Referenced by TestForRecursion().
|
protected |
Definition at line 133 of file sch_sheet_path.h.
Referenced by at(), clear(), empty(), initFromOther(), Last(), operator<(), Path(), pop_back(), push_back(), Rehash(), and size().
|
protected |
Definition at line 137 of file sch_sheet_path.h.
Referenced by GetMultiUnitComponents(), GetSymbols(), GetVirtualPageNumber(), initFromOther(), SCH_SHEET_PATH(), and SetVirtualPageNumber().