Files
IfcOpenShell/src/bonsaiviewer/modules/models/SettingsDialog.h
T
Dion Moult 75c9da5098 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>
2026-07-08 14:10:05 +10:00

106 lines
3.9 KiB
C++

// This file was generated with the assistance of an AI coding tool.
/********************************************************************************
* *
* This file is part of Bonsai. *
* *
* Bonsai is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3.0 of the License, or *
* (at your option) any later version. *
* *
* Bonsai is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
#ifndef IFCINTERFACE_MODULES_MODELS_SETTINGSDIALOG_H
#define IFCINTERFACE_MODULES_MODELS_SETTINGSDIALOG_H
#include "../../components/Dialog.h"
#include "Types.h"
#include <QString>
#include <vector>
class Federation;
class SceneLoader;
class QComboBox;
class QLabel;
class QLineEdit;
class QShowEvent;
class QTableWidget;
class QTableWidgetItem;
namespace bonsaiviewer {
class SessionState;
}
namespace bonsaiviewer::modules::models {
class SettingsView;
class SettingsDialog : public components::TabbedDialog {
Q_OBJECT
public:
explicit SettingsDialog(bonsaiviewer::SessionState* session_state, QWidget* parent = nullptr);
void renderSelectedModelGeoref(const SelectedModelGeorefState& state);
protected:
void showEvent(QShowEvent* event) override;
private:
struct ModelRowWidgets {
QString model_id;
QComboBox* frame = nullptr;
QTableWidgetItem* from_point = nullptr;
QTableWidgetItem* to_point = nullptr;
QTableWidgetItem* rotate = nullptr;
QTableWidgetItem* pivot = nullptr;
};
void setupUi();
void syncFromFederation();
void populateModelTable();
void updateSelectedModelGeoref();
void onAccepted();
bonsaiviewer::SessionState* session_state_ = nullptr;
Federation* federation_ = nullptr;
SceneLoader* loader_ = nullptr;
QComboBox* unit_combo_ = nullptr;
QLineEdit* xyz_x_ = nullptr;
QLineEdit* xyz_y_ = nullptr;
QLineEdit* xyz_z_ = nullptr;
QLineEdit* rz_deg_ = nullptr;
QLabel* georef_present_value_ = nullptr;
QLabel* georef_type_value_ = nullptr;
QLabel* georef_project_unit_value_ = nullptr;
QLabel* georef_map_unit_value_ = nullptr;
QLabel* georef_easting_value_ = nullptr;
QLabel* georef_northing_value_ = nullptr;
QLabel* georef_height_value_ = nullptr;
QLabel* georef_x_axis_abscissa_value_ = nullptr;
QLabel* georef_x_axis_ordinate_value_ = nullptr;
QLabel* georef_rotation_dd_value_ = nullptr;
QLabel* georef_rotation_dms_value_ = nullptr;
QLabel* georef_scale_value_ = nullptr;
QLabel* georef_factor_x_value_ = nullptr;
QLabel* georef_factor_y_value_ = nullptr;
QLabel* georef_factor_z_value_ = nullptr;
QTableWidget* model_table_ = nullptr;
std::vector<ModelRowWidgets> model_rows_;
SettingsView* settings_view_ = nullptr;
};
} // namespace bonsaiviewer::modules::models
#endif