wolfhece 2.1.119__py3-none-any.whl → 2.1.121__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wolfhece/PyDraw.py +732 -153
- wolfhece/PyVertexvectors.py +299 -0
- wolfhece/acceptability/acceptability.py +17 -13
- wolfhece/acceptability/acceptability_gui.py +517 -526
- wolfhece/acceptability/func.py +46 -58
- wolfhece/apps/check_install.py +39 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/lazviewer/_add_path.py +17 -17
- wolfhece/lazviewer/laz_viewer.py +72 -13
- wolfhece/lazviewer/libs/qt_plugins/platforms/qwindows.dll +0 -0
- wolfhece/lazviewer/viewer/qt.conf +2 -0
- wolfhece/lazviewer/viewer/viewer.py +16 -6
- wolfhece/matplotlib_fig.py +83 -1
- wolfhece/wolfresults_2D.py +487 -21
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/METADATA +1 -1
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/RECORD +19 -17
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.121.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -75,7 +75,7 @@ try:
|
|
75
75
|
from .xyz_file import xyz_scandir, XYZFile
|
76
76
|
from .mesh2d import wolf2dprev
|
77
77
|
from .PyPalette import wolfpalette
|
78
|
-
from .wolfresults_2D import Wolfresults_2D, views_2D
|
78
|
+
from .wolfresults_2D import Wolfresults_2D, views_2D, Extractable_results
|
79
79
|
from .PyTranslate import _
|
80
80
|
from .PyVertex import cloud_vertices, getIfromRGB
|
81
81
|
from .RatingCurve import SPWMIGaugingStations, SPWDCENNGaugingStations
|
@@ -114,7 +114,7 @@ try:
|
|
114
114
|
from .lagrangian.particle_system_ui import Particle_system_to_draw as Particle_system
|
115
115
|
from .opengl.py3d import Wolf_Viewer3D
|
116
116
|
from .pyGui1D import GuiNotebook1D
|
117
|
-
from .matplotlib_fig import Matplotlib_Figure as MplFig
|
117
|
+
from .matplotlib_fig import Matplotlib_Figure as MplFig, PRESET_LAYOUTS
|
118
118
|
except ImportError as e:
|
119
119
|
print(e)
|
120
120
|
raise ImportError("Error importing pyshields, pyviews, PyConfig, GraphProfile, pybridges, tools_mpl, wolf_tiles, lagrangian.particle_system_ui, opengl.py3d, pyGui1D. Please check your installation.")
|
@@ -170,6 +170,48 @@ PROJECT_GROUP_KEYS = {PROJECT_ACTION : {'which': 'compare_arrays'},
|
|
170
170
|
PROJECT_LINK_VEC_ARRAY : {'id - id vector': 'id of array/wolf2d/gpu2d - id of vector to link (only 1 vector in 1 zone)'},
|
171
171
|
}
|
172
172
|
|
173
|
+
class MplFigViewer(MplFig):
|
174
|
+
|
175
|
+
def __init__(self, layout = None, idx:str='',
|
176
|
+
mapviewer:"WolfMapViewer" = None,
|
177
|
+
caption:str = '', size:tuple = (800, 600),
|
178
|
+
style:int = wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER):
|
179
|
+
|
180
|
+
super().__init__(layout)
|
181
|
+
self._mapviewer = mapviewer
|
182
|
+
self._idx = idx
|
183
|
+
|
184
|
+
self.SetTitle(caption)
|
185
|
+
|
186
|
+
self.SetSize(size)
|
187
|
+
|
188
|
+
dpi = self.fig.get_dpi()
|
189
|
+
size_x = (size[0]-16)/dpi
|
190
|
+
size_y = (size[1]-240)/dpi
|
191
|
+
|
192
|
+
self.fig.set_size_inches(size_x, size_y)
|
193
|
+
|
194
|
+
|
195
|
+
self.SetWindowStyle(style)
|
196
|
+
|
197
|
+
self.Bind(wx.EVT_CLOSE, self.OnClose)
|
198
|
+
|
199
|
+
def OnClose(self, event):
|
200
|
+
""" Close the window """
|
201
|
+
|
202
|
+
if self.mapviewer is not None:
|
203
|
+
self.mapviewer.destroy_fig_by_id(self.idx)
|
204
|
+
else:
|
205
|
+
self.Destroy()
|
206
|
+
|
207
|
+
@property
|
208
|
+
def mapviewer(self):
|
209
|
+
return self._mapviewer
|
210
|
+
|
211
|
+
@property
|
212
|
+
def idx(self):
|
213
|
+
return self._idx
|
214
|
+
|
173
215
|
class Memory_View():
|
174
216
|
""" Memory view """
|
175
217
|
|
@@ -1154,6 +1196,166 @@ class Sim_Explorer(wx.Frame):
|
|
1154
1196
|
self._step_time.Set(['{:.3f} - {}'.format(i, datetime.strftime(self._starting_date + timedelta(seconds=i), '%Y-%m-%d %H:%M:%S')) for i in self._all_times_steps[0]])
|
1155
1197
|
self._step_num.Set([str(i) for i in self._all_times_steps[1]])
|
1156
1198
|
|
1199
|
+
|
1200
|
+
class Select_Begin_end_interval_step(wx.Dialog):
|
1201
|
+
""" wx.frame to select the begin and end of the interval to extract """
|
1202
|
+
|
1203
|
+
def __init__(self, parent, title, sim:Wolfresults_2D, checkbox:bool = False):
|
1204
|
+
|
1205
|
+
super(Select_Begin_end_interval_step, self).__init__(parent, title=title, size=(500, 350), style = wx.DEFAULT_FRAME_STYLE & ~ (wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX))
|
1206
|
+
|
1207
|
+
# ajout d'un slider pour choisir le début et la fin de l'intervalle -> selrange
|
1208
|
+
# ajout d'un slider pour choisir le pas de l'intervalle
|
1209
|
+
|
1210
|
+
|
1211
|
+
# + les mêmes informations mais sous forme de TextCtrl
|
1212
|
+
|
1213
|
+
# ajout d'un bouton pour valider
|
1214
|
+
# ajout d'un bouton pour annuler
|
1215
|
+
|
1216
|
+
self._panel = wx.Panel(self)
|
1217
|
+
|
1218
|
+
sizer = wx.BoxSizer(wx.VERTICAL)
|
1219
|
+
|
1220
|
+
self.begin = 1
|
1221
|
+
self.end = sim.get_nbresults(True)
|
1222
|
+
self.step = 1
|
1223
|
+
self.check_all = True
|
1224
|
+
self.check_violin = False
|
1225
|
+
|
1226
|
+
self._slider_begin = wx.Slider(self._panel, minValue=self.begin, maxValue=self.end, style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_MIN_MAX_LABELS | wx.SL_LABELS)
|
1227
|
+
self._slider_begin.SetToolTip(_('Select the first result to export'))
|
1228
|
+
self._slider_begin.SetValue(self.begin)
|
1229
|
+
|
1230
|
+
self._slider_begin.Bind(wx.EVT_SLIDER, self.OnSliderBegin)
|
1231
|
+
sizer.Add(self._slider_begin, 1, wx.EXPAND | wx.ALL, 2)
|
1232
|
+
|
1233
|
+
self._slider_end = wx.Slider(self._panel, minValue=self.begin, maxValue=self.end, style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_MIN_MAX_LABELS | wx.SL_LABELS)
|
1234
|
+
self._slider_end.SetToolTip(_('Select the last result to export - If step is > 1, this value will be forced if not already captured'))
|
1235
|
+
self._slider_end.SetValue(self.end)
|
1236
|
+
self._slider_end.Bind(wx.EVT_SLIDER, self.OnSliderEnd)
|
1237
|
+
|
1238
|
+
sizer.Add(self._slider_end, 1, wx.EXPAND | wx.ALL, 2)
|
1239
|
+
|
1240
|
+
sizer_txt1 = wx.BoxSizer(wx.HORIZONTAL)
|
1241
|
+
self._label_range = wx.StaticText(self._panel, label=_('Range'))
|
1242
|
+
self._text_range = wx.TextCtrl(self._panel, value='1 - {}'.format(sim.get_nbresults(True)))
|
1243
|
+
|
1244
|
+
sizer_txt1.Add(self._label_range, 0, wx.EXPAND | wx.ALL, 2)
|
1245
|
+
sizer_txt1.Add(self._text_range, 1, wx.EXPAND | wx.ALL, 2)
|
1246
|
+
|
1247
|
+
sizer.Add(sizer_txt1, 0, wx.EXPAND | wx.ALL, 2)
|
1248
|
+
|
1249
|
+
self._slider_step = wx.Slider(self._panel, minValue=1, maxValue=sim.get_nbresults(True), style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_MIN_MAX_LABELS | wx.SL_LABELS)
|
1250
|
+
self._slider_step.SetToolTip(_('Export one result every N steps'))
|
1251
|
+
self._slider_step.Bind(wx.EVT_SLIDER, self.OnSliderStep)
|
1252
|
+
sizer.Add(self._slider_step, 1, wx.EXPAND | wx.ALL, 2)
|
1253
|
+
|
1254
|
+
sizer_txt2 = wx.BoxSizer(wx.HORIZONTAL)
|
1255
|
+
self._label_step = wx.StaticText(self._panel, label=_('Step'))
|
1256
|
+
self._text_step = wx.TextCtrl(self._panel, value='1')
|
1257
|
+
|
1258
|
+
sizer_txt2.Add(self._label_step, 0, wx.EXPAND | wx.ALL, 2)
|
1259
|
+
sizer_txt2.Add(self._text_step, 0, wx.EXPAND | wx.ALL, 2)
|
1260
|
+
|
1261
|
+
sizer.Add(sizer_txt2, 0, wx.EXPAND | wx.ALL, 2)
|
1262
|
+
|
1263
|
+
sizer_but = wx.BoxSizer(wx.HORIZONTAL)
|
1264
|
+
self._cmd_apply = wx.Button(self._panel, wx.ID_APPLY, _('Apply'))
|
1265
|
+
self._cmd_apply.Bind(wx.EVT_BUTTON, self.OnApply)
|
1266
|
+
|
1267
|
+
self._cmd_ok = wx.Button(self._panel, wx.ID_OK, _('OK'))
|
1268
|
+
self._cmd_ok.Bind(wx.EVT_BUTTON, self.OnOK)
|
1269
|
+
|
1270
|
+
self._cmd_cancel = wx.Button(self._panel, wx.ID_CANCEL, _('Cancel'))
|
1271
|
+
self._cmd_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
|
1272
|
+
|
1273
|
+
sizer_but.Add(self._cmd_apply, 1, wx.EXPAND | wx.ALL, 2)
|
1274
|
+
sizer_but.Add(self._cmd_ok, 1, wx.EXPAND | wx.ALL, 2)
|
1275
|
+
sizer_but.Add(self._cmd_cancel, 1, wx.EXPAND | wx.ALL, 2)
|
1276
|
+
|
1277
|
+
sizer.Add(sizer_but, 1, wx.EXPAND | wx.ALL, 2)
|
1278
|
+
|
1279
|
+
if checkbox:
|
1280
|
+
sizer_check = wx.BoxSizer(wx.HORIZONTAL)
|
1281
|
+
self._check_all = wx.CheckBox(self._panel, label=_('Statistics and values'), style=wx.CHK_2STATE)
|
1282
|
+
self._check_all.SetToolTip(_('If checked, export statistics and all values for each step'))
|
1283
|
+
self._check_all.SetValue(True)
|
1284
|
+
self._check_all.Bind(wx.EVT_CHECKBOX, self.OnCheckAll)
|
1285
|
+
sizer_check.Add(self._check_all, 1, wx.EXPAND | wx.ALL, 2)
|
1286
|
+
sizer.Add(sizer_check, 1, wx.EXPAND | wx.ALL, 2)
|
1287
|
+
|
1288
|
+
self._check_violin= wx.CheckBox(self._panel, label=_('Violin plot (experimental)'), style=wx.CHK_2STATE)
|
1289
|
+
self._check_violin.SetToolTip(_('If checked, create a violin plot for each step'))
|
1290
|
+
self._check_violin.SetValue(False)
|
1291
|
+
self._check_violin.Bind(wx.EVT_CHECKBOX, self.OnCheckViolin)
|
1292
|
+
sizer_check.Add(self._check_violin, 1, wx.EXPAND | wx.ALL, 2)
|
1293
|
+
|
1294
|
+
self._panel.SetSizer(sizer)
|
1295
|
+
|
1296
|
+
self.CenterOnScreen()
|
1297
|
+
|
1298
|
+
self.SetIcon(wx.Icon(str(Path(__file__).parent / "apps/wolf_logo2.bmp")))
|
1299
|
+
|
1300
|
+
self.Show()
|
1301
|
+
|
1302
|
+
|
1303
|
+
def OnCheckAll(self, event):
|
1304
|
+
self.check_all = self._check_all.IsChecked()
|
1305
|
+
|
1306
|
+
def OnCheckViolin(self, event):
|
1307
|
+
self.check_violin = self._check_violin.IsChecked()
|
1308
|
+
|
1309
|
+
def OnSliderBegin(self, event):
|
1310
|
+
|
1311
|
+
self.begin = min(self._slider_begin.GetValue(), self.end)
|
1312
|
+
self._slider_begin.SetValue(self.begin)
|
1313
|
+
self._text_range.SetValue('{} - {}'.format(self.begin, self.end))
|
1314
|
+
|
1315
|
+
def OnSliderEnd(self, event):
|
1316
|
+
|
1317
|
+
self.end = max(self._slider_end.GetValue(), self.begin)
|
1318
|
+
self._slider_end.SetValue(self.end)
|
1319
|
+
self._text_range.SetValue('{} - {}'.format(self.begin, self.end))
|
1320
|
+
|
1321
|
+
def OnSliderStep(self, event):
|
1322
|
+
|
1323
|
+
self.step = self._slider_step.GetValue()
|
1324
|
+
self._text_step.SetValue(str(self.step))
|
1325
|
+
|
1326
|
+
def OnApply(self, event):
|
1327
|
+
|
1328
|
+
try:
|
1329
|
+
txt_begin, txt_end = self._text_range.GetValue().split('-')
|
1330
|
+
except:
|
1331
|
+
self._text_range.SetValue('{} - {}'.format(self.begin, self.end))
|
1332
|
+
|
1333
|
+
txt_step = self._text_step.GetValue()
|
1334
|
+
|
1335
|
+
try:
|
1336
|
+
if self.step != int(txt_step):
|
1337
|
+
self._slider_step.SetValue(int(txt_step))
|
1338
|
+
except:
|
1339
|
+
logging.error('Error while parsing the step')
|
1340
|
+
return
|
1341
|
+
|
1342
|
+
try:
|
1343
|
+
if int(txt_begin) != self.begin or int(txt_end) != self.end:
|
1344
|
+
self._slider_begin.SetRange(int(txt_begin), int(txt_end))
|
1345
|
+
except:
|
1346
|
+
logging.error('Error while parsing the range')
|
1347
|
+
return
|
1348
|
+
|
1349
|
+
def OnOK(self, event):
|
1350
|
+
self.Hide()
|
1351
|
+
|
1352
|
+
def OnCancel(self, event):
|
1353
|
+
self.begin = -1
|
1354
|
+
self.end = -1
|
1355
|
+
self.step = -1
|
1356
|
+
|
1357
|
+
self.Hide()
|
1358
|
+
|
1157
1359
|
class WolfMapViewer(wx.Frame):
|
1158
1360
|
"""
|
1159
1361
|
Fenêtre de visualisation de données WOLF grâce aux WxWidgets
|
@@ -1177,6 +1379,8 @@ class WolfMapViewer(wx.Frame):
|
|
1177
1379
|
myviewers3d:list[Wolf_Viewer3D]
|
1178
1380
|
mylazdata:list[Wolf_LAZ_Data]
|
1179
1381
|
|
1382
|
+
mymplfigs:list[MplFigViewer]
|
1383
|
+
|
1180
1384
|
sim_explorers: dict[Wolfresults_2D:Sim_Explorer]
|
1181
1385
|
|
1182
1386
|
canvas: GLCanvas # canvas OpenGL
|
@@ -1209,6 +1413,8 @@ class WolfMapViewer(wx.Frame):
|
|
1209
1413
|
active_weir : Weir
|
1210
1414
|
active_laz : Wolf_LAZ_Data
|
1211
1415
|
|
1416
|
+
active_fig: MplFigViewer
|
1417
|
+
|
1212
1418
|
def __init__(self,
|
1213
1419
|
wxparent = None,
|
1214
1420
|
title:str = _('Default Wolf Map Viewer'),
|
@@ -1474,34 +1680,44 @@ class WolfMapViewer(wx.Frame):
|
|
1474
1680
|
_("Linear colormap"))
|
1475
1681
|
|
1476
1682
|
self.analyzemenu = wx.Menu()
|
1477
|
-
|
1683
|
+
|
1684
|
+
self.analyzeplot = wx.Menu()
|
1685
|
+
self.analyzeexport = wx.Menu()
|
1686
|
+
|
1687
|
+
plotvect = self.analyzeplot.Append(wx.ID_ANY, _("Plot active vector..."),
|
1478
1688
|
_("Plot the active vector and linked arrays"))
|
1479
|
-
plotpoly = self.
|
1689
|
+
plotpoly = self.analyzeplot.Append(wx.ID_ANY, _("Plot active polygons..."),
|
1480
1690
|
_("Plot the active polygons and linked arrays"))
|
1481
1691
|
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1692
|
+
self.analyzeplot.AppendSeparator()
|
1693
|
+
|
1694
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Plot...'),self.analyzeplot)
|
1695
|
+
self.analyzemenu.Append(wx.ID_ANY,_('Export...'),self.analyzeexport)
|
1696
|
+
self.analyzemenu.AppendSeparator()
|
1697
|
+
|
1698
|
+
masksimul = self.analyzemenu.Append(wx.ID_ANY, _("Load and apply mask (nap)..."), _("Apply mask from sim2D"))
|
1699
|
+
filterinund = self.analyzemenu.Append(wx.ID_ANY, _("Filter inundation arrays..."), _("Filter arrays"))
|
1700
|
+
|
1486
1701
|
# Plot hydrographs
|
1487
|
-
|
1488
|
-
self.
|
1489
|
-
plotqvect = self.
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
exportqvect = self.
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
plothselect = self.
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1702
|
+
|
1703
|
+
plotqvect = self.analyzeplot.Append(wx.ID_ANY, _("Plot integrated Q along active vector..."), _("Integrate Q along the active vector and plot"))
|
1704
|
+
plotqvect = self.analyzeplot.Append(wx.ID_ANY, _("Plot integrated Q along active zone..."), _("Integrate Q along the active zone and plot"))
|
1705
|
+
|
1706
|
+
self.analyzeplot.AppendSeparator()
|
1707
|
+
|
1708
|
+
|
1709
|
+
exportqvect = self.analyzeexport.Append(wx.ID_ANY, _("Export integrated Q along active vector..."), _("Integrate Q along the active vector and export"))
|
1710
|
+
exportqvect = self.analyzeexport.Append(wx.ID_ANY, _("Export integrated Q along all vectors in active zone..."), _("Integrate Q along ALL VECTORS of the active zone and export"))
|
1711
|
+
|
1712
|
+
self.analyzeexport.AppendSeparator()
|
1713
|
+
|
1714
|
+
plothselect = self.analyzeplot.Append(wx.ID_ANY, _("Plot stats unknown (selected nodes)..."), _("Compute stats and plot on the selected nodes"))
|
1715
|
+
plothvector = self.analyzeplot.Append(wx.ID_ANY, _("Plot stats unknown (inside active vector)..."), _("Compute stats and plot on nodes inside the active vector"))
|
1716
|
+
plothzone = self.analyzeplot.Append(wx.ID_ANY, _("Plot stats unknown (inside active zone)..."), _("Compute stats and plot on nodes inside the active zone"))
|
1717
|
+
|
1718
|
+
exporthselect = self.analyzeexport.Append(wx.ID_ANY, _("Export stats unknown (selected nodes)..."), _("Compute stats and export on the selected nodes"))
|
1719
|
+
exporthvector = self.analyzeexport.Append(wx.ID_ANY, _("Export stats unknown (inside active vector)..."), _("Compute stats and export on nodes inside the active vector"))
|
1720
|
+
exporthzone = self.analyzeexport.Append(wx.ID_ANY, _("Export stats unknown (inside active zone)..."), _("Compute stats and export on nodes inside the active zone"))
|
1505
1721
|
|
1506
1722
|
self.filemenu.AppendSeparator()
|
1507
1723
|
menuquit = self.filemenu.Append(wx.ID_EXIT, _('&Quit\tCTRL+Q'), _('Quit application'))
|
@@ -1552,6 +1768,8 @@ class WolfMapViewer(wx.Frame):
|
|
1552
1768
|
self.active_weir = None
|
1553
1769
|
self.active_laz = None
|
1554
1770
|
|
1771
|
+
self.active_fig = None
|
1772
|
+
|
1555
1773
|
curtool = self.tools[ID_SORTALONG] = {}
|
1556
1774
|
curtool['menu'] = self.sortalong
|
1557
1775
|
curtool['name'] = 'Sort along vector'
|
@@ -1690,6 +1908,90 @@ class WolfMapViewer(wx.Frame):
|
|
1690
1908
|
# # print(msg)
|
1691
1909
|
# return 0
|
1692
1910
|
|
1911
|
+
def _check_id_for_fig(self, idx:str):
|
1912
|
+
""" Check if an ID is already used for a figure """
|
1913
|
+
|
1914
|
+
ids = [cur.idx for cur in self.mymplfigs]
|
1915
|
+
|
1916
|
+
if idx in ids:
|
1917
|
+
return True
|
1918
|
+
|
1919
|
+
return False
|
1920
|
+
|
1921
|
+
def _create_id_for_fig(self):
|
1922
|
+
|
1923
|
+
idx = 'Figure'
|
1924
|
+
while not self._check_id_for_fig(idx):
|
1925
|
+
idx += '_'
|
1926
|
+
|
1927
|
+
return idx
|
1928
|
+
|
1929
|
+
def _validate_id_for_fig(self, idx:str):
|
1930
|
+
""" Validate an ID for a figure """
|
1931
|
+
|
1932
|
+
if idx is None:
|
1933
|
+
return self._create_id_for_fig()
|
1934
|
+
|
1935
|
+
while self._check_id_for_fig(idx):
|
1936
|
+
idx += '_'
|
1937
|
+
|
1938
|
+
return idx
|
1939
|
+
|
1940
|
+
def new_fig(self, caption:str, idx:str = None, layout = PRESET_LAYOUTS.DEFAULT, size = (800,600), show:bool = True) -> MplFigViewer:
|
1941
|
+
""" Create a new figure """
|
1942
|
+
|
1943
|
+
if idx is None:
|
1944
|
+
with wx.TextEntryDialog(self, _('Enter an id for the figure'), _('Figure id'), _('Figure')) as dlg:
|
1945
|
+
dlg: wx.TextEntryDialog
|
1946
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
1947
|
+
return None
|
1948
|
+
|
1949
|
+
idx = dlg.GetValue()
|
1950
|
+
|
1951
|
+
idx = self._validate_id_for_fig(idx)
|
1952
|
+
else:
|
1953
|
+
idx = self._validate_id_for_fig(idx)
|
1954
|
+
|
1955
|
+
logging.info(f'Figure ID: {idx}')
|
1956
|
+
|
1957
|
+
added_fig = MplFigViewer(layout, idx= idx, mapviewer = self, caption = caption, size= size)
|
1958
|
+
|
1959
|
+
if show:
|
1960
|
+
added_fig.Show()
|
1961
|
+
else:
|
1962
|
+
added_fig.Hide()
|
1963
|
+
|
1964
|
+
self.mymplfigs.append(added_fig)
|
1965
|
+
|
1966
|
+
return added_fig
|
1967
|
+
|
1968
|
+
def destroy_fig_by_id(self, idx:str) -> bool:
|
1969
|
+
""" Destroy a figure by its ID """
|
1970
|
+
|
1971
|
+
for id, fig in enumerate(self.mymplfigs):
|
1972
|
+
if fig.idx == idx:
|
1973
|
+
if self.active_fig is fig:
|
1974
|
+
self.active_fig = None
|
1975
|
+
fig.Destroy()
|
1976
|
+
self.mymplfigs.pop(id)
|
1977
|
+
return True
|
1978
|
+
|
1979
|
+
return False
|
1980
|
+
|
1981
|
+
def get_fig(self, idx:str) -> MplFigViewer:
|
1982
|
+
""" Get a figure by its ID """
|
1983
|
+
|
1984
|
+
for cur in self.mymplfigs:
|
1985
|
+
if cur.idx == idx:
|
1986
|
+
return cur
|
1987
|
+
|
1988
|
+
return None
|
1989
|
+
|
1990
|
+
def list_ids_figs(self) -> list[str]:
|
1991
|
+
""" List all IDs of figures """
|
1992
|
+
|
1993
|
+
return [cur.idx for cur in self.mymplfigs]
|
1994
|
+
|
1693
1995
|
@property
|
1694
1996
|
def viewer_name(self):
|
1695
1997
|
return self.GetTitle()
|
@@ -1933,6 +2235,7 @@ class WolfMapViewer(wx.Frame):
|
|
1933
2235
|
|
1934
2236
|
readlaz = self.menulazdata.Append(wx.ID_ANY, _('Initialize from laz, las or npz'), _('LAZ data from one specific file (type laz, las or npz)'))
|
1935
2237
|
readlaz_gridinfo = self.menulazgrid.Append(wx.ID_ANY, _('Initialize from directory'), _('LAZ GRID stored in a directory - subgridding of LAZ files'), kind=wx.ITEM_CHECK)
|
2238
|
+
copylaz_gridinfo = self.menulazgrid.Append(wx.ID_ANY, _('Copy from current zoom'), _('Make a copy of the used files'))
|
1936
2239
|
updatecolors_laz = self.menulazgrid.Append(wx.ID_ANY, _('Change colors - Classification'), _('Change color map associated to the current classification'),)
|
1937
2240
|
|
1938
2241
|
bridgelaz = self.menulazdata.Append(wx.ID_ANY, _('Create cloud points from bridges'), _('Extract bridge from LAZ data as cloud points (class 10)'))
|
@@ -3905,6 +4208,8 @@ class WolfMapViewer(wx.Frame):
|
|
3905
4208
|
self.myviewerslaz = []
|
3906
4209
|
self.mylazdata = []
|
3907
4210
|
|
4211
|
+
self.mymplfigs = []
|
4212
|
+
|
3908
4213
|
self.sim_explorers = {}
|
3909
4214
|
|
3910
4215
|
# liste des éléments modifiable dans l'arbre
|
@@ -6359,7 +6664,8 @@ class WolfMapViewer(wx.Frame):
|
|
6359
6664
|
logging.warning(_('No active 2D result !'))
|
6360
6665
|
return
|
6361
6666
|
|
6362
|
-
self.
|
6667
|
+
fig = self.new_fig(_('Q along active vector'), 'Q_along_active_vector', show=False, size=(800, 600))
|
6668
|
+
self.active_res2d.plot_q_wx(self.active_vector, 'border', toshow=True, fig= fig)
|
6363
6669
|
|
6364
6670
|
elif itemlabel == _("Plot integrated Q along active zone..."):
|
6365
6671
|
""" Integrate Q along active zone """
|
@@ -6372,7 +6678,8 @@ class WolfMapViewer(wx.Frame):
|
|
6372
6678
|
logging.warning(_('No active 2D result !'))
|
6373
6679
|
return
|
6374
6680
|
|
6375
|
-
self.
|
6681
|
+
fig = self.new_fig(_('Q along active zone'), 'Q_along_active_zone', show=False, size=(800, 600))
|
6682
|
+
self.active_res2d.plot_q_wx(self.active_zone.myvectors, ['border'] * self.active_zone.nbvectors, toshow=True, fig = fig)
|
6376
6683
|
|
6377
6684
|
elif itemlabel == _("Export integrated Q along active vector..."):
|
6378
6685
|
|
@@ -6488,32 +6795,106 @@ class WolfMapViewer(wx.Frame):
|
|
6488
6795
|
logging.warning(_('No active 2D result !'))
|
6489
6796
|
return
|
6490
6797
|
|
6491
|
-
|
6798
|
+
all_selected = []
|
6799
|
+
for curblock in self.active_res2d.myblocks.values():
|
6800
|
+
if curblock.SelectionData.nb > 0:
|
6801
|
+
all_selected += curblock.SelectionData.myselection
|
6802
|
+
|
6803
|
+
if len(all_selected) == 0:
|
6804
|
+
logging.warning(_('No selected nodes - Nothing to do !'))
|
6805
|
+
return
|
6806
|
+
|
6807
|
+
keys = Extractable_results.get_list()
|
6808
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6492
6809
|
|
6493
6810
|
ret = dlg.ShowModal()
|
6494
6811
|
if ret == wx.ID_CANCEL:
|
6812
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6495
6813
|
dlg.Destroy()
|
6496
6814
|
return
|
6497
6815
|
|
6498
|
-
|
6816
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6499
6817
|
dlg.Destroy()
|
6500
6818
|
|
6501
|
-
|
6502
|
-
|
6503
|
-
|
6504
|
-
|
6505
|
-
|
6506
|
-
|
6819
|
+
try:
|
6820
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
6821
|
+
ret = choice_bes.ShowModal()
|
6822
|
+
|
6823
|
+
begin = choice_bes.begin
|
6824
|
+
end = choice_bes.end
|
6825
|
+
interval = choice_bes.step
|
6826
|
+
|
6827
|
+
finally:
|
6828
|
+
choice_bes.Destroy()
|
6829
|
+
|
6830
|
+
if begin == -1:
|
6831
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6832
|
+
return
|
6833
|
+
|
6834
|
+
newfig = self.new_fig(_('Series of {} - {} (nodes)').format(which.value[0], self.active_res2d.idx), 'series_'+self.active_res2d.idx, show=False, size= (800,600))
|
6507
6835
|
|
6508
|
-
figax =
|
6836
|
+
figax = self.active_res2d.plot_some_values(all_selected, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6837
|
+
|
6838
|
+
newfig.Show()
|
6839
|
+
|
6840
|
+
elif itemlabel == _("Export stats unknown (selected nodes)..."):
|
6841
|
+
|
6842
|
+
if self.active_res2d is None:
|
6843
|
+
logging.warning(_('No active 2D result !'))
|
6844
|
+
return
|
6845
|
+
|
6846
|
+
all_selected = []
|
6509
6847
|
for curblock in self.active_res2d.myblocks.values():
|
6510
6848
|
if curblock.SelectionData.nb > 0:
|
6849
|
+
all_selected += curblock.SelectionData.myselection
|
6511
6850
|
|
6512
|
-
|
6513
|
-
|
6514
|
-
|
6515
|
-
|
6516
|
-
|
6851
|
+
if len(all_selected) == 0:
|
6852
|
+
logging.warning(_('No selected nodes - Nothing to do !'))
|
6853
|
+
return
|
6854
|
+
|
6855
|
+
keys = Extractable_results.get_list()
|
6856
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6857
|
+
|
6858
|
+
ret = dlg.ShowModal()
|
6859
|
+
if ret == wx.ID_CANCEL:
|
6860
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6861
|
+
dlg.Destroy()
|
6862
|
+
return
|
6863
|
+
|
6864
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6865
|
+
dlg.Destroy()
|
6866
|
+
|
6867
|
+
dlg = wx.FileDialog(None, _('Choose the file to export'), wildcard='csv (*.csv)|*.csv', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
6868
|
+
ret = dlg.ShowModal()
|
6869
|
+
if ret == wx.ID_CANCEL:
|
6870
|
+
logging.info(_('No file chosen - Aborting !'))
|
6871
|
+
dlg.Destroy()
|
6872
|
+
return
|
6873
|
+
|
6874
|
+
filename = Path(dlg.GetPath())
|
6875
|
+
dlg.Destroy()
|
6876
|
+
|
6877
|
+
|
6878
|
+
try:
|
6879
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
6880
|
+
ret = choice_bes.ShowModal()
|
6881
|
+
|
6882
|
+
begin = choice_bes.begin
|
6883
|
+
end = choice_bes.end
|
6884
|
+
interval = choice_bes.step
|
6885
|
+
all = choice_bes.check_all
|
6886
|
+
|
6887
|
+
finally:
|
6888
|
+
choice_bes.Destroy()
|
6889
|
+
|
6890
|
+
if begin == -1:
|
6891
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6892
|
+
return
|
6893
|
+
|
6894
|
+
ret = self.active_res2d.export_some_values_to_csv(all_selected, which, filename, for_steps= (begin-1, end-1, interval), all_values=all)
|
6895
|
+
|
6896
|
+
if not ret:
|
6897
|
+
logging.error(_('Error in exporting values !'))
|
6517
6898
|
|
6518
6899
|
elif itemlabel == _("Plot stats unknown (inside active vector)..."):
|
6519
6900
|
|
@@ -6525,24 +6906,91 @@ class WolfMapViewer(wx.Frame):
|
|
6525
6906
|
logging.warning(_('No active vector !'))
|
6526
6907
|
return
|
6527
6908
|
|
6528
|
-
|
6909
|
+
keys = Extractable_results.get_list()
|
6910
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6911
|
+
|
6912
|
+
ret = dlg.ShowModal()
|
6913
|
+
if ret == wx.ID_CANCEL:
|
6914
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6915
|
+
dlg.Destroy()
|
6916
|
+
return
|
6917
|
+
|
6918
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6919
|
+
dlg.Destroy()
|
6920
|
+
|
6921
|
+
try:
|
6922
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
6923
|
+
ret = choice_bes.ShowModal()
|
6924
|
+
|
6925
|
+
begin = choice_bes.begin
|
6926
|
+
end = choice_bes.end
|
6927
|
+
interval = choice_bes.step
|
6928
|
+
violin = choice_bes.check_violin
|
6929
|
+
|
6930
|
+
finally:
|
6931
|
+
choice_bes.Destroy()
|
6932
|
+
|
6933
|
+
if begin == -1:
|
6934
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6935
|
+
return
|
6936
|
+
|
6937
|
+
newfig = self.new_fig(_('Series of {} - {} (polygon)').format(which.value[0], self.active_res2d.idx), 'series_'+self.active_res2d.idx, show=False, size= (800,600))
|
6938
|
+
|
6939
|
+
if violin:
|
6940
|
+
figax = self.active_res2d.plot_violin_values(self.active_vector, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6941
|
+
else:
|
6942
|
+
figax = self.active_res2d.plot_some_values(self.active_vector, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6943
|
+
|
6944
|
+
newfig.Show()
|
6945
|
+
|
6946
|
+
elif itemlabel == _("Export stats unknown (inside active vector)..."):
|
6947
|
+
|
6948
|
+
if self.active_res2d is None:
|
6949
|
+
logging.warning(_('No active 2D result !'))
|
6950
|
+
return
|
6951
|
+
|
6952
|
+
if self.active_vector is None:
|
6953
|
+
logging.warning(_('No active vector !'))
|
6954
|
+
return
|
6955
|
+
|
6956
|
+
keys = Extractable_results.get_list()
|
6957
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6958
|
+
|
6959
|
+
ret = dlg.ShowModal()
|
6960
|
+
if ret == wx.ID_CANCEL:
|
6961
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6962
|
+
dlg.Destroy()
|
6963
|
+
return
|
6964
|
+
|
6965
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6966
|
+
dlg.Destroy()
|
6529
6967
|
|
6968
|
+
dlg = wx.FileDialog(None, _('Choose the file to export'), wildcard='csv (*.csv)|*.csv', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
6530
6969
|
ret = dlg.ShowModal()
|
6531
6970
|
if ret == wx.ID_CANCEL:
|
6971
|
+
logging.info(_('No file chosen - Aborting !'))
|
6532
6972
|
dlg.Destroy()
|
6533
6973
|
return
|
6534
6974
|
|
6535
|
-
|
6975
|
+
filename = Path(dlg.GetPath())
|
6536
6976
|
dlg.Destroy()
|
6537
6977
|
|
6538
|
-
|
6539
|
-
|
6540
|
-
|
6541
|
-
|
6542
|
-
|
6543
|
-
|
6978
|
+
try:
|
6979
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
6980
|
+
ret = choice_bes.ShowModal()
|
6981
|
+
|
6982
|
+
begin = choice_bes.begin
|
6983
|
+
end = choice_bes.end
|
6984
|
+
interval = choice_bes.step
|
6985
|
+
|
6986
|
+
finally:
|
6987
|
+
choice_bes.Destroy()
|
6988
|
+
|
6989
|
+
if begin == -1:
|
6990
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6991
|
+
return
|
6544
6992
|
|
6545
|
-
|
6993
|
+
ret = self.active_res2d.export_some_values_to_csv(self.active_vector, which, filename=filename, for_steps= (begin-1, end-1, interval), all_values=all)
|
6546
6994
|
|
6547
6995
|
elif itemlabel == _("Plot stats unknown (inside active zone)..."):
|
6548
6996
|
|
@@ -6554,30 +7002,108 @@ class WolfMapViewer(wx.Frame):
|
|
6554
7002
|
logging.warning(_('No active zone !'))
|
6555
7003
|
return
|
6556
7004
|
|
6557
|
-
|
7005
|
+
keys = Extractable_results.get_list()
|
7006
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6558
7007
|
|
6559
7008
|
ret = dlg.ShowModal()
|
6560
7009
|
if ret == wx.ID_CANCEL:
|
7010
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6561
7011
|
dlg.Destroy()
|
6562
7012
|
return
|
6563
7013
|
|
6564
|
-
|
7014
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6565
7015
|
dlg.Destroy()
|
6566
7016
|
|
6567
|
-
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
6571
|
-
|
6572
|
-
|
7017
|
+
try:
|
7018
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
7019
|
+
ret = choice_bes.ShowModal()
|
7020
|
+
|
7021
|
+
begin = choice_bes.begin
|
7022
|
+
end = choice_bes.end
|
7023
|
+
interval = choice_bes.step
|
7024
|
+
violin = choice_bes.check_violin
|
7025
|
+
|
7026
|
+
finally:
|
7027
|
+
choice_bes.Destroy()
|
7028
|
+
|
7029
|
+
if begin == -1:
|
7030
|
+
logging.info(_('No interval chosen - Aborting !'))
|
7031
|
+
return
|
6573
7032
|
|
6574
7033
|
for idx, curvect in enumerate(self.active_zone.myvectors):
|
7034
|
+
logging.info(_('Plotting {} / {}'.format(idx, self.active_zone.nbvectors)))
|
6575
7035
|
if idx ==0:
|
6576
|
-
|
7036
|
+
newfig = self.new_fig(_('Series of {} - {} (zone)').format(which.value[0], self.active_res2d.idx), 'series_'+self.active_res2d.idx, show=False, size= (800,600))
|
7037
|
+
|
7038
|
+
if violin:
|
7039
|
+
figax = self.active_res2d.plot_violin_values(curvect, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6577
7040
|
else:
|
6578
|
-
self.active_res2d.
|
7041
|
+
figax = self.active_res2d.plot_some_values(curvect, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6579
7042
|
|
6580
|
-
|
7043
|
+
newfig.Show()
|
7044
|
+
|
7045
|
+
elif itemlabel == _("Export stats unknown (inside active zone)..."):
|
7046
|
+
|
7047
|
+
if self.active_res2d is None:
|
7048
|
+
logging.warning(_('No active 2D result !'))
|
7049
|
+
return
|
7050
|
+
|
7051
|
+
if self.active_zone is None:
|
7052
|
+
logging.warning(_('No active zone !'))
|
7053
|
+
return
|
7054
|
+
|
7055
|
+
keys = Extractable_results.get_list()
|
7056
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
7057
|
+
|
7058
|
+
ret = dlg.ShowModal()
|
7059
|
+
if ret == wx.ID_CANCEL:
|
7060
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
7061
|
+
dlg.Destroy()
|
7062
|
+
return
|
7063
|
+
|
7064
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
7065
|
+
dlg.Destroy()
|
7066
|
+
|
7067
|
+
dlg = wx.DirDialog(None, _('Choose the directory where to export'), style= wx.DD_DEFAULT_STYLE)
|
7068
|
+
ret = dlg.ShowModal()
|
7069
|
+
if ret == wx.ID_CANCEL:
|
7070
|
+
logging.info(_('No file chosen - Aborting !'))
|
7071
|
+
dlg.Destroy()
|
7072
|
+
return
|
7073
|
+
|
7074
|
+
directory = Path(dlg.GetPath())
|
7075
|
+
dlg.Destroy()
|
7076
|
+
|
7077
|
+
try:
|
7078
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
7079
|
+
ret = choice_bes.ShowModal()
|
7080
|
+
|
7081
|
+
begin = choice_bes.begin
|
7082
|
+
end = choice_bes.end
|
7083
|
+
interval = choice_bes.step
|
7084
|
+
|
7085
|
+
finally:
|
7086
|
+
choice_bes.Destroy()
|
7087
|
+
|
7088
|
+
if begin == -1:
|
7089
|
+
logging.info(_('No interval chosen - Aborting !'))
|
7090
|
+
return
|
7091
|
+
|
7092
|
+
allnames = [curvect.myname for curvect in self.active_zone.myvectors]
|
7093
|
+
if len(set(allnames)) != len(allnames):
|
7094
|
+
logging.warning(_('Some vectors have the same name !'))
|
7095
|
+
|
7096
|
+
# create new unique names
|
7097
|
+
unique_name = []
|
7098
|
+
for curvect in self.active_zone.myvectors:
|
7099
|
+
if curvect.myname in unique_name:
|
7100
|
+
unique_name.append(curvect.myname + '_' + str(unique_name.count(curvect.myname)))
|
7101
|
+
else:
|
7102
|
+
unique_name.append(curvect.myname)
|
7103
|
+
|
7104
|
+
|
7105
|
+
for idx, (curvect, name) in enumerate(zip(self.active_zone.myvectors, unique_name)):
|
7106
|
+
self.active_res2d.export_some_values_to_csv(curvect, which, filename=directory / name, for_steps= (begin-1, end-1, interval), all_values=all)
|
6581
7107
|
|
6582
7108
|
elif itemlabel == _("Plot active vector..."):
|
6583
7109
|
""" Plot data along active vector """
|
@@ -6623,16 +7149,13 @@ class WolfMapViewer(wx.Frame):
|
|
6623
7149
|
dlg.Destroy()
|
6624
7150
|
|
6625
7151
|
# Création d'un graphique matplotlib sous wx
|
6626
|
-
|
6627
|
-
figmpl.
|
6628
|
-
figmpl.Hide()
|
6629
|
-
fig, ax = figmpl.get_figax()
|
6630
|
-
|
6631
|
-
# fig, ax = self.active_vector.plot_mpl(True, False)
|
7152
|
+
lab = _('Plot of active vector') + ' - ' + self.active_vector.myname
|
7153
|
+
figmpl = self.new_fig(lab, lab, show=False, size= (800,600))
|
6632
7154
|
|
6633
7155
|
linkedarrays = self.get_linked_arrays()
|
6634
7156
|
|
6635
7157
|
with wx.MultiChoiceDialog(None, _('Choose the arrays to plot'), _('Arrays'), [curarray for curarray in list(linkedarrays.keys())]) as dlg:
|
7158
|
+
dlg:wx.MultiChoiceDialog
|
6636
7159
|
dlg.SetSelections(range(len(linkedarrays)))
|
6637
7160
|
|
6638
7161
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
@@ -6646,20 +7169,17 @@ class WolfMapViewer(wx.Frame):
|
|
6646
7169
|
|
6647
7170
|
linkedarrays = {curkey:curval for curkey, curval in linkedarrays.items() if curkey in selected}
|
6648
7171
|
|
6649
|
-
self.active_vector.
|
7172
|
+
self.active_vector.plot_linked_wx(figmpl, linkedarrays)
|
6650
7173
|
|
6651
7174
|
if add_cloud:
|
6652
7175
|
s, z = self.active_cloud.projectontrace(self.active_vector, return_cloud=False, proximity= proxval)
|
6653
7176
|
|
6654
|
-
|
7177
|
+
figmpl.plot( s, z, c='black', s=1.0, marker='x')
|
6655
7178
|
|
6656
7179
|
for curs, curz in zip(s,z):
|
6657
|
-
|
6658
|
-
|
6659
|
-
|
6660
|
-
|
6661
|
-
# fig.canvas.draw()
|
6662
|
-
# fig.canvas.flush_events()
|
7180
|
+
figmpl.plot([curs, curs], [curz-tolval, curz+tolval], 'k--', linewidth=0.5)
|
7181
|
+
figmpl.plot([curs-.1, curs+.1], [curz+tolval, curz+tolval], c='black', linewidth=0.5)
|
7182
|
+
figmpl.plot([curs-.1, curs+.1], [curz-tolval, curz-tolval], c='black', linewidth=0.5)
|
6663
7183
|
|
6664
7184
|
figmpl.Show()
|
6665
7185
|
|
@@ -6687,85 +7207,79 @@ class WolfMapViewer(wx.Frame):
|
|
6687
7207
|
logging.warning(_('No active zone ! -- please select a zone containing polygons !'))
|
6688
7208
|
return
|
6689
7209
|
|
6690
|
-
|
6691
|
-
|
6692
|
-
|
6693
|
-
|
6694
|
-
|
6695
|
-
|
6696
|
-
|
6697
|
-
|
6698
|
-
|
6699
|
-
|
6700
|
-
|
6701
|
-
|
6702
|
-
|
6703
|
-
|
6704
|
-
|
6705
|
-
|
6706
|
-
|
6707
|
-
|
6708
|
-
|
6709
|
-
|
7210
|
+
try:
|
7211
|
+
plotzone:list[zone]
|
7212
|
+
plotzone = []
|
7213
|
+
zonename = self.active_zone.myname
|
7214
|
+
if '_left_' in zonename or '_right_' in zonename:
|
7215
|
+
|
7216
|
+
logging.info(_('Left and Right polygons are detected'))
|
7217
|
+
|
7218
|
+
testname = zonename.replace('_left_', '')
|
7219
|
+
testname = testname.replace('_right_', '')
|
7220
|
+
|
7221
|
+
for curzone in self.active_zones.myzones:
|
7222
|
+
if testname == curzone.myname.replace('_left_', '').replace('_right_', ''):
|
7223
|
+
plotzone.append(curzone)
|
7224
|
+
|
7225
|
+
msg = wx.MessageDialog(self,
|
7226
|
+
_('Left and Right polygons are detected \nDo you want like to plot left and right polygons on the same plot ?'),
|
7227
|
+
style=wx.YES_NO | wx.YES_DEFAULT)
|
7228
|
+
ret = msg.ShowModal()
|
7229
|
+
msg.Destroy()
|
7230
|
+
if ret == wx.ID_NO:
|
7231
|
+
plotzone = [self.active_zone]
|
7232
|
+
else:
|
7233
|
+
logging.info(_('Sole polygon detected'))
|
6710
7234
|
plotzone = [self.active_zone]
|
6711
|
-
else:
|
6712
|
-
logging.info(_('Sole polygon detected'))
|
6713
|
-
plotzone = [self.active_zone]
|
6714
|
-
|
6715
|
-
# Création d'un graphique matplotlib sous wx
|
6716
|
-
figmpl = MplFig()
|
6717
|
-
figmpl.presets()
|
6718
|
-
figmpl.Hide()
|
6719
7235
|
|
6720
|
-
|
6721
|
-
|
6722
|
-
|
6723
|
-
|
6724
|
-
|
6725
|
-
|
6726
|
-
|
6727
|
-
|
6728
|
-
|
6729
|
-
|
6730
|
-
|
6731
|
-
|
6732
|
-
|
6733
|
-
|
6734
|
-
|
6735
|
-
|
6736
|
-
|
6737
|
-
|
6738
|
-
|
6739
|
-
|
6740
|
-
|
6741
|
-
|
6742
|
-
|
6743
|
-
|
6744
|
-
|
6745
|
-
|
6746
|
-
|
6747
|
-
|
6748
|
-
|
6749
|
-
|
6750
|
-
|
6751
|
-
|
6752
|
-
|
6753
|
-
|
6754
|
-
|
6755
|
-
|
6756
|
-
|
6757
|
-
|
6758
|
-
|
6759
|
-
|
6760
|
-
|
6761
|
-
plotzone[0].plot_linked_polygons(fig, ax, linkedarrays, linked_vec=linkedvecs)
|
7236
|
+
# Création d'un graphique matplotlib sous wx
|
7237
|
+
figmpl = self.new_fig(_('Plot of active polygons'), 'plot_active_polygons', show=False, size= (800,600))
|
7238
|
+
|
7239
|
+
linkedarrays = {}
|
7240
|
+
|
7241
|
+
# Matrices 2D
|
7242
|
+
for curarray in self.iterator_over_objects(draw_type.ARRAYS):
|
7243
|
+
curarray: WolfArray
|
7244
|
+
logging.info(_('Plotting array {}').format(curarray.idx))
|
7245
|
+
linkedarrays[curarray.idx] = curarray
|
7246
|
+
|
7247
|
+
# Résultats 2D
|
7248
|
+
for curarray in self.iterator_over_objects(draw_type.RES2D):
|
7249
|
+
curarray: Wolfresults_2D
|
7250
|
+
logging.info(_('Plotting results {}').format(curarray.idx))
|
7251
|
+
linkedarrays[curarray.idx] = curarray
|
7252
|
+
|
7253
|
+
linkedvecs={}
|
7254
|
+
for curvect in self.iterator_over_objects(draw_type.VECTORS):
|
7255
|
+
curvect: Zones
|
7256
|
+
logging.info(_('Plotting vector {}').format(curvect.idx))
|
7257
|
+
linkedvecs[curvect.idx] = curvect
|
7258
|
+
|
7259
|
+
if len(plotzone) > 1:
|
7260
|
+
# left and right polygons
|
7261
|
+
for curzone in plotzone:
|
7262
|
+
if '_left_' in curzone.myname:
|
7263
|
+
locarrays = {}
|
7264
|
+
for curkey, curarray in linkedarrays.items():
|
7265
|
+
locarrays[curkey+ '_left'] = curarray
|
7266
|
+
|
7267
|
+
curzone.plot_linked_polygons_wx(figmpl, locarrays, linked_vec=linkedvecs, linestyle= '--')
|
7268
|
+
elif '_right_' in curzone.myname:
|
7269
|
+
locarrays = {}
|
7270
|
+
for curkey, curarray in linkedarrays.items():
|
7271
|
+
locarrays[curkey+ '_right'] = curarray
|
7272
|
+
|
7273
|
+
curzone.plot_linked_polygons_wx(figmpl, locarrays, linked_vec=linkedvecs, linestyle= '-.')
|
7274
|
+
else:
|
7275
|
+
# sole polygon
|
7276
|
+
plotzone[0].plot_linked_polygons_wx(figmpl, linkedarrays, linked_vec=linkedvecs)
|
6762
7277
|
|
6763
|
-
|
6764
|
-
# ax.legend()
|
6765
|
-
# fig.show()
|
7278
|
+
figmpl.Show()
|
6766
7279
|
|
6767
|
-
|
6768
|
-
|
7280
|
+
except Exception as e:
|
7281
|
+
logging.error(_('Error in plotting active polygons\n{}'.format(e)))
|
7282
|
+
logging.warning(_('Are you sure the active zone contains polygons ?'))
|
6769
7283
|
|
6770
7284
|
elif itemlabel == _("Manage banks..."):
|
6771
7285
|
|
@@ -6950,6 +7464,23 @@ class WolfMapViewer(wx.Frame):
|
|
6950
7464
|
elif itemlabel == _('Initialize from directory'):
|
6951
7465
|
self.init_laz_from_gridinfos()
|
6952
7466
|
|
7467
|
+
elif itemlabel == _('Copy from current zoom'):
|
7468
|
+
|
7469
|
+
if self.mylazgrid is None:
|
7470
|
+
logging.warning(_('No gridded LAZ data loaded !'))
|
7471
|
+
return
|
7472
|
+
|
7473
|
+
dlg = wx.DirDialog(None, _('Choose a directory to copy the files'), _('Copy files'), style=wx.DD_DEFAULT_STYLE)
|
7474
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
7475
|
+
dlg.Destroy()
|
7476
|
+
|
7477
|
+
dirout = dlg.GetPath()
|
7478
|
+
dlg.Destroy()
|
7479
|
+
|
7480
|
+
curbounds = [[self.xmin, self.xmin + self.width], [self.ymin, self.ymin + self.height]]
|
7481
|
+
|
7482
|
+
self.mylazgrid.copy_files_in_bounds(curbounds, dirout)
|
7483
|
+
|
6953
7484
|
elif itemlabel == _('Create cloud points from bridges'):
|
6954
7485
|
|
6955
7486
|
if self.active_laz is None:
|
@@ -6990,12 +7521,39 @@ class WolfMapViewer(wx.Frame):
|
|
6990
7521
|
self.add_object('cloud', newobj=mycloud, ToCheck=True, id='Buildings')
|
6991
7522
|
|
6992
7523
|
elif itemlabel == _('Create cloud points from specified classes'):
|
6993
|
-
|
7524
|
+
|
7525
|
+
if self.active_laz is None:
|
7526
|
+
self.init_laz_from_lazlasnpz()
|
7527
|
+
|
7528
|
+
codes = self.active_laz.codes_unique
|
7529
|
+
|
7530
|
+
dlg = wx.MultiChoiceDialog(None, _('Choose the classes to plot'), _('Classes'), codes)
|
7531
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
7532
|
+
dlg.Destroy()
|
7533
|
+
|
7534
|
+
selected = dlg.GetSelections()
|
7535
|
+
selected = [codes[cur] for cur in selected]
|
7536
|
+
dlg.Destroy()
|
7537
|
+
|
7538
|
+
for curcode in selected:
|
7539
|
+
mycloud = cloud_vertices()
|
7540
|
+
mydata = self.active_laz.get_data_class(curcode)
|
7541
|
+
mycloud.init_from_nparray(mydata)
|
7542
|
+
mycloud.myprop.style = 2
|
7543
|
+
mycloud.myprop.color = getIfromRGB([102, 102, 102])
|
7544
|
+
mycloud.myprop.width = .5
|
7545
|
+
if self.linked:
|
7546
|
+
if len(self.linkedList) > 0:
|
7547
|
+
for curframe in self.linkedList:
|
7548
|
+
curframe.add_object('cloud', newobj=mycloud, ToCheck=True, id='Class {}'.format(curcode))
|
7549
|
+
else:
|
7550
|
+
self.add_object('cloud', newobj=mycloud, ToCheck=True, id='Class {}'.format(curcode))
|
6994
7551
|
|
6995
7552
|
elif itemlabel == _('Create LAZ viewer'):
|
6996
7553
|
|
6997
7554
|
laz_source = self._select_laz_source()
|
6998
7555
|
if laz_source is None:
|
7556
|
+
logging.warning(_('No LAZ data loaded !'))
|
6999
7557
|
return
|
7000
7558
|
|
7001
7559
|
if laz_source is self.mylazgrid:
|
@@ -7242,7 +7800,7 @@ class WolfMapViewer(wx.Frame):
|
|
7242
7800
|
self.menu_particlesystem()
|
7243
7801
|
|
7244
7802
|
elif itemlabel == _('Create particle system...'):
|
7245
|
-
self.
|
7803
|
+
self.active_particle_system = newpart = Particle_system()
|
7246
7804
|
self.add_object(which='particlesystem', newobj=newpart, ToCheck=True)
|
7247
7805
|
self.menu_particlesystem()
|
7248
7806
|
|
@@ -11990,6 +12548,19 @@ class WolfMapViewer(wx.Frame):
|
|
11990
12548
|
self.active_vertex = None
|
11991
12549
|
self.active_cloud = None
|
11992
12550
|
|
12551
|
+
self.active_laz = None
|
12552
|
+
|
12553
|
+
self.active_fig = None
|
12554
|
+
self.active_bridge = None
|
12555
|
+
self.active_bridges = None
|
12556
|
+
self.active_bc = None
|
12557
|
+
self.active_cs = None
|
12558
|
+
self.active_imagestiles = None
|
12559
|
+
self.active_landmap = None
|
12560
|
+
self.active_profile = None
|
12561
|
+
self.active_tri = None
|
12562
|
+
self.active_viewer3d = None
|
12563
|
+
|
11993
12564
|
self.set_statusbar_text(_('Esc pressed - No more action in progress - No more active object'))
|
11994
12565
|
self.set_label_selecteditem('')
|
11995
12566
|
|
@@ -12154,11 +12725,19 @@ class WolfMapViewer(wx.Frame):
|
|
12154
12725
|
self.active_array.myops.reset_all_selection()
|
12155
12726
|
self.Refresh()
|
12156
12727
|
|
12728
|
+
if self.active_res2d is not None:
|
12729
|
+
self.active_res2d.SelectionData.reset_all()
|
12730
|
+
self.Refresh()
|
12731
|
+
|
12157
12732
|
elif key == ord('R'): # r
|
12158
12733
|
if self.active_array is not None:
|
12159
12734
|
self.active_array.myops.reset_selection()
|
12160
12735
|
self.Refresh()
|
12161
12736
|
|
12737
|
+
if self.active_res2d is not None:
|
12738
|
+
self.active_res2d.SelectionData.reset()
|
12739
|
+
self.Refresh()
|
12740
|
+
|
12162
12741
|
elif key == ord('O'):
|
12163
12742
|
# Active Opacity for the active array
|
12164
12743
|
|