66import json
77import numpy as np
88__title__ = "LoopStructural"
9-
9+ default_bounding_box = {
10+ 'xmin' : 0 ,
11+ 'xmax' : 1000 ,
12+ 'ymin' : 0 ,
13+ 'ymax' : 1000 ,
14+ 'zmin' : - 7000 ,
15+ 'zmax' : 1000
16+ }
1017class ModellingDataManager :
1118 def __init__ (self , * , project = None , mapCanvas = None , logger = None ):
1219 if project is None :
@@ -18,7 +25,8 @@ def __init__(self, *, project=None, mapCanvas=None, logger=None):
1825 self .project = project
1926 self .project .readProject .connect (self .onLoadProject )
2027 self .project .writeProject .connect (self .onSaveProject )
21- self ._bounding_box = BoundingBox (origin = [0 , 0 , 0 ], maximum = [1000 , 1000 , 1000 ])
28+ self ._bounding_box = BoundingBox (origin = [default_bounding_box ['xmin' ], default_bounding_box ['ymin' ], default_bounding_box ['zmin' ]], maximum = [default_bounding_box ['xmax' ], default_bounding_box ['ymax' ], default_bounding_box ['zmax' ]])
29+
2230 self ._basal_contacts = None
2331 self ._fault_traces = None
2432 self ._structural_orientations = None
@@ -94,6 +102,7 @@ def set_bounding_box(self, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None
94102
95103 def set_bounding_box_update_callback (self , callback ):
96104 self .bounding_box_callback = callback
105+ self .bounding_box_callback (self ._bounding_box )
97106 def set_fault_trace_layer_callback (self , callback ):
98107 """Set the callback for when the fault trace layer is updated."""
99108 self .fault_traces_callback = callback
@@ -248,7 +257,6 @@ def get_stratigraphic_column(self):
248257 def update_stratigraphy (self ):
249258 """Update the foliation features in the model manager."""
250259 print ("Updating stratigraphy..." )
251- self .update_stratigraphic_column ()
252260 if self ._model_manager is not None :
253261 if self ._basal_contacts is not None :
254262 self ._model_manager .update_contact_traces (qgsLayerToGeoDataFrame (self ._basal_contacts ['layer' ]),
@@ -336,7 +344,8 @@ def update_from_dict(self, data):
336344 ymax = data ['bounding_box' ]['maximum' ][1 ],
337345 zmin = data ['bounding_box' ]['origin' ][2 ],
338346 zmax = data ['bounding_box' ]['maximum' ][2 ])
339-
347+ else :
348+ self .set_bounding_box (** default_bounding_box )
340349 if 'basal_contacts' in data and data ['basal_contacts' ] is not None and 'layer' in data ['basal_contacts' ]:
341350 layer = self .find_layer_by_name (data ['basal_contacts' ]['layer' ])
342351 if layer :
@@ -357,8 +366,11 @@ def update_from_dict(self, data):
357366 orientation_type = data ['structural_orientations' ].get ('orientation_type' ,None ))
358367 if 'stratigraphic_column' in data :
359368 self ._stratigraphic_column .update_from_dict (data ['stratigraphic_column' ])
360- if self .stratigraphic_column_callback :
361- self .stratigraphic_column_callback ()
369+ else :
370+ self ._stratigraphic_column = StratigraphicColumn ()
371+
372+ if self .stratigraphic_column_callback :
373+ self .stratigraphic_column_callback ()
362374
363375 def find_layer_by_name (self , layer_name ):
364376 """Find a layer by name in the project."""
0 commit comments