-
Notifications
You must be signed in to change notification settings - Fork 11
/
desurveyhole_dialog.py
105 lines (88 loc) · 4.65 KB
/
desurveyhole_dialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import os
from PyQt5 import QtCore, uic
from PyQt5 import QtWidgets
from qgis.core import *
from qgis.utils import *
from qgis.gui import *
from .dialogBase import dialogBase
# Load the UI file
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'desurveyhole_dialog_base.ui'))
class DesurveyHoleDialog(QtWidgets.QDialog, dialogBase, FORM_CLASS):
"""Dialog for managing desurveyed holes."""
def __init__(self, manager, parent=None):
"""
Constructor for DesurveyHoleDialog.
Args:
manager (DrillManager): Instance of DrillManager.
parent (QWidget): Parent widget (default is None).
"""
super(DesurveyHoleDialog, self).__init__(parent)
# Keep a reference to the DrillManager
self.drillManager = manager
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)
# Setup ComboBox filters
self.lbCollarLayer.setFilters(QgsMapLayerProxyModel.PointLayer)
self.lbSurveyLayer.setFilters(QgsMapLayerProxyModel.NoGeometry)
# Initialise local variables and ComboBoxes
self.checkDownDipNegative.setChecked(self.drillManager.downDipNegative)
self.leDesurveyLength.setText(str(self.drillManager.desurveyLength))
self.initLayer(self.drillManager.collarLayer, self.lbCollarLayer, ["collar", "hole"])
self.initLayer(self.drillManager.surveyLayer, self.lbSurveyLayer, ["survey"])
# Connect signals to slots
self.lbCollarLayer.layerChanged.connect(self.onCollarLayerChanged)
self.lbSurveyLayer.layerChanged.connect(self.onSurveyLayerChanged)
# Initialize configurations
self.onCollarLayerChanged()
self.onSurveyLayerChanged()
def onCollarLayerChanged(self):
"""Handle changes in the collar layer."""
layer = self.lbCollarLayer.currentLayer()
if layer is not None and layer.isValid():
# Set up fields for collar layer
self.fbCollarId.setLayer(layer)
self.initField(self.drillManager.collarId, self.fbCollarId, ["holeid", "bhid", "id", "hole", "name"])
self.fbCollarDepth.setLayer(layer)
self.initField(self.drillManager.collarDepth, self.fbCollarDepth, ["eoh", "e.o.h", "totaldepth", "depth", "length"])
self.fbCollarEast.setLayer(layer)
self.initField(self.drillManager.collarEast, self.fbCollarEast, ["east", "x"])
self.fbCollarNorth.setLayer(layer)
self.initField(self.drillManager.collarNorth, self.fbCollarNorth, ["north", "y"])
self.fbCollarElev.setLayer(layer)
self.initField(self.drillManager.collarElev, self.fbCollarElev, ["elev", "rl", "z"])
self.fbCollarAz.setLayer(layer)
self.initField(self.drillManager.collarAz, self.fbCollarAz, ["azimuth", "az"])
self.fbCollarDip.setLayer(layer)
self.initField(self.drillManager.collarDip, self.fbCollarDip, ["dip", "incl"])
else:
# Reset configurations if no valid layer is selected
self.fbCollarId.setCurrentIndex(-1)
self.fbCollarEast.setCurrentIndex(-1)
self.fbCollarNorth.setCurrentIndex(-1)
self.fbCollarElev.setCurrentIndex(-1)
self.fbCollarAz.setCurrentIndex(-1)
self.fbCollarDip.setCurrentIndex(-1)
def onSurveyLayerChanged(self):
"""Handle changes in the survey layer."""
layer = self.lbSurveyLayer.currentLayer()
if layer is not None and layer.isValid():
# Set up fields for survey layer
self.fbSurveyId.setLayer(layer)
self.initField(self.drillManager.surveyId, self.fbSurveyId, ["holeid", "bhid", "id", "hole", "name"])
self.fbSurveyDepth.setLayer(layer)
self.initField(self.drillManager.surveyDepth, self.fbSurveyDepth, ["depth", "at"])
self.fbSurveyAz.setLayer(layer)
self.initField(self.drillManager.surveyAz, self.fbSurveyAz, ["azimuth", "az"])
self.fbSurveyDip.setLayer(layer)
self.initField(self.drillManager.surveyDip, self.fbSurveyDip, ["dip", "incl"])
else:
# Reset configurations if no valid layer is selected
self.fbSurveyId.setCurrentIndex(-1)
self.fbSurveyDepth.setCurrentIndex(-1)
self.fbSurveyAz.setCurrentIndex(-1)
self.fbSurveyDip.setCurrentIndex(-1)