wolfhece 2.0.4__py3-none-any.whl → 2.0.6__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/GraphNotebook.py +0 -1
- wolfhece/GraphProfile.py +5 -14
- wolfhece/Lidar2002.py +0 -1
- wolfhece/PyCrosssections.py +21 -26
- wolfhece/PyDraw.py +219 -58
- wolfhece/PyGui.py +6 -3
- wolfhece/PyPalette.py +2 -2
- wolfhece/PyParams.py +48 -48
- wolfhece/PyVertex.py +1 -1
- wolfhece/PyVertexvectors.py +40 -4
- wolfhece/Results2DGPU.py +7 -6
- wolfhece/apps/WolfPython.png +0 -0
- wolfhece/bernoulli/NetworkOpenGL.py +1 -1
- wolfhece/cli.py +7 -0
- wolfhece/flow_SPWMI.py +1 -1
- wolfhece/friction_law.py +6 -6
- wolfhece/gpuview.py +1 -1
- wolfhece/hydrology/PyWatershed.py +9 -10
- wolfhece/lagrangian/emitter.py +1 -1
- wolfhece/lagrangian/example_domain.py +1 -1
- wolfhece/lagrangian/velocity_field.py +4 -4
- wolfhece/libs/WolfDll.dll +0 -0
- wolfhece/libs/WolfDll_CD.dll +0 -0
- wolfhece/libs/WolfOGL.c +28187 -28187
- wolfhece/mar/Interface_MAR_WOLF_objet.py +1004 -0
- wolfhece/mar/commontools.py +1289 -59
- wolfhece/mesh2d/bc_manager.py +89 -13
- wolfhece/mesh2d/cst_2D_boundary_conditions.py +12 -0
- wolfhece/mesh2d/wolf2dprev.py +1 -2
- wolfhece/pydike.py +1 -1
- wolfhece/pyshields.py +43 -43
- wolfhece/pywalous.py +2 -2
- wolfhece/scenario/config_manager.py +3 -1
- wolfhece/ui/wolf_multiselection_collapsiblepane.py +10 -10
- wolfhece/wolf_array.py +1298 -418
- wolfhece/wolf_texture.py +1 -1
- wolfhece/wolfresults_2D.py +124 -19
- {wolfhece-2.0.4.dist-info → wolfhece-2.0.6.dist-info}/METADATA +5 -1
- {wolfhece-2.0.4.dist-info → wolfhece-2.0.6.dist-info}/RECORD +42 -39
- {wolfhece-2.0.4.dist-info → wolfhece-2.0.6.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.4.dist-info → wolfhece-2.0.6.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.4.dist-info → wolfhece-2.0.6.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -14,8 +14,10 @@ from PIL.PngImagePlugin import PngInfo
|
|
14
14
|
import io
|
15
15
|
import json
|
16
16
|
import glob
|
17
|
-
|
18
|
-
import
|
17
|
+
try:
|
18
|
+
from osgeo import gdal
|
19
|
+
except ModuleNotFoundError:
|
20
|
+
raise Exception("I can't find the 'gdal' package. You should get it from https://www.lfd.uci.edu/~gohlke/pythonlibs/")
|
19
21
|
from time import sleep
|
20
22
|
from datetime import timedelta
|
21
23
|
from multiprocessing import Pool
|
@@ -28,7 +30,7 @@ try:
|
|
28
30
|
except:
|
29
31
|
msg=_('Error importing OpenGL library')
|
30
32
|
msg+=_(' Python version : ' + sys.version)
|
31
|
-
msg+=_(' Please check your version of opengl32.dll -- conflict may exist between different
|
33
|
+
msg+=_(' Please check your version of opengl32.dll -- conflict may exist between different files present on your desktop')
|
32
34
|
raise Exception(msg)
|
33
35
|
|
34
36
|
import matplotlib.pyplot as plt
|
@@ -50,7 +52,7 @@ from .wolfresults_2D import Wolfresults_2D, views_2D
|
|
50
52
|
from .PyTranslate import _
|
51
53
|
from .PyVertex import cloud_vertices, getIfromRGB
|
52
54
|
from .RatingCurve import SPWMIGaugingStations, SPWDCENNGaugingStations
|
53
|
-
from .wolf_array import WOLF_ARRAY_MB, SelectionData, WolfArray, WolfArray_Sim2D, WolfArrayMB, CropDialog, header_wolf, WolfArrayMNAP
|
55
|
+
from .wolf_array import WOLF_ARRAY_MB, SelectionData, WolfArray, WolfArray_Sim2D, WolfArrayMB, CropDialog, header_wolf, WolfArrayMNAP, WOLF_ARRAY_FULL_SINGLE, WOLF_ARRAY_FULL_INTEGER8, WOLF_ARRAY_FULL_INTEGER16, WOLF_ARRAY_FULL_DOUBLE, WOLF_ARRAY_FULL_INTEGER
|
54
56
|
from .PyParams import Wolf_Param, key_Param, Type_Param
|
55
57
|
from .mesh2d.bc_manager import BcManager
|
56
58
|
from .PyVertexvectors import *
|
@@ -138,8 +140,9 @@ class WolfMapViewer(wx.Frame):
|
|
138
140
|
active_tile: Tiles
|
139
141
|
active_particle_system: Particle_system
|
140
142
|
|
141
|
-
def __init__(self, wxparent, title, w=500, h=500, treewidth=200, wolfparent=None):
|
143
|
+
def __init__(self, wxparent, title, w=500, h=500, treewidth=200, wolfparent=None, wxlogging=None):
|
142
144
|
|
145
|
+
self._wxlogging = wxlogging
|
143
146
|
self.action = None # Action à entreprendre
|
144
147
|
self.update_absolute_minmax = False # Force la MAJ de la palette
|
145
148
|
self.copyfrom = None # aucun élément pointé par CTRL+C
|
@@ -195,7 +198,7 @@ class WolfMapViewer(wx.Frame):
|
|
195
198
|
# Gestion des menus
|
196
199
|
self.popupmenu = wx.Menu()
|
197
200
|
self.popupmenu.Bind(wx.EVT_MENU, self.OnPopupItemSelected)
|
198
|
-
for text in [_('Save'), _('Save as'), _('Rename'), _('Up'), _('Down'), _('Properties')]:
|
201
|
+
for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Up'), _('Down'), _('Properties')]:
|
199
202
|
item = self.popupmenu.Append(-1, text)
|
200
203
|
|
201
204
|
self.menubar = wx.MenuBar()
|
@@ -469,6 +472,14 @@ class WolfMapViewer(wx.Frame):
|
|
469
472
|
|
470
473
|
self.InitUI()
|
471
474
|
|
475
|
+
@property
|
476
|
+
def wxlogging(self):
|
477
|
+
return self._wxlogging
|
478
|
+
|
479
|
+
@wxlogging.setter
|
480
|
+
def wxlogging(self, value):
|
481
|
+
self._wxlogging = value
|
482
|
+
|
472
483
|
def get_mapviewer(self):
|
473
484
|
""" Retourne une instance WolfMapViewer """
|
474
485
|
return self
|
@@ -1249,6 +1260,11 @@ class WolfMapViewer(wx.Frame):
|
|
1249
1260
|
"""
|
1250
1261
|
Création d'une vidéo sur base des résultats
|
1251
1262
|
"""
|
1263
|
+
try:
|
1264
|
+
import cv2
|
1265
|
+
except:
|
1266
|
+
logging.error(_('Please install opencv-python'))
|
1267
|
+
return
|
1252
1268
|
|
1253
1269
|
if fn=='':
|
1254
1270
|
dlg = wx.FileDialog(patent = None,
|
@@ -1669,7 +1685,7 @@ class WolfMapViewer(wx.Frame):
|
|
1669
1685
|
|
1670
1686
|
newcap = dlg.GetValue()
|
1671
1687
|
dlg.Destroy()
|
1672
|
-
newview = WolfMapViewer(None, newcap, w=600, h=600)
|
1688
|
+
newview = WolfMapViewer(None, newcap, w=600, h=600, wxlogging=self.wxlogging)
|
1673
1689
|
|
1674
1690
|
if self.linkedList is None:
|
1675
1691
|
self.linkedList = [self]
|
@@ -1720,11 +1736,20 @@ class WolfMapViewer(wx.Frame):
|
|
1720
1736
|
self, xmin, xmax, ymin, ymax, -99999, 1024),
|
1721
1737
|
ToCheck=False, id=m)
|
1722
1738
|
|
1723
|
-
def set_compare(self, ListArrays=None, share_colormap=True):
|
1739
|
+
def set_compare(self, ListArrays:list[WolfArray]=None, share_colormap:bool=True):
|
1740
|
+
"""
|
1741
|
+
Comparison of 2 arrays
|
1742
|
+
|
1743
|
+
:param ListArrays: List of 2 arrays to compare
|
1744
|
+
:param share_colormap: Share the colormap between the 2 arrays
|
1745
|
+
"""
|
1746
|
+
|
1747
|
+
# assert len(ListArrays) == 2, _('List of arrays must contain 2 and only 2 arrays - Here, you have provided {} arrays'.format(len(ListArrays)))
|
1748
|
+
|
1724
1749
|
# Création de 3 fenêtres de visualisation basées sur la classe "WolfMapViewer"
|
1725
1750
|
first = self
|
1726
|
-
second = WolfMapViewer(None, 'Comparison', w=600, h=600)
|
1727
|
-
third = WolfMapViewer(None, 'Difference', w=600, h=600)
|
1751
|
+
second = WolfMapViewer(None, 'Comparison', w=600, h=600, wxlogging=self.wxlogging)
|
1752
|
+
third = WolfMapViewer(None, 'Difference', w=600, h=600, wxlogging=self.wxlogging)
|
1728
1753
|
|
1729
1754
|
second.add_grid()
|
1730
1755
|
third.add_grid()
|
@@ -1732,12 +1757,12 @@ class WolfMapViewer(wx.Frame):
|
|
1732
1757
|
third.add_WMS()
|
1733
1758
|
|
1734
1759
|
# Création d'une liste contenant les 3 instances d'objet "WolfMapViewer"
|
1735
|
-
list = []
|
1760
|
+
list:list[WolfMapViewer] = []
|
1736
1761
|
list.append(first)
|
1737
1762
|
list.append(second)
|
1738
1763
|
list.append(third)
|
1739
1764
|
|
1740
|
-
# On indique que les objets sont liés en
|
1765
|
+
# On indique que les objets sont liés en activant le Booléen et en pointant la liste précédente
|
1741
1766
|
for curlist in list:
|
1742
1767
|
curlist.linked = True
|
1743
1768
|
curlist.linkedList = list
|
@@ -1748,8 +1773,10 @@ class WolfMapViewer(wx.Frame):
|
|
1748
1773
|
mns = ListArrays[1]
|
1749
1774
|
else:
|
1750
1775
|
logging.warning(_('List of arrays must contain 2 and only 2 arrays - Here, you have provided {} arrays'.format(len(ListArrays))))
|
1776
|
+
return
|
1751
1777
|
else:
|
1752
1778
|
logging.warning(_('You must fill the List of arrays with 2 and only 2 arrays - Here, the list is void'))
|
1779
|
+
return
|
1753
1780
|
|
1754
1781
|
mns: WolfArray
|
1755
1782
|
mnt: WolfArray
|
@@ -1778,6 +1805,7 @@ class WolfMapViewer(wx.Frame):
|
|
1778
1805
|
diff.mypal = wolfpalette()
|
1779
1806
|
if isinstance(diff, WolfArrayMB):
|
1780
1807
|
diff.link_palette()
|
1808
|
+
|
1781
1809
|
diff.mypal.readfile(fn)
|
1782
1810
|
diff.mypal.automatic = False
|
1783
1811
|
diff.myops.palauto.SetValue(0)
|
@@ -1806,16 +1834,24 @@ class WolfMapViewer(wx.Frame):
|
|
1806
1834
|
mns.reset_plot()
|
1807
1835
|
diff.reset_plot()
|
1808
1836
|
|
1809
|
-
def set_compare_all(self, ListArrays=None):
|
1837
|
+
def set_compare_all(self, ListArrays=None, names:list[str] = None):
|
1838
|
+
""" Comparison of 2 or 3 arrays """
|
1839
|
+
|
1840
|
+
assert len(ListArrays) == 2 or len(ListArrays) == 3, _('List of arrays must contain 2 or 3 arrays - Here, you have provided {} arrays'.format(len(ListArrays)))
|
1841
|
+
if names is not None:
|
1842
|
+
assert len(names) == len(ListArrays)-1, _('List of names must contain the number of names as arrays minus one - Here, you have provided {} names for {} arrays'.format(len(names), len(ListArrays)))
|
1843
|
+
else:
|
1844
|
+
names = ['comp1', 'comp2']
|
1845
|
+
|
1810
1846
|
# Création de 3 fenêtres de visualisation basées sur la classe "WolfMapViewer"
|
1811
1847
|
first = self
|
1812
|
-
second = WolfMapViewer(None, 'Comparison
|
1813
|
-
third = WolfMapViewer(None, 'Difference
|
1848
|
+
second = WolfMapViewer(None, 'Comparison {}'.format(names[0]), w=600, h=600, wxlogging=self.wxlogging)
|
1849
|
+
third = WolfMapViewer(None, 'Difference {}'.format(names[0]), w=600, h=600, wxlogging=self.wxlogging)
|
1814
1850
|
if len(ListArrays) == 3:
|
1815
|
-
fourth = WolfMapViewer(None, 'Comparison
|
1816
|
-
fifth = WolfMapViewer(None, 'Difference
|
1851
|
+
fourth = WolfMapViewer(None, 'Comparison {}'.format(names[1]), w=600, h=600, wxlogging=self.wxlogging)
|
1852
|
+
fifth = WolfMapViewer(None, 'Difference {}'.format(names[1]), w=600, h=600, wxlogging=self.wxlogging)
|
1817
1853
|
|
1818
|
-
# Création d'une liste contenant les
|
1854
|
+
# Création d'une liste contenant les multiples instances d'objet "WolfMapViewer"
|
1819
1855
|
list = []
|
1820
1856
|
list.append(first)
|
1821
1857
|
list.append(second)
|
@@ -1969,11 +2005,11 @@ class WolfMapViewer(wx.Frame):
|
|
1969
2005
|
|
1970
2006
|
# Création de fenêtres de visualisation basées sur la classe "WolfMapViewer"
|
1971
2007
|
first = self
|
1972
|
-
second = WolfMapViewer(None, 'Sculpting', w=600, h=600)
|
1973
|
-
third = WolfMapViewer(None, 'Difference', w=600, h=600)
|
1974
|
-
fourth = WolfMapViewer(None, 'Gradient', w=600, h=600)
|
1975
|
-
fifth = WolfMapViewer(None, 'Laplace', w=600, h=600)
|
1976
|
-
sixth = WolfMapViewer(None, 'Unitary Mask', w=600, h=600)
|
2008
|
+
second = WolfMapViewer(None, 'Sculpting', w=600, h=600, wxlogging=self.wxlogging)
|
2009
|
+
third = WolfMapViewer(None, 'Difference', w=600, h=600, wxlogging=self.wxlogging)
|
2010
|
+
fourth = WolfMapViewer(None, 'Gradient', w=600, h=600, wxlogging=self.wxlogging)
|
2011
|
+
fifth = WolfMapViewer(None, 'Laplace', w=600, h=600, wxlogging=self.wxlogging)
|
2012
|
+
sixth = WolfMapViewer(None, 'Unitary Mask', w=600, h=600, wxlogging=self.wxlogging)
|
1977
2013
|
|
1978
2014
|
# Création d'une liste contenant les 3 instances d'objet "WolfMapViewer"
|
1979
2015
|
list = []
|
@@ -2059,7 +2095,7 @@ class WolfMapViewer(wx.Frame):
|
|
2059
2095
|
self.mimicme()
|
2060
2096
|
|
2061
2097
|
def update_blender_sculpting(self):
|
2062
|
-
|
2098
|
+
""" Mise à jour des fenêtres de visualisation pour la comparaison avec Blender """
|
2063
2099
|
if not self.linked:
|
2064
2100
|
return
|
2065
2101
|
if len(self.linkedList) != 6:
|
@@ -2139,7 +2175,17 @@ class WolfMapViewer(wx.Frame):
|
|
2139
2175
|
Back.SetLabel("{:.2f}".format(np.sum(diff.array[diff.array > 0.])) + ' [m³]')
|
2140
2176
|
Bal.SetLabel("{:.2f}".format(np.sum(diff.array)) + ' [m³]')
|
2141
2177
|
|
2142
|
-
def zoomon_activevector(self, size=500., forceupdate=True):
|
2178
|
+
def zoomon_activevector(self, size:float=500., forceupdate:bool=True):
|
2179
|
+
"""
|
2180
|
+
Zoom on active vector
|
2181
|
+
|
2182
|
+
:param size: size of the zoomed window
|
2183
|
+
:param forceupdate: force the update of the window
|
2184
|
+
"""
|
2185
|
+
|
2186
|
+
if self.active_vector is None:
|
2187
|
+
logging.warning(_('No active vector'))
|
2188
|
+
return
|
2143
2189
|
|
2144
2190
|
curvec = self.active_vector
|
2145
2191
|
if curvec.xmin == -99999:
|
@@ -2167,7 +2213,30 @@ class WolfMapViewer(wx.Frame):
|
|
2167
2213
|
cur.update()
|
2168
2214
|
|
2169
2215
|
def zoom_on(self, zoom_dict = None, width = 500, height = 500, center = None, xll = None, yll = None, forceupdate=True, canvas_height=1024):
|
2216
|
+
"""
|
2217
|
+
Zoom on a specific area
|
2218
|
+
|
2219
|
+
It is possible to zoom on a specific area by providing the zoom parameters in :
|
2220
|
+
- a dictionnary
|
2221
|
+
- width and height of the zoomed window and the lower left corner coordinates
|
2222
|
+
- width and height of the zoomed window and the center coordinates
|
2223
|
+
|
2224
|
+
:param zoom_dict: dictionnary containing the zoom parameters - possible keys : 'width', 'height', 'center', 'xmin', 'ymin', 'xmax', 'ymax'
|
2225
|
+
:param width: width of the zoomed window [m]
|
2226
|
+
:param height: height of the zoomed window [m]
|
2227
|
+
:param center: center of the zoomed window [m] - tuple (x,y)
|
2228
|
+
:param xll: lower left X coordinate of the zoomed window [m]
|
2229
|
+
:param yll: lower left Y coordinate of the zoomed window [m]
|
2230
|
+
:param forceupdate: force the update of the window
|
2231
|
+
:param canvas_height: height of the canvas [pixels]
|
2170
2232
|
|
2233
|
+
|
2234
|
+
Examples :
|
2235
|
+
|
2236
|
+
- zoom_on(zoom_dict = {'center':(500,500), 'width':1000, 'height':1000})
|
2237
|
+
- zoom_on(width = 1000, height = 1000, xll = 500, yll = 500)
|
2238
|
+
- zoom_on(width = 1000, height = 1000, center = (500,500))
|
2239
|
+
"""
|
2171
2240
|
if zoom_dict is not None:
|
2172
2241
|
width = 99999
|
2173
2242
|
height = 99999
|
@@ -2222,7 +2291,8 @@ class WolfMapViewer(wx.Frame):
|
|
2222
2291
|
if cur is not self:
|
2223
2292
|
cur.update()
|
2224
2293
|
|
2225
|
-
def zoomon_active_profile(self, size=500., forceupdate=True):
|
2294
|
+
def zoomon_active_profile(self, size:float=500., forceupdate:bool=True):
|
2295
|
+
""" Zoom on active profile """
|
2226
2296
|
|
2227
2297
|
curvec = self.active_profile
|
2228
2298
|
if curvec.xmin == -99999:
|
@@ -3451,8 +3521,10 @@ class WolfMapViewer(wx.Frame):
|
|
3451
3521
|
|
3452
3522
|
if keyvalue == _('Arrays'):
|
3453
3523
|
ListArrays = []
|
3454
|
-
|
3455
|
-
|
3524
|
+
filterArray = "bin (*.bin)|*.bin|Elevation WOLF2D (*.top)|*.top|Geotif (*.tif)|*.tif|Float ESRI (*.flt)|*.flt|Numpy (*.npy)|*.npy|Numpy named arrays(*.npz)|*.npz|all (*.*)|*.*"
|
3525
|
+
|
3526
|
+
# filterProject = "Array (*.bin)|*.bin|all (*.*)|*.*"
|
3527
|
+
file = wx.FileDialog(self, "Choose Source file", wildcard=filterArray)
|
3456
3528
|
if file.ShowModal() == wx.ID_CANCEL:
|
3457
3529
|
file.Destroy()
|
3458
3530
|
return
|
@@ -3461,7 +3533,7 @@ class WolfMapViewer(wx.Frame):
|
|
3461
3533
|
ListArrays.append(file.GetPath())
|
3462
3534
|
file.Destroy()
|
3463
3535
|
|
3464
|
-
file = wx.FileDialog(self, _("Choose Comparison file"), wildcard=
|
3536
|
+
file = wx.FileDialog(self, _("Choose Comparison file"), wildcard=filterArray)
|
3465
3537
|
if file.ShowModal() == wx.ID_CANCEL:
|
3466
3538
|
file.Destroy()
|
3467
3539
|
return
|
@@ -3483,6 +3555,9 @@ class WolfMapViewer(wx.Frame):
|
|
3483
3555
|
first.mask_data(0.)
|
3484
3556
|
sec.mask_data(0.)
|
3485
3557
|
self.set_compare([first, sec], share_colormap=sharecmap)
|
3558
|
+
else:
|
3559
|
+
logging.error(_('Arrays have different dimensions !'))
|
3560
|
+
|
3486
3561
|
elif keyvalue == _('Modelling'):
|
3487
3562
|
ListArrays = []
|
3488
3563
|
filterProject = "all (*.*)|*.*"
|
@@ -3647,7 +3722,7 @@ class WolfMapViewer(wx.Frame):
|
|
3647
3722
|
|
3648
3723
|
if self.active_array is not None:
|
3649
3724
|
|
3650
|
-
choices = {'WOLF prev':1, 'WOLF OO':2, 'GPU':
|
3725
|
+
choices = {'WOLF prev':1, 'WOLF OO':2, 'GPU':3}
|
3651
3726
|
|
3652
3727
|
dlg = wx.SingleChoiceDialog(None,
|
3653
3728
|
_("Which version of BC Manager"),
|
@@ -4267,7 +4342,7 @@ class WolfMapViewer(wx.Frame):
|
|
4267
4342
|
filterVector = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|dxf (*.dxf)|*.dxf|shp (*.shp)|*.shp|all (*.*)|*.*"
|
4268
4343
|
filterCloud = "xyz (*.xyz)|*.xyz|dxf (*.dxf)|*.dxf|text (*.txt)|*.txt|all (*.*)|*.*"
|
4269
4344
|
filtertri = "tri (*.tri)|*.tri|text (*.txt)|*.txt|dxf (*.dxf)|*.dxf|gltf (*.gltf)|*.gltf|gltf binary (*.glb)|*.glb|*.*'all (*.*)|*.*"
|
4270
|
-
filterCs = "
|
4345
|
+
filterCs = "vecz WOLF (*.vecz)|*.vecz|txt 2022 (*.txt)|*.txt|WOLF (*.sxy)|*.sxy|text 2000 (*.txt)|*.txt|all (*.*)|*.*"
|
4271
4346
|
|
4272
4347
|
if filename == '' and newobj is None:
|
4273
4348
|
# ouverture d'une boîte de dialogue
|
@@ -4700,9 +4775,9 @@ class WolfMapViewer(wx.Frame):
|
|
4700
4775
|
|
4701
4776
|
with wx.lib.busy.BusyInfo(_('Importing cross sections')):
|
4702
4777
|
wait = wx.BusyCursor()
|
4703
|
-
if curfilter ==
|
4778
|
+
if curfilter == 1: # txt 2022
|
4704
4779
|
newobj = crosssections(filename, format='2022', dirlaz=dirlaz, mapviewer=self)
|
4705
|
-
if curfilter ==
|
4780
|
+
if curfilter == 0: # vecz
|
4706
4781
|
newobj = crosssections(filename, format='vecz', dirlaz=dirlaz, mapviewer=self)
|
4707
4782
|
elif curfilter == 2: # sxy
|
4708
4783
|
newobj = crosssections(filename, format='sxy', dirlaz=dirlaz, mapviewer=self)
|
@@ -5174,6 +5249,70 @@ class WolfMapViewer(wx.Frame):
|
|
5174
5249
|
|
5175
5250
|
break
|
5176
5251
|
|
5252
|
+
elif text == _('Duplicate'):
|
5253
|
+
|
5254
|
+
# Duplication de l'objet sélectionné
|
5255
|
+
if self.selobj is not None:
|
5256
|
+
#récupération de l'id courant
|
5257
|
+
label = self.selobj.idx + '_copy'
|
5258
|
+
dlg = wx.TextEntryDialog(self, message=_('Chose a label for the copy:'), value=label)
|
5259
|
+
ret=dlg.ShowModal()
|
5260
|
+
newlab = dlg.GetValue()
|
5261
|
+
dlg.Destroy()
|
5262
|
+
|
5263
|
+
if isinstance(self.selobj, WolfArray) and (not type(self.selobj) in [WolfArrayMB, WolfArrayMNAP, WolfArray_Sim2D]):
|
5264
|
+
|
5265
|
+
curtype = self.selobj.dtype
|
5266
|
+
|
5267
|
+
if curtype == np.float64:
|
5268
|
+
curtype = 'float64'
|
5269
|
+
elif curtype == np.float32:
|
5270
|
+
curtype = 'float32'
|
5271
|
+
elif curtype == np.int32:
|
5272
|
+
curtype = 'int32'
|
5273
|
+
elif curtype == np.int16:
|
5274
|
+
curtype = 'int16'
|
5275
|
+
elif curtype == np.int8:
|
5276
|
+
curtype = 'int8'
|
5277
|
+
|
5278
|
+
dlg = wx.MessageDialog(None, _('The type of the data is {}.\nDo you want to change this type?'.format(curtype)), style=wx.YES_NO | wx.NO_DEFAULT)
|
5279
|
+
ret = dlg.ShowModal()
|
5280
|
+
dlg.Destroy()
|
5281
|
+
|
5282
|
+
if ret == wx.ID_YES:
|
5283
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose a type'), _('Type'), ['float32','float64','int32','int16','int8'], style=wx.CHOICEDLG_STYLE)
|
5284
|
+
ret = dlg.ShowModal()
|
5285
|
+
|
5286
|
+
if ret != wx.ID_OK:
|
5287
|
+
dlg.Destroy()
|
5288
|
+
return
|
5289
|
+
|
5290
|
+
idx = dlg.GetSelection()
|
5291
|
+
dlg.Destroy()
|
5292
|
+
|
5293
|
+
if idx == 0:
|
5294
|
+
curtype = WOLF_ARRAY_FULL_SINGLE # np.float32
|
5295
|
+
elif idx == 1:
|
5296
|
+
curtype = WOLF_ARRAY_FULL_DOUBLE # np.float64
|
5297
|
+
elif idx == 2:
|
5298
|
+
curtype = WOLF_ARRAY_FULL_INTEGER # np.int32
|
5299
|
+
elif idx == 3:
|
5300
|
+
curtype = WOLF_ARRAY_FULL_INTEGER16 #np.int16
|
5301
|
+
elif idx == 4:
|
5302
|
+
curtype = WOLF_ARRAY_FULL_INTEGER8 #np.int8
|
5303
|
+
|
5304
|
+
newarray = WolfArray(srcheader=self.selobj.get_header(), whichtype=curtype)
|
5305
|
+
|
5306
|
+
newarray.allocate_ressources()
|
5307
|
+
newarray.copy_mask(self.selobj, forcenullvalue=True, link=False)
|
5308
|
+
else:
|
5309
|
+
newarray = WolfArray(mold=self.selobj)
|
5310
|
+
|
5311
|
+
self.add_object('array', newobj=newarray, id=newlab)
|
5312
|
+
self.Refresh()
|
5313
|
+
else:
|
5314
|
+
logging.warning(_('Not yet implemented'))
|
5315
|
+
|
5177
5316
|
elif text == _('Save as'):
|
5178
5317
|
# save objet to file, choosing the file name
|
5179
5318
|
|
@@ -5225,21 +5364,28 @@ class WolfMapViewer(wx.Frame):
|
|
5225
5364
|
|
5226
5365
|
|
5227
5366
|
def OnClose(self, event):
|
5367
|
+
nb = 0
|
5228
5368
|
if self.linked:
|
5229
5369
|
if self.linkedList is not None:
|
5230
5370
|
if self in self.linkedList:
|
5231
5371
|
id = self.linkedList.index(self)
|
5232
5372
|
self.linkedList.pop(id)
|
5373
|
+
nb = len(self.linkedList)
|
5233
5374
|
|
5375
|
+
if nb == 0:
|
5376
|
+
if self.wxlogging is not None:
|
5377
|
+
dlg = wx.MessageDialog(None, _('Do you want to quit Wolf ?'), _('Quit Wolf'), wx.YES_NO | wx.NO_DEFAULT)
|
5378
|
+
ret = dlg.ShowModal()
|
5379
|
+
dlg.Destroy()
|
5380
|
+
if ret == wx.ID_YES:
|
5381
|
+
self.Destroy()
|
5382
|
+
#FIXME : It is not a really proper way to quit the application
|
5383
|
+
wx.Exit()
|
5384
|
+
return
|
5385
|
+
else:
|
5386
|
+
return
|
5234
5387
|
self.Destroy()
|
5235
5388
|
|
5236
|
-
# def OnActivatedItem(self,e):
|
5237
|
-
# myitem=e.GetItem()
|
5238
|
-
# nameitem=self.treelist.GetItemText(myitem).lower()
|
5239
|
-
# self.selobj = self.getobj(nameitem)
|
5240
|
-
# self.selitem.SetLabel(nameitem)
|
5241
|
-
# pass
|
5242
|
-
|
5243
5389
|
def onselectitem(self,event):
|
5244
5390
|
myitem = event.GetItem()
|
5245
5391
|
|
@@ -5392,6 +5538,12 @@ class WolfMapViewer(wx.Frame):
|
|
5392
5538
|
shiftdown = e.ShiftDown()
|
5393
5539
|
|
5394
5540
|
if self.action is None:
|
5541
|
+
if self.active_bc is not None:
|
5542
|
+
self.action = 'select bc'
|
5543
|
+
tmpvec = vector()
|
5544
|
+
self.active_vector = tmpvec
|
5545
|
+
tmpvec.add_vertex(wolfvertex(x, y))
|
5546
|
+
|
5395
5547
|
self.rightdown = (x, y)
|
5396
5548
|
|
5397
5549
|
elif self.action == 'bridge gltf':
|
@@ -5554,23 +5706,24 @@ class WolfMapViewer(wx.Frame):
|
|
5554
5706
|
pos = e.GetPosition()
|
5555
5707
|
x, y = self.getXY(pos)
|
5556
5708
|
|
5557
|
-
|
5558
|
-
|
5559
|
-
|
5560
|
-
|
5561
|
-
|
5562
|
-
|
5563
|
-
|
5564
|
-
|
5565
|
-
|
5566
|
-
|
5567
|
-
|
5709
|
+
if self.active_bc is not None:
|
5710
|
+
try:
|
5711
|
+
minx = min(self.rightdown[0], x)
|
5712
|
+
miny = min(self.rightdown[1], y)
|
5713
|
+
maxx = max(self.rightdown[0], x)
|
5714
|
+
maxy = max(self.rightdown[1], y)
|
5715
|
+
|
5716
|
+
if minx != maxx and maxy != miny:
|
5717
|
+
self.active_bc.ray_tracing_numpy([[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]], 'X')
|
5718
|
+
self.active_bc.ray_tracing_numpy([[minx, miny], [maxx, miny], [maxx, maxy], [minx, maxy]], 'Y')
|
5719
|
+
else:
|
5720
|
+
self.active_bc.query_kdtree((x, y))
|
5568
5721
|
|
5569
|
-
|
5570
|
-
|
5722
|
+
self.active_bc.update_selection()
|
5723
|
+
self.Refresh()
|
5571
5724
|
|
5572
|
-
|
5573
|
-
|
5725
|
+
except:
|
5726
|
+
pass
|
5574
5727
|
|
5575
5728
|
def OnButton(self, e: wx.MouseEvent):
|
5576
5729
|
d = e.GetWheelDelta()
|
@@ -5947,7 +6100,7 @@ class WolfMapViewer(wx.Frame):
|
|
5947
6100
|
|
5948
6101
|
|
5949
6102
|
def OnMotion(self, e: wx.MouseEvent):
|
5950
|
-
|
6103
|
+
""" Mouse move event """
|
5951
6104
|
# Déplacement de la souris sur le canvas OpenGL
|
5952
6105
|
posframe = self.GetPosition()
|
5953
6106
|
pos = e.GetPosition()
|
@@ -5961,6 +6114,13 @@ class WolfMapViewer(wx.Frame):
|
|
5961
6114
|
|
5962
6115
|
self.setbounds(False)
|
5963
6116
|
return
|
6117
|
+
elif e.RightIsDown():
|
6118
|
+
if self.action == 'select bc':
|
6119
|
+
self.active_vector.myvertices=[wolfvertex(self.rightdown[0],self.rightdown[1]),
|
6120
|
+
wolfvertex(self.rightdown[0],y),
|
6121
|
+
wolfvertex(x,y),
|
6122
|
+
wolfvertex(x,self.rightdown[1]),
|
6123
|
+
wolfvertex(self.rightdown[0],self.rightdown[1])]
|
5964
6124
|
else:
|
5965
6125
|
self.move=False
|
5966
6126
|
|
@@ -6681,6 +6841,7 @@ class WolfMapViewer(wx.Frame):
|
|
6681
6841
|
|
6682
6842
|
if self.active_vector is not None:
|
6683
6843
|
if self.active_vector.parentzone is None:
|
6844
|
+
# we must plot this vector because it is a temporary vector outside any zone
|
6684
6845
|
self.active_vector.plot()
|
6685
6846
|
|
6686
6847
|
# Dessin des triangulations
|
@@ -6782,7 +6943,7 @@ class WolfMapViewer(wx.Frame):
|
|
6782
6943
|
k += 1
|
6783
6944
|
|
6784
6945
|
for loccloud in self.myclouds:
|
6785
|
-
if self.added[
|
6946
|
+
if self.added[draw_type.CLOUD][loccloud.idx].checked or force:
|
6786
6947
|
loccloud.find_minmax(force)
|
6787
6948
|
xmin = min(loccloud.xbounds[0], xmin)
|
6788
6949
|
xmax = max(loccloud.xbounds[1], xmax)
|
@@ -6791,7 +6952,7 @@ class WolfMapViewer(wx.Frame):
|
|
6791
6952
|
k += 1
|
6792
6953
|
|
6793
6954
|
for loctri in self.mytri:
|
6794
|
-
if self.added[
|
6955
|
+
if self.added[draw_type.TRIANGULATION][loctri.idx].checked or force:
|
6795
6956
|
loctri.find_minmax(force)
|
6796
6957
|
xmin = min(loctri.minx, xmin)
|
6797
6958
|
xmax = max(loctri.maxx, xmax)
|
wolfhece/PyGui.py
CHANGED
@@ -27,6 +27,8 @@ except:
|
|
27
27
|
from .PyConfig import WolfConfiguration, ConfigurationKeys
|
28
28
|
from .pylogging import create_wxlogwindow
|
29
29
|
|
30
|
+
# FIXME : Is it necessary to override wx.Frame ? WolfMapManager is a wx.Frame.
|
31
|
+
# Is it sufficient to run a wx.App ?
|
30
32
|
class GenMapManager(wx.Frame):
|
31
33
|
mapviewer:WolfMapViewer
|
32
34
|
wx_exists:bool
|
@@ -73,7 +75,10 @@ class GenMapManager(wx.Frame):
|
|
73
75
|
"""
|
74
76
|
Setup of a WolfMapViewer
|
75
77
|
"""
|
76
|
-
self.mapviewer = WolfMapViewer(None,
|
78
|
+
self.mapviewer = WolfMapViewer(None,
|
79
|
+
title=title,
|
80
|
+
wolfparent= wolfparent,
|
81
|
+
wxlogging=self.mylogs)
|
77
82
|
self.add_grid()
|
78
83
|
self.add_WMS()
|
79
84
|
|
@@ -1134,8 +1139,6 @@ class Wolf2DModel(GenMapManager):
|
|
1134
1139
|
curhead.translx = self.myparam.translx
|
1135
1140
|
curhead.transly = self.myparam.transly
|
1136
1141
|
|
1137
|
-
curhead.nbdims = 2
|
1138
|
-
|
1139
1142
|
return curhead
|
1140
1143
|
|
1141
1144
|
def read_fine_array(self,which=''):
|
wolfhece/PyPalette.py
CHANGED
@@ -140,8 +140,8 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
|
|
140
140
|
"""
|
141
141
|
Export image from colormap
|
142
142
|
|
143
|
-
|
144
|
-
|
143
|
+
:param : fn : filepath or io.BytesIO()
|
144
|
+
:param : h_or_v : configuration to save 'h' = horizontal, 'v' = vertical, '' = both
|
145
145
|
"""
|
146
146
|
if fn=='':
|
147
147
|
file=wx.FileDialog(None,"Choose .pal file", wildcard="png (*.png)|*.png|all (*.*)|*.*",style=wx.FD_SAVE)
|