@@ -62,14 +62,14 @@ def setup_processing(self):
62
62
layout = QGridLayout ()
63
63
64
64
self .plot_stereonet_QPushButton = QPushButton (self .tr ("Plot stereonet" ))
65
- self .plot_stereonet_QPushButton .clicked .connect ( self .plot_stereonet )
65
+ self .plot_stereonet_QPushButton .clicked .connect ( self .process_geodata )
66
66
layout .addWidget (self .plot_stereonet_QPushButton , 0 , 0 , 1 , 1 )
67
67
68
68
self .plot_all_data_QRadioButton = QRadioButton ("all data" )
69
69
self .plot_all_data_QRadioButton .setChecked (True )
70
70
layout .addWidget (self .plot_all_data_QRadioButton , 0 ,1 ,1 ,1 )
71
71
72
- self .plot_selected_data_QRadioButton = QRadioButton ("selected " )
72
+ self .plot_selected_data_QRadioButton = QRadioButton ("selection " )
73
73
layout .addWidget (self .plot_selected_data_QRadioButton , 0 ,2 ,1 ,1 )
74
74
75
75
processing_QGroupBox .setLayout (layout )
@@ -156,9 +156,9 @@ def parse_field_choice(self, val, choose_message):
156
156
return val
157
157
158
158
159
- def get_used_field_names (self ):
159
+ def get_actual_field_names (self ):
160
160
161
- used_field_names = []
161
+ actual_field_names = []
162
162
163
163
usable_fields = [self .structural_input_params ["plane_azimuth_name_field" ],
164
164
self .structural_input_params ["plane_dip_name_field" ],
@@ -167,24 +167,96 @@ def get_used_field_names(self):
167
167
168
168
for usable_fld in usable_fields :
169
169
if usable_fld is not None :
170
- used_field_names .append (usable_fld )
170
+ actual_field_names .append (usable_fld )
171
171
172
- return used_field_names
172
+ return actual_field_names
173
+
174
+
175
+ def get_actual_data_type (self ):
176
+
177
+ # define type for planar data
178
+ if self .structural_input_params ["plane_azimuth_name_field" ] is not None and \
179
+ self .structural_input_params ["plane_dip_name_field" ] is not None :
180
+ planar_data = True
181
+ if self .structural_input_params ["plane_azimuth_type" ] == "dip dir." :
182
+ planar_az_type = "dip_dir"
183
+ elif self .structural_input_params ["plane_azimuth_type" ] == "strike rhr" :
184
+ planar_az_type = "strike_rhr"
185
+ planar_dip_type = "dip"
186
+ else :
187
+ planar_data = False
188
+ planar_az_type = None
189
+ planar_dip_type = None
190
+
191
+ # define type for linear data
192
+ if self .structural_input_params ["line_azimuth_name_field" ] is not None and \
193
+ self .structural_input_params ["line_dip_name_field" ] is not None :
194
+ linear_data = True
195
+ linear_az_type = "trend"
196
+ linear_dip_type = "plunge"
197
+ else :
198
+ linear_data = False
199
+ linear_az_type = None
200
+ linear_dip_type = None
201
+
202
+
203
+ return dict (planar_data = planar_data ,
204
+ planar_az_type = planar_az_type ,
205
+ planar_dip_type = planar_dip_type ,
206
+ linear_data = linear_data ,
207
+ linear_az_type = linear_az_type ,
208
+ linear_dip_type = linear_dip_type )
209
+
173
210
211
+ def process_geodata (self ):
174
212
175
- def plot_stereonet (self ):
213
+ # get used field names in the point attribute table
214
+ self .actual_field_names = self .get_actual_field_names ()
176
215
177
- self .used_field_names = self .get_used_field_names ()
216
+ # get input data presence and type
217
+ self .actual_data_type = self .get_actual_data_type ()
218
+
219
+ # decide if using all data or just selected ones
178
220
if self .plot_all_data_QRadioButton .isChecked ():
179
221
selected = False
180
222
else :
181
- selected = True
182
- structural_data = get_point_data (self .point_layer , self .used_field_names , selected )
223
+ selected = True
224
+
225
+ _ , structural_data = get_point_data (self .point_layer , self .actual_field_names , selected )
183
226
184
- for rec in structural_data :
185
- print rec
227
+ input_data_types = self .get_actual_data_type ()
228
+
229
+ xy_vals , plane_orientations , lineament_orientations = self .parse_geodata (input_data_types , structural_data )
186
230
231
+ for rec in lineament_orientations :
232
+ print rec
187
233
234
+
235
+ def parse_geodata (self , input_data_types , structural_data ):
236
+
237
+ xy_vals = [ (float (rec [0 ]), float (rec [1 ]) ) for rec in structural_data ]
238
+
239
+ if input_data_types ["planar_data" ]:
240
+ if input_data_types ["planar_az_type" ] == "dip_dir" :
241
+ dipdir_vals = [ float (rec [2 ]) for rec in structural_data ]
242
+ elif input_data_types ["planar_az_type" ] == "strike_rhr" :
243
+ dipdir_raw_vals = [ float (rec [2 ]) + 90.0 for rec in structural_data ]
244
+ dipdir_vals = [ val if val < 360.0 else val - 360.0 for val in dipdir_raw_vals ]
245
+ dipangle_vals = [ float (rec [3 ]) for rec in structural_data ]
246
+ plane_vals = zip (dipdir_vals , dipangle_vals )
247
+ line_data_ndx_start = 4
248
+ else :
249
+ plane_vals = None
250
+ line_data_ndx_start = 2
251
+
252
+ if input_data_types ["linear_data" ]:
253
+ line_vals = [ (float (rec [line_data_ndx_start ]), float (rec [line_data_ndx_start + 1 ])) for rec in structural_data ]
254
+ else :
255
+ line_vals = None
256
+
257
+ return xy_vals , plane_vals , line_vals
258
+
259
+
188
260
def open_help_page (self ):
189
261
190
262
import webbrowser
0 commit comments