-
Notifications
You must be signed in to change notification settings - Fork 3
/
layer_parameter_extractor.py
276 lines (248 loc) · 9.78 KB
/
layer_parameter_extractor.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
"""
This python module generate data from individual layers.
This option is activated only when we choose qgis panel as the option to load the layer.
"""
from .feature_import import (
label_mover,
qline_and_label_mover,
qlineeditor_default_string,
)
from .clear_features import clear_partially_combo_list, hide_all_combo_list
from .load_vectors import qgis_load_table
def load_data_when_qgis_is_choosen(self, colname, geol_name, lyr):
"""
This function load col name of qgis layer if qgis checkbox is chosen as the data loader option
# colname : list of layer column name
# geol_name: the sender object name, this can be GeolButton, FaultButton and so on...
# lyr : the layer in use or layer selected to extract informations
"""
self.colNames = colname
clear_partially_combo_list(self, 10, 1)
hide_all_combo_list(self, 1)
if (
self.sender().objectName() == "Ok_pushButton"
and geol_name == "GeolButton"
and self.GeolButton.isEnabled() == True
):
# This condition select Qgis option to load data from QGIS layer panel for Geology layer
self.PlaceHolderQlineEdit.hide()
comboHeader = [
"Formation*",
"Group",
"Supergroup",
"Description",
"Fm code",
"Rocktype 1",
"Rocktype 2",
"Polygon ID",
"Min Age",
"Max Age",
]
self.combo_column_appender(self.colNames, geol_name)
self.geol_col_dict = {"geology column": self.colNames}
# print(f" The fault full data column: {self.geol_col_dict}")
qline_and_label_mover(
340, 200, 340, 220, " Sill Text:", self.Sill_Label, self.Sill_LineEditor
)
qline_and_label_mover(
340,
280,
340,
300,
" Intrusion Text:",
self.Intrusion_Label,
self.Intrusion_LineEditor,
)
qlineeditor_default_string(self, "sill", "intrusive")
self.geolcheck = self.Geology_checkBox.checkState()
elif (
self.sender().objectName() == "Ok_pushButton"
and geol_name == "FaultButton"
and self.FaultButton.isEnabled() == True
):
# This condition select Qgis option to load data from QGIS layer panel for Fault Polyline
comboHeader = [
"Default Dip",
"Dip Direction",
"Feature",
"Dip Direction type",
"Fdipest",
"Point ID",
"Dip Dir Convention",
]
self.combo_column_appender(self.colNames, geol_name)
DipDirectiontype_colNames = ["num", "alpha"]
DipDirectionConv_colNames = ["Dip Direction", "Strike"]
self.cmbDescriptionLayerIDName.clear(), self.cmbRocktype2LayerIDName.clear()
self.cmbDescriptionLayerIDName.addItems(DipDirectiontype_colNames)
self.cmbRocktype2LayerIDName.addItems(DipDirectionConv_colNames)
self.fault_col_dict = {"fault column": self.colNames}
# print(f" The fault full data column: {self.fault_col_dict}")
qline_and_label_mover(
340, 125, 340, 145, " Fault Text:", self.Sill_Label, self.Sill_LineEditor
)
qline_and_label_mover(
340,
185,
340,
205,
" fdipest Text:",
self.Intrusion_Label,
self.Intrusion_LineEditor,
)
qlineeditor_default_string(self, "Fault", "shallow,steep,vertical")
clear_partially_combo_list(self, 7, 1), clear_partially_combo_list(self, 7, 0)
self.faultcheck = self.Fault_checkBox.checkState()
elif (
self.sender().objectName() == "Ok_pushButton"
and geol_name == "StructButton"
and self.StructButton.isEnabled() == True
):
# This condition select Qgis option to load data from QGIS layer panel for Structure Point
comboHeader = [
"Dip*",
"Dip Direction*",
"Feature",
"Dip Dir Convention*",
"Overturned Field",
"Point ID",
]
self.combo_column_appender(self.colNames, geol_name)
DipDirectionConv_colNames = ["Dip Direction", "Strike"]
self.cmbDescriptionLayerIDName.clear()
self.cmbDescriptionLayerIDName.addItems(DipDirectionConv_colNames)
self.struc_col_dict = {"structure column": self.colNames}
# print(f" The fault full data column: {self.struc_col_dict}")
qline_and_label_mover(
340, 125, 340, 145, " Bedding Text:", self.Sill_Label, self.Sill_LineEditor
)
qline_and_label_mover(
340,
185,
340,
205,
" Overturned Text:",
self.Intrusion_Label,
self.Intrusion_LineEditor,
)
qlineeditor_default_string(self, "Bed", "overturned")
clear_partially_combo_list(self, 6, 1), clear_partially_combo_list(self, 6, 0)
self.structcheck = self.Structure_checkBox.checkState()
else:
pass
label_mover(self, comboHeader)
self.params_function_activator(True)
self.geolcheck = self.Geology_checkBox.checkState()
qgis_load_table(self, lyr, self.colNames)
self.Ok_pushButton.clicked.disconnect()
switch_qpush_in_qgis_option(self, geol_name)
self.data_updater()
self.dtm_push_activator()
# print('finish with '+str(geol_name)+' button')
return
def three_push_activator(self, flag):
"""
This function deal with Geol, Faul, Struct Qpushbutton.
# flag =1, Geol-->True and Fault-->False and Struct-->False. flag=10 to Fault-->True and Struct-->True
# flag =2, Fault-->True and Geol-->False and Struct-->False. flag=20 to Geol-->True and Struct-->True
# flag =3, Geol-->True and Fault-->False and Struct-->False. flag=30 to Fault-->True and Geol-->True
"""
list_of_push_features = [self.GeolButton, self.FaultButton, self.StructButton]
for idx, elt in enumerate(list_of_push_features):
if idx == 0:
if flag == 1:
elt.setEnabled(True)
list_of_push_features[idx + 1].setEnabled(False)
list_of_push_features[idx + 2].setEnabled(False)
elif flag == 10:
elt.setEnabled(False)
list_of_push_features[idx + 1].setEnabled(True)
list_of_push_features[idx + 2].setEnabled(True)
else:
pass
break
elif idx == 1:
if flag == 2:
elt.setEnabled(True)
list_of_push_features[idx - 1].setEnabled(False)
list_of_push_features[idx + 1].setEnabled(False)
elif flag == 20:
list_of_push_features[idx - 1].setEnabled(True)
list_of_push_features[idx + 1].setEnabled(True)
else:
pass
break
elif idx == 2:
if flag == 3:
elt.setEnabled(True)
list_of_push_features[idx - 1].setEnabled(False)
list_of_push_features[idx - 2].setEnabled(False)
elif flag == 30:
list_of_push_features[idx - 1].setEnabled(True)
list_of_push_features[idx - 2].setEnabled(True)
else:
pass
break
else:
pass
return
def switch_qpush_in_qgis_option(self, name):
"""
This function is used to activate qpush button when Qgis option is chosen.
"""
try:
if name == "StructButton":
self.StructButton.setEnabled(False)
if (
self.Fault_checkBox.isChecked() == True
and self.Geology_checkBox.isChecked() == True
):
self.GeolButton.setEnabled(False), self.FaultButton.setEnabled(False)
pass
else:
self.GeolButton.setEnabled(True), self.FaultButton.setEnabled(True)
if self.Fault_checkBox.isChecked() == True:
self.FaultButton.setEnabled(False)
else:
self.FaultButton.setEnabled(True)
if self.Geology_checkBox.isChecked() == True:
self.GeolButton.setEnabled(False)
else:
self.GeolButton.setEnabled(True)
elif name == "FaultButton":
self.FaultButton.setEnabled(False)
if (
self.Geology_checkBox.isChecked() == True
and self.Structure_checkBox.isChecked() == True
):
self.GeolButton.setEnabled(False), self.StructButton.setEnabled(False)
else:
self.GeolButton.setEnabled(True), self.StructButton.setEnabled(True)
if self.Structure_checkBox.isChecked() == True:
self.StructButton.setEnabled(False)
else:
self.StructButton.setEnabled(True)
if self.Geology_checkBox.isChecked() == True:
self.GeolButton.setEnabled(False)
else:
self.GeolButton.setEnabled(True)
elif name == "GeolButton":
self.GeolButton.setEnabled(False)
if (
self.Fault_checkBox.isChecked() == True
and self.Structure_checkBox.isChecked() == True
):
self.StructButton.setEnabled(False), self.FaultButton.setEnabled(False)
else:
self.StructButton.setEnabled(True), self.FaultButton.setEnabled(True)
if self.Structure_checkBox.isChecked() == True:
self.StructButton.setEnabled(False)
else:
self.StructButton.setEnabled(True)
if self.Fault_checkBox.isChecked() == True:
self.FaultButton.setEnabled(False)
else:
self.FaultButton.setEnabled(True)
except:
pass
return