wolfhece 2.0.13__py3-none-any.whl → 2.0.15__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 +46 -11
- wolfhece/PyPalette.py +6 -0
- wolfhece/Results2DGPU.py +5 -1
- wolfhece/opengl/__init__.py +0 -0
- wolfhece/opengl/gl_utils.py +1544 -0
- wolfhece/opengl/py3d.py +1665 -0
- wolfhece/opengl/tile_packer.py +352 -0
- wolfhece/scenario/imposebc_void.py +6 -3
- wolfhece/scenario/update_void.py +6 -3
- wolfhece/shaders/fragment_shader_texture.glsl +12 -0
- wolfhece/shaders/geom_grid.glsl +32 -0
- wolfhece/shaders/quad_frag_shader.glsl +34 -0
- wolfhece/shaders/quad_geom_shader.glsl +234 -9
- wolfhece/shaders/quadpos_frag_shader.glsl +12 -0
- wolfhece/shaders/quadpos_geom_shader.glsl +76 -0
- wolfhece/shaders/simple_fragment_shader.glsl +4 -1
- wolfhece/shaders/simple_vertex_shader_mvp.glsl +13 -0
- wolfhece/shaders/vertex_shader_texture.glsl +15 -0
- wolfhece/wolf_array.py +52 -8
- wolfhece/wolfresults_2D.py +14 -12
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/METADATA +2 -1
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/RECORD +25 -14
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/WHEEL +0 -0
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.0.13.dist-info → wolfhece-2.0.15.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -74,6 +74,7 @@ from .pybridges import Bridges, Bridge, Weirs, Weir
|
|
74
74
|
from .tools_mpl import *
|
75
75
|
from .wolf_tiles import Tiles
|
76
76
|
from .lagrangian.particle_system_ui import Particle_system_to_draw as Particle_system
|
77
|
+
from .opengl.py3d import Wolf_Viewer3D
|
77
78
|
|
78
79
|
ID_SELECTCS = 1000
|
79
80
|
ID_SORTALONG = 1001
|
@@ -120,6 +121,7 @@ class WolfMapViewer(wx.Frame):
|
|
120
121
|
myres2D: list
|
121
122
|
mytiles: list[Tiles]
|
122
123
|
mypartsystems: list[Particle_system]
|
124
|
+
myviewers3d:list[Wolf_Viewer3D]
|
123
125
|
|
124
126
|
canvas: GLCanvas # canvas OpenGL
|
125
127
|
context: GLContext # context OpenGL
|
@@ -142,6 +144,7 @@ class WolfMapViewer(wx.Frame):
|
|
142
144
|
active_tri: Triangulation
|
143
145
|
active_tile: Tiles
|
144
146
|
active_particle_system: Particle_system
|
147
|
+
active_viewer3d: Wolf_Viewer3D
|
145
148
|
|
146
149
|
def __init__(self, wxparent, title, w=500, h=500, treewidth=200, wolfparent=None, wxlogging=None):
|
147
150
|
|
@@ -235,6 +238,7 @@ class WolfMapViewer(wx.Frame):
|
|
235
238
|
self.filemenu.AppendSeparator()
|
236
239
|
compareitem = self.filemenu.Append(wx.ID_ANY, _('Set comparison'), _('Set comparison'))
|
237
240
|
multiview = self.filemenu.Append(wx.ID_ANY, _('Multiviewer'), _('Multiviewer'))
|
241
|
+
viewer3d = self.filemenu.Append(wx.ID_ANY, _('3D viewer'), _('3D viewer'))
|
238
242
|
self.filemenu.AppendSeparator()
|
239
243
|
|
240
244
|
|
@@ -372,6 +376,7 @@ class WolfMapViewer(wx.Frame):
|
|
372
376
|
self.active_profile = None
|
373
377
|
self.active_res2d = None
|
374
378
|
self.active_particle_system = None
|
379
|
+
self.active_viewer3d = None
|
375
380
|
self.selected_treeitem = None
|
376
381
|
|
377
382
|
curtool = self.tools[ID_SORTALONG] = {}
|
@@ -1246,7 +1251,7 @@ class WolfMapViewer(wx.Frame):
|
|
1246
1251
|
else:
|
1247
1252
|
logging.warning( "Can't open the clipboard", "Error")
|
1248
1253
|
|
1249
|
-
def get_mpl_plot(self, center = [0., 0.], width = 500., height = 500., title='', toshow=True) ->
|
1254
|
+
def get_mpl_plot(self, center = [0., 0.], width = 500., height = 500., title='', toshow=True) -> tuple[Figure, Axes]:
|
1250
1255
|
"""
|
1251
1256
|
Récupère un graphique matplotlib sur base de la fenêtre OpenGL et de la palette de la matrice active
|
1252
1257
|
"""
|
@@ -1569,9 +1574,10 @@ class WolfMapViewer(wx.Frame):
|
|
1569
1574
|
self.mywmsback = []
|
1570
1575
|
self.mywmsfore = []
|
1571
1576
|
self.myres2D = []
|
1577
|
+
self.myviewers3d = []
|
1572
1578
|
|
1573
1579
|
# liste des éléments modifiable dans l'arbre
|
1574
|
-
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.mypartsystems]
|
1580
|
+
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.mypartsystems, self.myviewers3d]
|
1575
1581
|
|
1576
1582
|
if self.get_configuration() is not None:
|
1577
1583
|
self.menu_options = wx.Menu()
|
@@ -1787,15 +1793,15 @@ class WolfMapViewer(wx.Frame):
|
|
1787
1793
|
third.add_WMS()
|
1788
1794
|
|
1789
1795
|
# Création d'une liste contenant les 3 instances d'objet "WolfMapViewer"
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1796
|
+
mylist:list[WolfMapViewer] = []
|
1797
|
+
mylist.append(first)
|
1798
|
+
mylist.append(second)
|
1799
|
+
mylist.append(third)
|
1794
1800
|
|
1795
1801
|
# On indique que les objets sont liés en activant le Booléen et en pointant la liste précédente
|
1796
|
-
for curlist in
|
1802
|
+
for curlist in mylist:
|
1797
1803
|
curlist.linked = True
|
1798
|
-
curlist.linkedList =
|
1804
|
+
curlist.linkedList = mylist
|
1799
1805
|
|
1800
1806
|
if ListArrays is not None:
|
1801
1807
|
if len(ListArrays) == 2:
|
@@ -3437,6 +3443,26 @@ class WolfMapViewer(wx.Frame):
|
|
3437
3443
|
for i in range(nb):
|
3438
3444
|
self.add_viewer_and_link()
|
3439
3445
|
|
3446
|
+
elif itemlabel == _('3D viewer'):
|
3447
|
+
|
3448
|
+
self.active_viewer3d = Wolf_Viewer3D(self, _("3D Viewer"))
|
3449
|
+
self.active_viewer3d.Show()
|
3450
|
+
self.myviewers3d.append(self.active_viewer3d)
|
3451
|
+
|
3452
|
+
for curarray in self.iterator_over_objects(draw_type.ARRAYS):
|
3453
|
+
curarray:WolfArray
|
3454
|
+
if curarray.checked:
|
3455
|
+
if curarray._array3d is None:
|
3456
|
+
curarray.prepare_3D()
|
3457
|
+
|
3458
|
+
if self.active_viewer3d not in curarray.viewers3d:
|
3459
|
+
curarray.viewers3d.append(self.active_viewer3d)
|
3460
|
+
|
3461
|
+
self.active_viewer3d.add_array(curarray.idx, curarray._array3d)
|
3462
|
+
self.active_viewer3d.autoscale()
|
3463
|
+
|
3464
|
+
pass
|
3465
|
+
|
3440
3466
|
elif itemlabel == _('Set comparison'):
|
3441
3467
|
|
3442
3468
|
dlg = wx.SingleChoiceDialog(None,_('Do you want to compare arrays or modelling results?'), _('Array or 2D Model'), [_('Arrays'), _('Modelling')])
|
@@ -4010,7 +4036,7 @@ class WolfMapViewer(wx.Frame):
|
|
4010
4036
|
curarray:WolfArray
|
4011
4037
|
for curarray in self.myarrays:
|
4012
4038
|
if curarray.plotted:
|
4013
|
-
curarray.filter_inundation(bound)
|
4039
|
+
curarray.filter_inundation(epsilon = bound)
|
4014
4040
|
del wait
|
4015
4041
|
|
4016
4042
|
def export_results_as(self,which='geotiff'):
|
@@ -4960,7 +4986,7 @@ class WolfMapViewer(wx.Frame):
|
|
4960
4986
|
|
4961
4987
|
return [obj[i] for i in idx]
|
4962
4988
|
|
4963
|
-
def iterator_over_objects(self, drawing_type:draw_type, checked_state:bool=True)
|
4989
|
+
def iterator_over_objects(self, drawing_type:draw_type, checked_state:bool=True):
|
4964
4990
|
""" Create iterator over objects of type draw_type """
|
4965
4991
|
|
4966
4992
|
for obj in self.get_list_objects(drawing_type, checked_state):
|
@@ -5657,15 +5683,24 @@ class WolfMapViewer(wx.Frame):
|
|
5657
5683
|
def OnRDClick(self, e):
|
5658
5684
|
self._endactions()
|
5659
5685
|
|
5660
|
-
def OnLDClick(self, e):
|
5686
|
+
def OnLDClick(self, e:wx.MouseEvent):
|
5661
5687
|
pos = e.GetPosition()
|
5688
|
+
|
5689
|
+
ctrldown = e.ControlDown()
|
5690
|
+
|
5662
5691
|
x, y = self.getXY(pos)
|
5692
|
+
|
5663
5693
|
self.mousex = self.mousedown[0]
|
5664
5694
|
self.mousey = self.mousedown[1]
|
5665
5695
|
self.mousedown = (0., 0.)
|
5666
5696
|
self.oneclick = False
|
5667
5697
|
self.setbounds()
|
5668
5698
|
|
5699
|
+
if ctrldown:
|
5700
|
+
if self.active_viewer3d is not None:
|
5701
|
+
self.active_viewer3d.force_view(self.mousex, self.mousey, self.active_array.get_value(self.mousex, self.mousey))
|
5702
|
+
self.Refresh()
|
5703
|
+
|
5669
5704
|
def OnLDown(self, e):
|
5670
5705
|
if not self.move:
|
5671
5706
|
pos = e.GetPosition()
|
wolfhece/PyPalette.py
CHANGED
@@ -45,6 +45,12 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
|
|
45
45
|
LinearSegmentedColormap.__init__(self,'wolf',{},nseg)
|
46
46
|
self.set_bounds()
|
47
47
|
|
48
|
+
def get_colors_f32(self):
|
49
|
+
|
50
|
+
colors = self.colorsflt[:,:3].astype(np.float32)
|
51
|
+
|
52
|
+
return colors
|
53
|
+
|
48
54
|
def set_bounds(self):
|
49
55
|
self.set_under(tuple(self.colormin))
|
50
56
|
self.set_over(tuple(self.colormax))
|
wolfhece/Results2DGPU.py
CHANGED
@@ -254,7 +254,7 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
254
254
|
curblock.rough_n = WolfArray(path.join(sim_path, 'simul.frot'))
|
255
255
|
|
256
256
|
elif path.exists(path.join(sim_path, 'bathymetry.npy')):
|
257
|
-
curblock.top = WolfArray(path.join(sim_path, 'bathymetry.npy')
|
257
|
+
curblock.top = WolfArray(path.join(sim_path, 'bathymetry.npy'))
|
258
258
|
curblock.waterdepth = WolfArray(path.join(sim_path, 'h.npy'))
|
259
259
|
curblock.qx = WolfArray(path.join(sim_path, 'qx.npy'))
|
260
260
|
curblock.qy = WolfArray(path.join(sim_path, 'qy.npy'))
|
@@ -279,6 +279,10 @@ class wolfres2DGPU(Wolfresults_2D):
|
|
279
279
|
except:
|
280
280
|
logging.error(_('No spatial position (base_coord_x,base_coord_y) in parameters.json -- Results will not be spatially based'))
|
281
281
|
|
282
|
+
# Force nullvalue to zero because it will influence the size of the arrow in vector field views
|
283
|
+
curblock.qx.nullvalue = 0.
|
284
|
+
curblock.qy.nullvalue = 0.
|
285
|
+
|
282
286
|
self.loaded_rough = True
|
283
287
|
|
284
288
|
self.head_blocks[getkeyblock(0)] = curblock.top.get_header()
|
File without changes
|