Skip to content

Commit 83bb95f

Browse files
committed
fix: build the parametric faults with constraints
The parametric faults and the fault abutting relationships were built only in update_fault_features, which runs only with "map". Build them in the constraints mode too. The test for a mode change of an empty model used the fixture, which has a foliation in the model, so the model was not empty. Use a new manager.
1 parent fe34df2 commit 83bb95f

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎loopstructural/main/model_manager.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,11 @@ def update_model(
17301730
# Update the model with stratigraphy
17311731
self.update_fault_features()
17321732
self.update_foliation_features()
1733+
else:
1734+
# The parametric faults are not map data, so build them in
1735+
# both modes. With "map", update_fault_features builds them.
1736+
self._build_parametric_faults()
1737+
self.apply_fault_abutting_relationships()
17331738
# after the stratigraphy, so each gets the same unconformity
17341739
# regions as when the user added it
17351740
self._build_manual_foliations()

‎tests/qgis/test_parametric_fault.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from LoopStructural.datatypes import BoundingBox
1313

1414
from loopstructural.main.model_manager import GeologicalModelManager
15+
from loopstructural.main.workflow_mode import WORKFLOW_MODE_CONSTRAINTS
1516
from loopstructural.toolbelt.preferences import PlgSettingsStructure
1617

1718

@@ -55,6 +56,12 @@ def test_the_fault_is_built_by_update_model(self, manager):
5556
manager.update_model(notify_observers=False)
5657
assert 'F1' in _names(manager)
5758

59+
def test_the_fault_is_built_with_constraints(self, manager):
60+
manager.set_workflow_mode(WORKFLOW_MODE_CONSTRAINTS)
61+
manager.add_parametric_fault(_spec())
62+
manager.update_model(notify_observers=False)
63+
assert 'F1' in _names(manager)
64+
5865
def test_the_fault_surface_is_where_the_fault_is(self, manager):
5966
manager.add_parametric_fault(_spec())
6067
manager.update_model(notify_observers=False)

‎tests/qgis/test_workflow_mode_model.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ def test_a_change_of_the_mode_makes_a_built_model_stale(self, manager):
124124
manager.set_workflow_mode(WORKFLOW_MODE_CONSTRAINTS)
125125
assert manager.model_state == 'stale'
126126

127-
def test_a_change_of_the_mode_of_an_empty_model_is_not_stale(self, manager):
127+
def test_a_change_of_the_mode_of_an_empty_model_is_not_stale(self):
128+
# not the fixture: add_foliation puts 's1' into the model
129+
manager = GeologicalModelManager(debug_manager=_DebugManager())
128130
manager.set_workflow_mode(WORKFLOW_MODE_CONSTRAINTS)
129131
assert manager.model_state == 'empty'
132+
assert not manager._column_dirty
130133

131134
def test_the_same_mode_does_not_make_the_model_stale(self, manager):
132135
manager.update_model(notify_observers=False)

0 commit comments

Comments
 (0)