mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
ifcviewer: overhaul model/object ID tracking
Rename the two overloaded model identifiers and make object_id assignment single-authority, fixing a pick -> properties mismatch. Identifiers: - Per-model UUID fed_id -> model_id; the uint32 runtime handle model_id -> session_model_id (SessionState accessors + mirror hashes renamed to match). "fed_id" was a misnomer -- the federation is the whole collection, not one model. object_id assignment (fixes wrong class on click): - Producers (GeometryStreamer, .ifcview sidecar) now stamp model-LOCAL object_ids; ViewportCore::applyCachedModel is the sole authority that assigns the session-global id (base + local). Removed SceneLoader::next_object_id_, GeometryStreamer::lastObjectId(), and the streamer's start_object_id parameter. - The element table is stamped by the same base on both load paths (applySidecarData and onStreamerFinished), so registry ids match the ids pick returns. Previously the sidecar path double-rebased instances vs the registry (click IfcSite -> showed IfcDoor); the live-stream path had the same latent mismatch. Both closed. Naming / cleanup: - SceneLoader::addFiles -> queueModels; startStreamLoadFor -> loadFromGeometryStreamer; readSidecarMetadataOnly -> readSidecarMetadata. - Federation::addModel takes an explicit display_name (no QFileInfo fallback); callers pass QFileInfo(path).fileName(). - Disambiguate cryptic short locals (d->sidecar, m->model, c->chunk, ...) in SceneLoader, Federation, ViewportWindow, AreaMeasurement, SectionGizmoRenderer, and the SidecarData/SidecarReadPlan spots in ViewportCore. Tests: 125/125 pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -64,25 +64,25 @@ public:
|
||||
void setProgress(int percent);
|
||||
void endProgress();
|
||||
|
||||
void setModelMapping(const QString& fed_id, uint32_t model_id);
|
||||
void removeModelMappingByFedId(const QString& fed_id);
|
||||
void setModelMapping(const QString& model_id, uint32_t session_model_id);
|
||||
void removeModelMappingByModelId(const QString& model_id);
|
||||
void clearModelMappings();
|
||||
|
||||
// Per-session cloud metadata returned by connectors (revision/date/
|
||||
// author/...). Not persisted to the .ifcfed; display only. Lifetime
|
||||
// is tied to the fed_id — removeModelMappingByFedId and
|
||||
// is tied to the model_id — removeModelMappingByModelId and
|
||||
// clearModelMappings drop the matching entries.
|
||||
void setCloudMetadata(const QString& fed_id, const QVariantMap& metadata);
|
||||
QVariantMap cloudMetadata(const QString& fed_id) const;
|
||||
uint32_t modelIdForFedId(const QString& fed_id) const;
|
||||
QString fedIdForModelId(uint32_t model_id) const;
|
||||
QList<uint32_t> modelIds() const;
|
||||
void setCloudMetadata(const QString& model_id, const QVariantMap& metadata);
|
||||
QVariantMap cloudMetadata(const QString& model_id) const;
|
||||
uint32_t sessionModelIdForModelId(const QString& model_id) const;
|
||||
QString modelIdForSessionModelId(uint32_t session_model_id) const;
|
||||
QList<uint32_t> sessionModelIds() const;
|
||||
|
||||
void notifySelectionChanged();
|
||||
void notifyModelsChanged();
|
||||
void notifyFederationChanged();
|
||||
void notifyVisibilityChanged();
|
||||
void notifyModelGeometryReady(uint32_t model_id);
|
||||
void notifyModelGeometryReady(uint32_t session_model_id);
|
||||
void notifyProjectOpened(const QString& path);
|
||||
void notifyProjectSaved(const QString& path);
|
||||
void notifyProjectReset();
|
||||
@@ -100,7 +100,7 @@ signals:
|
||||
// Fires when a model's geometry has been pushed to the viewport. Fires
|
||||
// for both sidecar-cache and stream loads; subscribers that just need to
|
||||
// re-derive view state (e.g. ViewportView::refresh) listen to this.
|
||||
void modelGeometryReady(uint32_t model_id);
|
||||
void modelGeometryReady(uint32_t session_model_id);
|
||||
// Fires when SceneLoader reports a load failure. SessionState turns the
|
||||
// raw loader signal into a session-level one so views (e.g. the MessageBox)
|
||||
// can subscribe without touching the loader directly.
|
||||
@@ -119,8 +119,8 @@ private:
|
||||
uint32_t selected_object_id_ = 0;
|
||||
QString status_mode_;
|
||||
QString status_detail_;
|
||||
QHash<QString, uint32_t> fed_id_to_model_id_;
|
||||
QHash<uint32_t, QString> model_id_to_fed_id_;
|
||||
QHash<QString, uint32_t> model_id_to_session_model_id_;
|
||||
QHash<uint32_t, QString> session_model_id_to_model_id_;
|
||||
QHash<QString, QVariantMap> cloud_metadata_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user