wolfhece 2.1.119__py3-none-any.whl → 2.1.120__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 +731 -153
- wolfhece/PyVertexvectors.py +299 -0
- 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 +484 -21
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.120.dist-info}/METADATA +1 -1
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.120.dist-info}/RECORD +16 -14
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.120.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.120.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.119.dist-info → wolfhece-2.1.120.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,105 @@ 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
|
+
|
6886
|
+
finally:
|
6887
|
+
choice_bes.Destroy()
|
6888
|
+
|
6889
|
+
if begin == -1:
|
6890
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6891
|
+
return
|
6892
|
+
|
6893
|
+
ret = self.active_res2d.export_some_values_to_csv(all_selected, which, filename, for_steps= (begin-1, end-1, interval))
|
6894
|
+
|
6895
|
+
if not ret:
|
6896
|
+
logging.error(_('Error in exporting values !'))
|
6517
6897
|
|
6518
6898
|
elif itemlabel == _("Plot stats unknown (inside active vector)..."):
|
6519
6899
|
|
@@ -6525,24 +6905,91 @@ class WolfMapViewer(wx.Frame):
|
|
6525
6905
|
logging.warning(_('No active vector !'))
|
6526
6906
|
return
|
6527
6907
|
|
6528
|
-
|
6908
|
+
keys = Extractable_results.get_list()
|
6909
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6910
|
+
|
6911
|
+
ret = dlg.ShowModal()
|
6912
|
+
if ret == wx.ID_CANCEL:
|
6913
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6914
|
+
dlg.Destroy()
|
6915
|
+
return
|
6916
|
+
|
6917
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6918
|
+
dlg.Destroy()
|
6919
|
+
|
6920
|
+
try:
|
6921
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
6922
|
+
ret = choice_bes.ShowModal()
|
6923
|
+
|
6924
|
+
begin = choice_bes.begin
|
6925
|
+
end = choice_bes.end
|
6926
|
+
interval = choice_bes.step
|
6927
|
+
violin = choice_bes.check_violin
|
6928
|
+
|
6929
|
+
finally:
|
6930
|
+
choice_bes.Destroy()
|
6931
|
+
|
6932
|
+
if begin == -1:
|
6933
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6934
|
+
return
|
6935
|
+
|
6936
|
+
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))
|
6937
|
+
|
6938
|
+
if violin:
|
6939
|
+
figax = self.active_res2d.plot_violin_values(self.active_vector, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6940
|
+
else:
|
6941
|
+
figax = self.active_res2d.plot_some_values(self.active_vector, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6942
|
+
|
6943
|
+
newfig.Show()
|
6944
|
+
|
6945
|
+
elif itemlabel == _("Export stats unknown (inside active vector)..."):
|
6946
|
+
|
6947
|
+
if self.active_res2d is None:
|
6948
|
+
logging.warning(_('No active 2D result !'))
|
6949
|
+
return
|
6950
|
+
|
6951
|
+
if self.active_vector is None:
|
6952
|
+
logging.warning(_('No active vector !'))
|
6953
|
+
return
|
6954
|
+
|
6955
|
+
keys = Extractable_results.get_list()
|
6956
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6957
|
+
|
6958
|
+
ret = dlg.ShowModal()
|
6959
|
+
if ret == wx.ID_CANCEL:
|
6960
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6961
|
+
dlg.Destroy()
|
6962
|
+
return
|
6963
|
+
|
6964
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6965
|
+
dlg.Destroy()
|
6529
6966
|
|
6967
|
+
dlg = wx.FileDialog(None, _('Choose the file to export'), wildcard='csv (*.csv)|*.csv', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
6530
6968
|
ret = dlg.ShowModal()
|
6531
6969
|
if ret == wx.ID_CANCEL:
|
6970
|
+
logging.info(_('No file chosen - Aborting !'))
|
6532
6971
|
dlg.Destroy()
|
6533
6972
|
return
|
6534
6973
|
|
6535
|
-
|
6974
|
+
filename = Path(dlg.GetPath())
|
6536
6975
|
dlg.Destroy()
|
6537
6976
|
|
6538
|
-
|
6539
|
-
|
6540
|
-
|
6541
|
-
|
6542
|
-
|
6543
|
-
|
6977
|
+
try:
|
6978
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
6979
|
+
ret = choice_bes.ShowModal()
|
6980
|
+
|
6981
|
+
begin = choice_bes.begin
|
6982
|
+
end = choice_bes.end
|
6983
|
+
interval = choice_bes.step
|
6984
|
+
|
6985
|
+
finally:
|
6986
|
+
choice_bes.Destroy()
|
6987
|
+
|
6988
|
+
if begin == -1:
|
6989
|
+
logging.info(_('No interval chosen - Aborting !'))
|
6990
|
+
return
|
6544
6991
|
|
6545
|
-
|
6992
|
+
ret = self.active_res2d.export_some_values_to_csv(self.active_vector, which, filename=filename, for_steps= (begin-1, end-1, interval))
|
6546
6993
|
|
6547
6994
|
elif itemlabel == _("Plot stats unknown (inside active zone)..."):
|
6548
6995
|
|
@@ -6554,30 +7001,108 @@ class WolfMapViewer(wx.Frame):
|
|
6554
7001
|
logging.warning(_('No active zone !'))
|
6555
7002
|
return
|
6556
7003
|
|
6557
|
-
|
7004
|
+
keys = Extractable_results.get_list()
|
7005
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
6558
7006
|
|
6559
7007
|
ret = dlg.ShowModal()
|
6560
7008
|
if ret == wx.ID_CANCEL:
|
7009
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
6561
7010
|
dlg.Destroy()
|
6562
7011
|
return
|
6563
7012
|
|
6564
|
-
|
7013
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
6565
7014
|
dlg.Destroy()
|
6566
7015
|
|
6567
|
-
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
6571
|
-
|
6572
|
-
|
7016
|
+
try:
|
7017
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
7018
|
+
ret = choice_bes.ShowModal()
|
7019
|
+
|
7020
|
+
begin = choice_bes.begin
|
7021
|
+
end = choice_bes.end
|
7022
|
+
interval = choice_bes.step
|
7023
|
+
violin = choice_bes.check_violin
|
7024
|
+
|
7025
|
+
finally:
|
7026
|
+
choice_bes.Destroy()
|
7027
|
+
|
7028
|
+
if begin == -1:
|
7029
|
+
logging.info(_('No interval chosen - Aborting !'))
|
7030
|
+
return
|
6573
7031
|
|
6574
7032
|
for idx, curvect in enumerate(self.active_zone.myvectors):
|
7033
|
+
logging.info(_('Plotting {} / {}'.format(idx, self.active_zone.nbvectors)))
|
6575
7034
|
if idx ==0:
|
6576
|
-
|
7035
|
+
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))
|
7036
|
+
|
7037
|
+
if violin:
|
7038
|
+
figax = self.active_res2d.plot_violin_values(curvect, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6577
7039
|
else:
|
6578
|
-
self.active_res2d.
|
7040
|
+
figax = self.active_res2d.plot_some_values(curvect, which, toshow=False, figax=newfig, for_steps= (begin-1, end-1, interval))
|
6579
7041
|
|
6580
|
-
|
7042
|
+
newfig.Show()
|
7043
|
+
|
7044
|
+
elif itemlabel == _("Export stats unknown (inside active zone)..."):
|
7045
|
+
|
7046
|
+
if self.active_res2d is None:
|
7047
|
+
logging.warning(_('No active 2D result !'))
|
7048
|
+
return
|
7049
|
+
|
7050
|
+
if self.active_zone is None:
|
7051
|
+
logging.warning(_('No active zone !'))
|
7052
|
+
return
|
7053
|
+
|
7054
|
+
keys = Extractable_results.get_list()
|
7055
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the unknown/variable to plot'), _('Unknown'), keys)
|
7056
|
+
|
7057
|
+
ret = dlg.ShowModal()
|
7058
|
+
if ret == wx.ID_CANCEL:
|
7059
|
+
logging.info(_('No unknown chosen - Aborting !'))
|
7060
|
+
dlg.Destroy()
|
7061
|
+
return
|
7062
|
+
|
7063
|
+
which = Extractable_results.get_from_key(dlg.GetStringSelection())
|
7064
|
+
dlg.Destroy()
|
7065
|
+
|
7066
|
+
dlg = wx.DirDialog(None, _('Choose the directory where to export'), style= wx.DD_DEFAULT_STYLE)
|
7067
|
+
ret = dlg.ShowModal()
|
7068
|
+
if ret == wx.ID_CANCEL:
|
7069
|
+
logging.info(_('No file chosen - Aborting !'))
|
7070
|
+
dlg.Destroy()
|
7071
|
+
return
|
7072
|
+
|
7073
|
+
directory = Path(dlg.GetPath())
|
7074
|
+
dlg.Destroy()
|
7075
|
+
|
7076
|
+
try:
|
7077
|
+
choice_bes = Select_Begin_end_interval_step(self, _('Choose the interval and step'), self.active_res2d, checkbox=True)
|
7078
|
+
ret = choice_bes.ShowModal()
|
7079
|
+
|
7080
|
+
begin = choice_bes.begin
|
7081
|
+
end = choice_bes.end
|
7082
|
+
interval = choice_bes.step
|
7083
|
+
|
7084
|
+
finally:
|
7085
|
+
choice_bes.Destroy()
|
7086
|
+
|
7087
|
+
if begin == -1:
|
7088
|
+
logging.info(_('No interval chosen - Aborting !'))
|
7089
|
+
return
|
7090
|
+
|
7091
|
+
allnames = [curvect.myname for curvect in self.active_zone.myvectors]
|
7092
|
+
if len(set(allnames)) != len(allnames):
|
7093
|
+
logging.warning(_('Some vectors have the same name !'))
|
7094
|
+
|
7095
|
+
# create new unique names
|
7096
|
+
unique_name = []
|
7097
|
+
for curvect in self.active_zone.myvectors:
|
7098
|
+
if curvect.myname in unique_name:
|
7099
|
+
unique_name.append(curvect.myname + '_' + str(unique_name.count(curvect.myname)))
|
7100
|
+
else:
|
7101
|
+
unique_name.append(curvect.myname)
|
7102
|
+
|
7103
|
+
|
7104
|
+
for idx, (curvect, name) in enumerate(zip(self.active_zone.myvectors, unique_name)):
|
7105
|
+
self.active_res2d.export_some_values_to_csv(curvect, which, filename=directory / name, for_steps= (begin-1, end-1, interval))
|
6581
7106
|
|
6582
7107
|
elif itemlabel == _("Plot active vector..."):
|
6583
7108
|
""" Plot data along active vector """
|
@@ -6623,16 +7148,13 @@ class WolfMapViewer(wx.Frame):
|
|
6623
7148
|
dlg.Destroy()
|
6624
7149
|
|
6625
7150
|
# 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)
|
7151
|
+
lab = _('Plot of active vector') + ' - ' + self.active_vector.myname
|
7152
|
+
figmpl = self.new_fig(lab, lab, show=False, size= (800,600))
|
6632
7153
|
|
6633
7154
|
linkedarrays = self.get_linked_arrays()
|
6634
7155
|
|
6635
7156
|
with wx.MultiChoiceDialog(None, _('Choose the arrays to plot'), _('Arrays'), [curarray for curarray in list(linkedarrays.keys())]) as dlg:
|
7157
|
+
dlg:wx.MultiChoiceDialog
|
6636
7158
|
dlg.SetSelections(range(len(linkedarrays)))
|
6637
7159
|
|
6638
7160
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
@@ -6646,20 +7168,17 @@ class WolfMapViewer(wx.Frame):
|
|
6646
7168
|
|
6647
7169
|
linkedarrays = {curkey:curval for curkey, curval in linkedarrays.items() if curkey in selected}
|
6648
7170
|
|
6649
|
-
self.active_vector.
|
7171
|
+
self.active_vector.plot_linked_wx(figmpl, linkedarrays)
|
6650
7172
|
|
6651
7173
|
if add_cloud:
|
6652
7174
|
s, z = self.active_cloud.projectontrace(self.active_vector, return_cloud=False, proximity= proxval)
|
6653
7175
|
|
6654
|
-
|
7176
|
+
figmpl.plot( s, z, c='black', s=1.0, marker='x')
|
6655
7177
|
|
6656
7178
|
for curs, curz in zip(s,z):
|
6657
|
-
|
6658
|
-
|
6659
|
-
|
6660
|
-
|
6661
|
-
# fig.canvas.draw()
|
6662
|
-
# fig.canvas.flush_events()
|
7179
|
+
figmpl.plot([curs, curs], [curz-tolval, curz+tolval], 'k--', linewidth=0.5)
|
7180
|
+
figmpl.plot([curs-.1, curs+.1], [curz+tolval, curz+tolval], c='black', linewidth=0.5)
|
7181
|
+
figmpl.plot([curs-.1, curs+.1], [curz-tolval, curz-tolval], c='black', linewidth=0.5)
|
6663
7182
|
|
6664
7183
|
figmpl.Show()
|
6665
7184
|
|
@@ -6687,85 +7206,79 @@ class WolfMapViewer(wx.Frame):
|
|
6687
7206
|
logging.warning(_('No active zone ! -- please select a zone containing polygons !'))
|
6688
7207
|
return
|
6689
7208
|
|
6690
|
-
|
6691
|
-
|
6692
|
-
|
6693
|
-
|
6694
|
-
|
6695
|
-
|
6696
|
-
|
6697
|
-
|
6698
|
-
|
6699
|
-
|
6700
|
-
|
6701
|
-
|
6702
|
-
|
6703
|
-
|
6704
|
-
|
6705
|
-
|
6706
|
-
|
6707
|
-
|
6708
|
-
|
6709
|
-
|
7209
|
+
try:
|
7210
|
+
plotzone:list[zone]
|
7211
|
+
plotzone = []
|
7212
|
+
zonename = self.active_zone.myname
|
7213
|
+
if '_left_' in zonename or '_right_' in zonename:
|
7214
|
+
|
7215
|
+
logging.info(_('Left and Right polygons are detected'))
|
7216
|
+
|
7217
|
+
testname = zonename.replace('_left_', '')
|
7218
|
+
testname = testname.replace('_right_', '')
|
7219
|
+
|
7220
|
+
for curzone in self.active_zones.myzones:
|
7221
|
+
if testname == curzone.myname.replace('_left_', '').replace('_right_', ''):
|
7222
|
+
plotzone.append(curzone)
|
7223
|
+
|
7224
|
+
msg = wx.MessageDialog(self,
|
7225
|
+
_('Left and Right polygons are detected \nDo you want like to plot left and right polygons on the same plot ?'),
|
7226
|
+
style=wx.YES_NO | wx.YES_DEFAULT)
|
7227
|
+
ret = msg.ShowModal()
|
7228
|
+
msg.Destroy()
|
7229
|
+
if ret == wx.ID_NO:
|
7230
|
+
plotzone = [self.active_zone]
|
7231
|
+
else:
|
7232
|
+
logging.info(_('Sole polygon detected'))
|
6710
7233
|
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
7234
|
|
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)
|
7235
|
+
# Création d'un graphique matplotlib sous wx
|
7236
|
+
figmpl = self.new_fig(_('Plot of active polygons'), 'plot_active_polygons', show=False, size= (800,600))
|
7237
|
+
|
7238
|
+
linkedarrays = {}
|
7239
|
+
|
7240
|
+
# Matrices 2D
|
7241
|
+
for curarray in self.iterator_over_objects(draw_type.ARRAYS):
|
7242
|
+
curarray: WolfArray
|
7243
|
+
logging.info(_('Plotting array {}').format(curarray.idx))
|
7244
|
+
linkedarrays[curarray.idx] = curarray
|
7245
|
+
|
7246
|
+
# Résultats 2D
|
7247
|
+
for curarray in self.iterator_over_objects(draw_type.RES2D):
|
7248
|
+
curarray: Wolfresults_2D
|
7249
|
+
logging.info(_('Plotting results {}').format(curarray.idx))
|
7250
|
+
linkedarrays[curarray.idx] = curarray
|
7251
|
+
|
7252
|
+
linkedvecs={}
|
7253
|
+
for curvect in self.iterator_over_objects(draw_type.VECTORS):
|
7254
|
+
curvect: Zones
|
7255
|
+
logging.info(_('Plotting vector {}').format(curvect.idx))
|
7256
|
+
linkedvecs[curvect.idx] = curvect
|
7257
|
+
|
7258
|
+
if len(plotzone) > 1:
|
7259
|
+
# left and right polygons
|
7260
|
+
for curzone in plotzone:
|
7261
|
+
if '_left_' in curzone.myname:
|
7262
|
+
locarrays = {}
|
7263
|
+
for curkey, curarray in linkedarrays.items():
|
7264
|
+
locarrays[curkey+ '_left'] = curarray
|
7265
|
+
|
7266
|
+
curzone.plot_linked_polygons_wx(figmpl, locarrays, linked_vec=linkedvecs, linestyle= '--')
|
7267
|
+
elif '_right_' in curzone.myname:
|
7268
|
+
locarrays = {}
|
7269
|
+
for curkey, curarray in linkedarrays.items():
|
7270
|
+
locarrays[curkey+ '_right'] = curarray
|
7271
|
+
|
7272
|
+
curzone.plot_linked_polygons_wx(figmpl, locarrays, linked_vec=linkedvecs, linestyle= '-.')
|
7273
|
+
else:
|
7274
|
+
# sole polygon
|
7275
|
+
plotzone[0].plot_linked_polygons_wx(figmpl, linkedarrays, linked_vec=linkedvecs)
|
6762
7276
|
|
6763
|
-
|
6764
|
-
# ax.legend()
|
6765
|
-
# fig.show()
|
7277
|
+
figmpl.Show()
|
6766
7278
|
|
6767
|
-
|
6768
|
-
|
7279
|
+
except Exception as e:
|
7280
|
+
logging.error(_('Error in plotting active polygons\n{}'.format(e)))
|
7281
|
+
logging.warning(_('Are you sure the active zone contains polygons ?'))
|
6769
7282
|
|
6770
7283
|
elif itemlabel == _("Manage banks..."):
|
6771
7284
|
|
@@ -6950,6 +7463,23 @@ class WolfMapViewer(wx.Frame):
|
|
6950
7463
|
elif itemlabel == _('Initialize from directory'):
|
6951
7464
|
self.init_laz_from_gridinfos()
|
6952
7465
|
|
7466
|
+
elif itemlabel == _('Copy from current zoom'):
|
7467
|
+
|
7468
|
+
if self.mylazgrid is None:
|
7469
|
+
logging.warning(_('No gridded LAZ data loaded !'))
|
7470
|
+
return
|
7471
|
+
|
7472
|
+
dlg = wx.DirDialog(None, _('Choose a directory to copy the files'), _('Copy files'), style=wx.DD_DEFAULT_STYLE)
|
7473
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
7474
|
+
dlg.Destroy()
|
7475
|
+
|
7476
|
+
dirout = dlg.GetPath()
|
7477
|
+
dlg.Destroy()
|
7478
|
+
|
7479
|
+
curbounds = [[self.xmin, self.xmin + self.width], [self.ymin, self.ymin + self.height]]
|
7480
|
+
|
7481
|
+
self.mylazgrid.copy_files_in_bounds(curbounds, dirout)
|
7482
|
+
|
6953
7483
|
elif itemlabel == _('Create cloud points from bridges'):
|
6954
7484
|
|
6955
7485
|
if self.active_laz is None:
|
@@ -6990,12 +7520,39 @@ class WolfMapViewer(wx.Frame):
|
|
6990
7520
|
self.add_object('cloud', newobj=mycloud, ToCheck=True, id='Buildings')
|
6991
7521
|
|
6992
7522
|
elif itemlabel == _('Create cloud points from specified classes'):
|
6993
|
-
|
7523
|
+
|
7524
|
+
if self.active_laz is None:
|
7525
|
+
self.init_laz_from_lazlasnpz()
|
7526
|
+
|
7527
|
+
codes = self.active_laz.codes_unique
|
7528
|
+
|
7529
|
+
dlg = wx.MultiChoiceDialog(None, _('Choose the classes to plot'), _('Classes'), codes)
|
7530
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
7531
|
+
dlg.Destroy()
|
7532
|
+
|
7533
|
+
selected = dlg.GetSelections()
|
7534
|
+
selected = [codes[cur] for cur in selected]
|
7535
|
+
dlg.Destroy()
|
7536
|
+
|
7537
|
+
for curcode in selected:
|
7538
|
+
mycloud = cloud_vertices()
|
7539
|
+
mydata = self.active_laz.get_data_class(curcode)
|
7540
|
+
mycloud.init_from_nparray(mydata)
|
7541
|
+
mycloud.myprop.style = 2
|
7542
|
+
mycloud.myprop.color = getIfromRGB([102, 102, 102])
|
7543
|
+
mycloud.myprop.width = .5
|
7544
|
+
if self.linked:
|
7545
|
+
if len(self.linkedList) > 0:
|
7546
|
+
for curframe in self.linkedList:
|
7547
|
+
curframe.add_object('cloud', newobj=mycloud, ToCheck=True, id='Class {}'.format(curcode))
|
7548
|
+
else:
|
7549
|
+
self.add_object('cloud', newobj=mycloud, ToCheck=True, id='Class {}'.format(curcode))
|
6994
7550
|
|
6995
7551
|
elif itemlabel == _('Create LAZ viewer'):
|
6996
7552
|
|
6997
7553
|
laz_source = self._select_laz_source()
|
6998
7554
|
if laz_source is None:
|
7555
|
+
logging.warning(_('No LAZ data loaded !'))
|
6999
7556
|
return
|
7000
7557
|
|
7001
7558
|
if laz_source is self.mylazgrid:
|
@@ -7242,7 +7799,7 @@ class WolfMapViewer(wx.Frame):
|
|
7242
7799
|
self.menu_particlesystem()
|
7243
7800
|
|
7244
7801
|
elif itemlabel == _('Create particle system...'):
|
7245
|
-
self.
|
7802
|
+
self.active_particle_system = newpart = Particle_system()
|
7246
7803
|
self.add_object(which='particlesystem', newobj=newpart, ToCheck=True)
|
7247
7804
|
self.menu_particlesystem()
|
7248
7805
|
|
@@ -11990,6 +12547,19 @@ class WolfMapViewer(wx.Frame):
|
|
11990
12547
|
self.active_vertex = None
|
11991
12548
|
self.active_cloud = None
|
11992
12549
|
|
12550
|
+
self.active_laz = None
|
12551
|
+
|
12552
|
+
self.active_fig = None
|
12553
|
+
self.active_bridge = None
|
12554
|
+
self.active_bridges = None
|
12555
|
+
self.active_bc = None
|
12556
|
+
self.active_cs = None
|
12557
|
+
self.active_imagestiles = None
|
12558
|
+
self.active_landmap = None
|
12559
|
+
self.active_profile = None
|
12560
|
+
self.active_tri = None
|
12561
|
+
self.active_viewer3d = None
|
12562
|
+
|
11993
12563
|
self.set_statusbar_text(_('Esc pressed - No more action in progress - No more active object'))
|
11994
12564
|
self.set_label_selecteditem('')
|
11995
12565
|
|
@@ -12154,11 +12724,19 @@ class WolfMapViewer(wx.Frame):
|
|
12154
12724
|
self.active_array.myops.reset_all_selection()
|
12155
12725
|
self.Refresh()
|
12156
12726
|
|
12727
|
+
if self.active_res2d is not None:
|
12728
|
+
self.active_res2d.SelectionData.reset_all()
|
12729
|
+
self.Refresh()
|
12730
|
+
|
12157
12731
|
elif key == ord('R'): # r
|
12158
12732
|
if self.active_array is not None:
|
12159
12733
|
self.active_array.myops.reset_selection()
|
12160
12734
|
self.Refresh()
|
12161
12735
|
|
12736
|
+
if self.active_res2d is not None:
|
12737
|
+
self.active_res2d.SelectionData.reset()
|
12738
|
+
self.Refresh()
|
12739
|
+
|
12162
12740
|
elif key == ord('O'):
|
12163
12741
|
# Active Opacity for the active array
|
12164
12742
|
|