Skip to content

Commit eb2e059

Browse files
authored
feat: object registry and isosurfaces in the 3D view (6.8) (#145)
* feat: add an object registry to the viewer and isosurfaces from a feature Move the mesh builders out of feature_list_widget into a module without Qt, keep the viewer objects and their sources in an object registry, group the object list by source feature, and add "Add isosurface..." to the menu of a model feature. The value of an isosurface can change in the object properties. * fix: review fixes for the object registry and isosurfaces - Allow one model task at a time across the update of the out-of-date objects, the isosurfaces and the tasks of ViewerActionsWidget. - Rename the object when change_isovalue changes its value. - Mark an isosurface out of date if the model changed while it was built. - Fix the ruff error B007 in _on_isosurfaces_finished.
1 parent 036ce18 commit eb2e059

20 files changed

Lines changed: 2696 additions & 2117 deletions

‎docs/development/usability-plan.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -713,30 +713,30 @@ Rules:
713713

714714
Tasks:
715715

716-
- [ ] Read the three files and write a short list of what each class does and
716+
- [x] Read the three files and write a short list of what each class does and
717717
which methods are duplicated or not used. Remove dead code first.
718-
- [ ] Add an object registry class (no Qt) for the meshes and their source
718+
- [x] Add an object registry class (no Qt) for the meshes and their source
719719
information. Move the reads and writes of `viewer.meshes` to it.
720-
- [ ] Split `feature_list_widget.py`: move the mesh builders to a module without
720+
- [x] Split `feature_list_widget.py`: move the mesh builders to a module without
721721
Qt code (`mesh_builders.py`), and move the cross-section, block model and
722722
topography actions out of the tree widget.
723-
- [ ] Simplify `object_properties_widget.py`: one handler for the selected
723+
- [x] Simplify `object_properties_widget.py`: one handler for the selected
724724
object, and the controls shown for each source type, not a check for the
725725
object name in each method.
726-
- [ ] Simplify the object/model view (`object_list_widget.py`): group the
726+
- [x] Simplify the object/model view (`object_list_widget.py`): group the
727727
objects by source feature, and show the type and the isovalue of each
728728
object.
729-
- [ ] Add "Add isosurface..." to the menu of a model feature. The user enters
729+
- [x] Add "Add isosurface..." to the menu of a model feature. The user enters
730730
one or more values (a list, or a start, an end and a count). The default
731731
values come from the range of the scalar field. A pure function gives the
732732
values from the input.
733-
- [ ] Build the isosurfaces with the scalar field of the feature
733+
- [x] Build the isosurfaces with the scalar field of the feature
734734
(`feature.surfaces(value)`). Give each object a name with its value, for
735735
example `Fault_1_iso_0.50`. A value outside the range of the field gives
736736
a message in the message bar, not an error dialog.
737-
- [ ] Let the user change the value of an existing isosurface in the object
737+
- [x] Let the user change the value of an existing isosurface in the object
738738
properties. The object is built again.
739-
- [ ] Update the docs for the viewer.
739+
- [x] Update the docs for the viewer.
740740

741741
Acceptance: the user adds five isosurfaces from one feature in one action. They
742742
show in the object list under that feature, each with its value. The user

‎docs/usage/interface.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ The **Export** panel in step 5 is open when the model is solved. It has three ta
2020

2121
The exports run in the background and show a message when they finish.
2222

23+
### The 3D view
24+
The 3D view has three parts: the object list, the feature list with the action buttons, and the properties of the selected object.
25+
26+
- **Object list**: the objects in the view are in groups, one group for each source feature. Each row has a check box (show or hide), the name of the object, its type and, for a surface from a scalar value, its value. Select an object to see its properties. The right-click menu can zoom to an object, export it, show or hide it, or remove it.
27+
- **Feature list**: right-click a feature to add its scalar field, its surfaces, its vector field or its data. The action buttons under the list add the model bounding box, the fault and stratigraphic surfaces, the topography, cross sections and a block model.
28+
- **Out-of-date objects**: when the model changes, the objects that come from the model show in grey italic. The **Update** button under the feature list builds them again from the current model, with the same settings.
29+
30+
#### Isosurfaces
31+
Right-click a feature and choose **Add Isosurface...** to add the surface of the scalar field at values that you choose. Enter a list of values (for example `0.1, 0.5, 0.9`), or a start, an end and a count. The default values are inside the range of the scalar field. The plugin adds one object for each value. The name has the value, for example `Fault_1_iso_0.50`. These objects do not replace the surfaces that the model gives.
32+
33+
If the scalar field has no surface at a value (for example, the value is outside the range of the field), a message shows the value and the other surfaces are still added.
34+
35+
To change the value of an isosurface, select it in the object list, enter a new value in the **Isosurface** panel of the properties and choose **Apply**. Only this object is built again. The name of the object does not change. After the model changes, **Update** builds each isosurface again at its value.
36+
2337
The header of the dock has **Save**, **Open**, **Reset** and **Settings**. They apply to all of the plugin.
2438

2539
The toolbar has three actions: LoopStructural (the dock), 3D View and Help. The **Tools** submenu of the Plugins menu has the map2loop dialogs for advanced users.

‎loopstructural/gui/modelling/geological_model_tab/feature_details_panel/_base.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def _on_evaluate_target_changed(index):
487487
self.meshObjectCombo.clear()
488488
if self.plugin.loop_widget.visualisation_widget.plotter is not None:
489489
viewer = self.plugin.loop_widget.visualisation_widget.plotter
490-
mesh_names = list(viewer.meshes.keys())
490+
mesh_names = viewer.registry.names()
491491
self.meshObjectCombo.addItems(mesh_names)
492492

493493
self.evaluate_target_combo.currentIndexChanged.connect(_on_evaluate_target_changed)
@@ -774,7 +774,7 @@ def _export_scalar_points(self):
774774
mesh = self.meshObjectCombo.currentText()
775775
if not mesh:
776776
return
777-
vtk_mesh = viewer.meshes[mesh]['mesh']
777+
vtk_mesh = viewer.registry.get(mesh).mesh
778778
self.model_manager.export_feature_values_to_vtk_mesh(
779779
self.feature.name, vtk_mesh, scalar_type=scalar_type
780780
)

0 commit comments

Comments
 (0)