@@ -44,9 +44,10 @@ def __init__(self, parent=None, data_manager=None, debug_manager=None):
4444 self .basalContactsComboBox .setFilters (QgsMapLayerProxyModel .LineLayer )
4545 self .sampledContactsComboBox .setFilters (QgsMapLayerProxyModel .PointLayer )
4646 self .structureLayerComboBox .setFilters (QgsMapLayerProxyModel .PointLayer )
47+ self .crossSectionLayerComboBox .setFilters (QgsMapLayerProxyModel .LineLayer )
4748
4849 # Initialize calculator types
49- self .calculator_types = ["InterpolatedStructure" , "StructuralPoint" ]
50+ self .calculator_types = ["InterpolatedStructure" , "StructuralPoint" , "AlongSection" ]
5051 self .calculatorTypeComboBox .addItems (self .calculator_types )
5152
5253 # Initialize orientation types
@@ -149,6 +150,14 @@ def _guess_layers(self):
149150 if structure_layer_match :
150151 structure_layer = self .data_manager .find_layer_by_name (structure_layer_match )
151152 self .structureLayerComboBox .setLayer (structure_layer )
153+
154+ # Attempt to find cross-sections layer
155+ cross_sections_layer_names = get_layer_names (self .crossSectionLayerComboBox )
156+ cross_sections_matcher = ColumnMatcher (cross_sections_layer_names )
157+ cross_sections_layer_match = cross_sections_matcher .find_match ('CROSS_SECTIONS' )
158+ if cross_sections_layer_match :
159+ cross_sections_layer = self .data_manager .find_layer_by_name (cross_sections_layer_match )
160+ self .crossSectionLayerComboBox .setLayer (cross_sections_layer )
152161
153162 def _setup_field_combo_boxes (self ):
154163 """Set up field combo boxes to link to their respective layers."""
@@ -209,7 +218,18 @@ def _on_calculator_type_changed(self):
209218 if calculator_type == "StructuralPoint" :
210219 self .maxLineLengthLabel .setVisible (True )
211220 self .maxLineLengthSpinBox .setVisible (True )
212- else : # InterpolatedStructure
221+ self .crossSectionLayerLabel .setVisible (False )
222+ self .crossSectionLayerComboBox .setVisible (False )
223+
224+ if calculator_type == "InterpolatedStructure" :
225+ self .maxLineLengthLabel .setVisible (False )
226+ self .maxLineLengthSpinBox .setVisible (False )
227+ self .crossSectionLayerLabel .setVisible (False )
228+ self .crossSectionLayerComboBox .setVisible (False )
229+
230+ if calculator_type == "AlongSection" :
231+ self .crossSectionLayerLabel .setVisible (True )
232+ self .crossSectionLayerComboBox .setVisible (True )
213233 self .maxLineLengthLabel .setVisible (False )
214234 self .maxLineLengthSpinBox .setVisible (False )
215235
@@ -226,6 +246,7 @@ def _restore_selection(self):
226246 ('basal_contacts_layer' , self .basalContactsComboBox ),
227247 ('sampled_contacts_layer' , self .sampledContactsComboBox ),
228248 ('structure_layer' , self .structureLayerComboBox ),
249+ ("cross_sections_layer" , self .crossSectionLayerComboBox )
229250 ):
230251 if layer_name := settings .get (key ):
231252 layer = self .data_manager .find_layer_by_name (layer_name )
@@ -276,6 +297,11 @@ def _persist_selection(self):
276297 if self .structureLayerComboBox .currentLayer ()
277298 else None
278299 ),
300+ 'cross_sections_layer' : (
301+ self .crossSectionLayerComboBox .currentLayer ().name ()
302+ if self .crossSectionLayerComboBox .currentLayer ()
303+ else None
304+ ),
279305 'calculator_type_index' : self .calculatorTypeComboBox .currentIndex (),
280306 'orientation_type_index' : self .orientationTypeComboBox .currentIndex (),
281307 'max_line_length' : self .maxLineLengthSpinBox .value (),
@@ -308,6 +334,12 @@ def _run_calculator(self):
308334 if not self .structureLayerComboBox .currentLayer ():
309335 QMessageBox .warning (self , "Missing Input" , "Please select a structure layer." )
310336 return False
337+
338+ elif calculator_type == "AlongSection" :
339+ if not self .crossSectionLayerComboBox .currentLayer ():
340+ QMessageBox .warning (self , "Missing Input" , "Please select a cross-sections layer." )
341+ return False
342+
311343
312344 # Prepare parameters
313345 params = self .get_parameters ()
@@ -376,6 +408,7 @@ def get_parameters(self):
376408 'basal_contacts' : self .basalContactsComboBox .currentLayer (),
377409 'sampled_contacts' : self .sampledContactsComboBox .currentLayer (),
378410 'structure' : self .structureLayerComboBox .currentLayer (),
411+ 'cross_sections' : self .crossSectionLayerComboBox .currentLayer (),
379412 'orientation_type' : self .orientationTypeComboBox .currentText (),
380413 'unit_name_field' : self .unitNameFieldComboBox .currentField (),
381414 'dip_field' : self .dipFieldComboBox .currentField (),
0 commit comments