wolfhece 2.2.1__py3-none-any.whl → 2.2.3__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/PandasGrid.py +67 -0
- wolfhece/PyDraw.py +671 -30
- wolfhece/PyGui.py +6 -2
- wolfhece/PyHydrographs.py +2 -3
- wolfhece/PyPalette.py +10 -0
- wolfhece/PyParams.py +2 -3
- wolfhece/PyVertex.py +7 -7
- wolfhece/PyVertexvectors.py +1 -0
- wolfhece/PyWMS.py +72 -3
- wolfhece/acceptability/Parallels.py +25 -19
- wolfhece/acceptability/acceptability_gui.py +104 -131
- wolfhece/acceptability/func.py +99 -13
- wolfhece/apps/check_install.py +6 -6
- wolfhece/apps/splashscreen.py +5 -0
- wolfhece/apps/version.py +1 -1
- wolfhece/assets/__init__.py +1 -0
- wolfhece/assets/speedometer.py +135 -0
- wolfhece/dike.py +684 -0
- wolfhece/drowning_victims/Class.py +2165 -0
- wolfhece/drowning_victims/Functions.py +1019 -0
- wolfhece/drowning_victims/__init__.py +0 -0
- wolfhece/lifewatch.py +88 -0
- wolfhece/scenario/config_manager.py +4 -4
- wolfhece/wolf_array.py +58 -33
- wolfhece/wolf_texture.py +9 -2
- {wolfhece-2.2.1.dist-info → wolfhece-2.2.3.dist-info}/METADATA +3 -1
- {wolfhece-2.2.1.dist-info → wolfhece-2.2.3.dist-info}/RECORD +30 -22
- {wolfhece-2.2.1.dist-info → wolfhece-2.2.3.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.1.dist-info → wolfhece-2.2.3.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.1.dist-info → wolfhece-2.2.3.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -7,6 +7,11 @@ Copyright (c) 2024 University of Liege. All rights reserved.
|
|
7
7
|
This script and its content are protected by copyright law. Unauthorized
|
8
8
|
copying or distribution of this file, via any medium, is strictly prohibited.
|
9
9
|
"""
|
10
|
+
try:
|
11
|
+
from osgeo import gdal
|
12
|
+
except ImportError as e:
|
13
|
+
print(e)
|
14
|
+
raise ImportError("I can't find the 'gdal' package. You should get it from https://www.lfd.uci.edu/~gohlke/pythonlibs/")
|
10
15
|
|
11
16
|
try:
|
12
17
|
import numpy as np
|
@@ -24,18 +29,13 @@ try:
|
|
24
29
|
import json
|
25
30
|
import glob
|
26
31
|
import traceback
|
27
|
-
from datetime import datetime
|
32
|
+
from datetime import datetime
|
28
33
|
from sklearn import linear_model, datasets
|
29
34
|
|
30
35
|
except ImportError as e:
|
31
36
|
print(e)
|
32
37
|
raise ImportError("Error importing wxPython, numpy, PIL, json, glob, traceback, sklearn. Please check your installation.")
|
33
38
|
|
34
|
-
try:
|
35
|
-
from osgeo import gdal
|
36
|
-
except ModuleNotFoundError:
|
37
|
-
raise Exception("I can't find the 'gdal' package. You should get it from https://www.lfd.uci.edu/~gohlke/pythonlibs/")
|
38
|
-
|
39
39
|
try:
|
40
40
|
from time import sleep
|
41
41
|
from datetime import timedelta
|
@@ -97,6 +97,11 @@ except ImportError as e:
|
|
97
97
|
print(e)
|
98
98
|
raise ImportError("Error importing wolf_texture, xyz_file, mesh2d, PyPalette, wolfresults_2D, PyTranslate, PyVertex, RatingCurve, wolf_array, PyParams, mesh2d.bc_manager, PyVertexvectors, Results2DGPU, PyCrosssections, GraphNotebook, lazviewer, picc, wolf_zi_db, math_parser.calculator, wintab. Please check your installation.")
|
99
99
|
|
100
|
+
try:
|
101
|
+
from .dike import DikeWolf, Wolf_Param_dike
|
102
|
+
except:
|
103
|
+
logging.warning(_("Missing package. Install wolfpydike module via pip."))
|
104
|
+
|
100
105
|
try:
|
101
106
|
from .hydrometry.kiwis_wolfgui import hydrometry_wolfgui
|
102
107
|
except ImportError as e:
|
@@ -125,6 +130,12 @@ except ImportError as e:
|
|
125
130
|
print(e)
|
126
131
|
raise ImportError("Error importing apps.curvedigitizer. Please check your installation.")
|
127
132
|
|
133
|
+
try:
|
134
|
+
from .drowning_victims.Class import Drowning_victim_Viewer
|
135
|
+
except ImportError as e:
|
136
|
+
print(e)
|
137
|
+
raise ImportError("Error importing Drowning_victims.Class. Please check your installation.")
|
138
|
+
|
128
139
|
ID_SELECTCS = 1000
|
129
140
|
ID_SORTALONG = 1001
|
130
141
|
ID_LOCMINMAX = 1002
|
@@ -603,6 +614,8 @@ class draw_type(Enum):
|
|
603
614
|
TILES = 'tiles'
|
604
615
|
IMAGESTILES = 'imagestiles'
|
605
616
|
LAZ = 'laz'
|
617
|
+
DROWNING = 'drowning'
|
618
|
+
DIKE = 'dike'
|
606
619
|
|
607
620
|
class Colors_1to9(wx.Frame):
|
608
621
|
|
@@ -1197,6 +1210,273 @@ class Sim_Explorer(wx.Frame):
|
|
1197
1210
|
self._step_num.Set([str(i) for i in self._all_times_steps[1]])
|
1198
1211
|
|
1199
1212
|
|
1213
|
+
class Drowning_Explorer(wx.Frame):
|
1214
|
+
|
1215
|
+
def __init__(self, parent, title, mapviewer:any, sim:Drowning_victim_Viewer):
|
1216
|
+
|
1217
|
+
super().__init__(parent, title=title, size=(150, 250), style = wx.DEFAULT_FRAME_STYLE & ~ (wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX))
|
1218
|
+
|
1219
|
+
self._panel = wx.Panel(self)
|
1220
|
+
|
1221
|
+
self.mapviewer = mapviewer
|
1222
|
+
self.active_drowning:Drowning_victim_Viewer = sim
|
1223
|
+
|
1224
|
+
main_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
1225
|
+
|
1226
|
+
left_bar = wx.BoxSizer(wx.VERTICAL)
|
1227
|
+
right_bar = wx.BoxSizer(wx.VERTICAL)
|
1228
|
+
|
1229
|
+
self._all_times_steps = self.active_drowning.wanted_time
|
1230
|
+
|
1231
|
+
# Right bar
|
1232
|
+
# ---------
|
1233
|
+
|
1234
|
+
# Slider
|
1235
|
+
self._slider_steps = wx.Slider(self._panel, minValue=1, maxValue=len(self.active_drowning.wanted_time)-1, style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_MIN_MAX_LABELS | wx.SL_LABELS)
|
1236
|
+
self._slider_steps.Bind(wx.EVT_SLIDER, self.OnSliderSteps)
|
1237
|
+
right_bar.Add(self._slider_steps, 1, wx.EXPAND | wx.ALL, 2)
|
1238
|
+
|
1239
|
+
self._time_drowning = wx.TextCtrl(self._panel, value=f"Drowning at 0 days, 0 hours,\n0 minutes and 0 seconds", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_CENTER)
|
1240
|
+
right_bar.Add(self._time_drowning, 0, wx.EXPAND | wx.ALL, 2)
|
1241
|
+
|
1242
|
+
# Explore by time
|
1243
|
+
self._label_time = wx.StaticText(self._panel, label=_('Time [s]'))
|
1244
|
+
right_bar.Add(self._label_time, 1, wx.EXPAND | wx.ALL, 2)
|
1245
|
+
|
1246
|
+
_now = datetime.now()
|
1247
|
+
self._starting_date = datetime(year=_now.year, month=_now.month, day=_now.day, hour=0, minute=0, second=0)
|
1248
|
+
self._texttime = wx.TextCtrl(self._panel, value=self._starting_date.strftime('%Y-%m-%d %H:%M:%S'))
|
1249
|
+
right_bar.Add(self._texttime, 1, wx.EXPAND | wx.ALL, 5)
|
1250
|
+
self._texttime.Bind(wx.EVT_TEXT, self.OnTextTime)
|
1251
|
+
|
1252
|
+
self._step_time = wx.ListBox(self._panel, choices=['{:.3f} - {}'.format(i, datetime.strftime(self._starting_date + timedelta(seconds=i), '%Y-%m-%d %H:%M:%S')) for i in self._all_times_steps[:-1]], style=wx.LB_SINGLE)
|
1253
|
+
self._step_time.Bind(wx.EVT_LISTBOX, self.OnSelectNumStep)
|
1254
|
+
right_bar.Add(self._step_time, 1, wx.EXPAND | wx.ALL, 5)
|
1255
|
+
|
1256
|
+
self._step_idx = wx.ListBox(self._panel, choices=[str(i) for i in range(1, len(self.active_drowning.wanted_time)-1+1)], style=wx.LB_SINGLE)
|
1257
|
+
self._step_idx.Bind(wx.EVT_LISTBOX, self.OnSelectIdxStep)
|
1258
|
+
right_bar.Add(self._step_idx, 1, wx.EXPAND | wx.ALL, 5)
|
1259
|
+
|
1260
|
+
# Left bar
|
1261
|
+
# --------
|
1262
|
+
|
1263
|
+
# Apply selected step
|
1264
|
+
self._cmd_apply = wx.Button(self._panel, wx.ID_APPLY, _('Apply'))
|
1265
|
+
self._cmd_apply.SetToolTip(_('Apply the selected parameters to the map'))
|
1266
|
+
self._cmd_apply.Bind(wx.EVT_BUTTON, self.OnApply)
|
1267
|
+
left_bar.Add(self._cmd_apply, 1, wx.EXPAND | wx.ALL, 5)
|
1268
|
+
|
1269
|
+
# Next step
|
1270
|
+
self._cmd_next = wx.Button(self._panel, wx.ID_FORWARD, _('Next'))
|
1271
|
+
self._cmd_next.SetToolTip(_('Go to the next step -- using the selected mode'))
|
1272
|
+
self._cmd_next.Bind(wx.EVT_BUTTON, self.OnNext)
|
1273
|
+
left_bar.Add(self._cmd_next, 1, wx.EXPAND | wx.ALL, 5)
|
1274
|
+
|
1275
|
+
# Previous step
|
1276
|
+
self._cmd_prev = wx.Button(self._panel, wx.ID_BACKWARD, _('Previous'))
|
1277
|
+
self._cmd_prev.SetToolTip(_('Go to the previous step -- using the selected mode'))
|
1278
|
+
self._cmd_prev.Bind(wx.EVT_BUTTON, self.OnPrev)
|
1279
|
+
left_bar.Add(self._cmd_prev, 1, wx.EXPAND | wx.ALL, 5)
|
1280
|
+
|
1281
|
+
self.Bind(wx.EVT_CLOSE, self.OnClose)
|
1282
|
+
|
1283
|
+
main_sizer.Add(left_bar, 1, wx.EXPAND | wx.ALL, 2)
|
1284
|
+
main_sizer.Add(right_bar, 1, wx.EXPAND | wx.ALL, 2)
|
1285
|
+
|
1286
|
+
self._panel.SetSizer(main_sizer)
|
1287
|
+
self._panel.SetAutoLayout(True)
|
1288
|
+
|
1289
|
+
self.MinSize = (450, 500)
|
1290
|
+
|
1291
|
+
self.Fit()
|
1292
|
+
self.Show()
|
1293
|
+
|
1294
|
+
self.SetIcon(wx.Icon(str(Path(__file__).parent / "apps/wolf_logo2.bmp")))
|
1295
|
+
|
1296
|
+
self._set_all(0)
|
1297
|
+
|
1298
|
+
def _find_next(self, idx:int):
|
1299
|
+
""" Find the next step based on the mode and interval """
|
1300
|
+
|
1301
|
+
mode = 2
|
1302
|
+
if mode == 0:
|
1303
|
+
# By time [s]
|
1304
|
+
next_time = self._all_times_steps[idx] + float(self._interval.GetValue())
|
1305
|
+
diff = [abs(next_time - i) for i in self._all_times_steps[idx:]]
|
1306
|
+
next_idx = diff.index(min(diff)) + idx
|
1307
|
+
|
1308
|
+
return next_idx
|
1309
|
+
|
1310
|
+
elif mode == 1:
|
1311
|
+
# By time [hour]
|
1312
|
+
next_time = self._all_times_steps[idx] + float(self._interval.GetValue())*3600
|
1313
|
+
diff = [abs(next_time - i) for i in self._all_times_steps[idx:]]
|
1314
|
+
next_idx = diff.index(min(diff)) + idx
|
1315
|
+
|
1316
|
+
return next_idx
|
1317
|
+
|
1318
|
+
elif mode == 2:
|
1319
|
+
# By index
|
1320
|
+
next_idx = min(idx + int(1), len(self._all_times_steps)-1)
|
1321
|
+
|
1322
|
+
return next_idx
|
1323
|
+
|
1324
|
+
elif mode == 3:
|
1325
|
+
# By time step
|
1326
|
+
next_idx = self._all_times_steps[1].index(self._all_times_steps[idx] + int(1))
|
1327
|
+
diff = [abs(next_idx - i) for i in self._all_times_steps[idx:]]
|
1328
|
+
next_idx = diff.index(min(diff)) + idx
|
1329
|
+
|
1330
|
+
return next_idx
|
1331
|
+
|
1332
|
+
def _find_prev(self, idx:int):
|
1333
|
+
""" Find the previous step based on the mode and interval """
|
1334
|
+
|
1335
|
+
mode = 2
|
1336
|
+
|
1337
|
+
if mode == 0:
|
1338
|
+
# By time [s]
|
1339
|
+
prev_time = self._all_times_steps[idx] - float(1)
|
1340
|
+
diff = [abs(prev_time - i) for i in self._all_times_steps[:idx]]
|
1341
|
+
prev_idx = diff.index(min(diff))
|
1342
|
+
|
1343
|
+
return prev_idx
|
1344
|
+
|
1345
|
+
elif mode == 1:
|
1346
|
+
# By time [hour]
|
1347
|
+
prev_time = self._all_times_steps[idx] - float(1)*3600
|
1348
|
+
diff = [abs(prev_time - i) for i in self._all_times_steps[:idx]]
|
1349
|
+
prev_idx = diff.index(min(diff))
|
1350
|
+
|
1351
|
+
return prev_idx
|
1352
|
+
|
1353
|
+
elif mode == 2:
|
1354
|
+
# By index
|
1355
|
+
prev_idx = max(idx - int(1), 0)
|
1356
|
+
|
1357
|
+
return prev_idx
|
1358
|
+
|
1359
|
+
elif mode == 3:
|
1360
|
+
# By time step
|
1361
|
+
prev_idx = self._all_times_steps[1].index(self._all_times_steps[idx] - int(1))
|
1362
|
+
diff = [abs(prev_idx - i) for i in self._all_times_steps[:idx]]
|
1363
|
+
prev_idx = diff.index(min(diff))
|
1364
|
+
|
1365
|
+
return prev_idx
|
1366
|
+
|
1367
|
+
def OnNext(self, event):
|
1368
|
+
""" Go to the next step """
|
1369
|
+
|
1370
|
+
selected_step = self._slider_steps.GetValue()+1
|
1371
|
+
next_idx = self._find_next(selected_step)
|
1372
|
+
|
1373
|
+
if next_idx != selected_step:
|
1374
|
+
self._set_all(next_idx)
|
1375
|
+
self.Refresh(next_idx)
|
1376
|
+
|
1377
|
+
def OnTextTime(self, event):
|
1378
|
+
try:
|
1379
|
+
self._starting_date = datetime.strptime(self._texttime.GetValue(), '%Y-%m-%d %H:%M:%S')
|
1380
|
+
self._step_time.Set(['{:.3f} - {}'.format(int(i/3600/24), datetime.strftime(self._starting_date + timedelta(seconds=i), '%Y-%m-%d %H:%M:%S')) for i in self._all_times_steps[:-1]])
|
1381
|
+
except:
|
1382
|
+
pass
|
1383
|
+
|
1384
|
+
def OnPrev(self, event):
|
1385
|
+
""" Go to the previous step """
|
1386
|
+
|
1387
|
+
selected_step = self._slider_steps.GetValue()-1
|
1388
|
+
prev_idx = self._find_prev(selected_step)
|
1389
|
+
|
1390
|
+
if prev_idx != selected_step:
|
1391
|
+
self._set_all(prev_idx)
|
1392
|
+
self.Refresh(prev_idx)
|
1393
|
+
|
1394
|
+
def OnClose(self, event):
|
1395
|
+
""" Close the simulation explorer """
|
1396
|
+
|
1397
|
+
self.mapviewer._pop_sim_explorer(self.active_drowning)
|
1398
|
+
self.Destroy()
|
1399
|
+
|
1400
|
+
def OnUpdate(self, event):
|
1401
|
+
self._update()
|
1402
|
+
|
1403
|
+
def OnApply(self, event):
|
1404
|
+
selected_step = self._slider_steps.GetValue()-1
|
1405
|
+
|
1406
|
+
self._cmd_apply.SetBackgroundColour(wx.Colour(255, 0, 0)) # Set button color to red
|
1407
|
+
self._cmd_apply.Refresh() # Refresh the button to apply the color change
|
1408
|
+
|
1409
|
+
self.Refresh(selected_step)
|
1410
|
+
|
1411
|
+
self._cmd_apply.SetBackgroundColour(wx.NullColour) # Reset button color to default
|
1412
|
+
self._cmd_apply.Refresh() # Refresh the button to apply the color change
|
1413
|
+
|
1414
|
+
def _set_all(self, idx:int):
|
1415
|
+
self._slider_steps.SetValue(idx+1)
|
1416
|
+
self._step_idx.SetSelection(idx)
|
1417
|
+
|
1418
|
+
def Refresh(self, idx:int):
|
1419
|
+
self.active_drowning.read_oneresult(idx)
|
1420
|
+
self.mapviewer.Refresh()
|
1421
|
+
|
1422
|
+
def OnSliderSteps(self, event):
|
1423
|
+
selected_step = self._slider_steps.GetValue()-1
|
1424
|
+
self.active_drowning.time_id = selected_step
|
1425
|
+
time_id = self._slider_steps.GetValue()-1
|
1426
|
+
time_value = self.active_drowning.wanted_time[time_id]
|
1427
|
+
|
1428
|
+
days = np.floor(time_value // 86400)
|
1429
|
+
hours = np.floor((time_value % 86400) / 3600)
|
1430
|
+
minutes = np.floor(((time_value % 86400) % 3600) / 60)
|
1431
|
+
seconds = np.floor(((time_value % 86400) % 3600) % 60)
|
1432
|
+
|
1433
|
+
self._time_drowning.SetValue(
|
1434
|
+
f"Drowning at {int(days)} days, {int(hours)} hours,\n"
|
1435
|
+
f"{int(minutes)} minutes and {int(seconds)} seconds"
|
1436
|
+
)
|
1437
|
+
self._set_all(selected_step)
|
1438
|
+
|
1439
|
+
def OnSelectNumStep(self, event):
|
1440
|
+
selected_step = self._step_time.GetSelection()
|
1441
|
+
self.active_drowning.time_id = selected_step
|
1442
|
+
time_id = selected_step
|
1443
|
+
time_value = self.active_drowning.wanted_time[time_id]
|
1444
|
+
|
1445
|
+
days = np.floor(time_value // 86400)
|
1446
|
+
hours = np.floor((time_value % 86400) / 3600)
|
1447
|
+
minutes = np.floor(((time_value % 86400) % 3600) / 60)
|
1448
|
+
seconds = np.floor(((time_value % 86400) % 3600) % 60)
|
1449
|
+
|
1450
|
+
self._time_drowning.SetValue(
|
1451
|
+
f"Drowning at {int(days)} days, {int(hours)} hours,\n"
|
1452
|
+
f"{int(minutes)} minutes and {int(seconds)} seconds"
|
1453
|
+
)
|
1454
|
+
self._set_all(selected_step)
|
1455
|
+
|
1456
|
+
def OnSelectIdxStep(self, event):
|
1457
|
+
selected_step = self._step_idx.GetSelection()
|
1458
|
+
self.active_drowning.time_id = selected_step
|
1459
|
+
time_id = selected_step
|
1460
|
+
time_value = self.active_drowning.wanted_time[time_id]
|
1461
|
+
|
1462
|
+
days = np.floor(time_value // 86400)
|
1463
|
+
hours = np.floor((time_value % 86400) / 3600)
|
1464
|
+
minutes = np.floor(((time_value % 86400) % 3600) / 60)
|
1465
|
+
seconds = np.floor(((time_value % 86400) % 3600) % 60)
|
1466
|
+
|
1467
|
+
self._time_drowning.SetValue(
|
1468
|
+
f"Drowning at {int(days)} days, {int(hours)} hours,\n"
|
1469
|
+
f"{int(minutes)} minutes and {int(seconds)} seconds"
|
1470
|
+
)
|
1471
|
+
self._set_all(selected_step)
|
1472
|
+
|
1473
|
+
def _update(self):
|
1474
|
+
nb = len(self.active_drowning.wanted_time)
|
1475
|
+
self._all_times_steps = self.active_drowning.wanted_time
|
1476
|
+
|
1477
|
+
self._slider_steps.SetMax(nb)
|
1478
|
+
self._step_idx.Set([str(i) for i in range(1,nb+1)])
|
1479
|
+
|
1200
1480
|
class Select_Begin_end_interval_step(wx.Dialog):
|
1201
1481
|
""" wx.frame to select the begin and end of the interval to extract """
|
1202
1482
|
|
@@ -1636,6 +1916,8 @@ class WolfMapViewer(wx.Frame):
|
|
1636
1916
|
mypartsystems: list[Particle_system]
|
1637
1917
|
myviewers3d:list[Wolf_Viewer3D]
|
1638
1918
|
mylazdata:list[Wolf_LAZ_Data]
|
1919
|
+
mydrownings: list[Drowning_victim_Viewer]
|
1920
|
+
mydikes: list[DikeWolf]
|
1639
1921
|
|
1640
1922
|
mymplfigs:list[MplFigViewer]
|
1641
1923
|
|
@@ -1670,6 +1952,8 @@ class WolfMapViewer(wx.Frame):
|
|
1670
1952
|
active_weirs : Weirs
|
1671
1953
|
active_weir : Weir
|
1672
1954
|
active_laz : Wolf_LAZ_Data
|
1955
|
+
active_drowning: Drowning_victim_Viewer
|
1956
|
+
active_dike : DikeWolf
|
1673
1957
|
|
1674
1958
|
active_fig: MplFigViewer
|
1675
1959
|
|
@@ -1758,7 +2042,7 @@ class WolfMapViewer(wx.Frame):
|
|
1758
2042
|
self.popupmenu = wx.Menu()
|
1759
2043
|
self.popupmenu.Bind(wx.EVT_MENU, self.OnPopupItemSelected)
|
1760
2044
|
|
1761
|
-
for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Delete'), _('Up'), _('Down'), _('Properties')]:
|
2045
|
+
for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Delete'), _('Up'), _('Down'), _('Check/Uncheck'), _('Properties')]:
|
1762
2046
|
item = self.popupmenu.Append(-1, text)
|
1763
2047
|
|
1764
2048
|
self.menubar = wx.MenuBar()
|
@@ -1777,6 +2061,8 @@ class WolfMapViewer(wx.Frame):
|
|
1777
2061
|
self.menulaz = None
|
1778
2062
|
self.menutiles = None
|
1779
2063
|
self.menuimagestiles = None
|
2064
|
+
self.menudrowning = None
|
2065
|
+
self.menudike = None
|
1780
2066
|
|
1781
2067
|
self.filemenu = wx.Menu()
|
1782
2068
|
openitem = self.filemenu.Append(wx.ID_OPEN, _('Open/Add project'), _('Open a full project from file'))
|
@@ -1854,6 +2140,8 @@ class WolfMapViewer(wx.Frame):
|
|
1854
2140
|
createbcmanager2D = self.menucreateobj.Append(wx.ID_ANY, _('Create BC manager Wolf2D...'), _('New BC manager 2D'))
|
1855
2141
|
createpartsystem = self.menucreateobj.Append(wx.ID_ANY, _('Create particle system...'), _('Create a particle system - Lagrangian view'))
|
1856
2142
|
create_acceptability = self.menucreateobj.Append(wx.ID_ANY, _('Create acceptability manager...'), _('Create acceptability manager'))
|
2143
|
+
createdrowning = self.menucreateobj.Append(wx.ID_ANY, _('Create a drowning...'),_('Create a drowning'))
|
2144
|
+
createdike = self.menucreateobj.Append(wx.ID_ANY, _('Create dike...'), _('New dike'))
|
1857
2145
|
|
1858
2146
|
self.filemenu.AppendSeparator()
|
1859
2147
|
|
@@ -1879,6 +2167,8 @@ class WolfMapViewer(wx.Frame):
|
|
1879
2167
|
addbridges = self.menuaddobj.Append(wx.ID_ANY, _('Add bridges...'), _('Add bridges from directory'))
|
1880
2168
|
addweirs = self.menuaddobj.Append(wx.ID_ANY, _('Add weirs...'), _('Add bridges from directory'))
|
1881
2169
|
addview = self.menuaddobj.Append(wx.ID_ANY, _('Add view...'), _('Add view from project file'))
|
2170
|
+
adddrowning = self.menuaddobj.Append(wx.ID_ANY, _('Add a drowning result...'),_('Add a drowning result'))
|
2171
|
+
adddike = self.menuaddobj.Append(wx.ID_ANY, _('Add dike...'), _('Add dike'))
|
1882
2172
|
|
1883
2173
|
self.precomputed_menu = None
|
1884
2174
|
if self.default_dem != "":
|
@@ -2047,8 +2337,10 @@ class WolfMapViewer(wx.Frame):
|
|
2047
2337
|
self.active_weirs = None
|
2048
2338
|
self.active_weir = None
|
2049
2339
|
self.active_laz = None
|
2340
|
+
self.active_dike = None
|
2050
2341
|
|
2051
2342
|
self.active_fig = None
|
2343
|
+
self.active_drowning = None
|
2052
2344
|
|
2053
2345
|
curtool = self.tools[ID_SORTALONG] = {}
|
2054
2346
|
curtool['menu'] = self.sortalong
|
@@ -2108,6 +2400,8 @@ class WolfMapViewer(wx.Frame):
|
|
2108
2400
|
self.myitemsviews = self.treelist.AppendItem(self.root, _("Views"))
|
2109
2401
|
self.myitemswmsback = self.treelist.AppendItem(self.root, _("WMS-background"))
|
2110
2402
|
self.myitemswmsfore = self.treelist.AppendItem(self.root, _("WMS-foreground"))
|
2403
|
+
self.myitemsdrowning = self.treelist.AppendItem(self.root,_("Drowning"))
|
2404
|
+
self.myitemsdike = self.treelist.AppendItem(self.root, _("Dikes"))
|
2111
2405
|
|
2112
2406
|
width, height = self.GetClientSize()
|
2113
2407
|
self.bordersize = int((w - width + self.treewidth) / 2)
|
@@ -2584,6 +2878,62 @@ class WolfMapViewer(wx.Frame):
|
|
2584
2878
|
|
2585
2879
|
self.menuwalous.Bind(wx.EVT_MENU, self.Onmenuwalous)
|
2586
2880
|
|
2881
|
+
def menu_drowning(self):
|
2882
|
+
|
2883
|
+
if self.menudrowning is None:
|
2884
|
+
|
2885
|
+
self.menudrowning = wx.Menu()
|
2886
|
+
|
2887
|
+
self.menudrowning_plot = wx.Menu()
|
2888
|
+
|
2889
|
+
self.menudrowning_explore_results = self.menudrowning.Append(wx.ID_ANY, _("Explore time/index results"), _("Open a dialog to explore time/index results"))
|
2890
|
+
|
2891
|
+
self.menudrowning.AppendSeparator()
|
2892
|
+
|
2893
|
+
self.menudrowning.Append(wx.ID_ANY, _("Plot..."),self.menudrowning_plot)
|
2894
|
+
self.plot_runs = self.menudrowning_plot.Append(wx.ID_ANY, _("Plot runs positions"), _("Plot runs positions"),kind=wx.ITEM_CHECK)
|
2895
|
+
self.plot_cells = self.menudrowning_plot.Append(wx.ID_ANY, _("Plot cells positions"), _("Plot the cells where bodies colored as a function of bodies in it"),kind=wx.ITEM_CHECK)
|
2896
|
+
self.plot_KDE = self.menudrowning_plot.Append(wx.ID_ANY, _("Plot KDE"), _("Plot Kernel Density Estimation - Map of probability of presence"),kind=wx.ITEM_CHECK)
|
2897
|
+
|
2898
|
+
self.menudrowning_lastres = self.menudrowning.Append(wx.ID_ANY, _("Read last result"), _("Current view"))
|
2899
|
+
|
2900
|
+
self.menudrowning_zoom = self.menudrowning.Append(wx.ID_ANY, _("Zoom on hotspots"), _("Zoom on areas where you have the highest probability of presence"))
|
2901
|
+
|
2902
|
+
self.menudrowning.AppendSeparator()
|
2903
|
+
|
2904
|
+
self.menudrowning_get_bodies = self.menudrowning.Append(wx.ID_ANY, _("Get bodies characteristics"), _("Get a table of the characteristics of all simulated bodies"))
|
2905
|
+
self.menudrowning_get_perc = self.menudrowning.Append(wx.ID_ANY, _("Vertical position proportion"), _("Get proportion of runs at the surface and at the bottom at selected time"))
|
2906
|
+
|
2907
|
+
self.menudrowning.AppendSeparator()
|
2908
|
+
|
2909
|
+
self.menudrowning_video = self.menudrowning.Append(wx.ID_ANY, _("Create video..."), _("Video/Movie"))
|
2910
|
+
|
2911
|
+
self.menubar.Append(self.menudrowning, _('Drowning'))
|
2912
|
+
|
2913
|
+
self.menudrowning.Bind(wx.EVT_MENU, self.Onmenudrowning)
|
2914
|
+
|
2915
|
+
def menu_dike(self):
|
2916
|
+
|
2917
|
+
if self.menudike is None:
|
2918
|
+
self.menudike = wx.Menu()
|
2919
|
+
|
2920
|
+
self.menudike_launchsimu = self.menudike.Append(wx.ID_ANY, _("Launch simulation"), _("Launch simulation"))
|
2921
|
+
|
2922
|
+
self.menudike.AppendSeparator()
|
2923
|
+
|
2924
|
+
self.menudike_showtri = self.menudike.Append(wx.ID_ANY, _("Show triangulation"), _("Show triangulation"))
|
2925
|
+
self.menudike_plotQ = self.menudike.Append(wx.ID_ANY, _("Plot discharges"), _("Plot discharges"))
|
2926
|
+
self.menudike_plotz = self.menudike.Append(wx.ID_ANY, _("Plot water levels/breach bottom"), _("Plot water levels/breach bottom"))
|
2927
|
+
self.menudike_plotB = self.menudike.Append(wx.ID_ANY, _("Plot breach width"), _("Plot breach width"))
|
2928
|
+
|
2929
|
+
self.menudike.AppendSeparator()
|
2930
|
+
|
2931
|
+
self.menudike_showparam = self.menudike.Append(wx.ID_ANY, _("Show parameters"), _("Show parameters"))
|
2932
|
+
|
2933
|
+
self.menubar.Append(self.menudike, _('Dike'))
|
2934
|
+
|
2935
|
+
self.menudike.Bind(wx.EVT_MENU, self.Onmenudike)
|
2936
|
+
|
2587
2937
|
|
2588
2938
|
def get_canvas_bounds(self, gridsize:float = None):
|
2589
2939
|
"""
|
@@ -2786,6 +3136,115 @@ class WolfMapViewer(wx.Frame):
|
|
2786
3136
|
if which in self.sim_explorers:
|
2787
3137
|
self.sim_explorers[which]._set_all(which.current_result)
|
2788
3138
|
|
3139
|
+
def Onmenudrowning(self, event: wx.MenuEvent):
|
3140
|
+
|
3141
|
+
id = event.GetId()
|
3142
|
+
item = self.menubar.FindItemById(event.GetId())
|
3143
|
+
|
3144
|
+
if item is None:
|
3145
|
+
return
|
3146
|
+
|
3147
|
+
itemlabel = item.ItemLabel
|
3148
|
+
|
3149
|
+
|
3150
|
+
if itemlabel == _("Read last result"):
|
3151
|
+
|
3152
|
+
self.active_drowning.read_last_result()
|
3153
|
+
self.Refresh()
|
3154
|
+
self._update_mytooltip()
|
3155
|
+
|
3156
|
+
elif itemlabel == _("Explore time/index results"):
|
3157
|
+
if self.active_drowning is None:
|
3158
|
+
logging.warning(_('No active drowning ! -- Please activate a drowning first'))
|
3159
|
+
return
|
3160
|
+
which = self.active_drowning
|
3161
|
+
self.sim_explorers[which] = Drowning_Explorer(self,title=f'Explore drowning results: {self.active_drowning.idx}',mapviewer=self, sim=which)
|
3162
|
+
|
3163
|
+
elif itemlabel == _("Plot runs positions"):
|
3164
|
+
if self.plot_runs.IsChecked():
|
3165
|
+
self.active_drowning.prepare_plot_runs_positions()
|
3166
|
+
else:
|
3167
|
+
self.active_drowning.reset_plot_runs_positions()
|
3168
|
+
self._update_mytooltip()
|
3169
|
+
self.Refresh()
|
3170
|
+
|
3171
|
+
|
3172
|
+
elif itemlabel == _("Plot cells positions"):
|
3173
|
+
if self.plot_cells.IsChecked():
|
3174
|
+
self._update_mytooltip()
|
3175
|
+
self.active_drowning.prepare_plot_cells_positions()
|
3176
|
+
else:
|
3177
|
+
self.active_drowning.reset_plot_cells_positions()
|
3178
|
+
self._update_mytooltip()
|
3179
|
+
self.Refresh()
|
3180
|
+
|
3181
|
+
elif itemlabel == _("Plot KDE"):
|
3182
|
+
if self.plot_KDE.IsChecked():
|
3183
|
+
self.active_drowning.prepare_plot_kde()
|
3184
|
+
else:
|
3185
|
+
self.active_drowning.reset_plot_kde()
|
3186
|
+
self._update_mytooltip()
|
3187
|
+
self.Refresh()
|
3188
|
+
|
3189
|
+
elif itemlabel == _("Zoom on hotspots"):
|
3190
|
+
self.memory_views = Memory_Views()
|
3191
|
+
self.active_drowning.zoom_on_hotspots(self.memory_views)
|
3192
|
+
self._memory_views_gui = Memory_Views_GUI(self, _('Memory view manager'), self.memory_views, mapviewer = self)
|
3193
|
+
|
3194
|
+
elif itemlabel == _("Get bodies characteristics"):
|
3195
|
+
self.active_drowning.get_bodies_characteristics()
|
3196
|
+
|
3197
|
+
elif itemlabel == _("Vertical position proportion"):
|
3198
|
+
self.active_drowning.get_vertical_position_proportion()
|
3199
|
+
|
3200
|
+
elif itemlabel == _("Create video..."):
|
3201
|
+
logging.info(_("Not yet implemeted"))
|
3202
|
+
return
|
3203
|
+
|
3204
|
+
|
3205
|
+
def Onmenudike(self, event: wx.MenuEvent):
|
3206
|
+
|
3207
|
+
id = event.GetId()
|
3208
|
+
item = self.menubar.FindItemById(event.GetId())
|
3209
|
+
|
3210
|
+
if item is None:
|
3211
|
+
return
|
3212
|
+
|
3213
|
+
itemlabel = item.ItemLabel
|
3214
|
+
|
3215
|
+
if self.active_dike is None:
|
3216
|
+
logging.warning(_('No active dike -- Please activate a dike first'))
|
3217
|
+
return
|
3218
|
+
|
3219
|
+
class plot_types(Enum):
|
3220
|
+
"""
|
3221
|
+
Enum class for plot types.
|
3222
|
+
"""
|
3223
|
+
DISCHARGES = 0
|
3224
|
+
LEVELS = 1
|
3225
|
+
BREACHWIDTH = 2
|
3226
|
+
|
3227
|
+
if itemlabel == _("Launch simulation"):
|
3228
|
+
|
3229
|
+
self.active_dike.run()
|
3230
|
+
|
3231
|
+
elif itemlabel == _("Show triangulation"):
|
3232
|
+
|
3233
|
+
self.active_dike.show_triangulation()
|
3234
|
+
|
3235
|
+
elif itemlabel == _("Plot discharges"):
|
3236
|
+
self.active_dike.plot_mainOutputs(plot_types.DISCHARGES.value)
|
3237
|
+
|
3238
|
+
elif itemlabel == _("Plot water levels/breach bottom"):
|
3239
|
+
self.active_dike.plot_mainOutputs(plot_types.LEVELS.value)
|
3240
|
+
|
3241
|
+
elif itemlabel == _("Plot breach width"):
|
3242
|
+
self.active_dike.plot_mainOutputs(plot_types.BREACHWIDTH.value)
|
3243
|
+
|
3244
|
+
elif itemlabel == _("Show parameters"):
|
3245
|
+
self.active_dike.show_properties()
|
3246
|
+
|
3247
|
+
|
2789
3248
|
def Onmenuwolf2d(self, event: wx.MenuEvent):
|
2790
3249
|
|
2791
3250
|
id = event.GetId()
|
@@ -4551,13 +5010,15 @@ class WolfMapViewer(wx.Frame):
|
|
4551
5010
|
self.myviewers3d = []
|
4552
5011
|
self.myviewerslaz = []
|
4553
5012
|
self.mylazdata = []
|
5013
|
+
self.mydrownings = []
|
5014
|
+
self.mydikes = []
|
4554
5015
|
|
4555
5016
|
self.mymplfigs = []
|
4556
5017
|
|
4557
5018
|
self.sim_explorers = {}
|
4558
5019
|
|
4559
5020
|
# liste des éléments modifiable dans l'arbre
|
4560
|
-
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.myimagestiles, self.mypartsystems, self.myviewers3d, self.myviewerslaz]
|
5021
|
+
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.myimagestiles, self.mypartsystems, self.myviewers3d, self.myviewerslaz, self.mydikes, self.mydrownings]
|
4561
5022
|
|
4562
5023
|
self.menu_options = wx.Menu()
|
4563
5024
|
self._change_title = self.menu_options.Append(wx.ID_ANY, _('Change title'), _('Change title of the window'))
|
@@ -4787,6 +5248,17 @@ class WolfMapViewer(wx.Frame):
|
|
4787
5248
|
'Emprise': 'ZONES_INONDEES',
|
4788
5249
|
'Emprise wo Alea': 'ZONES_INONDEES_wo_alea'}}
|
4789
5250
|
|
5251
|
+
lifewatch = {'LW_ecotopes_lc_hr_raster': {'2006': '2006',
|
5252
|
+
'2010': '2010',
|
5253
|
+
'2015': '2015',
|
5254
|
+
'2018': '2018',
|
5255
|
+
'2019': '2019',
|
5256
|
+
'2020': '2020',
|
5257
|
+
'2021': '2021',
|
5258
|
+
'2021': '2021',
|
5259
|
+
'2022': '2022',
|
5260
|
+
}}
|
5261
|
+
|
4790
5262
|
for idx, (k, item) in enumerate(orthos.items()):
|
4791
5263
|
for kdx, (m, subitem) in enumerate(item.items()):
|
4792
5264
|
self.add_object(which='wmsback',
|
@@ -4801,11 +5273,19 @@ class WolfMapViewer(wx.Frame):
|
|
4801
5273
|
self, xmin, xmax, ymin, ymax, -99999, 1024),
|
4802
5274
|
ToCheck=False, id='Data 2021 ' + m)
|
4803
5275
|
|
5276
|
+
for idx, (k, item) in enumerate(lifewatch.items()):
|
5277
|
+
for kdx, (m, subitem) in enumerate(item.items()):
|
5278
|
+
self.add_object(which='wmsback',
|
5279
|
+
newobj=imagetexture('LanCover', m, k, subitem,
|
5280
|
+
self, xmin, xmax, ymin, ymax, -99999, 1024, LifeWatch=True),
|
5281
|
+
ToCheck=False, id='LifeWatch LC' + m)
|
5282
|
+
|
4804
5283
|
self.add_object(which='wmsback',
|
4805
5284
|
newobj=imagetexture('PPNC', 'Orthos France', 'OI.OrthoimageCoverage.HR', '',
|
4806
5285
|
self, xmin, xmax, ymin, ymax, -99999, 1024, France=True, epsg='EPSG:27563'),
|
4807
5286
|
ToCheck=False, id='Orthos France')
|
4808
5287
|
|
5288
|
+
|
4809
5289
|
forelist = {'EAU': {'Aqualim': 'RES_LIMNI_DGARNE', 'Alea': 'ALEA_INOND', 'Lidaxes': 'LIDAXES'},
|
4810
5290
|
'LIMITES': {'Secteurs Statistiques': 'LIMITES_QS_STATBEL',
|
4811
5291
|
'Limites administratives': 'LIMITES_ADMINISTRATIVES'},
|
@@ -5379,9 +5859,6 @@ class WolfMapViewer(wx.Frame):
|
|
5379
5859
|
def zoom_on_array(self, array:WolfArray, forceupdate=True, canvas_height=1024):
|
5380
5860
|
""" Zoom on array """
|
5381
5861
|
|
5382
|
-
if array.xmin == -99999:
|
5383
|
-
array.find_minmax()
|
5384
|
-
|
5385
5862
|
bounds = array.get_bounds()
|
5386
5863
|
|
5387
5864
|
center = [(bounds[0][1] + bounds[0][0]) / 2., (bounds[1][1] + bounds[1][0]) / 2.]
|
@@ -6932,6 +7409,44 @@ class WolfMapViewer(wx.Frame):
|
|
6932
7409
|
|
6933
7410
|
return ass_values[idx]
|
6934
7411
|
|
7412
|
+
def newdrowning(self,itemlabel):
|
7413
|
+
|
7414
|
+
if itemlabel == ('Create a drowning...'):
|
7415
|
+
new_drowning = Drowning_victim_Viewer(mapviewer = self)
|
7416
|
+
self.add_object(which='drowning',newobj=new_drowning,ToCheck=True)
|
7417
|
+
|
7418
|
+
elif itemlabel == ('Add a drowning result...'):
|
7419
|
+
dialog = wx.DirDialog(None,_("Select the folder containing your drowning"), style=wx.DD_DEFAULT_STYLE)
|
7420
|
+
if dialog.ShowModal() == wx.ID_OK:
|
7421
|
+
# Récupérer le chemin sélectionné
|
7422
|
+
filedir = dialog.GetPath()
|
7423
|
+
dialog.Destroy()
|
7424
|
+
|
7425
|
+
if not os.path.exists(os.path.join(filedir, "Results.npz")):
|
7426
|
+
logging.error(_("The selected folder does not contain any Results.npz"))
|
7427
|
+
return
|
7428
|
+
|
7429
|
+
new_drowning = Drowning_victim_Viewer(mapviewer = self,filedir=filedir)
|
7430
|
+
new_drowning.file_drowning = 1
|
7431
|
+
self.add_object(which='drowning',newobj=new_drowning,ToCheck=True)
|
7432
|
+
new_drowning.load_results()
|
7433
|
+
new_drowning.time_id = len(new_drowning.wanted_time)-2
|
7434
|
+
new_drowning.init_plot()
|
7435
|
+
self.menu_drowning()
|
7436
|
+
|
7437
|
+
def new_dike(self, itemlabel):
|
7438
|
+
"""
|
7439
|
+
Called when 'Create dike...' or 'Add dike...' are selected in the viewer
|
7440
|
+
"""
|
7441
|
+
newdike = DikeWolf(mapviewer = self)
|
7442
|
+
|
7443
|
+
if _('Add dike...') in itemlabel:
|
7444
|
+
newdike.load_results()
|
7445
|
+
|
7446
|
+
self.add_object(which='dike', newobj=newdike, ToCheck = True)#, filename=newdike.filename, id=newdike.filename)
|
7447
|
+
|
7448
|
+
self.menu_dike()
|
7449
|
+
autoscale = True
|
6935
7450
|
|
6936
7451
|
def OnMenubar(self, event: wx.MenuEvent):
|
6937
7452
|
"""
|
@@ -7941,7 +8456,6 @@ class WolfMapViewer(wx.Frame):
|
|
7941
8456
|
if self.mylazgrid is None:
|
7942
8457
|
logging.warning(_('No gridded LAZ data loaded !'))
|
7943
8458
|
return
|
7944
|
-
autoscale=False
|
7945
8459
|
self.clip_laz_gridded()
|
7946
8460
|
|
7947
8461
|
if self.active_laz.nb_points ==0:
|
@@ -8351,8 +8865,16 @@ class WolfMapViewer(wx.Frame):
|
|
8351
8865
|
self.frame_create1Dfrom2D = GuiNotebook1D(mapviewer= self)
|
8352
8866
|
logging.info(_(f'New window available - Wolf1D.'))
|
8353
8867
|
|
8354
|
-
elif
|
8868
|
+
elif itemlabel in [_('Create dike...'), _('Add dike...')]:
|
8869
|
+
self.new_dike(itemlabel)
|
8870
|
+
|
8871
|
+
elif itemlabel in [_('Create a drowning...'), _('Add a drowning result...')]:
|
8355
8872
|
|
8873
|
+
self.newdrowning(itemlabel)
|
8874
|
+
|
8875
|
+
|
8876
|
+
elif id == wx.ID_FILE7:
|
8877
|
+
autoscale = False
|
8356
8878
|
# Création de nouveaux vecteurs
|
8357
8879
|
newzones = Zones(parent=self)
|
8358
8880
|
self.add_object('vector', newobj=newzones)
|
@@ -8554,8 +9076,8 @@ class WolfMapViewer(wx.Frame):
|
|
8554
9076
|
if ret == wx.ID_OK:
|
8555
9077
|
obj.saveas(fdlg.GetPath())
|
8556
9078
|
|
8557
|
-
if len(self.myarrays) + len(self.myvectors) + len(self.myclouds) + len(self.mytri) + len(self.myres2D) + len(self.mytiles) + len(self.myimagestiles) + len(self.mypartsystems) == 2
|
8558
|
-
# Trouve les
|
9079
|
+
if len(self.myarrays) + len(self.myvectors) + len(self.myclouds) + len(self.mytri) + len(self.myres2D) + len(self.mytiles) + len(self.myimagestiles) + len(self.mypartsystems) + len(self.mydikes) + len(self.mydrownings) == 2 or autoscale:
|
9080
|
+
# Trouve les bornes si un seul élément est présent, sinon on conserve l'état du zoom
|
8559
9081
|
self.Autoscale()
|
8560
9082
|
|
8561
9083
|
def pop_boundary_manager(self, which:BcManager):
|
@@ -9131,7 +9653,9 @@ class WolfMapViewer(wx.Frame):
|
|
9131
9653
|
'particlesystem',
|
9132
9654
|
'wmsback',
|
9133
9655
|
'wmsfore',
|
9134
|
-
'
|
9656
|
+
'drowning',
|
9657
|
+
'imagestiles',
|
9658
|
+
'dike'] = 'array',
|
9135
9659
|
filename='',
|
9136
9660
|
newobj=None,
|
9137
9661
|
ToCheck=True,
|
@@ -9187,7 +9711,11 @@ class WolfMapViewer(wx.Frame):
|
|
9187
9711
|
elif which.lower() == 'res2d':
|
9188
9712
|
file = wx.FileDialog(self, "Choose file", wildcard=filterres2d)
|
9189
9713
|
elif which.lower() == 'res2d_gpu':
|
9190
|
-
file = wx.DirDialog(self, "Choose directory
|
9714
|
+
file = wx.DirDialog(self, "Choose directory containing WolfGPU results")
|
9715
|
+
elif which.lower() == 'drowning':
|
9716
|
+
file = wx.DirDialog(self, "Choose directory containing the drowning")
|
9717
|
+
elif which.lower() == 'dike':
|
9718
|
+
file = wx.DirDialog(self, "Choose directory", wildcard=filterall)
|
9191
9719
|
|
9192
9720
|
# FIXME : particularize filters for wmsback and wmsfore
|
9193
9721
|
elif which.lower() == 'wmsback':
|
@@ -9704,7 +10232,7 @@ class WolfMapViewer(wx.Frame):
|
|
9704
10232
|
with open(filename,'r') as f:
|
9705
10233
|
text=f.read().splitlines()
|
9706
10234
|
tmphead=''
|
9707
|
-
for i in range(4):
|
10235
|
+
for i in range(min(4, len(text))):
|
9708
10236
|
tmphead += text[i].replace('\t','\\t') +'\n'
|
9709
10237
|
|
9710
10238
|
dlg = wx.MessageDialog(None,_('Is there a file header (one upper line containing column names)?') + '\n\n' + tmphead,style=wx.YES_NO|wx.NO_DEFAULT)
|
@@ -9810,7 +10338,7 @@ class WolfMapViewer(wx.Frame):
|
|
9810
10338
|
self.myothers.append(newobj)
|
9811
10339
|
newobj.mapviewer = self
|
9812
10340
|
else:
|
9813
|
-
logging.warning('No object to add in "Other" category -- Please provide an object to add or check your code')
|
10341
|
+
logging.warning(_('No object to add in "Other" category -- Please provide an object to add or check your code'))
|
9814
10342
|
|
9815
10343
|
elif which.lower() == 'views':
|
9816
10344
|
|
@@ -9829,7 +10357,7 @@ class WolfMapViewer(wx.Frame):
|
|
9829
10357
|
curtree = self.myitemswmsback
|
9830
10358
|
self.mywmsback.append(newobj)
|
9831
10359
|
else:
|
9832
|
-
logging.warning('No object to add in "WMS background" category -- Please provide an object to add or check your code')
|
10360
|
+
logging.warning(_('No object to add in "WMS background" category -- Please provide an object to add or check your code'))
|
9833
10361
|
|
9834
10362
|
elif which.lower() == 'wmsfore':
|
9835
10363
|
|
@@ -9838,7 +10366,7 @@ class WolfMapViewer(wx.Frame):
|
|
9838
10366
|
curtree = self.myitemswmsfore
|
9839
10367
|
self.mywmsfore.append(newobj)
|
9840
10368
|
else:
|
9841
|
-
logging.warning('No object to add in "WMS foreground" category -- Please provide an object to add or check your code')
|
10369
|
+
logging.warning(_('No object to add in "WMS foreground" category -- Please provide an object to add or check your code'))
|
9842
10370
|
|
9843
10371
|
elif which.lower() == 'particlesystem':
|
9844
10372
|
|
@@ -9851,6 +10379,23 @@ class WolfMapViewer(wx.Frame):
|
|
9851
10379
|
self.mypartsystems.append(newobj)
|
9852
10380
|
self.active_particle_system = newobj
|
9853
10381
|
|
10382
|
+
elif which.lower() == 'drowning':
|
10383
|
+
|
10384
|
+
curdict = self.mydrownings
|
10385
|
+
curtree = self.myitemsdrowning
|
10386
|
+
|
10387
|
+
self.mydrownings.append(newobj)
|
10388
|
+
self.active_drowning = newobj
|
10389
|
+
|
10390
|
+
|
10391
|
+
elif which.lower() == 'dike':
|
10392
|
+
|
10393
|
+
curdict = self.mydikes
|
10394
|
+
curtree = self.myitemsdike
|
10395
|
+
|
10396
|
+
self.mydikes.append(newobj)
|
10397
|
+
self.active_dike = newobj
|
10398
|
+
|
9854
10399
|
# ID chooser
|
9855
10400
|
if id == '':
|
9856
10401
|
dlg = wx.TextEntryDialog(self, 'ID ? (case insensitive)', 'Choose an identifier', '')
|
@@ -9965,7 +10510,7 @@ class WolfMapViewer(wx.Frame):
|
|
9965
10510
|
|
9966
10511
|
if drawing_type is None:
|
9967
10512
|
# return all_lists
|
9968
|
-
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D
|
10513
|
+
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D + self.mydikes + self.mydrownings
|
9969
10514
|
|
9970
10515
|
if drawing_type == draw_type.ARRAYS:
|
9971
10516
|
return self.myarrays
|
@@ -9993,6 +10538,10 @@ class WolfMapViewer(wx.Frame):
|
|
9993
10538
|
return self.myimagestiles
|
9994
10539
|
elif drawing_type == draw_type.LAZ:
|
9995
10540
|
return self.mylazdata
|
10541
|
+
elif drawing_type == draw_type.DROWNING:
|
10542
|
+
return self.mydrownings
|
10543
|
+
elif drawing_type == draw_type.DIKE:
|
10544
|
+
return self.mydikes
|
9996
10545
|
else:
|
9997
10546
|
logging.error('Unknown drawing type : ' + drawing_type)
|
9998
10547
|
return None
|
@@ -10120,6 +10669,24 @@ class WolfMapViewer(wx.Frame):
|
|
10120
10669
|
|
10121
10670
|
self.removeobj_from_id(id)
|
10122
10671
|
|
10672
|
+
def checkuncheckobj(self):
|
10673
|
+
""" Check/uncheck selected item from general tree """
|
10674
|
+
|
10675
|
+
if self.selected_treeitem is None:
|
10676
|
+
return
|
10677
|
+
|
10678
|
+
id = self.treelist.GetItemText(self.selected_treeitem).lower()
|
10679
|
+
|
10680
|
+
current_check = self.treelist.GetCheckedState(self.selected_treeitem)
|
10681
|
+
myobj = self.getobj_from_id(id)
|
10682
|
+
if myobj is not None:
|
10683
|
+
if current_check == 0:
|
10684
|
+
self.treelist.CheckItem(self.selected_treeitem)
|
10685
|
+
myobj.check_plot()
|
10686
|
+
else:
|
10687
|
+
self.treelist.CheckItem(self.selected_treeitem, False)
|
10688
|
+
myobj.uncheck_plot()
|
10689
|
+
|
10123
10690
|
def removeobj_from_id(self, id:str):
|
10124
10691
|
""" Remove object from id """
|
10125
10692
|
|
@@ -10169,6 +10736,12 @@ class WolfMapViewer(wx.Frame):
|
|
10169
10736
|
elif myobj is self.active_zones:
|
10170
10737
|
self.active_zones = None
|
10171
10738
|
self.set_label_selecteditem('')
|
10739
|
+
elif myobj is self.active_drowning:
|
10740
|
+
self.active_drowning = None
|
10741
|
+
self.set_label_selecteditem('')
|
10742
|
+
elif myobj is self.active_dike:
|
10743
|
+
self.active_dike = None
|
10744
|
+
self.set_label_selecteditem('')
|
10172
10745
|
|
10173
10746
|
def upobj(self):
|
10174
10747
|
"""Up selected item into general tree"""
|
@@ -10297,6 +10870,11 @@ class WolfMapViewer(wx.Frame):
|
|
10297
10870
|
self.selected_object.saveas()
|
10298
10871
|
elif isinstance(self.selected_object, Particle_system):
|
10299
10872
|
self.selected_object.save()
|
10873
|
+
elif isinstance(self.selected_object, Drowning_victim_Viewer):
|
10874
|
+
self.selected_object.save()
|
10875
|
+
elif isinstance(self.selected_object, DikeWolf):
|
10876
|
+
self.selected_object.save()
|
10877
|
+
|
10300
10878
|
elif text==_('Up'):
|
10301
10879
|
self.upobj()
|
10302
10880
|
|
@@ -10306,6 +10884,9 @@ class WolfMapViewer(wx.Frame):
|
|
10306
10884
|
elif text == _('Delete'):
|
10307
10885
|
self.removeobj()
|
10308
10886
|
|
10887
|
+
elif text == ('Check/Uncheck'):
|
10888
|
+
self.checkuncheckobj()
|
10889
|
+
|
10309
10890
|
elif text == _('Rename'):
|
10310
10891
|
#Modification du nom de l'objet sélectionné
|
10311
10892
|
if self.selected_object is not None:
|
@@ -10439,6 +11020,8 @@ class WolfMapViewer(wx.Frame):
|
|
10439
11020
|
self.selected_object.save(fdlg.GetPath())
|
10440
11021
|
|
10441
11022
|
fdlg.Destroy()
|
11023
|
+
elif isinstance(self.selected_object, DikeWolf):
|
11024
|
+
self.selected_object.save_as()
|
10442
11025
|
|
10443
11026
|
elif isinstance(self.selected_object, Wolf_LAZ_Data):
|
10444
11027
|
filterArray = "Dump (*.dump)|*.dmp|all (*.*)|*.*"
|
@@ -10450,10 +11033,16 @@ class WolfMapViewer(wx.Frame):
|
|
10450
11033
|
|
10451
11034
|
fdlg.Destroy()
|
10452
11035
|
|
11036
|
+
elif isinstance(self.selected_object, Particle_system):
|
11037
|
+
self.selected_object.saveas()
|
11038
|
+
|
11039
|
+
elif isinstance(self.selected_object, Drowning_victim_Viewer):
|
11040
|
+
self.selected_object.saveas()
|
11041
|
+
|
10453
11042
|
elif text == _('Properties'):
|
10454
11043
|
|
10455
11044
|
myobj = self.selected_object
|
10456
|
-
if type(myobj) in [WolfArray, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data, Cadaster_data, hydrometry_wolfgui, Bridge, Weir, Wolf_LAZ_Data]:
|
11045
|
+
if type(myobj) in [WolfArray, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data, Cadaster_data, hydrometry_wolfgui, Bridge, Weir, Wolf_LAZ_Data, DikeWolf, Drowning_victim_Viewer]:
|
10457
11046
|
myobj.show_properties()
|
10458
11047
|
|
10459
11048
|
elif isinstance(myobj, cloud_vertices):
|
@@ -10802,9 +11391,10 @@ class WolfMapViewer(wx.Frame):
|
|
10802
11391
|
|
10803
11392
|
self.treelist.SetToolTip(self.treelist.GetItemText(myitem))
|
10804
11393
|
|
10805
|
-
myparent = self.treelist.GetItemParent(myitem)
|
10806
|
-
check = self.treelist.GetCheckedState(myitem)
|
10807
|
-
|
11394
|
+
# myparent = self.treelist.GetItemParent(myitem)
|
11395
|
+
# check = self.treelist.GetCheckedState(myitem)
|
11396
|
+
# if myparent is not None:
|
11397
|
+
# nameparent = self.treelist.GetItemText(myparent).lower()
|
10808
11398
|
|
10809
11399
|
self.selected_object = curobj
|
10810
11400
|
self.selected_treeitem = myitem
|
@@ -11671,6 +12261,13 @@ class WolfMapViewer(wx.Frame):
|
|
11671
12261
|
if ctrl:
|
11672
12262
|
myobj.show_properties()
|
11673
12263
|
|
12264
|
+
elif type(myobj) == Drowning_victim_Viewer:
|
12265
|
+
logging.info(_('Activating Drowning victim event : ' + nameitem))
|
12266
|
+
self.active_drowning = myobj
|
12267
|
+
|
12268
|
+
if ctrl:
|
12269
|
+
myobj.show_properties()
|
12270
|
+
|
11674
12271
|
def _update_mytooltip(self):
|
11675
12272
|
""" Update the tooltip with the values of the active arrays and results at position x,y """
|
11676
12273
|
|
@@ -11978,6 +12575,34 @@ class WolfMapViewer(wx.Frame):
|
|
11978
12575
|
except:
|
11979
12576
|
pass
|
11980
12577
|
|
12578
|
+
for loc_drowning in self.mydrownings:
|
12579
|
+
if loc_drowning.checked:
|
12580
|
+
try:
|
12581
|
+
if loc_drowning.bottom_cells is not None:
|
12582
|
+
curgroup = loc_drowning.idx
|
12583
|
+
try:
|
12584
|
+
i_bottom, j_bottom = loc_drowning.bottom_cells.get_ij_from_xy(x, y)
|
12585
|
+
i_surface, j_surface = loc_drowning.surface_cells.get_ij_from_xy(x, y)
|
12586
|
+
except:
|
12587
|
+
pass
|
12588
|
+
value = loc_drowning.bottom_cells.array[i_bottom,j_bottom]
|
12589
|
+
if not np.ma.is_masked(value) and value >0:
|
12590
|
+
self.mytooltip.add_param(groupname = curgroup,
|
12591
|
+
name = 'Bottom - percentage of the whole sample',
|
12592
|
+
value = value,
|
12593
|
+
type = Type_Param.Float,
|
12594
|
+
comment = '')
|
12595
|
+
value = loc_drowning.surface_cells.array[i_surface,j_surface]
|
12596
|
+
if not np.ma.is_masked(value) and value >0:
|
12597
|
+
self.mytooltip.add_param(groupname = curgroup,
|
12598
|
+
name = 'Surface - percentage of the whole sample',
|
12599
|
+
value = value,
|
12600
|
+
type = Type_Param.Float,
|
12601
|
+
comment = '')
|
12602
|
+
except:
|
12603
|
+
pass
|
12604
|
+
|
12605
|
+
|
11981
12606
|
self.mytooltip.PopulateOnePage()
|
11982
12607
|
|
11983
12608
|
|
@@ -13094,6 +13719,7 @@ class WolfMapViewer(wx.Frame):
|
|
13094
13719
|
self.active_particle_system = None
|
13095
13720
|
self.active_vertex = None
|
13096
13721
|
self.active_cloud = None
|
13722
|
+
self.active_dike = None
|
13097
13723
|
|
13098
13724
|
self.active_laz = None
|
13099
13725
|
|
@@ -13481,6 +14107,7 @@ class WolfMapViewer(wx.Frame):
|
|
13481
14107
|
self.height = ymax - ymin
|
13482
14108
|
|
13483
14109
|
self.setbounds()
|
14110
|
+
self.update()
|
13484
14111
|
|
13485
14112
|
|
13486
14113
|
def update(self):
|
@@ -13616,6 +14243,9 @@ class WolfMapViewer(wx.Frame):
|
|
13616
14243
|
# Dessin du reste
|
13617
14244
|
self._plotting(draw_type.OTHER)
|
13618
14245
|
|
14246
|
+
# Dessin du noyé
|
14247
|
+
self._plotting(draw_type.DROWNING)
|
14248
|
+
|
13619
14249
|
# Dessin du Front
|
13620
14250
|
self._plotting(draw_type.WMSFORE)
|
13621
14251
|
|
@@ -13654,10 +14284,11 @@ class WolfMapViewer(wx.Frame):
|
|
13654
14284
|
k = 0
|
13655
14285
|
for locarray in self.myarrays:
|
13656
14286
|
if locarray.plotted or force:
|
13657
|
-
|
13658
|
-
|
13659
|
-
|
13660
|
-
|
14287
|
+
[xmin_arr, xmax_arr], [ymin_arr, ymax_arr] = locarray.get_bounds()
|
14288
|
+
xmin = min(xmin, xmin_arr)
|
14289
|
+
xmax = max(xmax, xmax_arr)
|
14290
|
+
ymin = min(ymin, ymin_arr)
|
14291
|
+
ymax = max(ymax, ymax_arr)
|
13661
14292
|
k += 1
|
13662
14293
|
|
13663
14294
|
for locvector in self.myvectors:
|
@@ -13773,6 +14404,16 @@ class WolfMapViewer(wx.Frame):
|
|
13773
14404
|
ymax = max(locothers.ymax, ymax)
|
13774
14405
|
k += 1
|
13775
14406
|
|
14407
|
+
for drown in self.mydrownings:
|
14408
|
+
if drown.plotted or force:
|
14409
|
+
drown.find_minmax(force)
|
14410
|
+
xmin = min(drown.xmin, xmin)
|
14411
|
+
xmax = max(drown.xmax, xmax)
|
14412
|
+
ymin = min(drown.ymin, ymin)
|
14413
|
+
ymax = max(drown.ymax, ymax)
|
14414
|
+
k += 1
|
14415
|
+
|
14416
|
+
|
13776
14417
|
if k > 0:
|
13777
14418
|
self.xmin = xmin
|
13778
14419
|
self.xmax = xmax
|