wolfhece 2.1.21__py3-none-any.whl → 2.1.23__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 +179 -39
- wolfhece/PyGui.py +2 -3
- wolfhece/PyParams.py +3 -2
- wolfhece/PyVertexvectors.py +91 -12
- wolfhece/apps/version.py +1 -1
- wolfhece/coupling/__init__.py +0 -0
- wolfhece/coupling/hydrology_2d.py +1226 -0
- wolfhece/irm_qdf.py +19 -2
- wolfhece/wintab/__init__.py +0 -0
- wolfhece/wintab/wintab.py +248 -0
- {wolfhece-2.1.21.dist-info → wolfhece-2.1.23.dist-info}/METADATA +1 -1
- {wolfhece-2.1.21.dist-info → wolfhece-2.1.23.dist-info}/RECORD +15 -11
- {wolfhece-2.1.21.dist-info → wolfhece-2.1.23.dist-info}/WHEEL +1 -1
- {wolfhece-2.1.21.dist-info → wolfhece-2.1.23.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.21.dist-info → wolfhece-2.1.23.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -63,6 +63,7 @@ from . import Lidar2002
|
|
63
63
|
from .picc import Picc_data, Cadaster_data
|
64
64
|
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier
|
65
65
|
from .math_parser.calculator import Calculator
|
66
|
+
from .wintab.wintab import Wintab
|
66
67
|
|
67
68
|
# try:
|
68
69
|
# from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
|
@@ -337,6 +338,7 @@ class WolfMapViewer(wx.Frame):
|
|
337
338
|
# Gestion des menus
|
338
339
|
self.popupmenu = wx.Menu()
|
339
340
|
self.popupmenu.Bind(wx.EVT_MENU, self.OnPopupItemSelected)
|
341
|
+
|
340
342
|
for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Up'), _('Down'), _('Properties')]:
|
341
343
|
item = self.popupmenu.Append(-1, text)
|
342
344
|
|
@@ -412,6 +414,7 @@ class WolfMapViewer(wx.Frame):
|
|
412
414
|
createbcmanager2D = self.menucreateobj.Append(wx.ID_ANY, _('Create BC manager Wolf2D...'), _('New BC manager 2D'))
|
413
415
|
createpartsystem = self.menucreateobj.Append(wx.ID_ANY, _('Create particle system...'), _('Create a particle system - Lagrangian view'))
|
414
416
|
create1Dmodel = self.menucreateobj.Append(wx.ID_ANY, _('Create Wolf1D...'),('Create a 1D model using crossections, vectors and arrays...'))
|
417
|
+
create_acceptability = self.menucreateobj.Append(wx.ID_ANY, _('Create acceptability manager...'), _('Create acceptability manager'))
|
415
418
|
|
416
419
|
self.filemenu.AppendSeparator()
|
417
420
|
|
@@ -665,6 +668,32 @@ class WolfMapViewer(wx.Frame):
|
|
665
668
|
|
666
669
|
self.InitUI()
|
667
670
|
|
671
|
+
# self._wintab = Wintab(self.GetHandle())
|
672
|
+
|
673
|
+
# if self._wintab:
|
674
|
+
|
675
|
+
# import win32gui
|
676
|
+
# import win32con
|
677
|
+
|
678
|
+
# # self.oldWndProc = win32gui.SetWindowLong(self.GetHandle(), win32con.GWL_WNDPROC, self.MyWndProc)
|
679
|
+
|
680
|
+
# def MyWndProc(self, hWnd, msg, wParam, lParam):
|
681
|
+
# import win32con
|
682
|
+
|
683
|
+
# # Intercept a specific Windows message (for example, WM_KEYDOWN)
|
684
|
+
# # if msg == 0x7FF0:
|
685
|
+
# # key_code = wParam
|
686
|
+
# # print(f"Key pressed: {key_code}")
|
687
|
+
|
688
|
+
# # # Process the message or do something custom
|
689
|
+
# # if key_code == win32con.VK_ESCAPE:
|
690
|
+
# # print("Escape key pressed, intercepting the event.")
|
691
|
+
|
692
|
+
# # # You can return 0 to indicate the message has been processed
|
693
|
+
# # return 0
|
694
|
+
# # print(msg)
|
695
|
+
# return 0
|
696
|
+
|
668
697
|
@property
|
669
698
|
def wxlogging(self):
|
670
699
|
return self._wxlogging
|
@@ -860,7 +889,7 @@ class WolfMapViewer(wx.Frame):
|
|
860
889
|
self.menu2d_dangermap = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map"), _("Compute the danger map"))
|
861
890
|
self.menu2d_dangermaph = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map - only h"), _("Compute the danger map"))
|
862
891
|
|
863
|
-
self.menuwolf2d.AppendSeparator()
|
892
|
+
self.menuwolf2d.AppendSeparator()
|
864
893
|
|
865
894
|
self.menubar.Append(self.menuwolf2d, _('Results 2D'))
|
866
895
|
|
@@ -885,9 +914,9 @@ class WolfMapViewer(wx.Frame):
|
|
885
914
|
|
886
915
|
|
887
916
|
def get_canvas_bounds(self, gridsize:float = None):
|
888
|
-
"""
|
889
|
-
Retourne les limites de la zone d'affichage
|
890
|
-
|
917
|
+
"""
|
918
|
+
Retourne les limites de la zone d'affichage
|
919
|
+
|
891
920
|
:return: [xmin, ymin, xmax, ymax]
|
892
921
|
|
893
922
|
"""
|
@@ -1206,21 +1235,21 @@ class WolfMapViewer(wx.Frame):
|
|
1206
1235
|
|
1207
1236
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1208
1237
|
return
|
1209
|
-
|
1238
|
+
|
1210
1239
|
start_step = dlg.GetValue()
|
1211
|
-
|
1240
|
+
|
1212
1241
|
with wx.NumberEntryDialog(None, _('Danger map'), _('To step'), _('Danger map'), self.active_res2d.get_nbresults(), start_step, self.active_res2d.get_nbresults()) as dlg:
|
1213
1242
|
|
1214
1243
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1215
1244
|
return
|
1216
|
-
|
1245
|
+
|
1217
1246
|
end_step = dlg.GetValue()
|
1218
1247
|
|
1219
1248
|
with wx.NumberEntryDialog(None, _('Danger map'), _('Every'), _('Danger map'), 1, 1, 60) as dlg:
|
1220
|
-
|
1249
|
+
|
1221
1250
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1222
1251
|
return
|
1223
|
-
|
1252
|
+
|
1224
1253
|
every = dlg.GetValue()
|
1225
1254
|
|
1226
1255
|
danger_map = self.active_res2d.danger_map_only_h(start_step-1, end_step-1, every)
|
@@ -1229,7 +1258,7 @@ class WolfMapViewer(wx.Frame):
|
|
1229
1258
|
|
1230
1259
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1231
1260
|
return
|
1232
|
-
|
1261
|
+
|
1233
1262
|
outdir = dlg.GetPath()
|
1234
1263
|
|
1235
1264
|
danger_map.write_all(Path(outdir) / 'danger_h.tif')
|
@@ -1243,21 +1272,21 @@ class WolfMapViewer(wx.Frame):
|
|
1243
1272
|
|
1244
1273
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1245
1274
|
return
|
1246
|
-
|
1275
|
+
|
1247
1276
|
start_step = dlg.GetValue()
|
1248
|
-
|
1277
|
+
|
1249
1278
|
with wx.NumberEntryDialog(None, _('Danger map'), _('To step'), _('Danger map'), self.active_res2d.get_nbresults(), start_step, self.active_res2d.get_nbresults()) as dlg:
|
1250
1279
|
|
1251
1280
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1252
1281
|
return
|
1253
|
-
|
1282
|
+
|
1254
1283
|
end_step = dlg.GetValue()
|
1255
1284
|
|
1256
1285
|
with wx.NumberEntryDialog(None, _('Danger map'), _('Every'), _('Danger map'), 1, 1, 60) as dlg:
|
1257
|
-
|
1286
|
+
|
1258
1287
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1259
1288
|
return
|
1260
|
-
|
1289
|
+
|
1261
1290
|
every = dlg.GetValue()
|
1262
1291
|
|
1263
1292
|
danger_maps = self.active_res2d.danger_map(start_step-1, end_step-1, every)
|
@@ -1266,7 +1295,7 @@ class WolfMapViewer(wx.Frame):
|
|
1266
1295
|
|
1267
1296
|
if dlg.ShowModal() == wx.ID_CANCEL:
|
1268
1297
|
return
|
1269
|
-
|
1298
|
+
|
1270
1299
|
outdir = dlg.GetPath()
|
1271
1300
|
|
1272
1301
|
names = ['danger_h.tif', 'danger_u.tif', 'danger_q.tif', 'danger_Z.tif']
|
@@ -2782,10 +2811,10 @@ class WolfMapViewer(wx.Frame):
|
|
2782
2811
|
'2021': 'ORTHO_2021', '2022 printemps': 'ORTHO_2022_PRINTEMPS', '2022 été': 'ORTHO_2022_ETE',
|
2783
2812
|
'2023 été': 'ORTHO_2023_ETE',
|
2784
2813
|
}}
|
2785
|
-
data_2021 = {'EAU': {'IDW': 'ZONES_INONDEES_IDW',
|
2786
|
-
'Emprise': 'ZONES_INONDEES',
|
2814
|
+
data_2021 = {'EAU': {'IDW': 'ZONES_INONDEES_IDW',
|
2815
|
+
'Emprise': 'ZONES_INONDEES',
|
2787
2816
|
'Emprise wo Alea': 'ZONES_INONDEES_wo_alea'}}
|
2788
|
-
|
2817
|
+
|
2789
2818
|
for idx, (k, item) in enumerate(orthos.items()):
|
2790
2819
|
for kdx, (m, subitem) in enumerate(item.items()):
|
2791
2820
|
self.add_object(which='wmsback',
|
@@ -5021,6 +5050,13 @@ class WolfMapViewer(wx.Frame):
|
|
5021
5050
|
from .scenario.config_manager import Config_Manager_2D_GPU
|
5022
5051
|
newmanager = Config_Manager_2D_GPU(mapviewer=self)
|
5023
5052
|
|
5053
|
+
elif itemlabel == _('Create acceptability manager...'):
|
5054
|
+
|
5055
|
+
from .acceptability.acceptability_gui import AcceptabilityGui
|
5056
|
+
newmanager = AcceptabilityGui()
|
5057
|
+
newmanager.mapviewer = self
|
5058
|
+
newmanager.Show()
|
5059
|
+
|
5024
5060
|
elif itemlabel==_('Create BC manager Wolf2D...'):
|
5025
5061
|
|
5026
5062
|
if self.active_array is not None:
|
@@ -5248,7 +5284,7 @@ class WolfMapViewer(wx.Frame):
|
|
5248
5284
|
if obj.idx=='grid':
|
5249
5285
|
pass
|
5250
5286
|
else:
|
5251
|
-
filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|all (*.*)|*.*"
|
5287
|
+
filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|Shapefile (*.shp)|*.shp|all (*.*)|*.*"
|
5252
5288
|
fdlg = wx.FileDialog(self, "Choose file name for Vector :" + obj.idx, wildcard=filterArray,
|
5253
5289
|
style=wx.FD_SAVE)
|
5254
5290
|
ret = fdlg.ShowModal()
|
@@ -5468,13 +5504,27 @@ class WolfMapViewer(wx.Frame):
|
|
5468
5504
|
|
5469
5505
|
if which =='geotiff':
|
5470
5506
|
self.export_geotif(outdir,curarray.idx,myarrays,mynames)
|
5507
|
+
|
5471
5508
|
elif which=='shape':
|
5472
5509
|
self.export_shape(outdir,curarray.idx,myarrays,mynames,curarray)
|
5473
5510
|
del wait
|
5474
5511
|
|
5475
|
-
def export_shape(self,outdir='',fn = '',myarrays=[], descr=[],mask:WolfArray=None):
|
5512
|
+
def export_shape(self, outdir='', fn = '', myarrays=[], descr=[], mask:WolfArray=None):
|
5513
|
+
""" Export multiple arrays to shapefile
|
5514
|
+
|
5515
|
+
:param outdir: output directory
|
5516
|
+
:param fn: filename -- .shp will be added if not present
|
5517
|
+
:param myarrays: list of Wolfarrays to export
|
5518
|
+
:param descr: list of descriptions
|
5519
|
+
:param mask: mask array -- export only where mask > 0
|
5520
|
+
"""
|
5476
5521
|
|
5477
5522
|
if len(myarrays)==0:
|
5523
|
+
logging.warning(_('No arrays provided for shapefile export'))
|
5524
|
+
return
|
5525
|
+
|
5526
|
+
if mask is None:
|
5527
|
+
logging.warning(_('No mask provided for shapefile export'))
|
5478
5528
|
return
|
5479
5529
|
|
5480
5530
|
from osgeo import gdal, osr, gdalconst,ogr
|
@@ -5488,7 +5538,10 @@ class WolfMapViewer(wx.Frame):
|
|
5488
5538
|
driver = ogr.GetDriverByName("ESRI Shapefile")
|
5489
5539
|
|
5490
5540
|
# create the data source
|
5491
|
-
filename = join(outdir,fn)
|
5541
|
+
filename = join(outdir,fn)
|
5542
|
+
if not filename.endswith('.shp'):
|
5543
|
+
filename+='.shp'
|
5544
|
+
|
5492
5545
|
ds = driver.CreateDataSource(filename)
|
5493
5546
|
|
5494
5547
|
# create one layer
|
@@ -5533,9 +5586,18 @@ class WolfMapViewer(wx.Frame):
|
|
5533
5586
|
# Save and close DataSource
|
5534
5587
|
ds = None
|
5535
5588
|
|
5536
|
-
def export_geotif(self,outdir='',fn = '',myarrays=[], descr=[]):
|
5589
|
+
def export_geotif(self, outdir='', fn = '', myarrays=[], descr=[]):
|
5590
|
+
""" Export multiple arrays to geotiff
|
5591
|
+
|
5592
|
+
:param outdir: output directory
|
5593
|
+
:param fn: filename -- .tif will be added if not present
|
5594
|
+
:param myarrays: list of Wolfarrays to export
|
5595
|
+
:param descr: list of descriptions -- Bands names
|
5596
|
+
|
5597
|
+
"""
|
5537
5598
|
|
5538
5599
|
if len(myarrays)==0:
|
5600
|
+
logging.warning(_('No arrays provided for geotiff export'))
|
5539
5601
|
return
|
5540
5602
|
|
5541
5603
|
from osgeo import gdal, osr, gdalconst
|
@@ -5543,7 +5605,9 @@ class WolfMapViewer(wx.Frame):
|
|
5543
5605
|
srs = osr.SpatialReference()
|
5544
5606
|
srs.ImportFromEPSG(31370)
|
5545
5607
|
|
5546
|
-
filename = join(outdir,fn)
|
5608
|
+
filename = join(outdir,fn)
|
5609
|
+
if not filename.endswith('.tif'):
|
5610
|
+
filename+='.tif'
|
5547
5611
|
|
5548
5612
|
arr=myarrays[0].array
|
5549
5613
|
if arr.dtype == np.float32:
|
@@ -6200,7 +6264,7 @@ class WolfMapViewer(wx.Frame):
|
|
6200
6264
|
logging.warning('No object to add in "WMS foreground" category -- Please provide an object to add or check your code')
|
6201
6265
|
|
6202
6266
|
elif which.lower() == 'particlesystem':
|
6203
|
-
|
6267
|
+
|
6204
6268
|
curdict = self.mypartsystems
|
6205
6269
|
curtree = self.myitemsps
|
6206
6270
|
if newobj is None:
|
@@ -6688,7 +6752,7 @@ class WolfMapViewer(wx.Frame):
|
|
6688
6752
|
self.selected_object.write_all()
|
6689
6753
|
fdlg.Destroy()
|
6690
6754
|
elif type(self.selected_object) is Zones:
|
6691
|
-
filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|all (*.*)|*.*"
|
6755
|
+
filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|Shapefile (*.shp)|*.shp|all (*.*)|*.*"
|
6692
6756
|
fdlg = wx.FileDialog(self, "Choose file name for Vector :" + self.selected_object.idx, wildcard=filterArray,
|
6693
6757
|
style=wx.FD_SAVE)
|
6694
6758
|
ret = fdlg.ShowModal()
|
@@ -6758,6 +6822,29 @@ class WolfMapViewer(wx.Frame):
|
|
6758
6822
|
self.add_object('array', newobj=mb, id=self.selected_object.idx + '_mb')
|
6759
6823
|
else:
|
6760
6824
|
logging.warning(_('Convert to multi-blocks not yet implemented for this type of object'))
|
6825
|
+
|
6826
|
+
elif _('Export to Shape file') in text:
|
6827
|
+
|
6828
|
+
if isinstance(self.selected_object, Zones):
|
6829
|
+
filterArray = "Shapefile (*.shp)|*.shp"
|
6830
|
+
fdlg = wx.FileDialog(self, "Choose file name for Zones :" + self.selected_object.idx, wildcard=filterArray,
|
6831
|
+
style=wx.FD_SAVE)
|
6832
|
+
ret = fdlg.ShowModal()
|
6833
|
+
if ret == wx.ID_OK:
|
6834
|
+
self.selected_object.export_to_shapefile(fdlg.GetPath())
|
6835
|
+
fdlg.Destroy()
|
6836
|
+
|
6837
|
+
elif _('Export active zone to Shape file') in text:
|
6838
|
+
|
6839
|
+
if isinstance(self.selected_object, Zones):
|
6840
|
+
|
6841
|
+
filterArray = "Shapefile (*.shp)|*.shp"
|
6842
|
+
fdlg = wx.FileDialog(self, "Choose file name for Vector :" + self.selected_object.idx, wildcard=filterArray,
|
6843
|
+
style=wx.FD_SAVE)
|
6844
|
+
ret = fdlg.ShowModal()
|
6845
|
+
if ret == wx.ID_OK:
|
6846
|
+
self.selected_object.export_active_zone_to_shapefile(fdlg.GetPath())
|
6847
|
+
fdlg.Destroy()
|
6761
6848
|
|
6762
6849
|
|
6763
6850
|
def OnClose(self, event):
|
@@ -6931,6 +7018,13 @@ class WolfMapViewer(wx.Frame):
|
|
6931
7018
|
|
6932
7019
|
|
6933
7020
|
def OnRightDown(self, e: wx.MouseEvent):
|
7021
|
+
"""
|
7022
|
+
Event when the right button of the mouse is pressed.
|
7023
|
+
|
7024
|
+
We use this event to manage "action" set by others objects.
|
7025
|
+
|
7026
|
+
"""
|
7027
|
+
|
6934
7028
|
pos = e.GetPosition()
|
6935
7029
|
x, y = self.getXY(pos)
|
6936
7030
|
|
@@ -6951,6 +7045,7 @@ class WolfMapViewer(wx.Frame):
|
|
6951
7045
|
self.rightdown = (x, y)
|
6952
7046
|
|
6953
7047
|
elif 'pick landmap' in self.action:
|
7048
|
+
# Pick a landmap if loaded
|
6954
7049
|
|
6955
7050
|
if self.active_landmap is None:
|
6956
7051
|
logging.warning(_('No landmap available -- Please activate the data and retry !'))
|
@@ -6963,6 +7058,7 @@ class WolfMapViewer(wx.Frame):
|
|
6963
7058
|
self.Refresh()
|
6964
7059
|
|
6965
7060
|
elif self.action == 'bridge gltf':
|
7061
|
+
# Create a bridge in gltf format
|
6966
7062
|
|
6967
7063
|
self.bridgepar = (x, y)
|
6968
7064
|
|
@@ -6989,11 +7085,13 @@ class WolfMapViewer(wx.Frame):
|
|
6989
7085
|
|
6990
7086
|
self.start_action('', 'None')
|
6991
7087
|
|
6992
|
-
# Profile plots
|
6993
7088
|
elif self.action == 'Plot cross section':
|
7089
|
+
# Plot cross section
|
6994
7090
|
self.plot_cross(x, y)
|
6995
7091
|
|
6996
7092
|
elif self.action == 'Set 1D profile':
|
7093
|
+
# Set 1D profile
|
7094
|
+
|
6997
7095
|
if self.active_cs is None:
|
6998
7096
|
self.active_cs = self.get_cross_sections()
|
6999
7097
|
|
@@ -7032,6 +7130,8 @@ class WolfMapViewer(wx.Frame):
|
|
7032
7130
|
self.Paint()
|
7033
7131
|
|
7034
7132
|
elif self.action == 'Select nearest profile':
|
7133
|
+
# Select nearest profile
|
7134
|
+
|
7035
7135
|
if self.active_cs is None:
|
7036
7136
|
self.active_cs = self.get_cross_sections()
|
7037
7137
|
|
@@ -7068,6 +7168,7 @@ class WolfMapViewer(wx.Frame):
|
|
7068
7168
|
self.Refresh()
|
7069
7169
|
|
7070
7170
|
elif self.action == 'select active tile':
|
7171
|
+
# Select active tile from Lidar data
|
7071
7172
|
|
7072
7173
|
self.active_tile.select_vectors_from_point(x, y, True)
|
7073
7174
|
self.active_vector = self.active_tile.get_selected_vectors()
|
@@ -7083,9 +7184,10 @@ class WolfMapViewer(wx.Frame):
|
|
7083
7184
|
self.add_object('array', newobj = tilearray, ToCheck=True, id=id_label)
|
7084
7185
|
|
7085
7186
|
elif self.action.find('select active vector') > -1:
|
7187
|
+
# Select active vector
|
7086
7188
|
|
7087
|
-
inside = self.action.find('inside') > -1
|
7088
|
-
onlyonezone = self.action.find('2') > -1
|
7189
|
+
inside = self.action.find('inside') > -1 # only polygons/closed polyline if 'inside' is in the action name
|
7190
|
+
onlyonezone = self.action.find('2') > -1 # only the active zone if '2' is in the action name, all zones otherwise
|
7089
7191
|
|
7090
7192
|
if onlyonezone:
|
7091
7193
|
self.active_zone.select_vectors_from_point(x, y, inside)
|
@@ -7105,6 +7207,7 @@ class WolfMapViewer(wx.Frame):
|
|
7105
7207
|
self.active_zones.expand_tree(self.active_zone)
|
7106
7208
|
|
7107
7209
|
elif 'select node by node' in self.action:
|
7210
|
+
# Select node by node
|
7108
7211
|
|
7109
7212
|
if 'results' in self.action:
|
7110
7213
|
curobj:Wolfresults_2D
|
@@ -7118,7 +7221,7 @@ class WolfMapViewer(wx.Frame):
|
|
7118
7221
|
self.Paint()
|
7119
7222
|
|
7120
7223
|
elif 'select by tmp vector' in self.action or 'select by vector' in self.action:
|
7121
|
-
|
7224
|
+
# Select nodes by vector or temporary vector
|
7122
7225
|
self.active_vector.add_vertex(wolfvertex(x, y))
|
7123
7226
|
|
7124
7227
|
elif 'laz tmp vector' == self.action:
|
@@ -7144,7 +7247,7 @@ class WolfMapViewer(wx.Frame):
|
|
7144
7247
|
self.active_zone.find_minmax()
|
7145
7248
|
|
7146
7249
|
elif self.action == 'dynamic parallel':
|
7147
|
-
|
7250
|
+
# Create a dynamic parallel line
|
7148
7251
|
if ctrl:
|
7149
7252
|
if self.active_array is not None:
|
7150
7253
|
z = self.active_array.get_value(x, y)
|
@@ -7309,6 +7412,7 @@ class WolfMapViewer(wx.Frame):
|
|
7309
7412
|
self.Refresh()
|
7310
7413
|
|
7311
7414
|
def OnLDown(self, e):
|
7415
|
+
|
7312
7416
|
if not self.move:
|
7313
7417
|
pos = e.GetPosition()
|
7314
7418
|
x, y = self.getXY(pos)
|
@@ -7387,7 +7491,7 @@ class WolfMapViewer(wx.Frame):
|
|
7387
7491
|
#Print info in the status bar
|
7388
7492
|
txt = 'Dx : {:4f} ; Dy : {:4f}'.format(self.active_array.dx, self.active_array.dy)
|
7389
7493
|
txt += ' ; Xmin : {:4f} ; Ymin : {:4f}'.format(self.active_array.origx, self.active_array.origy)
|
7390
|
-
txt += ' ; Xmax : {:4f} ; Ymax : {:4f}'.format(self.active_array.origx + self.active_array.dx * float(self.active_array.nbx),
|
7494
|
+
txt += ' ; Xmax : {:4f} ; Ymax : {:4f}'.format(self.active_array.origx + self.active_array.dx * float(self.active_array.nbx),
|
7391
7495
|
self.active_array.origy + self.active_array.dy * float(self.active_array.nby))
|
7392
7496
|
txt += ' ; Nx : {:d} ; Ny : {:d}'.format(self.active_array.nbx, self.active_array.nby)
|
7393
7497
|
|
@@ -7688,6 +7792,7 @@ class WolfMapViewer(wx.Frame):
|
|
7688
7792
|
|
7689
7793
|
def OnMotion(self, e: wx.MouseEvent):
|
7690
7794
|
""" Mouse move event """
|
7795
|
+
|
7691
7796
|
# Déplacement de la souris sur le canvas OpenGL
|
7692
7797
|
posframe = self.GetPosition()
|
7693
7798
|
pos = e.GetPosition()
|
@@ -7836,6 +7941,7 @@ class WolfMapViewer(wx.Frame):
|
|
7836
7941
|
|
7837
7942
|
Each action must call self.end_action() to nullify the action and print a message.
|
7838
7943
|
"""
|
7944
|
+
|
7839
7945
|
if self.action is not None:
|
7840
7946
|
locaction = self.action
|
7841
7947
|
if 'select by tmp vector' in self.action or 'select by vector' in self.action:
|
@@ -7965,10 +8071,8 @@ class WolfMapViewer(wx.Frame):
|
|
7965
8071
|
|
7966
8072
|
self.end_action(_('End of dynamic parallel'))
|
7967
8073
|
|
7968
|
-
elif
|
7969
|
-
self.end_action(_('End of vector selection'))
|
8074
|
+
elif 'select active vector' in self.action:
|
7970
8075
|
|
7971
|
-
elif self.action == 'select active vector2':
|
7972
8076
|
self.end_action(_('End of vector selection'))
|
7973
8077
|
|
7974
8078
|
elif 'select node by node' in self.action:
|
@@ -8124,8 +8228,9 @@ class WolfMapViewer(wx.Frame):
|
|
8124
8228
|
|
8125
8229
|
def msg_action(self, which:int = 0):
|
8126
8230
|
""" Message to end action """
|
8231
|
+
|
8127
8232
|
if which == 0:
|
8128
|
-
self.StatusBar.SetStatusText(_('Action in progress... -- To quit, press "RETURN" or "double clicks RIGHT"'))
|
8233
|
+
self.StatusBar.SetStatusText(_('Action in progress... -- To quit, press "RETURN" or "double clicks RIGHT" or press "ESC"'))
|
8129
8234
|
else:
|
8130
8235
|
self.StatusBar.SetStatusText('')
|
8131
8236
|
|
@@ -8142,6 +8247,7 @@ class WolfMapViewer(wx.Frame):
|
|
8142
8247
|
|
8143
8248
|
def end_action(self, message:str=''):
|
8144
8249
|
""" Message to end action """
|
8250
|
+
|
8145
8251
|
self.action = None
|
8146
8252
|
logging.info(_('ACTION : ') + _(message) if message != '' else _('ACTION : End of action') )
|
8147
8253
|
self.msg_action(1)
|
@@ -8595,7 +8701,13 @@ class WolfMapViewer(wx.Frame):
|
|
8595
8701
|
self.setbounds()
|
8596
8702
|
|
8597
8703
|
def paste_values(self,fromarray:WolfArray):
|
8598
|
-
|
8704
|
+
""" Paste selected values from a WolfArray to the active array """
|
8705
|
+
|
8706
|
+
if self.active_array is None:
|
8707
|
+
logging.warning(_('The active array is None - Please active an array into which to paste the values !'))
|
8708
|
+
return
|
8709
|
+
|
8710
|
+
logging.info(_('Paste selection values'))
|
8599
8711
|
cursel = fromarray.SelectionData.myselection
|
8600
8712
|
if cursel == 'all':
|
8601
8713
|
self.active_array.paste_all(fromarray)
|
@@ -8604,6 +8716,12 @@ class WolfMapViewer(wx.Frame):
|
|
8604
8716
|
self.active_array.set_values_sel(cursel, z)
|
8605
8717
|
|
8606
8718
|
def paste_selxy(self,fromarray:WolfArray):
|
8719
|
+
""" Paste selected nodes from a WolfArray to the active array """
|
8720
|
+
|
8721
|
+
if self.active_array is None:
|
8722
|
+
logging.warning(_('The active array is None - Please active an array into which to paste the selection !'))
|
8723
|
+
return
|
8724
|
+
|
8607
8725
|
logging.info(_('Paste selection position'))
|
8608
8726
|
cursel = fromarray.SelectionData.myselection
|
8609
8727
|
if cursel == 'all':
|
@@ -8626,6 +8744,8 @@ class WolfMapViewer(wx.Frame):
|
|
8626
8744
|
tracks.append(_('Convert to mono-block'))
|
8627
8745
|
tracks.append(_('Convert to mono-block (result)'))
|
8628
8746
|
tracks.append(_('Convert to multi-blocks (result)'))
|
8747
|
+
tracks.append(_('Export to Shape file'))
|
8748
|
+
tracks.append(_('Export active zone to Shape file'))
|
8629
8749
|
|
8630
8750
|
# Récupération des items du menu contextuel
|
8631
8751
|
menuitems = self.popupmenu.GetMenuItems()
|
@@ -8660,9 +8780,18 @@ class WolfMapViewer(wx.Frame):
|
|
8660
8780
|
self.popupmenu.Append(wx.ID_ANY, _('Convert to mono-block (result)'), _('Convert to mono-block'))
|
8661
8781
|
self.popupmenu.Append(wx.ID_ANY, _('Convert to multi-blocks (result)'), _('Convert to multi-blocks'))
|
8662
8782
|
|
8783
|
+
if isinstance(self.selected_object, Zones):
|
8784
|
+
self.popupmenu.Append(wx.ID_ANY, _('Export to Shape file'), _('Export to Shape file'))
|
8785
|
+
self.popupmenu.Append(wx.ID_ANY, _('Export active zone to Shape file'), _('Export active zone to Shape file'))
|
8786
|
+
|
8663
8787
|
self.treelist.PopupMenu(self.popupmenu)
|
8664
8788
|
|
8665
8789
|
def update(self):
|
8790
|
+
"""
|
8791
|
+
Update backgournd et foreground elements and arrays if local minmax is checked.
|
8792
|
+
|
8793
|
+
"""
|
8794
|
+
|
8666
8795
|
# dessin du background
|
8667
8796
|
for obj in self.iterator_over_objects(draw_type.WMSBACK):
|
8668
8797
|
obj.reload()
|
@@ -8682,7 +8811,6 @@ class WolfMapViewer(wx.Frame):
|
|
8682
8811
|
curarray.delete_lists()
|
8683
8812
|
|
8684
8813
|
self.Paint()
|
8685
|
-
# self.Refresh()
|
8686
8814
|
|
8687
8815
|
def _plotting(self, drawing_type: draw_type, checked_state: bool = True):
|
8688
8816
|
""" Drawing objets on canvas"""
|
@@ -8722,6 +8850,7 @@ class WolfMapViewer(wx.Frame):
|
|
8722
8850
|
return self.canvas.SetCurrent(self.context)
|
8723
8851
|
|
8724
8852
|
def Paint(self):
|
8853
|
+
""" Dessin des éléments ajoutés au viewer """
|
8725
8854
|
|
8726
8855
|
if self.currently_readresults:
|
8727
8856
|
return
|
@@ -8806,6 +8935,7 @@ class WolfMapViewer(wx.Frame):
|
|
8806
8935
|
|
8807
8936
|
def OnPaint(self, e):
|
8808
8937
|
""" event handler for paint event"""
|
8938
|
+
|
8809
8939
|
self.Paint()
|
8810
8940
|
if e is not None:
|
8811
8941
|
e.Skip()
|
@@ -8938,7 +9068,13 @@ class WolfMapViewer(wx.Frame):
|
|
8938
9068
|
self.ymin = ymin
|
8939
9069
|
self.ymax = ymax
|
8940
9070
|
|
8941
|
-
def resizeFrame(self, w, h):
|
9071
|
+
def resizeFrame(self, w:int, h:int):
|
9072
|
+
""" Resize the frame
|
9073
|
+
|
9074
|
+
:param w: width in pixels
|
9075
|
+
:param h: height in pixels
|
9076
|
+
"""
|
9077
|
+
|
8942
9078
|
self.SetClientSize(w, h)
|
8943
9079
|
|
8944
9080
|
def mimicme(self):
|
@@ -8990,6 +9126,8 @@ class WolfMapViewer(wx.Frame):
|
|
8990
9126
|
curFrame.forcemimic = True
|
8991
9127
|
|
8992
9128
|
def Active_vector(self, vect):
|
9129
|
+
""" Active un vecteur et sa zone parent si existante """
|
9130
|
+
|
8993
9131
|
self.active_vector = vect
|
8994
9132
|
|
8995
9133
|
if vect is not None:
|
@@ -9000,6 +9138,8 @@ class WolfMapViewer(wx.Frame):
|
|
9000
9138
|
self.mimicme()
|
9001
9139
|
|
9002
9140
|
def Active_zone(self, zone: zone):
|
9141
|
+
""" Active une zone et son parent si existant """
|
9142
|
+
|
9003
9143
|
self.active_zone = zone
|
9004
9144
|
self.active_zones = zone.parent
|
9005
9145
|
logging.info(_('Activating zone : ' + zone.myname))
|
wolfhece/PyGui.py
CHANGED
@@ -82,7 +82,6 @@ class GenMapManager(wx.Frame):
|
|
82
82
|
# super().__init__(*args)
|
83
83
|
self.mylogs = create_wxlogwindow(_('Informations'))
|
84
84
|
|
85
|
-
|
86
85
|
def setup_mapviewer(self, title:str, wolfparent):
|
87
86
|
""" Setup of a WolfMapViewer """
|
88
87
|
|
@@ -282,7 +281,7 @@ class HydrologyModel(GenMapManager):
|
|
282
281
|
|
283
282
|
for curfile in self.files_hydrology_array['Characteristic_maps']:
|
284
283
|
curext=curfile[0]
|
285
|
-
curidx=curfile[1]
|
284
|
+
curidx=curfile[1]
|
286
285
|
self.mapviewer.add_object(which='array',filename=self.mydircharact+curext,id=curidx,ToCheck=False)
|
287
286
|
|
288
287
|
|
@@ -298,7 +297,7 @@ class HydrologyModel(GenMapManager):
|
|
298
297
|
cur_vect = cur_zone.myvectors[0]
|
299
298
|
cur_vect.set_legend_to_centroid(cur_sub.name + ' - ' + str(cur_sub.iDSorted), visible=True)
|
300
299
|
cur_vect.myprop.legendfontsize = 12
|
301
|
-
|
300
|
+
|
302
301
|
delimit.reset_listogl()
|
303
302
|
|
304
303
|
self.mapviewer.add_object(which='vector',newobj = delimit, id=curidx, ToCheck=True)
|
wolfhece/PyParams.py
CHANGED
@@ -927,7 +927,7 @@ class Wolf_Param(wx.Frame):
|
|
927
927
|
# priority to default parameters
|
928
928
|
if key_Param.ADDED_JSON in param_def.keys():
|
929
929
|
param[key_Param.ADDED_JSON] = param_def[key_Param.ADDED_JSON]
|
930
|
-
|
930
|
+
|
931
931
|
param[key_Param.COMMENT] = param_def[key_Param.COMMENT]
|
932
932
|
param[key_Param.TYPE] = param_def[key_Param.TYPE]
|
933
933
|
|
@@ -1032,7 +1032,7 @@ class Wolf_Param(wx.Frame):
|
|
1032
1032
|
else:
|
1033
1033
|
if locvalue is None:
|
1034
1034
|
locvalue = ""
|
1035
|
-
|
1035
|
+
|
1036
1036
|
page.Append(pg.StringProperty(label = param_name, name = locname, value = locvalue))
|
1037
1037
|
|
1038
1038
|
def _add_elem_to_page(self, page:pg.PropertyGridPage, group:str, param:dict, param_def:dict = None, prefix:str=''):
|
@@ -1373,6 +1373,7 @@ class Wolf_Param(wx.Frame):
|
|
1373
1373
|
self.myIncParam.clear()
|
1374
1374
|
if self.prop is not None:
|
1375
1375
|
self.prop.Clear()
|
1376
|
+
self.prop.SetDescription("","")
|
1376
1377
|
|
1377
1378
|
# Object access
|
1378
1379
|
# -------------
|