53std::optional<TEXT_EVAL_VCS::CONTEXT_PATH_SCOPE> sourceProjectContext(
const SCHEMATIC& aSchematic )
58 return std::optional<TEXT_EVAL_VCS::CONTEXT_PATH_SCOPE>( std::in_place,
path );
64struct INSTANCE_TEXT_CONTEXT
72 std::vector<wxString> title;
75 bool portrait =
false;
76 bool operator==(
const INSTANCE_TEXT_CONTEXT& )
const =
default;
79struct VARIANT_TEXT_CONTEXT
81 std::map<wxString, wxString> fields;
82 std::array<bool, 5> attributes{};
83 bool operator==(
const VARIANT_TEXT_CONTEXT& )
const =
default;
86struct SHEET_TEXT_CONTEXT
88 std::vector<std::tuple<FIELD_T, wxString, wxString>> fields;
89 std::array<bool, 5> attributes{};
90 std::map<KIID_PATH, std::map<wxString, VARIANT_TEXT_CONTEXT>> variants;
91 bool operator==(
const SHEET_TEXT_CONTEXT& )
const =
default;
94struct MODEL_TEXT_CONTEXT
99 wxString workingDirectory;
100 wxString drawingLayout;
101 bool allowEmptyLayout =
false;
103 bool vcsContextIsFile =
false;
105 wxString variantDescription;
107 std::map<wxString, wxString> variables;
108 std::vector<wxString> templateFields;
109 std::vector<INSTANCE_TEXT_CONTEXT> instances;
110 std::map<KIID_PATH, SHEET_TEXT_CONTEXT> sheets;
113 std::map<std::pair<KIID, KIID_PATH>, wxString> packageSuffixes;
114 bool operator==(
const MODEL_TEXT_CONTEXT& )
const =
default;
117std::optional<MODEL_TEXT_CONTEXT> CaptureTextContext(
SCHEMATIC& aSchematic,
const SCH_SHEET_LIST& aPaths )
119 MODEL_TEXT_CONTEXT
result;
128 result.workingDirectory = wxGetCwd();
130 if(
project.GetProjectPath().empty() )
145 for(
const auto& field :
project.GetProjectFile().m_TemplateFieldNames.GetResolvedTemplateFieldNames() )
146 result.templateFields.push_back( field.m_Name );
148 for(
const SCH_SHEET_PATH&
path : aPaths )
150 SCH_SCREEN* screen =
path.LastScreen();
157 path.GetPageNumber(),
path.PathHumanReadable(),
path.Last()->GetName(),
164 for(
int comment = 0; comment < 9; ++comment )
165 instance.title.push_back( title.
GetComment( comment ) );
167 result.instances.push_back( std::move( instance ) );
170 for(
size_t depth = 0; depth <
path.size(); ++depth )
172 const SCH_SHEET* sheet =
path.at( depth );
173 sheetPath.push_back( sheet->
m_Uuid );
175 if(
result.sheets.contains( sheetPath ) )
178 SHEET_TEXT_CONTEXT
source;
182 for(
const SCH_FIELD& field : sheet->
GetFields() )
183 source.fields.emplace_back( field.GetId(), field.GetName(
false ), field.GetText() );
185 for(
const SCH_SHEET_INSTANCE& sheetInstance : sheet->
GetInstances() )
187 auto& variants =
source.variants[sheetInstance.m_Path];
189 for(
const auto& [
name, variant] : sheetInstance.m_Variants )
191 variants.emplace(
name, VARIANT_TEXT_CONTEXT{
193 { variant.m_DNP, variant.m_ExcludedFromSim, variant.m_ExcludedFromBOM,
194 variant.m_ExcludedFromBoard, variant.m_ExcludedFromPosFiles } } );
198 result.sheets.emplace( sheetPath, std::move(
source ) );
202 std::ranges::sort(
result.instances, {}, &INSTANCE_TEXT_CONTEXT::path );
211 std::shared_ptr<const COMPONENT_CONTENT>
content;
231 std::map<INST_ID, std::weak_ptr<const SCH_SCREEN::CONNECTIVITY_SOURCE>>
sources;
232 std::map<NODE_ID, std::shared_ptr<const NET_ITEMS>>
netItems;
238 throw std::logic_error(
"ERC sources require applied connectivity outside input capture" );
244 if( !
path.LastScreen() )
247 const auto instance =
engine.Keys().FindInstance(
path.PathRef() );
249 if( !instance ||
Screen( *instance ) !=
path.LastScreen() )
250 throw std::logic_error(
"ERC sources require current connectivity" );
260 for(
const auto& [node, component] :
engine.Published().Components() )
262 const auto old =
netItems.find( node );
264 if( old !=
netItems.end() && old->second->content == component.content )
266 current.emplace( node, old->second );
270 auto membership = std::make_shared<NET_ITEMS>();
271 membership->content = component.content;
273 for(
const ITEM_KEY& item : component.content->items )
274 membership->instances[item.
inst].push_back( item.
item );
276 for(
const SLOT_KEY& slot : component.content->slots )
279 current.emplace( node, std::move( membership ) );
287 std::vector<INST_ID> live;
288 live.reserve(
sources.size() );
293 live.push_back( instance );
301 const auto found =
netItems.find( aNode );
302 return found !=
netItems.end() && std::any_of( found->second->instances.begin(),
303 found->second->instances.end(), [&](
const auto& entry )
305 return std::binary_search( aLive.begin(), aLive.end(), entry.first );
309 std::optional<NODE_ID>
BusNode(
const wxString& aName )
const
311 const auto node =
engine.Published().FindByName( aName );
312 return node &&
engine.Published().Components().at( *node ).content->kind ==
KIND::BUNDLE
313 ? node : std::nullopt;
316 std::optional<NET_GROUP>
Group(
NODE_ID aNode, std::span<const INST_ID> aLive,
317 const std::weak_ptr<const FACADE_STATE>& aState )
const
319 const auto component =
engine.Published().Components().find( aNode );
321 if( component ==
engine.Published().Components().end() || component->second.name ==
INVALID_ID )
324 std::vector<INST_ID> instances;
326 for(
const auto& [instance, items] :
netItems.at( aNode )->instances )
328 if( std::binary_search( aLive.begin(), aLive.end(), instance ) )
329 instances.push_back( instance );
332 if( instances.empty() )
337 result.instances.reserve( instances.size() );
339 for(
INST_ID instance : instances )
340 result.instances.push_back(
NET_VIEW( aState, aNode, instance ) );
345 std::vector<NET_GROUP>
Groups( std::vector<NODE_ID> aNodes, std::span<const INST_ID> aLive,
346 const std::weak_ptr<const FACADE_STATE>& aState )
const
349 std::erase_if( aNodes,
357 return engine.Published().Components().at( aNode ).name;
359 std::vector<NET_GROUP>
result;
360 result.reserve( aNodes.size() );
364 if(
auto group =
Group( node, aLive, aState ) )
373 wxASSERT( wxThread::IsMain() );
374 const auto found =
netItems.find( aNode );
376 if( found ==
netItems.end() || !found->second->instances.contains( aInstance ) || !
Screen( aInstance ) )
379 return &
engine.Published().Components().at( aNode );
389 if( aIgnoreSheet && aComponent.
content->best )
406 const std::weak_ptr<const FACADE_STATE>& aState,
const ITEM_RESULT* aRow =
nullptr )
const
408 const auto& component =
engine.Published().Components().at( aNode );
409 const auto& content = *component.content;
415 const auto* local = aRow && aRow->busSource ? &*aRow->busSource :
nullptr;
417 if( local && !
Resolve( local->source ) )
420 result.schema = local ? local->schema : content.best->schema;
421 result.tree =
engine.FindBusTree(
engine.Keys().Name( local ? aRow->localName : content.best->name ) );
422 wxASSERT(
result.tree && content.best->schema->leaves.size() == content.members.size() );
423 std::span<const SLOT_KEY> slots = content.members;
424 std::vector<SLOT_KEY> localSlots;
428 localSlots.resize(
result.schema->leaves.size() );
432 for(
const auto& [from, to] : alignment.
matched )
433 localSlots[from] = content.members.at( to );
436 localSlots[from] =
SLOT_KEY{ local->source,
static_cast<uint32_t
>( from ) };
441 result.leaves.reserve( slots.size() );
445 const NODE_ID leaf =
engine.Published().SlotComponents().at( slot );
446 const auto& instances =
netItems.at( leaf )->instances;
447 const INST_ID instance = instances.contains( aInstance ) ? aInstance : slot.bundleDriver.inst;
456 const auto found =
sources.find( aInstance );
461 return Screen( found->second );
464 SCH_SCREEN*
Screen(
const std::weak_ptr<const SCH_SCREEN::CONNECTIVITY_SOURCE>& aSource )
const
466 const auto source = aSource.lock();
472 const auto& revisions =
engine.Published().Auxiliary().ScreenRevisions();
475 if( revision == revisions.end() )
486 const auto& revisions =
engine.Published().Auxiliary().ScreenRevisions();
493 wxASSERT( wxThread::IsMain() );
501 const auto row =
rows.find( aItem );
503 if( row ==
rows.end() )
528 m_state( std::move( aOther.m_state ) ),
m_id( std::exchange( aOther.m_id, 0 ) )
534 if(
this != &aOther )
537 m_state = std::move( aOther.m_state );
538 m_id = std::exchange( aOther.m_id, 0 );
546 wxASSERT( wxThread::IsMain() );
548 if(
auto state =
m_state.lock() )
549 state->listeners.erase(
m_id );
565 wxASSERT( wxThread::IsMain() );
568 throw std::invalid_argument(
"Connectivity listener is empty" );
570 if(
m_state->nextListener == std::numeric_limits<uint64_t>::max() )
571 throw std::overflow_error(
"Connectivity listener identities exhausted" );
573 const uint64_t
id = ++
m_state->nextListener;
574 m_state->listeners.emplace(
id, std::move( aListener ) );
579 const std::function<
void(
SCH_ITEM* )>& aChangedHandler )
581 wxASSERT( wxThread::IsMain() );
584 throw std::invalid_argument(
"Cannot apply connectivity without a schematic project" );
587 const auto handler = aChangedHandler;
595 chains.
sheets.reserve( paths.size() );
601 std::map<INST_ID, SHEET_SOURCE> sheets;
605 if( !
path.LastScreen() )
611 throw std::logic_error(
"Missing sheet instance while rebuilding netchains" );
613 SCH_SCREEN* screen = state->Screen( *instance );
616 throw std::logic_error(
"Stale screen while rebuilding netchains" );
619 sheets.emplace( *instance, SHEET_SOURCE{ &chains.
sheets.back(), screen } );
622 for(
const auto& [key, row] :
Published().Rows() )
624 const auto sheet = sheets.find( key.inst );
625 SCH_ITEM* item = sheet != sheets.end()
626 ? sheet->second.screen->GetConnectivityItem( key.item ) :
nullptr;
629 throw std::logic_error(
"Stale item while rebuilding netchains" );
636 sheet->second.input->nets.emplace( item, std::move( net ) );
647 std::map<SCREEN_ID, INST_ID> displayed;
651 if(
const auto instance =
Keys().FindInstance(
path.PathRef() ) )
653 if(
SCH_SCREEN* screen = state->Screen( *instance ) )
660 if(
SCH_SCREEN* screen = state->Screen( *current ) )
664 std::set<ITEM_KEY, KEY_LESS> changed(
KEY_LESS{
Keys() } );
666 changed.insert( publishedChanges.begin(), publishedChanges.end() );
670 const auto applyEnds = [](
auto* aItem,
auto aDangling )
672 const bool differs = aItem->IsStartDangling() != bool( aDangling & 1 )
673 || aItem->IsEndDangling() != bool( aDangling & 2 );
674 aItem->SetDanglingState( aDangling & 1, aDangling & 2 );
678 for(
const auto& [key, island] :
Published().Auxiliary().Islands() )
680 SCH_SCREEN* screen = state->Screen( key.inst );
687 if( instance == displayed.end() || instance->second != key.inst )
690 for(
const auto& [
id, dangling] : island.value.dangling )
693 bool differs =
false;
698 switch( item->
Type() )
701 differs = applyEnds(
static_cast<SCH_LINE*
>( item ), dangling );
714 differs = label->SCH_LABEL_BASE::IsDangling() != bool( dangling );
715 label->SetIsDangling( dangling );
720 std::unordered_set<SCH_RULE_AREA*> areas;
722 const auto attached = auxiliary.
RuleAreasOf().find( { id, key.inst } );
724 if( attached != auxiliary.RuleAreasOf().end() )
726 for(
const KIID& areaId : attached->second )
729 areas.insert( live );
733 if( directive->GetConnectedRuleAreas() != areas )
735 directive->ClearConnectedRuleAreas();
738 directive->AddConnectedRuleArea( area );
746 differs =
static_cast<SCH_PIN*
>( item )->SetIsDangling( dangling );
753 changed.insert( { id, key.inst } );
757 for(
const auto& [
id, instance] : displayed )
759 SCH_SCREEN* screen = state->Screen( instance );
766 item->SetConnectivityDirty(
false );
772 state->publicationApplied =
true;
774 const uint64_t generation = state->resetGeneration;
775 const uint64_t dispatch = ++state->dispatchGeneration;
776 std::vector<uint64_t> listeners;
779 if( !state->listeners.empty() )
781 notification = state->engine.Published().Changes();
782 notification.
changedItems.assign( changed.begin(), changed.end() );
783 std::ranges::copy( state->listeners | std::views::keys, std::back_inserter( listeners ) );
787 const auto superseded = [&]()
789 return state->resetGeneration != generation || state->dispatchGeneration != dispatch;
793 const auto deliver = [](
const char* aKind,
const auto& aCall )
799 catch(
const std::exception& error )
801 wxLogTrace(
"KICAD_CONNECTIVITY",
"Connectivity %s failed: %s", aKind, error.what() );
805 wxLogTrace(
"KICAD_CONNECTIVITY",
"Connectivity %s failed with an unknown exception", aKind );
811 for(
const ITEM_KEY& key : changed )
816 if(
SCH_ITEM* item = state->Resolve( key ) )
817 deliver(
"change handler",
825 if( !notification.
Empty() )
827 for( uint64_t
id : listeners )
832 const auto found = state->listeners.find(
id );
834 if( found != state->listeners.end() )
836 const auto listener = found->second;
840 listener( notification );
850 wxASSERT( wxThread::IsMain() );
870 catch(
const std::exception& error )
873 wxLogTrace(
"CONN_SHADOW",
"Shadow connectivity failed: %s", error.what() );
878 wxLogTrace(
"CONN_SHADOW",
"Shadow connectivity failed with an unknown exception" );
887 wxASSERT( wxThread::IsMain() );
888 std::map<wxString, std::set<wxString>> assignments;
890 for(
const auto& [
name, classes] :
Published().Netclasses() )
894 for(
NAME_ID netclass : *classes )
895 names.insert(
Keys().Name( netclass ) );
898 std::vector<wxString> retired;
902 if( !assignments.contains(
name ) )
903 retired.push_back(
name );
906 for(
const wxString&
name : retired )
914 for(
const auto& [
name, classes] : assignments )
916 const auto old = previous.find(
name );
918 if( old == previous.end() || old->second != classes )
929 wxASSERT( wxThread::IsMain() );
933 auto context = CaptureTextContext( aSchematic, aPaths );
934 const bool changed = !context ||
m_state->textContext != context
935 ||
m_state->engine.ExternalSourcesChanged( aPaths,
true );
937 if( changed &&
m_state->textEpoch == std::numeric_limits<uint64_t>::max() )
938 throw std::overflow_error(
"Connectivity text epoch exhausted" );
945 aliases.insert_or_assign( alias->GetName(), alias->Members() );
948 Update( aPaths,
m_state->textEpoch + ( changed ? 1 : 0 ), aliases, aRebuild );
949 m_state->textContext = std::move( context );
954 wxASSERT( wxThread::IsMain() );
957 m_state->publicationApplied =
false;
959 m_state->simulationModels.reset();
963 m_state->engine.Update( aPaths, aTextEpoch, aAliases, aRebuild );
964 decltype(
m_state->sources ) sources;
970 if(
const auto instance =
Keys().FindInstance(
path.PathRef() ) )
976 m_state->sources.swap( sources );
977 m_state->textEpoch = aTextEpoch;
988 m_state->publicationApplied =
false;
990 m_state->simulationModels.reset();
1001 wxASSERT( wxThread::IsMain() );
1002 ++aFacade.
m_state->publicationHolds;
1007 if(
const auto state =
m_state.lock() )
1008 --state->publicationHolds;
1017 wxASSERT( wxThread::IsMain() );
1019 const auto paths =
m_state->SourcePaths( aSchematic );
1020 const auto vcs = sourceProjectContext( aSchematic );
1021 std::optional<DS_DATA_MODEL> isolated;
1022 struct RESTORE_LAYOUT
1032 if( aIncludeDrawingSheet )
1039 restoreLayout.previous = &original;
1041 isolated->SetPageLayout( layout.utf8_str() );
1045 std::map<KIID_PATH, FACADE_STATE::TEXT_CHECKS> captured;
1049 auto& checks = captured[
path.PathRef()];
1051 if( aIncludeDrawingSheet )
1052 checks.drawingSheet.emplace();
1058 if( aIncludeDrawingSheet )
1063 m_state->textChecks = std::move( captured );
1068 wxASSERT( wxThread::IsMain() );
1071 throw std::logic_error(
"Text sources have not been prepared" );
1073 const auto& captured =
m_state->textChecks->at( aPath );
1075 if( aDrawingSheet && !captured.drawingSheet )
1076 throw std::logic_error(
"Drawing sheet text sources have not been prepared" );
1078 return aDrawingSheet ? *captured.drawingSheet : captured.items;
1083 wxASSERT( wxThread::IsMain() );
1084 m_state->simulationModels.reset();
1085 const auto vcs = sourceProjectContext( aSchematic );
1087 std::map<KIID_PATH, std::vector<SIMULATION_MODEL_FACT>> captured;
1093 m_state->simulationModels = std::move( captured );
1098 wxASSERT( wxThread::IsMain() );
1100 if( !
m_state->simulationModels )
1101 throw std::logic_error(
"Simulation sources have not been prepared" );
1103 return m_state->simulationModels->at( aPath );
1111 return std::nullopt;
1113 const ITEM_KEY key{ aItem, *instance };
1116 return std::nullopt;
1123 const auto state =
m_state.lock();
1124 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1125 return row ? state->Name( state->engine.Published().Components().at( row->component ), aIgnoreSheet ) : wxString();
1130 const auto state =
m_state.lock();
1131 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1132 return row && row->localName !=
INVALID_ID ? state->engine.Keys().Name( row->localName ) : wxString();
1137 const auto state =
m_state.lock();
1138 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1139 return row && row->fullLocalName !=
INVALID_ID ? state->engine.Keys().Name( row->fullLocalName ) : wxString();
1144 const auto state =
m_state.lock();
1145 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1151 const auto state =
m_state.lock();
1152 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1158 const auto state =
m_state.lock();
1159 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1160 return !row || !row->driver;
1165 const auto state =
m_state.lock();
1166 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1167 return row ? row->netCode : 0;
1172 const auto state =
m_state.lock();
1173 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1174 return row ? row->subgraphCode : 0;
1179 const auto state =
m_state.lock();
1180 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1181 return row && row->driver ? state->Resolve( *row->driver ) :
nullptr;
1186 std::vector<SCH_ITEM*>
result;
1187 const auto state =
m_state.lock();
1189 if( !state || !state->Row(
m_item ) )
1192 const auto& neighbors = state->engine.Published().Auxiliary().NeighborsOf();
1193 const auto found = neighbors.find(
m_item );
1195 if( found == neighbors.end() )
1198 result.reserve( found->second.size() );
1200 for(
const KIID&
id : found->second )
1202 if(
SCH_ITEM* item = state->Resolve( { id, m_item.inst } ) )
1203 result.push_back( item );
1211 const auto state =
m_state.lock();
1212 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1213 return row ? state->Sheet( row->driver ) :
KIID_PATH();
1218 const auto state =
m_state.lock();
1219 const auto* row = state ? state->Row(
m_item ) :
nullptr;
1228 return std::nullopt;
1230 const auto* row =
m_state->Row( { aItem, *instance } );
1233 return std::nullopt;
1240 const auto live =
m_state->LiveInstances();
1241 std::vector<NET_GROUP>
result;
1255 const auto live =
m_state->LiveInstances();
1256 std::vector<wxString>
result;
1261 if(
m_state->AnyLive( node, live ) )
1274 return std::nullopt;
1282 const auto node =
m_state->BusNode( aName );
1287 const auto live =
m_state->LiveInstances();
1289 if( !
m_state->AnyLive( *node, live ) )
1293 std::vector<NODE_ID> nodes( members.begin(), members.end() );
1294 nodes.push_back( *node );
1302 if( parents.empty() )
1305 const auto live =
m_state->LiveInstances();
1307 if( !
m_state->AnyLive( aSignal, live ) )
1310 return m_state->Groups( { parents.begin(), parents.end() }, live,
m_state );
1315 const auto node =
m_state->BusNode( aName );
1320 const auto live =
m_state->LiveInstances();
1322 if( !
m_state->AnyLive( *node, live ) )
1326 std::erase_if( names, [&](
const wxString&
name )
1336 const auto state =
m_state.lock();
1342 const auto state =
m_state.lock();
1344 return net ? state->Name( *net, aIgnoreSheet ) : wxString();
1349 const auto state =
m_state.lock();
1356 const auto state =
m_state.lock();
1363 const auto state =
m_state.lock();
1365 return net && net->content->best ? state->Resolve( net->content->best->source ) :
nullptr;
1370 const auto state =
m_state.lock();
1372 return net && net->content->best ? state->Sheet( net->content->best->source ) :
KIID_PATH();
1377 const auto state =
m_state.lock();
1384 std::vector<SCH_ITEM*>
result;
1385 const auto state =
m_state.lock();
1391 result.reserve( ids.size() );
1393 for(
const KIID&
id : ids )
1395 if(
SCH_ITEM* item = state->Resolve( { id, m_instance } ) )
1396 result.push_back( item );
bool operator==(const wxAuiPaneInfo &aLhs, const wxAuiPaneInfo &aRhs)
Handle the graphic items list to draw/plot the frame and title block.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
void SaveInString(wxString *aOutputString)
Save the description in a buffer.
static void SetAltInstance(DS_DATA_MODEL *aLayout=nullptr)
Set an alternate instance of DS_DATA_MODEL.
KICAD_T Type() const
Returns the type of object.
NET_SETTINGS stores various net-related settings in a project context.
void ClearCacheForNet(const wxString &netName)
Clears the net cache and cached bus classes derived from that net.
void ClearNetclassLabelAssignment(const wxString &netName)
Clears a specific net name to netclass assignment Calling user is responsible for resetting the effec...
void SetNetclassLabelAssignment(const wxString &netName, const std::set< wxString > &netclasses)
Sets a net name to netclasses assignment Calling user is responsible for resetting the effective netc...
const std::map< wxString, std::set< wxString > > & GetNetclassLabelAssignments() const
Gets all current net name to netclasses assignments.
wxString GetTypeAsString() const
const VECTOR2D & GetSizeMils() const
std::shared_ptr< NET_SETTINGS > & NetSettings()
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual PROJECT_FILE & GetProjectFile() const
Holds all the data relating to one schematic.
SCH_CONNECTIVITY::NETCHAIN_MANAGER & NetChains() const
wxString GetVariantDescription(const wxString &aVariantName) const
Return the description for a variant.
SCH_SHEET_LIST BuildSheetListSortedByPageNumbers() const
const std::vector< std::shared_ptr< BUS_ALIAS > > & GetAllBusAliases() const
wxString GetFileName() const
Helper to retrieve the filename from the root sheet screen.
PROJECT & Project() const
Return a reference to the project this schematic is part of.
wxString GetCurrentVariant() const
Return the current variant being edited.
bool IsValid() const
A simple test if the schematic is loaded, not a complete one.
SCH_SHEET_PATH & CurrentSheet() const
std::map< std::pair< KIID, KIID_PATH >, wxString > PackageRefSuffixes() const
Symbol and sheet path of each instance whose package suffix is another sheet's, with that suffix.
Base class for a bus or wire entry.
const AREA_INDEX & RuleAreasOf() const
Owns one key/version session and its current stage evaluations; main-thread use only.
Model-owned source resolver.
std::optional< NET_GROUP > NetByName(const wxString &aName) const
void Update(SCHEMATIC &aSchematic, bool aRebuild=false)
std::optional< NET_VIEW > GetSubgraphForItem(const KIID &aItem, const KIID_PATH &aPath) const
void Recalculate(SCHEMATIC &aSchematic, bool aRebuild=false, const std::function< void(SCH_ITEM *)> &aChangedHandler={})
Update the complete model and apply netclasses, dangling flags and dirty-state clearing.
void ApplyNetclasses(NET_SETTINGS &aSettings) const
Replace label-derived assignments from a complete publication; invalidate changed net caches.
std::vector< NET_GROUP > GetNetMap() const
Owned query-time groups in canonical name order, with unique instances in KIID_PATH order.
std::vector< TEXT_CHECK_FACT > TextChecks(const KIID_PATH &aPath, bool aDrawingSheet=false) const
std::vector< wxString > NetNames() const
const SESSION_KEYS & Keys() const
void PrepareSimulationModels(SCHEMATIC &aSchematic)
const ENGINE & Engine() const
void updateModel(SCHEMATIC &aSchematic, const SCH_SHEET_LIST &aPaths, bool aRebuild)
Capture the text context and advance the text epoch when it or an external source changed.
void PrepareTextChecks(SCHEMATIC &aSchematic, bool aIncludeDrawingSheet=false)
std::vector< SIMULATION_MODEL_FACT > SimulationModels(const KIID_PATH &aPath) const
bool UpdateShadow(SCHEMATIC &aSchematic, const SCH_SHEET_LIST &aPaths, bool aRebuild=false)
std::optional< ITEM_VIEW > Connection(const KIID &aItem, const KIID_PATH &aPath) const
const PUBLICATION & Published() const
SUBSCRIPTION Subscribe(std::function< void(const CHANGE_SET &)> aListener)
std::vector< wxString > GetEquivalentBusNames(const wxString &aName) const
std::vector< NET_GROUP > BundlesOf(NODE_ID aSignal) const
std::shared_ptr< FACADE_STATE > m_state
std::vector< NET_GROUP > BusWithMembers(const wxString &aName) const
Excludes derived graph text and shares dynamic source values through nested resolvers.
bool IsUnconnected() const
wxString FullLocalName() const
BUS_MEMBERS Members() const
SCH_ITEM * Driver() const
wxString Name(bool aIgnoreSheet=false) const
wxString LocalName() const
std::weak_ptr< const FACADE_STATE > m_state
uint32_t SubgraphCode() const
std::vector< SCH_ITEM * > ConnectedItems() const
void Rebuild(const NETCHAIN_INPUT &aConnectivity, const std::function< void(NETCHAIN_MANAGER &)> &aBeforePublish={})
void ApplyNetChainNetclasses()
Mirror each committed net chain's netclass override into the project NET_SETTINGS as a chain-derived ...
wxString Name(bool aIgnoreSheet=false) const
BUS_MEMBERS Members() const
SCH_ITEM * Driver() const
std::vector< SCH_ITEM * > Items() const
KIID_PATH Instance() const
std::weak_ptr< const FACADE_STATE > m_state
PUBLICATION_HOLD(const FACADE &aFacade)
std::weak_ptr< FACADE_STATE > m_state
std::span< const NODE_ID > MembersOf(NODE_ID aBundle) const
std::vector< wxString > EquivalentBusNames(const wxString &aName) const
const AUXILIARY & Auxiliary() const
std::span< const NODE_ID > ParentsOf(NODE_ID aSignal) const
const CHANGE_SET & Changes() const
std::optional< NODE_ID > FindByName(const wxString &aName) const
static bool Active()
True inside a render scope, unless an INPUT_TEXT_SCOPE is also active.
Session IDs are dense handles, never a canonical ordering.
const wxString & Name(NAME_ID aId) const
const KIID_PATH & Instance(INST_ID aId) const
std::optional< INST_ID > FindInstance(const KIID_PATH &aPath) const
Main-thread registration owner.
SUBSCRIPTION & operator=(const SUBSCRIPTION &)=delete
std::weak_ptr< FACADE_STATE > m_state
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
Segment description base class to describe items which have 2 end points (track, wire,...
static wxString MakeKey(const wxString &aName, uint32_t aComponent)
const PAGE_INFO & GetPageSettings() const
uint64_t ConnectivityId() const
Process-local lifetime identity; file UUIDs can be shared by distinct screens.
uint64_t ConnectivityRevision() const
The only change signal that the connectivity engine reads from this screen.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
const wxString & GetFileName() const
std::weak_ptr< const CONNECTIVITY_SOURCE > ConnectivitySource() const
SCH_ITEM * GetConnectivityItem(const KIID &aId) const
Resolve a drawing item or a connectable child on this screen; ambiguous IDs return null.
TITLE_BLOCK & GetTitleBlock()
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
const KIID_PATH & PathRef() const
Borrow the cached path until this sheet path is modified or destroyed.
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flags.
bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
const std::vector< SCH_SHEET_INSTANCE > & GetInstances() const
const wxString & GetCompany() const
const wxString & GetRevision() const
const wxString & GetDate() const
const wxString & GetComment(int aIdx) const
const wxString & GetTitle() const
bool equivalent(SIM_MODEL::DEVICE_T a, SIM_MODEL::DEVICE_T b)
Value keys and the key session of the schematic connectivity engine.
std::map< wxString, std::vector< wxString > > BUS_ALIASES
Bus alias table, from alias name to member texts.
uint32_t INST_ID
Session handle of a sheet instance KIID_PATH.
std::vector< SIMULATION_MODEL_FACT > ExtractSimulationModelFacts(const SCH_SHEET_PATH &aPath, const wxString &aVariantName)
std::vector< TEXT_CHECK_FACT > ExtractTextChecks(const SCH_SCREEN &aScreen, const SCH_SHEET_PATH &aPath)
uint32_t NAME_ID
Session handle of a name, ordered by UTF-8 value through NAME_LESS.
uint64_t SCREEN_ID
Process-local SCH_SCREEN::ConnectivityId(), never a file UUID.
uint32_t NODE_ID
Session handle of a NODE_KEY graph node.
std::vector< TEXT_CHECK_FACT > ExtractDrawingSheetTextChecks(const SCH_SCREEN &aScreen, const SCH_SHEET_PATH &aPath)
TEXT_EVAL::ENVIRONMENT TEXT_ENVIRONMENT
BUS_ALIGNMENT Align(const BUS_SCHEMA &aLeft, const BUS_SCHEMA &aRight)
Match the leaves of aLeft to the leaves of aRight.
constexpr uint32_t INVALID_ID
Marks an unset handle.
wxString GetContextPath()
Return the current context path for repo-scoped VCS queries.
bool GetContextIsFile()
File/directory classification captured when the current context was activated.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Member correspondence between two bus schemas.
std::vector< size_t > unmappedLeft
Left leaf ordinals without a right partner.
std::vector< std::pair< size_t, size_t > > matched
Pairs of left and right leaf ordinals.
Query-time snapshot; reacquire after Update.
Difference between two publications.
std::vector< ITEM_KEY > changedItems
Items whose row, island, rule area, source or text changed.
std::shared_ptr< const COMPONENT_CONTENT > content
std::map< INST_ID, std::vector< KIID > > instances
std::optional< std::vector< TEXT_CHECK_FACT > > drawingSheet
std::vector< TEXT_CHECK_FACT > items
std::map< NODE_ID, std::shared_ptr< const NET_ITEMS > > netItems
std::optional< NODE_ID > BusNode(const wxString &aName) const
std::vector< NET_GROUP > Groups(std::vector< NODE_ID > aNodes, std::span< const INST_ID > aLive, const std::weak_ptr< const FACADE_STATE > &aState) const
uint64_t dispatchGeneration
std::vector< INST_ID > LiveInstances() const
const ITEM_RESULT * Row(const ITEM_KEY &aItem) const
KIID_PATH Sheet(const std::optional< ITEM_KEY > &aDriver) const
const PUBLISHED_COMPONENT * Net(NODE_ID aNode, INST_ID aInstance) const
std::optional< NET_GROUP > Group(NODE_ID aNode, std::span< const INST_ID > aLive, const std::weak_ptr< const FACADE_STATE > &aState) const
wxString Name(const PUBLISHED_COMPONENT &aComponent, bool aIgnoreSheet) const
unsigned publicationHolds
std::map< INST_ID, std::weak_ptr< const SCH_SCREEN::CONNECTIVITY_SOURCE > > sources
bool AnyLive(NODE_ID aNode, std::span< const INST_ID > aLive) const
std::map< uint64_t, std::function< void(const CHANGE_SET &)> > listeners
BUS_MEMBERS Members(NODE_ID aNode, INST_ID aInstance, const std::weak_ptr< const FACADE_STATE > &aState, const ITEM_RESULT *aRow=nullptr) const
bool Current(const SCH_SCREEN &aScreen) const
SCH_SCREEN * Screen(const std::weak_ptr< const SCH_SCREEN::CONNECTIVITY_SOURCE > &aSource) const
SCH_ITEM * Resolve(const ITEM_KEY &aItem) const
std::optional< MODEL_TEXT_CONTEXT > textContext
SCH_SHEET_LIST SourcePaths(SCHEMATIC &aSchematic) const
std::optional< std::map< KIID_PATH, std::vector< SIMULATION_MODEL_FACT > > > simulationModels
SCH_SCREEN * Screen(INST_ID aInstance) const
std::optional< std::map< KIID_PATH, TEXT_CHECKS > > textChecks
One item or pin in one sheet instance.
KIID item
The item or pin KIID.
INST_ID inst
The sheet instance that shows the item.
Published connection of one item on one sheet instance.
Orders keys by value through SESSION_KEYS::Less().
Orders name handles by UTF-8 value.
One published net or bus with its identity.
NAME_ID name
Unique name, invalid without a claim.
std::shared_ptr< const COMPONENT_CONTENT > content
One member position of a bus.
ITEM_KEY bundleDriver
The source item of the claim that defines the leaf order.
std::vector< DATABASE_CONNECTION::ROW > rows
wxString result
Test unit parsing edge cases and error handling.
VECTOR2< double > VECTOR2D