wolfhece 2.1.89__py3-none-any.whl → 2.1.90__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 +84 -25
- wolfhece/PyPalette.py +4 -0
- wolfhece/PyParams.py +22 -16
- wolfhece/PyVertex.py +33 -1
- wolfhece/PyVertexvectors.py +70 -9
- wolfhece/apps/version.py +1 -1
- wolfhece/gpuview.py +9 -1
- {wolfhece-2.1.89.dist-info → wolfhece-2.1.90.dist-info}/METADATA +1 -1
- {wolfhece-2.1.89.dist-info → wolfhece-2.1.90.dist-info}/RECORD +12 -12
- {wolfhece-2.1.89.dist-info → wolfhece-2.1.90.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.89.dist-info → wolfhece-2.1.90.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.89.dist-info → wolfhece-2.1.90.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -622,9 +622,6 @@ class WolfMapViewer(wx.Frame):
|
|
622
622
|
self.menupontgltfonebyone = self.cs_menu.Append(wx.ID_ANY, _("Create bridge and export gltf..."),
|
623
623
|
_("Bridge gltf"))
|
624
624
|
# self.menuimport3dfaces_from_DXF = self.toolsmenu.Append(wx.ID_ANY, _("Import triangulation..."), _("DXF"))
|
625
|
-
self.menuinteractptri = self.cs_menu.Append(wx.ID_ANY, _("Interpolate on active triangulation..."), _("InterpolateTri"))
|
626
|
-
self.menucomparecloud = self.cs_menu.Append(wx.ID_ANY, _("Compare cloud to array..."), _("Comparison"))
|
627
|
-
self.menucomparetri = self.cs_menu.Append(wx.ID_ANY, _("Compare triangles to array..."), _("Comparison"))
|
628
625
|
|
629
626
|
#Profile plots
|
630
627
|
#The action for plotting cross section's profile is initialised.
|
@@ -816,6 +813,8 @@ class WolfMapViewer(wx.Frame):
|
|
816
813
|
self.myfigprof = None
|
817
814
|
|
818
815
|
self.cloudmenu=None
|
816
|
+
self.trianglesmenu = None
|
817
|
+
|
819
818
|
self._configuration = None
|
820
819
|
|
821
820
|
self.compare_results = None
|
@@ -914,14 +913,37 @@ class WolfMapViewer(wx.Frame):
|
|
914
913
|
def do_quit(self):
|
915
914
|
pass
|
916
915
|
|
916
|
+
def create_triangles_menu(self):
|
917
|
+
""" Menu for triangulations """
|
918
|
+
|
919
|
+
if self.trianglesmenu is None:
|
920
|
+
|
921
|
+
self.trianglesmenu = wx.Menu()
|
922
|
+
self.menubar.Append(self.trianglesmenu, _('&Triangulations'))
|
923
|
+
|
924
|
+
self._menuinteractptri = self.trianglesmenu.Append(wx.ID_ANY, _("Interpolate on active triangulation..."), _("InterpolateTri"))
|
925
|
+
self._menucomparetri = self.trianglesmenu.Append(wx.ID_ANY, _("Compare triangles to array..."), _("Comparison"))
|
926
|
+
|
927
|
+
|
917
928
|
def create_cloud_menu(self):
|
929
|
+
""" Menu for cloud points """
|
918
930
|
|
919
931
|
if self.cloudmenu is None:
|
920
932
|
self.cloudmenu = wx.Menu()
|
921
933
|
self.menubar.Append(self.cloudmenu, _('Cloud'))
|
922
934
|
|
923
|
-
interpcloudonarray = self.cloudmenu.Append(wx.ID_ANY, _("Interpolate active cloud on active array..."),
|
924
|
-
|
935
|
+
interpcloudonarray = self.cloudmenu.Append(wx.ID_ANY, _("Interpolate active cloud on active array..."),_("Interpolation"))
|
936
|
+
self._menucomparecloud = self.cloudmenu.Append(wx.ID_ANY, _("Compare cloud to array..."), _("Comparison"))
|
937
|
+
split_cloud = self.cloudmenu.Append(wx.ID_ANY, _("Split cloud..."), _("Split cloud"))
|
938
|
+
|
939
|
+
def split_cloud_by_vector(self):
|
940
|
+
""" Split cloud by vector """
|
941
|
+
|
942
|
+
inside_cloud, outside_cloud = self.active_vector.split_cloud(self.active_cloud)
|
943
|
+
|
944
|
+
self.add_object('cloud', newobj = inside_cloud, id = inside_cloud.idx)
|
945
|
+
self.add_object('cloud', newobj = outside_cloud, id = outside_cloud.idx)
|
946
|
+
|
925
947
|
|
926
948
|
def get_choices_arrays(self):
|
927
949
|
"""Boîte de dialogue permettant de choisir une ou plusieurs matrices parmi celles chargées"""
|
@@ -2336,19 +2358,32 @@ class WolfMapViewer(wx.Frame):
|
|
2336
2358
|
# palette = self.active_res2d.mypal
|
2337
2359
|
|
2338
2360
|
if palette is not None:
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2361
|
+
if palette.values is not None:
|
2362
|
+
bufpal = io.BytesIO()
|
2363
|
+
palette.export_image(bufpal,'v')
|
2364
|
+
bufpal.seek(0)
|
2365
|
+
|
2366
|
+
#lecture du buffer et conversion en image avec PIL
|
2367
|
+
impal = Image.open(bufpal)
|
2368
|
+
impal = impal.resize((int(impal.size[0]*im.size[1]*.8/impal.size[1]),int(im.size[1]*.8)))
|
2342
2369
|
|
2343
|
-
|
2344
|
-
impal = Image.open(bufpal)
|
2345
|
-
impal = impal.resize((int(impal.size[0]*im.size[1]*.8/impal.size[1]),int(im.size[1]*.8)))
|
2370
|
+
imnew = Image.new('RGB',(im.size[0]+impal.size[0], im.size[1]), (255,255,255))
|
2346
2371
|
|
2347
|
-
|
2372
|
+
# On colle l'image du buffer et la palette pour ne former qu'une seul image à copier dans le clipboard
|
2373
|
+
imnew.paste(im.convert('RGB'),(0,0))
|
2374
|
+
imnew.paste(impal.convert('RGB'),(im.size[0]-10, int((im.size[1]-impal.size[1])/3)))
|
2375
|
+
im=imnew
|
2376
|
+
else:
|
2377
|
+
imnew = Image.new('RGB', (im.size[0], im.size[1]), (255,255,255))
|
2378
|
+
|
2379
|
+
# On colle l'image du buffer et la palette pour ne former qu'une seul image à copier dans le clipboard
|
2380
|
+
imnew.paste(im.convert('RGB'),(0,0))
|
2381
|
+
im=imnew
|
2382
|
+
else:
|
2383
|
+
imnew = Image.new('RGB', (im.size[0], im.size[1]), (255,255,255))
|
2348
2384
|
|
2349
2385
|
# On colle l'image du buffer et la palette pour ne former qu'une seul image à copier dans le clipboard
|
2350
2386
|
imnew.paste(im.convert('RGB'),(0,0))
|
2351
|
-
imnew.paste(impal.convert('RGB'),(im.size[0]-10, int((im.size[1]-impal.size[1])/3)))
|
2352
2387
|
im=imnew
|
2353
2388
|
|
2354
2389
|
#création d'un objet bitmap wx
|
@@ -2724,7 +2759,11 @@ class WolfMapViewer(wx.Frame):
|
|
2724
2759
|
ax.set_xlabel('X [m]')
|
2725
2760
|
ax.set_ylabel('Y [m]')
|
2726
2761
|
|
2727
|
-
self.palette_for_copy.
|
2762
|
+
if self.palette_for_copy.values is not None:
|
2763
|
+
self.palette_for_copy.export_image(None, h_or_v='v', figax=(fig,axes[1]))
|
2764
|
+
else:
|
2765
|
+
axes[1].clear()
|
2766
|
+
axes[1].axis('off')
|
2728
2767
|
|
2729
2768
|
# if self.active_array is not None:
|
2730
2769
|
# self.active_array.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
|
@@ -3847,7 +3886,8 @@ class WolfMapViewer(wx.Frame):
|
|
3847
3886
|
if curid != 'format' and curid != 'dirlaz':
|
3848
3887
|
mycs = crosssections(curname[key_Param.VALUE],
|
3849
3888
|
format=myproject.myparams['cross_sections']['format'][key_Param.VALUE],
|
3850
|
-
dirlaz=myproject.myparams['cross_sections']['dirlaz'][key_Param.VALUE]
|
3889
|
+
dirlaz=myproject.myparams['cross_sections']['dirlaz'][key_Param.VALUE],
|
3890
|
+
mapviewer = self)
|
3851
3891
|
|
3852
3892
|
self.add_object('cross_sections', newobj=mycs, id=curid)
|
3853
3893
|
|
@@ -3875,7 +3915,7 @@ class WolfMapViewer(wx.Frame):
|
|
3875
3915
|
if 'vector' in myproject.myparams.keys():
|
3876
3916
|
for curid, curname in zip(myproject.myparams['vector'].keys(), myproject.myparams['vector'].values()):
|
3877
3917
|
if exists(curname[key_Param.VALUE]):
|
3878
|
-
myvec = Zones(curname[key_Param.VALUE], parent=self)
|
3918
|
+
myvec = Zones(curname[key_Param.VALUE], parent=self, mapviewer = self)
|
3879
3919
|
self.add_object('vector', newobj=myvec, id=curid)
|
3880
3920
|
else:
|
3881
3921
|
logging.info(_('Bad parameter in project file - vector : ')+ curname[key_Param.VALUE])
|
@@ -3884,7 +3924,7 @@ class WolfMapViewer(wx.Frame):
|
|
3884
3924
|
for curid, curname in zip(myproject.myparams['array'].keys(), myproject.myparams['array'].values()):
|
3885
3925
|
|
3886
3926
|
if exists(curname[key_Param.VALUE]):
|
3887
|
-
curarray = WolfArray(curname[key_Param.VALUE])
|
3927
|
+
curarray = WolfArray(curname[key_Param.VALUE], mapviewer=self)
|
3888
3928
|
self.add_object('array', newobj=curarray, id=curid)
|
3889
3929
|
else:
|
3890
3930
|
logging.info(_('Bad parameter in project file - array : ')+ curname[key_Param.VALUE])
|
@@ -3892,7 +3932,7 @@ class WolfMapViewer(wx.Frame):
|
|
3892
3932
|
if 'cloud' in myproject.myparams.keys():
|
3893
3933
|
for curid, curname in zip(myproject.myparams['cloud'].keys(), myproject.myparams['cloud'].values()):
|
3894
3934
|
if exists(curname[key_Param.VALUE]):
|
3895
|
-
mycloud = cloud_vertices(curname[key_Param.VALUE])
|
3935
|
+
mycloud = cloud_vertices(curname[key_Param.VALUE], mapviewer=self)
|
3896
3936
|
self.add_object('cloud', newobj=mycloud, id=curid)
|
3897
3937
|
else:
|
3898
3938
|
logging.info(_('Bad parameter in project file - cloud : ')+ curname[key_Param.VALUE])
|
@@ -3900,7 +3940,7 @@ class WolfMapViewer(wx.Frame):
|
|
3900
3940
|
if 'wolf2d' in myproject.myparams.keys():
|
3901
3941
|
for curid, curname in zip(myproject.myparams['wolf2d'].keys(), myproject.myparams['wolf2d'].values()):
|
3902
3942
|
if exists(curname[key_Param.VALUE]):
|
3903
|
-
curwolf = Wolfresults_2D(curname[key_Param.VALUE])
|
3943
|
+
curwolf = Wolfresults_2D(curname[key_Param.VALUE], mapviewer=self)
|
3904
3944
|
self.add_object('res2d', newobj=curwolf, id=curid)
|
3905
3945
|
else:
|
3906
3946
|
logging.info(_('Bad parameter in project file - wolf2d : ')+ curname[key_Param.VALUE])
|
@@ -3912,10 +3952,10 @@ class WolfMapViewer(wx.Frame):
|
|
3912
3952
|
if exists(curname[key_Param.VALUE]):
|
3913
3953
|
|
3914
3954
|
if 'simul_gpu_results' in curname[key_Param.VALUE]:
|
3915
|
-
curwolf = wolfres2DGPU(Path(curname[key_Param.VALUE]))
|
3955
|
+
curwolf = wolfres2DGPU(Path(curname[key_Param.VALUE]), mapviewer=self)
|
3916
3956
|
else:
|
3917
3957
|
if exists(join(curname[key_Param.VALUE], 'simul_gpu_results')):
|
3918
|
-
curwolf = wolfres2DGPU(Path(join(curname[key_Param.VALUE], 'simul_gpu_results')))
|
3958
|
+
curwolf = wolfres2DGPU(Path(join(curname[key_Param.VALUE], 'simul_gpu_results')), mapviewer=self)
|
3919
3959
|
else:
|
3920
3960
|
logging.info(_('Bad directory : ')+ curname[key_Param.VALUE])
|
3921
3961
|
|
@@ -5146,6 +5186,19 @@ class WolfMapViewer(wx.Frame):
|
|
5146
5186
|
autoscale = False
|
5147
5187
|
self.compare_cloud2array()
|
5148
5188
|
|
5189
|
+
elif itemlabel==_("Split cloud..."):
|
5190
|
+
autoscale = False
|
5191
|
+
|
5192
|
+
if self.active_cloud is None:
|
5193
|
+
logging.warning(_('No active cloud !'))
|
5194
|
+
return
|
5195
|
+
|
5196
|
+
if self.active_vector is None:
|
5197
|
+
logging.warning(_('No active vector !'))
|
5198
|
+
return
|
5199
|
+
|
5200
|
+
self.split_cloud_by_vector()
|
5201
|
+
|
5149
5202
|
elif itemlabel==_("Compare triangles to array..."):
|
5150
5203
|
autoscale = False
|
5151
5204
|
self.compare_tri2array()
|
@@ -6753,6 +6806,8 @@ class WolfMapViewer(wx.Frame):
|
|
6753
6806
|
self.myclouds.append(newobj)
|
6754
6807
|
self.active_cloud = newobj
|
6755
6808
|
|
6809
|
+
newobj.set_mapviewer(self)
|
6810
|
+
|
6756
6811
|
self.create_cloud_menu()
|
6757
6812
|
|
6758
6813
|
elif which.lower() == 'triangulation':
|
@@ -6768,6 +6823,8 @@ class WolfMapViewer(wx.Frame):
|
|
6768
6823
|
self.mytri.append(newobj)
|
6769
6824
|
self.active_tri = newobj
|
6770
6825
|
|
6826
|
+
self.create_triangles_menu()
|
6827
|
+
|
6771
6828
|
elif which.lower() == 'other':
|
6772
6829
|
|
6773
6830
|
if not newobj is None:
|
@@ -7376,6 +7433,8 @@ class WolfMapViewer(wx.Frame):
|
|
7376
7433
|
myobj = self.selected_object
|
7377
7434
|
if type(myobj) in [WolfArray, WolfArrayMB, WolfArrayMNAP, Zones, Wolfresults_2D, wolfres2DGPU, Particle_system, Picc_data, Cadaster_data, hydrometry_wolfgui]:
|
7378
7435
|
myobj.show_properties()
|
7436
|
+
elif isinstance(myobj, cloud_vertices):
|
7437
|
+
myobj.show_properties()
|
7379
7438
|
|
7380
7439
|
elif text == _('Boundary conditions'):
|
7381
7440
|
bc = self.get_boundary_manager(self.selected_object)
|
@@ -9828,10 +9887,10 @@ class WolfMapViewer(wx.Frame):
|
|
9828
9887
|
for loctri in self.mytri:
|
9829
9888
|
if loctri.plotted or force:
|
9830
9889
|
loctri.find_minmax(force)
|
9831
|
-
xmin = min(loctri.
|
9832
|
-
xmax = max(loctri.
|
9833
|
-
ymin = min(loctri.
|
9834
|
-
ymax = max(loctri.
|
9890
|
+
xmin = min(loctri.xmin, xmin)
|
9891
|
+
xmax = max(loctri.xmax, xmax)
|
9892
|
+
ymin = min(loctri.ymin, ymin)
|
9893
|
+
ymax = max(loctri.ymax, ymax)
|
9835
9894
|
k += 1
|
9836
9895
|
|
9837
9896
|
for locres2d in self.myres2D:
|
wolfhece/PyPalette.py
CHANGED
@@ -203,6 +203,10 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
|
|
203
203
|
:param : fn : filepath or io.BytesIO()
|
204
204
|
:param : h_or_v : configuration to save 'h' = horizontal, 'v' = vertical, '' = both
|
205
205
|
"""
|
206
|
+
if self.values is None:
|
207
|
+
logging.warning('No values in palette - Nothing to do !')
|
208
|
+
return None, None
|
209
|
+
|
206
210
|
if fn == '':
|
207
211
|
file = wx.FileDialog(None, "Choose .pal file", wildcard="png (*.png)|*.png|all (*.*)|*.*", style=wx.FD_SAVE)
|
208
212
|
if file.ShowModal() == wx.ID_CANCEL:
|
wolfhece/PyParams.py
CHANGED
@@ -18,6 +18,7 @@ from typing import Union, Literal
|
|
18
18
|
from enum import Enum
|
19
19
|
from copy import deepcopy
|
20
20
|
import numpy as np
|
21
|
+
from pathlib import Path
|
21
22
|
|
22
23
|
try:
|
23
24
|
from .PyTranslate import _
|
@@ -39,19 +40,17 @@ class Type_Param(Enum):
|
|
39
40
|
Strings are also used by Fortran Code -- modify with care
|
40
41
|
"""
|
41
42
|
Integer_or_Float = 'Integer_or_Float'
|
42
|
-
Integer = '
|
43
|
+
Integer = 'Integer'
|
43
44
|
Logical = 'Logical'
|
44
45
|
Float = 'Float'
|
45
46
|
File = 'File'
|
46
|
-
file = 'file'
|
47
47
|
Directory = 'Directory'
|
48
|
-
directory = 'directory'
|
49
48
|
Color = 'Color'
|
50
49
|
Fontname = 'Fontname'
|
51
50
|
String = 'String'
|
52
51
|
Empty = ''
|
53
|
-
Double = '
|
54
|
-
Real = '
|
52
|
+
Double = 'Double'
|
53
|
+
Real = 'Real'
|
55
54
|
|
56
55
|
|
57
56
|
class key_Param(Enum):
|
@@ -99,17 +98,17 @@ def new_infos_incr(groupname:str= None, paramname:str='nb', min:int=1, max:int=1
|
|
99
98
|
def search_type(chain:str) -> Type_Param:
|
100
99
|
""" recherche du typage dans une chaîne de caractères """
|
101
100
|
|
102
|
-
if chain.lower().find(Type_Param.Integer.value)>-1 and chain.find(Type_Param.Double.value)>-1:
|
101
|
+
if chain.lower().find(Type_Param.Integer.value.lower())>-1 and chain.find(Type_Param.Double.value.lower())>-1:
|
103
102
|
return Type_Param.Integer_or_Float
|
104
|
-
elif chain.lower().find(Type_Param.Integer.value)>-1:
|
103
|
+
elif chain.lower().find(Type_Param.Integer.value.lower())>-1:
|
105
104
|
return Type_Param.Integer
|
106
|
-
elif chain.find(Type_Param.Logical.value)>-1:
|
105
|
+
elif chain.lower().find(Type_Param.Logical.value.lower())>-1:
|
107
106
|
return Type_Param.Logical
|
108
|
-
elif chain.find(Type_Param.Double.value)>-1 or chain.find('dble')>-1 or chain.find(Type_Param.Real.value)>-1:
|
107
|
+
elif chain.lower().find(Type_Param.Double.value.lower())>-1 or chain.find('dble')>-1 or chain.find(Type_Param.Real.value.lower())>-1:
|
109
108
|
return Type_Param.Float
|
110
|
-
elif chain.find('({})'.format(Type_Param.
|
109
|
+
elif chain.lower().find('({})'.format(Type_Param.File.value.lower()))>-1:
|
111
110
|
return Type_Param.File
|
112
|
-
elif chain.find('({})'.format(Type_Param.
|
111
|
+
elif chain.lower().find('({})'.format(Type_Param.Directory.value.lower()))>-1 or chain.find('(dir)')>-1:
|
113
112
|
return Type_Param.Directory
|
114
113
|
else:
|
115
114
|
return Type_Param.String
|
@@ -1511,13 +1510,13 @@ class Wolf_Param(wx.Frame):
|
|
1511
1510
|
# recherche du type dans le commentaire
|
1512
1511
|
curparam[key_Param.TYPE]=search_type(paramloc[2])
|
1513
1512
|
if curparam[key_Param.TYPE] == Type_Param.String:
|
1514
|
-
# recherche du type dans la
|
1513
|
+
# recherche du type dans la chaîne complète
|
1515
1514
|
type_in_fulchain = search_type(param)
|
1516
1515
|
|
1517
1516
|
if type_in_fulchain != Type_Param.String:
|
1518
1517
|
curparam[key_Param.TYPE] = type_in_fulchain
|
1519
1518
|
try:
|
1520
|
-
#
|
1519
|
+
# tentative de recherche du type dans les valeurs par défaut
|
1521
1520
|
param_def=self.myparams_default[groupname][paramloc[0]]
|
1522
1521
|
curparam[key_Param.TYPE]=param_def[key_Param.TYPE]
|
1523
1522
|
except:
|
@@ -1903,14 +1902,21 @@ class Wolf_Param(wx.Frame):
|
|
1903
1902
|
|
1904
1903
|
if isinstance(value, float):
|
1905
1904
|
return Type_Param.Float
|
1906
|
-
|
1907
|
-
return Type_Param.Integer
|
1905
|
+
# ATTEENTION : les booléens sont des entiers --> il faut les traiter avant
|
1908
1906
|
elif isinstance(value, bool):
|
1909
1907
|
return Type_Param.Logical
|
1908
|
+
elif isinstance(value, int):
|
1909
|
+
return Type_Param.Integer
|
1910
1910
|
elif isinstance(value, tuple):
|
1911
1911
|
return Type_Param.Color
|
1912
1912
|
else:
|
1913
|
-
|
1913
|
+
tmp_path = Path(value)
|
1914
|
+
if tmp_path.is_file():
|
1915
|
+
return Type_Param.File
|
1916
|
+
elif tmp_path.is_dir():
|
1917
|
+
return Type_Param.Directory
|
1918
|
+
else:
|
1919
|
+
return Type_Param.String
|
1914
1920
|
|
1915
1921
|
def change_param(self, group:str, name:str, value:Union[float, int, str, bool]):
|
1916
1922
|
""" Modify the value of the parameter if found, otherwise None obj """
|
wolfhece/PyVertex.py
CHANGED
@@ -843,6 +843,20 @@ class cloud_vertices(Element_To_Draw):
|
|
843
843
|
self._updatebounds(newcloud=cloud)
|
844
844
|
pass
|
845
845
|
|
846
|
+
def add_vertices(self, vertices:list[wolfvertex]):
|
847
|
+
""" Add a list of vertices to the cloud """
|
848
|
+
|
849
|
+
first_id = len(self.myvertices)
|
850
|
+
for curid, curvert in enumerate(vertices):
|
851
|
+
self.myvertices[first_id + curid] = {}
|
852
|
+
self.myvertices[first_id + curid]['vertex'] = curvert
|
853
|
+
self._updatebounds(curvert)
|
854
|
+
|
855
|
+
def get_vertices(self):
|
856
|
+
""" Return the vertices as a list """
|
857
|
+
|
858
|
+
return [self.myvertices[item]['vertex'] for item in self.myvertices]
|
859
|
+
|
846
860
|
# def _create_textures(self):
|
847
861
|
# """ Create textures for the cloud """
|
848
862
|
|
@@ -879,11 +893,29 @@ class cloud_vertices(Element_To_Draw):
|
|
879
893
|
|
880
894
|
mapviewer = self.get_mapviewer()
|
881
895
|
|
896
|
+
which_legend = self.myprop.legendtext
|
897
|
+
|
882
898
|
for id, item in enumerate(self.myvertices):
|
899
|
+
|
883
900
|
curvert = self.myvertices[item]['vertex']
|
884
901
|
|
885
902
|
if curvert.x > xmin and curvert.x < xmax and curvert.y > ymin and curvert.y < ymax:
|
886
903
|
|
904
|
+
if which_legend == '':
|
905
|
+
text_legend = str(item)
|
906
|
+
elif which_legend == 'ID':
|
907
|
+
text_legend = str(id)
|
908
|
+
elif which_legend == 'X':
|
909
|
+
text_legend = str(curvert.x)
|
910
|
+
elif which_legend == 'Y':
|
911
|
+
text_legend = str(curvert.y)
|
912
|
+
elif which_legend == 'Z':
|
913
|
+
text_legend = str(curvert.z)
|
914
|
+
elif which_legend in self.myvertices[item]:
|
915
|
+
text_legend = self.myvertices[item][which_legend]
|
916
|
+
else:
|
917
|
+
text_legend = which_legend
|
918
|
+
|
887
919
|
r,g,b = getRGBfromI(self.myprop.legendcolor)
|
888
920
|
|
889
921
|
curtxt_infos = Text_Infos(self.myprop.legendpriority,
|
@@ -896,7 +928,7 @@ class cloud_vertices(Element_To_Draw):
|
|
896
928
|
relative_position=self.myprop.legendrelpos
|
897
929
|
)
|
898
930
|
|
899
|
-
text = Text_Image_Texture(
|
931
|
+
text = Text_Image_Texture(text_legend, mapviewer, curtxt_infos, None, curvert.x, curvert.y)
|
900
932
|
|
901
933
|
text.paint()
|
902
934
|
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -18,7 +18,7 @@ from wx.core import BoxSizer, FlexGridSizer, TreeItemId
|
|
18
18
|
from OpenGL.GL import *
|
19
19
|
from shapely.geometry import LineString, MultiLineString,Point,MultiPoint,Polygon,JOIN_STYLE, MultiPolygon
|
20
20
|
from shapely.ops import nearest_points,substring, split, polygonize
|
21
|
-
from shapely import delaunay_triangles
|
21
|
+
from shapely import delaunay_triangles, prepare, is_prepared, destroy_prepared
|
22
22
|
import pygltflib
|
23
23
|
from scipy.interpolate import interp1d
|
24
24
|
import matplotlib.pyplot as plt
|
@@ -39,7 +39,7 @@ from .wolf_texture import genericImagetexture
|
|
39
39
|
from .textpillow import Font_Priority
|
40
40
|
from .PyTranslate import _
|
41
41
|
from .CpGrid import CpGrid
|
42
|
-
from .PyVertex import wolfvertex,getIfromRGB,getRGBfromI
|
42
|
+
from .PyVertex import wolfvertex,getIfromRGB,getRGBfromI, cloud_vertices
|
43
43
|
from .PyParams import Wolf_Param, key_Param, Type_Param, new_json, new_infos_incr
|
44
44
|
from .lazviewer.laz_viewer import myviewer
|
45
45
|
from .wolf_texture import Text_Image_Texture,Text_Infos
|
@@ -1010,6 +1010,7 @@ class vector:
|
|
1010
1010
|
self.myprop=vectorproperties(parent=self)
|
1011
1011
|
|
1012
1012
|
self.linestring = None
|
1013
|
+
self.polygon = None
|
1013
1014
|
|
1014
1015
|
# Utile surtout pour les sections en travers
|
1015
1016
|
self.zdatum = 0.
|
@@ -1276,13 +1277,26 @@ class vector:
|
|
1276
1277
|
xyz[:,2]+=self.zdatum
|
1277
1278
|
return xyz
|
1278
1279
|
|
1279
|
-
def prepare_shapely(self):
|
1280
|
+
def prepare_shapely(self, prepare_shapely:bool = True):
|
1280
1281
|
"""
|
1281
1282
|
Conversion Linestring Shapely et rétention de l'objet afin d'éviter de multiples appel
|
1282
|
-
par ex. dans une boucle
|
1283
|
+
par ex. dans une boucle.
|
1284
|
+
|
1285
|
+
:param prepare_shapely: Préparation de l'objet Shapely pour une utilisation optimisée
|
1286
|
+
- True par défaut
|
1287
|
+
- see https://shapely.readthedocs.io/en/stable/reference/shapely.prepare.html
|
1288
|
+
|
1283
1289
|
"""
|
1284
1290
|
|
1291
|
+
self.reset_linestring()
|
1292
|
+
|
1285
1293
|
self.linestring = self.asshapely_ls()
|
1294
|
+
self.polygon = self.asshapely_pol()
|
1295
|
+
|
1296
|
+
if prepare_shapely:
|
1297
|
+
prepare(self.linestring)
|
1298
|
+
prepare(self.polygon)
|
1299
|
+
|
1286
1300
|
|
1287
1301
|
def projectontrace(self, trace):
|
1288
1302
|
"""
|
@@ -1343,7 +1357,7 @@ class vector:
|
|
1343
1357
|
else:
|
1344
1358
|
return None
|
1345
1359
|
|
1346
|
-
def intersection(self, vec2 = None, eval_dist=False,norm=False, force_single=False):
|
1360
|
+
def intersection(self, vec2:"vector" = None, eval_dist=False,norm=False, force_single=False):
|
1347
1361
|
"""
|
1348
1362
|
Calcul de l'intersection avec un autre vecteur
|
1349
1363
|
|
@@ -1380,7 +1394,20 @@ class vector:
|
|
1380
1394
|
def reset(self):
|
1381
1395
|
"""Remise à zéro"""
|
1382
1396
|
self.myvertices=[]
|
1383
|
-
self.
|
1397
|
+
self.reset_linestring()
|
1398
|
+
|
1399
|
+
def reset_linestring(self):
|
1400
|
+
"""Remise à zéro de l'objet Shapely"""
|
1401
|
+
|
1402
|
+
if self.linestring is not None:
|
1403
|
+
if is_prepared(self.linestring):
|
1404
|
+
destroy_prepared(self.linestring)
|
1405
|
+
self.linestring=None
|
1406
|
+
|
1407
|
+
if self.polygon is not None:
|
1408
|
+
if is_prepared(self.polygon):
|
1409
|
+
destroy_prepared(self.polygon)
|
1410
|
+
self.polygon=None
|
1384
1411
|
|
1385
1412
|
def add_vertex(self,addedvert: Union[list[wolfvertex], wolfvertex]):
|
1386
1413
|
"""
|
@@ -1817,7 +1844,7 @@ class vector:
|
|
1817
1844
|
while k<self.nbvertices:
|
1818
1845
|
self.myvertices.pop(k)
|
1819
1846
|
|
1820
|
-
if self.linestring is not None:
|
1847
|
+
if self.linestring is not None or self.polygon is not None:
|
1821
1848
|
self.prepare_shapely()
|
1822
1849
|
|
1823
1850
|
self._reset_listogl()
|
@@ -2391,11 +2418,11 @@ class vector:
|
|
2391
2418
|
return np.asarray([[curvert.x, curvert.y, curvert.in_use] for curvert in self.myvertices])
|
2392
2419
|
|
2393
2420
|
@property
|
2394
|
-
def
|
2421
|
+
def sz_curvi(self):
|
2395
2422
|
return self.get_sz()
|
2396
2423
|
|
2397
2424
|
@property
|
2398
|
-
def
|
2425
|
+
def s_curvi(self):
|
2399
2426
|
sz = self.get_sz()
|
2400
2427
|
return sz[0]
|
2401
2428
|
|
@@ -2649,6 +2676,40 @@ class vector:
|
|
2649
2676
|
self.parentzone.reset_listogl()
|
2650
2677
|
|
2651
2678
|
|
2679
|
+
def select_points_inside(self, xy:cloud_vertices | np.ndarray):
|
2680
|
+
""" Select the points inside a polygon
|
2681
|
+
|
2682
|
+
:param xy: cloud_vertices or np.ndarray with x,y coordinates
|
2683
|
+
:return: list of boolean
|
2684
|
+
"""
|
2685
|
+
|
2686
|
+
self.prepare_shapely()
|
2687
|
+
|
2688
|
+
if isinstance(xy, cloud_vertices):
|
2689
|
+
xy = xy.get_xyz()[:,0:2]
|
2690
|
+
|
2691
|
+
inside = [self.polygon.contains(Point(curxy)) for curxy in xy]
|
2692
|
+
|
2693
|
+
return inside
|
2694
|
+
|
2695
|
+
def split_cloud(self, cloud_to_split:cloud_vertices):
|
2696
|
+
""" Split a cloud of vertices on the vector """
|
2697
|
+
|
2698
|
+
inside = self.select_points_inside(cloud_to_split)
|
2699
|
+
|
2700
|
+
cloud_inside = cloud_vertices(idx = 'inside_'+cloud_to_split.idx)
|
2701
|
+
cloud_outside = cloud_vertices(idx = 'outside_'+cloud_to_split.idx)
|
2702
|
+
|
2703
|
+
vertices = cloud_to_split.get_vertices()
|
2704
|
+
|
2705
|
+
for idx, (locinside, curvert) in enumerate(zip(inside, vertices)):
|
2706
|
+
if locinside:
|
2707
|
+
cloud_inside.add_vertex(curvert)
|
2708
|
+
else:
|
2709
|
+
cloud_outside.add_vertex(curvert)
|
2710
|
+
|
2711
|
+
return cloud_inside, cloud_outside
|
2712
|
+
|
2652
2713
|
class zone:
|
2653
2714
|
"""
|
2654
2715
|
Objet de gestion d'informations vectorielles
|
wolfhece/apps/version.py
CHANGED
wolfhece/gpuview.py
CHANGED
@@ -277,7 +277,15 @@ class VectorField(Element_To_Draw):
|
|
277
277
|
|
278
278
|
super().__init__(idx, plotted, mapviewer, need_for_wx)
|
279
279
|
|
280
|
-
self.mapviewer
|
280
|
+
if self.mapviewer is None:
|
281
|
+
logging.error("No mapviewer defined for VectorField")
|
282
|
+
return
|
283
|
+
|
284
|
+
try:
|
285
|
+
self.mapviewer.SetCurrentContext()
|
286
|
+
except:
|
287
|
+
logging.error("Error during OpenGL context setup -- VectorField")
|
288
|
+
return
|
281
289
|
|
282
290
|
self._gpu_program_ref = 1
|
283
291
|
while self._gpu_program_ref in _global_gpu_state:
|
@@ -7,16 +7,16 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
|
|
7
7
|
wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
|
8
8
|
wolfhece/PyConfig.py,sha256=UNtl5UzZ399JqjJT67-4DWaIkv76sc1FiEsSDJpXlL0,10458
|
9
9
|
wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
|
10
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
+
wolfhece/PyDraw.py,sha256=CvnaK7NgeB25hlzlF-BxU38LT7-3ffuPnana6Mm9PDE,427447
|
11
11
|
wolfhece/PyGui.py,sha256=HY0beOMSp1JEyq8-vfVynzVrmKxvaO_sJSMwlNqCNrg,105289
|
12
12
|
wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
|
13
13
|
wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
|
14
|
-
wolfhece/PyPalette.py,sha256=
|
15
|
-
wolfhece/PyParams.py,sha256=
|
14
|
+
wolfhece/PyPalette.py,sha256=QCzXBnYlv7YfHjpJWyO_8F-uOLOe7O_RbkyrnMYzgM4,28146
|
15
|
+
wolfhece/PyParams.py,sha256=6fREK5cUCGw84SDyPvuSzidnX-9BXOX3fve5XBG1K_I,98114
|
16
16
|
wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
|
17
17
|
wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
|
18
|
-
wolfhece/PyVertex.py,sha256=
|
19
|
-
wolfhece/PyVertexvectors.py,sha256=
|
18
|
+
wolfhece/PyVertex.py,sha256=aj1Xp6n0pMb_q6AMADHnQ9pgjjRU4EQm0m4Tmc1uoEM,41912
|
19
|
+
wolfhece/PyVertexvectors.py,sha256=BLIs97SN45nFQn2T1brzN9c4FIzNNzB0WaM1kUd-E1g,251815
|
20
20
|
wolfhece/PyWMS.py,sha256=fyyzm2HFwq8aRwVYHKiBatcZOeKnFi6DWhv4nfscySQ,4602
|
21
21
|
wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
|
22
22
|
wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
|
@@ -30,7 +30,7 @@ wolfhece/color_constants.py,sha256=Snc5RX11Ydi756EkBp_83C7DiAQ_Z1aHD9jFIBsosAU,3
|
|
30
30
|
wolfhece/drawing_obj.py,sha256=7vY04B6r08nurTTFmBXHyR5tVIF1YzAEw_uz4pqTDIw,4233
|
31
31
|
wolfhece/flow_SPWMI.py,sha256=XDAelwAY-3rYOR0WKW3fgYJ_r8DU4IP6Y5xULW421tk,20956
|
32
32
|
wolfhece/friction_law.py,sha256=MtZJLo-pTj3-Fw-w12z1LSgSIDrH-JGR0iD9wer_fpQ,5498
|
33
|
-
wolfhece/gpuview.py,sha256=
|
33
|
+
wolfhece/gpuview.py,sha256=Rrq8R4Bjp_CCJbJ08gmolpYjXKIzV5qmnJJTiQLhFTY,24463
|
34
34
|
wolfhece/import_ascfiles.py,sha256=6Zl8qBR9c6VtyziookQ8YE9KC0GtW_J9WFt5ubyGp-s,4465
|
35
35
|
wolfhece/ins.py,sha256=uUeLMS1n3GPnfJhxl0Z2l-UXpmPUgthuwct282OOEzk,36184
|
36
36
|
wolfhece/irm_qdf.py,sha256=KyrIk0Gu50Q702EWxRpwKTWI2KGjtHA1l8CL-Y469O0,26394
|
@@ -75,7 +75,7 @@ wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefg
|
|
75
75
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
76
76
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
77
77
|
wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
|
78
|
-
wolfhece/apps/version.py,sha256=
|
78
|
+
wolfhece/apps/version.py,sha256=0ewKEdaYlj_bYhGOPsIk1mktB1LQK_EnKtWL-Vk3Dl8,388
|
79
79
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
80
80
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
81
81
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -285,8 +285,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
285
285
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
286
286
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
287
287
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
288
|
-
wolfhece-2.1.
|
289
|
-
wolfhece-2.1.
|
290
|
-
wolfhece-2.1.
|
291
|
-
wolfhece-2.1.
|
292
|
-
wolfhece-2.1.
|
288
|
+
wolfhece-2.1.90.dist-info/METADATA,sha256=Nf-U-idNQhjOSifNKkIGDY8shuwNX8TV1B3AyAZcXlA,2570
|
289
|
+
wolfhece-2.1.90.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
290
|
+
wolfhece-2.1.90.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
291
|
+
wolfhece-2.1.90.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
292
|
+
wolfhece-2.1.90.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|