wolfhece 2.1.105__py3-none-any.whl → 2.1.107__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 +135 -6
- wolfhece/PyVertexvectors.py +8 -6
- wolfhece/apps/version.py +1 -1
- wolfhece/images_tiles.py +94 -0
- wolfhece/lazviewer/laz_viewer.py +15 -2
- wolfhece/wolf_tiles.py +2 -2
- {wolfhece-2.1.105.dist-info → wolfhece-2.1.107.dist-info}/METADATA +1 -1
- {wolfhece-2.1.105.dist-info → wolfhece-2.1.107.dist-info}/RECORD +11 -10
- {wolfhece-2.1.105.dist-info → wolfhece-2.1.107.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.105.dist-info → wolfhece-2.1.107.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.105.dist-info → wolfhece-2.1.107.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -90,6 +90,7 @@ try:
|
|
90
90
|
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier
|
91
91
|
from .math_parser.calculator import Calculator
|
92
92
|
from .wintab.wintab import Wintab
|
93
|
+
from .images_tiles import ImagesTiles
|
93
94
|
except ImportError as e:
|
94
95
|
print(e)
|
95
96
|
raise ImportError("Error importing wolf_texture, xyz_file, mesh2d, PyPalette, wolfresults_2D, PyTranslate, PyVertex, RatingCurve, wolf_array, PyParams, mesh2d.bc_manager, PyVertexvectors, Results2DGPU, PyCrosssections, GraphNotebook, lazviewer, picc, wolf_zi_db, math_parser.calculator, wintab. Please check your installation.")
|
@@ -511,6 +512,7 @@ class draw_type(Enum):
|
|
511
512
|
WMSBACK = 'wms-background'
|
512
513
|
WMSFORE = 'wms-foreground'
|
513
514
|
TILES = 'tiles'
|
515
|
+
IMAGESTILES = 'imagestiles'
|
514
516
|
|
515
517
|
class Colors_1to9(wx.Frame):
|
516
518
|
|
@@ -1116,6 +1118,7 @@ class WolfMapViewer(wx.Frame):
|
|
1116
1118
|
mywmsfore: list
|
1117
1119
|
myres2D: list
|
1118
1120
|
mytiles: list[Tiles]
|
1121
|
+
myimagestiles: list[ImagesTiles]
|
1119
1122
|
mypartsystems: list[Particle_system]
|
1120
1123
|
myviewers3d:list[Wolf_Viewer3D]
|
1121
1124
|
sim_explorers: dict[Wolfresults_2D:Sim_Explorer]
|
@@ -1140,6 +1143,7 @@ class WolfMapViewer(wx.Frame):
|
|
1140
1143
|
active_cs: crosssections
|
1141
1144
|
active_tri: Triangulation
|
1142
1145
|
active_tile: Tiles
|
1146
|
+
active_imagestiles: ImagesTiles
|
1143
1147
|
active_particle_system: Particle_system
|
1144
1148
|
active_viewer3d: Wolf_Viewer3D
|
1145
1149
|
|
@@ -1244,6 +1248,7 @@ class WolfMapViewer(wx.Frame):
|
|
1244
1248
|
self.menusim2D_GPU = None
|
1245
1249
|
self.menulaz = None
|
1246
1250
|
self.menutiles = None
|
1251
|
+
self.menuimagestiles = None
|
1247
1252
|
|
1248
1253
|
self.filemenu = wx.Menu()
|
1249
1254
|
openitem = self.filemenu.Append(wx.ID_OPEN, _('Open project'), _('Open a complete project from file'))
|
@@ -1334,8 +1339,9 @@ class WolfMapViewer(wx.Frame):
|
|
1334
1339
|
_('Add array and crop (binary file - real)'))
|
1335
1340
|
addvector = self.menuaddobj.Append(wx.ID_FILE2, _('Add vectors...'), _('Add vectors'))
|
1336
1341
|
addtiles = self.menuaddobj.Append(wx.ID_ANY, _('Add tiles...'), _('Add tiles'))
|
1342
|
+
addimagestiles = self.menuaddobj.Append(wx.ID_ANY, _('Add images tiles...'), _('Add georeferenced images tiles'))
|
1337
1343
|
addtilescomp = self.menuaddobj.Append(wx.ID_ANY, _('Add tiles comparator...'), _('Add tiles comparator'))
|
1338
|
-
|
1344
|
+
addtilesgpu = self.menuaddobj.Append(wx.ID_ANY, _('Add tiles GPU...'), _('Add tiles from 2D GPU model -- 2 arrays will be added'))
|
1339
1345
|
addcloud = self.menuaddobj.Append(wx.ID_FILE3, _('Add cloud...'), _('Add cloud'))
|
1340
1346
|
addtri = self.menuaddobj.Append(wx.ID_ANY, _('Add triangulation...'), _('Add triangulation'))
|
1341
1347
|
addprofiles = self.menuaddobj.Append(wx.ID_FILE4, _('Add cross sections...'), _('Add cross sections'))
|
@@ -1751,6 +1757,25 @@ class WolfMapViewer(wx.Frame):
|
|
1751
1757
|
self.Bind(wx.EVT_MENU, self.create_data_from_tiles_activevec, data_active_polygon_tiles)
|
1752
1758
|
self.Bind(wx.EVT_MENU, self.create_data_from_tiles_tmpvec, data_tmpvec_tiles)
|
1753
1759
|
|
1760
|
+
def pîck_image_tile(self, event: wx.Event):
|
1761
|
+
|
1762
|
+
if self.active_imagestiles is None:
|
1763
|
+
logging.warning(_('No active image tile -- Please load data first'))
|
1764
|
+
return
|
1765
|
+
|
1766
|
+
self.action = 'select active image tile'
|
1767
|
+
logging.info(_('Select active image tile'))
|
1768
|
+
|
1769
|
+
def menu_imagestiles(self):
|
1770
|
+
""" Menu for image tiles """
|
1771
|
+
if self.menuimagestiles is None:
|
1772
|
+
self.menuimagestiles = wx.Menu()
|
1773
|
+
self.menubar.Append(self.menuimagestiles, _('&Image tiles'))
|
1774
|
+
|
1775
|
+
picktiles = self.menuimagestiles.Append(wx.ID_ANY, _('Pick a tile and (un)load data'), _('Right click to pick a tile'))
|
1776
|
+
self.Bind(wx.EVT_MENU, self.pîck_image_tile, picktiles)
|
1777
|
+
|
1778
|
+
|
1754
1779
|
def pick_tile(self, event: wx.Event):
|
1755
1780
|
|
1756
1781
|
if self.active_tile is None:
|
@@ -3750,6 +3775,7 @@ class WolfMapViewer(wx.Frame):
|
|
3750
3775
|
self.mypartsystems = []
|
3751
3776
|
self.myvectors = []
|
3752
3777
|
self.mytiles = []
|
3778
|
+
self.myimagestiles = []
|
3753
3779
|
self.myclouds = []
|
3754
3780
|
self.mytri = []
|
3755
3781
|
self.myothers = []
|
@@ -3761,7 +3787,7 @@ class WolfMapViewer(wx.Frame):
|
|
3761
3787
|
self.sim_explorers = {}
|
3762
3788
|
|
3763
3789
|
# liste des éléments modifiable dans l'arbre
|
3764
|
-
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.mypartsystems, self.myviewers3d]
|
3790
|
+
self.all_lists = [self.myarrays, self.myvectors, self.myclouds, self.mytri, self.myothers, self.myviews, self.myres2D, self.mytiles, self.myimagestiles, self.mypartsystems, self.myviewers3d]
|
3765
3791
|
|
3766
3792
|
self.menu_options = wx.Menu()
|
3767
3793
|
self._change_title = self.menu_options.Append(wx.ID_ANY, _('Change title'), _('Change title of the window'))
|
@@ -5045,6 +5071,14 @@ class WolfMapViewer(wx.Frame):
|
|
5045
5071
|
|
5046
5072
|
logging.info(_('Clip LAZ grid on current zoom {}-{} {}-{}').format(curbounds[0][0],curbounds[0][1],curbounds[1][0],curbounds[1][1]))
|
5047
5073
|
|
5074
|
+
def decimate_data(self, factor:int = 10):
|
5075
|
+
""" Decimate data """
|
5076
|
+
|
5077
|
+
if self.mylazdata is None:
|
5078
|
+
return
|
5079
|
+
|
5080
|
+
self.mylazdata = self.mylazdata[::factor]
|
5081
|
+
|
5048
5082
|
def select_active_array_from_laz(self, array:WolfArray = None, used_codes:list = None, chunk_size:float = 500.):
|
5049
5083
|
""" select some nodes from laz data
|
5050
5084
|
|
@@ -6394,6 +6428,27 @@ class WolfMapViewer(wx.Frame):
|
|
6394
6428
|
autoscale=False
|
6395
6429
|
self.clip_laz_gridded()
|
6396
6430
|
|
6431
|
+
if self.mylazdata is None:
|
6432
|
+
return
|
6433
|
+
|
6434
|
+
if self.mylazdata.shape[0] > 100_000_000:
|
6435
|
+
|
6436
|
+
# Choose a decimation factor - integer
|
6437
|
+
dlg = wx.NumberEntryDialog(None, _('Your data selection is very large (>100 M)\nWould you like to decimate?'),
|
6438
|
+
_('Decaimate factor'), _('Decimation'), 0, 0, 100)
|
6439
|
+
|
6440
|
+
ret = dlg.ShowModal()
|
6441
|
+
|
6442
|
+
if ret == wx.ID_CANCEL:
|
6443
|
+
dlg.Destroy()
|
6444
|
+
return
|
6445
|
+
|
6446
|
+
decimate_fact = dlg.GetValue()
|
6447
|
+
dlg.Destroy()
|
6448
|
+
|
6449
|
+
if decimate_fact > 0:
|
6450
|
+
self.decimate_data(decimate_fact)
|
6451
|
+
|
6397
6452
|
elif itemlabel == _('Fill active array from LAZ data'):
|
6398
6453
|
if self.mylazgrid is None:
|
6399
6454
|
logging.warning('')
|
@@ -6530,6 +6585,9 @@ class WolfMapViewer(wx.Frame):
|
|
6530
6585
|
elif itemlabel == _('Add tiles...'):
|
6531
6586
|
self.add_object(which='tiles', ToCheck=True)
|
6532
6587
|
|
6588
|
+
elif itemlabel ==_('Add images tiles...'):
|
6589
|
+
self.add_object(which='imagestiles', ToCheck=True)
|
6590
|
+
|
6533
6591
|
elif itemlabel == _('Add tiles comparator...'):
|
6534
6592
|
self.add_object(which='tilescomp', ToCheck=True)
|
6535
6593
|
|
@@ -6914,7 +6972,7 @@ class WolfMapViewer(wx.Frame):
|
|
6914
6972
|
# print("Simulation")
|
6915
6973
|
# load_sim_to_gpu()
|
6916
6974
|
|
6917
|
-
if len(self.myarrays) + len(self.myvectors) + len(self.myclouds) + len(self.mytri) + len(self.myres2D) + len(self.mytiles) + len(self.mypartsystems) == 2 and autoscale:
|
6975
|
+
if len(self.myarrays) + len(self.myvectors) + len(self.myclouds) + len(self.mytri) + len(self.myres2D) + len(self.mytiles) + len(self.myimagestiles) + len(self.mypartsystems) == 2 and autoscale:
|
6918
6976
|
# Trouve les bornzs si un seul élément est présent, sinon on conserve l'état du zoom
|
6919
6977
|
self.Autoscale()
|
6920
6978
|
|
@@ -7439,7 +7497,8 @@ class WolfMapViewer(wx.Frame):
|
|
7439
7497
|
'res2d_gpu',
|
7440
7498
|
'particlesystem',
|
7441
7499
|
'wmsback',
|
7442
|
-
'wmsfore'
|
7500
|
+
'wmsfore',
|
7501
|
+
'imagestiles'] = 'array',
|
7443
7502
|
filename='',
|
7444
7503
|
newobj=None,
|
7445
7504
|
ToCheck=True,
|
@@ -7463,6 +7522,8 @@ class WolfMapViewer(wx.Frame):
|
|
7463
7522
|
# ouverture d'une boîte de dialogue
|
7464
7523
|
if which.lower() == 'array' or which.lower() == 'array_crop':
|
7465
7524
|
file = wx.FileDialog(self, "Choose file", wildcard=filterArray)
|
7525
|
+
elif which.lower() == 'imagestiles':
|
7526
|
+
file = wx.DirDialog(self, "Choose directory containing images")
|
7466
7527
|
elif which.lower() == 'particlesystem':
|
7467
7528
|
file = wx.FileDialog(self, "Choose file", wildcard=filterjson)
|
7468
7529
|
elif which.lower() == 'array_lidar_first' or which.lower() == 'array_lidar_second':
|
@@ -7670,6 +7731,21 @@ class WolfMapViewer(wx.Frame):
|
|
7670
7731
|
|
7671
7732
|
return
|
7672
7733
|
|
7734
|
+
|
7735
|
+
elif which.lower() == 'imagestiles':
|
7736
|
+
|
7737
|
+
curdict = self.myimagestiles
|
7738
|
+
curtree = self.myitemsvector
|
7739
|
+
|
7740
|
+
if newobj is None:
|
7741
|
+
|
7742
|
+
newobj = ImagesTiles('', parent=self, mapviewer=self)
|
7743
|
+
newobj.scan_dir(Path(filename))
|
7744
|
+
|
7745
|
+
self.myimagestiles.append(newobj)
|
7746
|
+
self.active_imagestiles = newobj
|
7747
|
+
self.menu_imagestiles()
|
7748
|
+
|
7673
7749
|
elif which.lower() == 'bridges':
|
7674
7750
|
curdict = self.myvectors
|
7675
7751
|
curtree = self.myitemsvector
|
@@ -7974,7 +8050,7 @@ class WolfMapViewer(wx.Frame):
|
|
7974
8050
|
|
7975
8051
|
if ret == wx.ID_YES:
|
7976
8052
|
loadhead = True
|
7977
|
-
|
8053
|
+
|
7978
8054
|
types = None
|
7979
8055
|
|
7980
8056
|
elif filename.endswith('.dxf'):
|
@@ -7987,7 +8063,7 @@ class WolfMapViewer(wx.Frame):
|
|
7987
8063
|
if ret == wx.ID_CANCEL:
|
7988
8064
|
dlg.Destroy()
|
7989
8065
|
return -1
|
7990
|
-
|
8066
|
+
|
7991
8067
|
types = [types[i] for i in dlg.GetSelections()]
|
7992
8068
|
dlg.Destroy()
|
7993
8069
|
|
@@ -8194,6 +8270,8 @@ class WolfMapViewer(wx.Frame):
|
|
8194
8270
|
return self.mywmsback
|
8195
8271
|
elif drawing_type == draw_type.WMSFORE:
|
8196
8272
|
return self.mywmsfore
|
8273
|
+
elif drawing_type == draw_type.IMAGESTILES:
|
8274
|
+
return self.myimagestiles
|
8197
8275
|
else:
|
8198
8276
|
logging.error('Unknown drawing type : ' + drawing_type)
|
8199
8277
|
return None
|
@@ -8642,6 +8720,37 @@ class WolfMapViewer(wx.Frame):
|
|
8642
8720
|
self.add_object('vector', newobj= cont, id= cont.idx)
|
8643
8721
|
self.Paint()
|
8644
8722
|
|
8723
|
+
elif text == _('Rebin'):
|
8724
|
+
|
8725
|
+
if isinstance(self.selected_object, WolfArray):
|
8726
|
+
dlg = wx.TextEntryDialog(self, _('Enter the rebin factor (>1 will decrease the resolution, <1 will increase the resolution) :'), _('Rebin'), '1')
|
8727
|
+
if dlg.ShowModal() == wx.ID_OK:
|
8728
|
+
res = dlg.GetValue()
|
8729
|
+
dlg.Destroy()
|
8730
|
+
try:
|
8731
|
+
res = float(res)
|
8732
|
+
|
8733
|
+
ops = ['Mean', 'Sum', 'Max', 'Min', 'Median']
|
8734
|
+
dlg_op = wx.SingleChoiceDialog(None, _('Choose the operation'), _('Operation'), ops, style=wx.CHOICEDLG_STYLE)
|
8735
|
+
ret = dlg_op.ShowModal()
|
8736
|
+
|
8737
|
+
if ret != wx.ID_OK:
|
8738
|
+
dlg_op.Destroy()
|
8739
|
+
logging.info(_('Rebin cancelled'))
|
8740
|
+
return
|
8741
|
+
|
8742
|
+
op = dlg_op.GetSelection()
|
8743
|
+
dlg_op.Destroy()
|
8744
|
+
|
8745
|
+
self.selected_object.rebin(res, ops[op].lower())
|
8746
|
+
except:
|
8747
|
+
logging.warning(_('Invalid value for rebin factor'))
|
8748
|
+
return
|
8749
|
+
else:
|
8750
|
+
dlg.Destroy()
|
8751
|
+
else:
|
8752
|
+
logging.warning(_('Rebin not yet implemented for this type of object'))
|
8753
|
+
|
8645
8754
|
elif _('Convert to mono-block') in text:
|
8646
8755
|
|
8647
8756
|
if isinstance(self.selected_object, WolfArrayMB):
|
@@ -9045,6 +9154,13 @@ class WolfMapViewer(wx.Frame):
|
|
9045
9154
|
|
9046
9155
|
self.add_object('array', newobj = tilearray, ToCheck=True, id=id_label)
|
9047
9156
|
|
9157
|
+
elif self.action == 'select active image tile':
|
9158
|
+
# select active image tile
|
9159
|
+
|
9160
|
+
self.active_imagestiles.select_vectors_from_point(x, y, True)
|
9161
|
+
active_tile = self.active_imagestiles.get_selected_vectors()
|
9162
|
+
active_tile.myprop.imagevisible = not active_tile.myprop.imagevisible
|
9163
|
+
|
9048
9164
|
elif self.action.find('select active vector') > -1:
|
9049
9165
|
# Select active vector
|
9050
9166
|
|
@@ -10873,6 +10989,7 @@ class WolfMapViewer(wx.Frame):
|
|
10873
10989
|
tracks.append(_('Convert to multi-blocks (result)'))
|
10874
10990
|
tracks.append(_('Export to Shape file'))
|
10875
10991
|
tracks.append(_('Export active zone to Shape file'))
|
10992
|
+
tracks.append(_('Rebin'))
|
10876
10993
|
|
10877
10994
|
# Récupération des items du menu contextuel
|
10878
10995
|
menuitems = self.popupmenu.GetMenuItems()
|
@@ -10898,6 +11015,7 @@ class WolfMapViewer(wx.Frame):
|
|
10898
11015
|
if bc is not None:
|
10899
11016
|
self.popupmenu.Append(wx.ID_ANY, _('Boundary conditions'), _('Boundary conditions'))
|
10900
11017
|
self.popupmenu.Append(wx.ID_ANY, _('Contours'))
|
11018
|
+
self.popupmenu.Append(wx.ID_ANY, _('Rebin'), _('Change the spatial resolution'))
|
10901
11019
|
|
10902
11020
|
# Add specific menu items for WolfArrayMB
|
10903
11021
|
if isinstance(self.selected_object, WolfArrayMB):
|
@@ -11025,6 +11143,7 @@ class WolfMapViewer(wx.Frame):
|
|
11025
11143
|
|
11026
11144
|
# Dessin des tuiles
|
11027
11145
|
self._plotting(draw_type.TILES)
|
11146
|
+
self._plotting(draw_type.IMAGESTILES)
|
11028
11147
|
|
11029
11148
|
if self.active_vector is not None:
|
11030
11149
|
if self.active_vector.parentzone is None:
|
@@ -11111,6 +11230,16 @@ class WolfMapViewer(wx.Frame):
|
|
11111
11230
|
ymax = max(locvector.ymax, ymax)
|
11112
11231
|
k += 1
|
11113
11232
|
|
11233
|
+
for locvector in self.myimagestiles:
|
11234
|
+
if locvector.plotted or force:
|
11235
|
+
locvector.find_minmax()
|
11236
|
+
if isinstance(locvector,ImagesTiles):
|
11237
|
+
xmin = min(locvector.xmin, xmin)
|
11238
|
+
xmax = max(locvector.xmax, xmax)
|
11239
|
+
ymin = min(locvector.ymin, ymin)
|
11240
|
+
ymax = max(locvector.ymax, ymax)
|
11241
|
+
k += 1
|
11242
|
+
|
11114
11243
|
for locvector in self.mytiles:
|
11115
11244
|
if locvector.plotted or force:
|
11116
11245
|
if locvector.idx != 'grid':
|
wolfhece/PyVertexvectors.py
CHANGED
@@ -3355,7 +3355,7 @@ class zone:
|
|
3355
3355
|
mytri.find_minmax(True)
|
3356
3356
|
|
3357
3357
|
return mytri
|
3358
|
-
|
3358
|
+
|
3359
3359
|
def create_constrainedDelaunay(self, nb=None) -> Triangulation:
|
3360
3360
|
"""
|
3361
3361
|
Création d'une triangulation Delaunay contrainte sur base des vecteurs
|
@@ -3426,7 +3426,7 @@ class zone:
|
|
3426
3426
|
k+=1
|
3427
3427
|
|
3428
3428
|
# Création de la géométrie pour la triangulation
|
3429
|
-
geom = {'vertices' : [[x,y] for x,y in xyz[:,:2]],
|
3429
|
+
geom = {'vertices' : [[x,y] for x,y in xyz[:,:2]],
|
3430
3430
|
'segments' : segments}
|
3431
3431
|
|
3432
3432
|
try:
|
@@ -3434,8 +3434,8 @@ class zone:
|
|
3434
3434
|
delaunay = triangle.triangulate(geom, 'p') # d'autres options sont possibles (voir la doc de triangle)
|
3435
3435
|
|
3436
3436
|
# Recover z values from xyz for each vertex
|
3437
|
-
# Searching value in xyz is not the best way
|
3438
|
-
# We create a dictionary to avoid searching manually
|
3437
|
+
# Searching value in xyz is not the best way
|
3438
|
+
# We create a dictionary to avoid searching manually
|
3439
3439
|
xyz_dict = {(curxyz[0], curxyz[1]): curxyz[2] for curxyz in xyz}
|
3440
3440
|
allvert = []
|
3441
3441
|
for curvert in delaunay['vertices']:
|
@@ -3445,7 +3445,7 @@ class zone:
|
|
3445
3445
|
allvert.append([x + xmin, y + ymin, z])
|
3446
3446
|
|
3447
3447
|
# Create the Triangulation object
|
3448
|
-
mytri=Triangulation(pts= allvert,
|
3448
|
+
mytri=Triangulation(pts= allvert,
|
3449
3449
|
tri= [curtri for curtri in delaunay['triangles']])
|
3450
3450
|
mytri.find_minmax(True)
|
3451
3451
|
|
@@ -4663,6 +4663,8 @@ class Zones(wx.Frame, Element_To_Draw):
|
|
4663
4663
|
for idx, row in content.iterrows():
|
4664
4664
|
if 'NAME' in row.keys():
|
4665
4665
|
name = row['NAME']
|
4666
|
+
elif 'name' in row.keys():
|
4667
|
+
name = row['name']
|
4666
4668
|
elif 'MAJ_NIV3T' in row.keys():
|
4667
4669
|
# WALOUS
|
4668
4670
|
name = row['MAJ_NIV3T']
|
@@ -7042,5 +7044,5 @@ class Grid(Zones):
|
|
7042
7044
|
contour.add_vertex(newvert)
|
7043
7045
|
newvert=wolfvertex(locox,locey)
|
7044
7046
|
contour.add_vertex(newvert)
|
7045
|
-
|
7047
|
+
|
7046
7048
|
self.find_minmax(True)
|
wolfhece/apps/version.py
CHANGED
wolfhece/images_tiles.py
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
"""
|
2
|
+
Author: HECE - University of Liege, Pierre Archambeau
|
3
|
+
Date: 2024
|
4
|
+
|
5
|
+
Copyright (c) 2024 University of Liege. All rights reserved.
|
6
|
+
|
7
|
+
This script and its content are protected by copyright law. Unauthorized
|
8
|
+
copying or distribution of this file, via any medium, is strictly prohibited.
|
9
|
+
"""
|
10
|
+
|
11
|
+
from osgeo import gdal
|
12
|
+
import logging
|
13
|
+
from pathlib import Path
|
14
|
+
|
15
|
+
from .PyTranslate import _
|
16
|
+
from .wolf_array import WolfArray, WolfArrayMB
|
17
|
+
from .PyVertexvectors import zone,Zones,vector, wolfvertex
|
18
|
+
|
19
|
+
|
20
|
+
class ImagesTiles(Zones):
|
21
|
+
""" Class to manage images tiles.
|
22
|
+
|
23
|
+
Images must be stored in the same directory.
|
24
|
+
"""
|
25
|
+
|
26
|
+
def __init__(self,
|
27
|
+
filename = '',
|
28
|
+
ox = 0, oy = 0,
|
29
|
+
tx = 0, ty = 0,
|
30
|
+
parent=None, is2D=True,
|
31
|
+
idx = '', plotted = True,
|
32
|
+
mapviewer=None, need_for_wx = False,
|
33
|
+
bbox = None, find_minmax = True,
|
34
|
+
shared = False, colors = None):
|
35
|
+
|
36
|
+
super().__init__(filename, ox, oy, tx, ty, parent, is2D, idx, plotted, mapviewer, need_for_wx, bbox, find_minmax, shared, colors)
|
37
|
+
|
38
|
+
def scan_dir(self, directory:Path, extensions:list[str] = ['tif', 'tiff']):
|
39
|
+
""" Scan directory for images tiles.
|
40
|
+
|
41
|
+
:param directory: directory to scan.
|
42
|
+
:param extensions: list of extensions to search for.
|
43
|
+
"""
|
44
|
+
|
45
|
+
self.myzones = []
|
46
|
+
for ext in extensions:
|
47
|
+
self.myzones += self.scan_dir_ext(directory, ext)
|
48
|
+
|
49
|
+
self.find_minmax(True)
|
50
|
+
|
51
|
+
def scan_dir_ext(self, directory:Path, ext:str, force_visible:bool = False):
|
52
|
+
""" Scan directory for images tiles with a specific extension.
|
53
|
+
|
54
|
+
:param directory: directory to scan.
|
55
|
+
:param ext: extension to search for.
|
56
|
+
"""
|
57
|
+
|
58
|
+
all_files = directory.glob(f'*.{ext}')
|
59
|
+
|
60
|
+
zones = []
|
61
|
+
for file in all_files:
|
62
|
+
try:
|
63
|
+
ds:gdal.Dataset
|
64
|
+
ds = gdal.Open(str(file))
|
65
|
+
if ds is None:
|
66
|
+
logging.error(f'Could not open {file}')
|
67
|
+
continue
|
68
|
+
|
69
|
+
ulx, xres, xskew, uly, yskew, yres = ds.GetGeoTransform()
|
70
|
+
lrx = ulx + (ds.RasterXSize * xres)
|
71
|
+
lry = uly + (ds.RasterYSize * yres)
|
72
|
+
|
73
|
+
xmin, xmax = min(ulx, lrx), max(ulx, lrx)
|
74
|
+
ymin, ymax = min(uly, lry), max(uly, lry)
|
75
|
+
|
76
|
+
loczone = zone(name = file, parent= self)
|
77
|
+
vect = vector(name='image', parentzone=loczone)
|
78
|
+
loczone.add_vector(vect)
|
79
|
+
|
80
|
+
vect.myprop.attachedimage = Path(file)
|
81
|
+
vect.myprop.imagevisible = True if ds.RasterXSize * ds.RasterYSize < 8_000_000 or force_visible else False
|
82
|
+
|
83
|
+
vect.add_vertex(wolfvertex(xmin, ymin))
|
84
|
+
vect.add_vertex(wolfvertex(xmax, ymin))
|
85
|
+
vect.add_vertex(wolfvertex(xmax, ymax))
|
86
|
+
vect.add_vertex(wolfvertex(xmin, ymax))
|
87
|
+
vect.close_force()
|
88
|
+
|
89
|
+
zones.append(loczone)
|
90
|
+
|
91
|
+
except Exception as e:
|
92
|
+
logging.error(f'Error while opening {file}: {e}')
|
93
|
+
|
94
|
+
return zones
|
wolfhece/lazviewer/laz_viewer.py
CHANGED
@@ -53,6 +53,7 @@ class Classification_LAZ():
|
|
53
53
|
def init_2013(self):
|
54
54
|
|
55
55
|
self.classification={
|
56
|
+
0 : ['0', 'Pas de classification', Colors.rgb_withalpha_float('black',.2),],
|
56
57
|
1 : ['Hors-sol', 'building, toits et autres', Colors.rgb_withalpha_float('white',.2),],
|
57
58
|
2 : ['Sol', 'y compris talus et digues', Colors.rgb_withalpha_float('brown',1.)],
|
58
59
|
4 : ['Végétation', 'y compris la végétation linéaire', Colors.rgb_withalpha_float('forestgreen',1.)],
|
@@ -62,6 +63,7 @@ class Classification_LAZ():
|
|
62
63
|
def init_2023(self):
|
63
64
|
|
64
65
|
self.classification={
|
66
|
+
0 : ['0', 'Pas de classification', Colors.rgb_withalpha_float('black',.2),],
|
65
67
|
1 : ['Défaut', 'Voiture, câbles électrique, points de végétation diffus, Sursol non utile', Colors.rgb_withalpha_float('white',.2),],
|
66
68
|
2 : ['Sol', 'Tous les éléments du sol y compris les descentes de garage en sous-sol', Colors.rgb_withalpha_float('gray',1.)],
|
67
69
|
4 : ['Végétation', 'Végétation', Colors.rgb_withalpha_float('forestgreen',1.)],
|
@@ -451,6 +453,11 @@ class xyz_laz_grid():
|
|
451
453
|
self.endy = ybounds[1]
|
452
454
|
self.nbx = gridsize[0]
|
453
455
|
self.nby = gridsize[1]
|
456
|
+
|
457
|
+
if self.nbx == 0 or self.nby == 0:
|
458
|
+
logging.error(_('Grid size is 0 - abort !'))
|
459
|
+
return
|
460
|
+
|
454
461
|
self.dx = (self.endx-self.origx)/float(self.nbx)
|
455
462
|
self.dy = (self.endy-self.origy)/float(self.nby)
|
456
463
|
self.genfile=fn_out+'_'+'x1'+'_'+'y1'+'_xyz.bin'
|
@@ -503,9 +510,12 @@ class xyz_laz_grids():
|
|
503
510
|
ret = [cur for cur in ret if len(cur)>0]
|
504
511
|
|
505
512
|
if len(ret)==0:
|
513
|
+
logging.info(_('No data found'))
|
506
514
|
return np.asarray([])
|
507
515
|
else:
|
508
|
-
|
516
|
+
ret = np.concatenate(ret)
|
517
|
+
logging.info(_('Data found -- {} points'.format(ret.shape[0])))
|
518
|
+
return ret
|
509
519
|
|
510
520
|
def read_dir(self, dir_grids):
|
511
521
|
dirs = listdir(dir_grids)
|
@@ -633,6 +643,9 @@ class xyz_laz_grids():
|
|
633
643
|
vec = vecs.get_zone(file_wo_suf)
|
634
644
|
bounds = vec.myvectors[0].get_bounds()
|
635
645
|
|
646
|
+
bounds = [[math.floor(bounds[0][0]/ds)*ds, math.floor(bounds[0][1]/ds)*ds],
|
647
|
+
[math.ceil(bounds[1][0]/ds)*ds, math.ceil(bounds[1][1]/ds)*ds]]
|
648
|
+
|
636
649
|
dx = bounds[1][0] -bounds[0][0]
|
637
650
|
dy = bounds[1][1] -bounds[0][1]
|
638
651
|
nb = max(int(dx/ds), int(dy/ds))
|
@@ -640,7 +653,7 @@ class xyz_laz_grids():
|
|
640
653
|
self.grids.append(newlaz._sort_grid_np(entry.path,
|
641
654
|
join(dirname, file_wo_suf),
|
642
655
|
bounds=[[bounds[0][0], bounds[1][0]], [bounds[0][1], bounds[1][1]]],
|
643
|
-
gridsize=[int(dx/ds), int(dy/ds)],
|
656
|
+
gridsize=[max(int(dx/ds),1), max(int(dy/ds),1)],
|
644
657
|
force_format=force_format))
|
645
658
|
|
646
659
|
def find_pointsXYZ(xyz:np.ndarray, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]) -> np.ndarray:
|
wolfhece/wolf_tiles.py
CHANGED
@@ -44,8 +44,8 @@ class Tiles(Zones):
|
|
44
44
|
need_for_wx: bool = False,
|
45
45
|
linked_data_dir=None) -> None:
|
46
46
|
"""
|
47
|
-
filename
|
48
|
-
linked_data_dir
|
47
|
+
:param filename: le fichier de forme (ShapeFile) de tuilage
|
48
|
+
:param linked_data_dir: le répertoire des données .tif
|
49
49
|
"""
|
50
50
|
super().__init__(filename, ox, oy, tx, ty, parent, is2D, idx, plotted, mapviewer, need_for_wx)
|
51
51
|
|
@@ -7,7 +7,7 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
|
|
7
7
|
wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
|
8
8
|
wolfhece/PyConfig.py,sha256=Bb1T8qjgKMChadJYDrHO9uo6CwItiAXScZpYkDXqZF8,11387
|
9
9
|
wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
|
10
|
-
wolfhece/PyDraw.py,sha256=
|
10
|
+
wolfhece/PyDraw.py,sha256=prtoxdiwAkS7V_H16bRchSjv-Zd3U5yfzASckTeSt1A,482283
|
11
11
|
wolfhece/PyGui.py,sha256=pD_t3leVt8U9tzFnSMGsF-Ds4m0qPwLb_Tc8fQT34GQ,144147
|
12
12
|
wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
|
13
13
|
wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
|
@@ -16,7 +16,7 @@ wolfhece/PyParams.py,sha256=GRp1zZDUJIjs8PtjwScDdov-E9orr1JWOntDazN5AOw,98577
|
|
16
16
|
wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
|
17
17
|
wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
|
18
18
|
wolfhece/PyVertex.py,sha256=0TATf_Se6E7_P-kR1_DMEzRw_zy8-5cGFnc3yAod7yQ,44754
|
19
|
-
wolfhece/PyVertexvectors.py,sha256=
|
19
|
+
wolfhece/PyVertexvectors.py,sha256=F2ZtinpWk1ms7e-lDG_9WzD3waLbkVTKXTD5k6BhMpw,258966
|
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
|
@@ -32,6 +32,7 @@ wolfhece/drawing_obj.py,sha256=7vY04B6r08nurTTFmBXHyR5tVIF1YzAEw_uz4pqTDIw,4233
|
|
32
32
|
wolfhece/flow_SPWMI.py,sha256=XDAelwAY-3rYOR0WKW3fgYJ_r8DU4IP6Y5xULW421tk,20956
|
33
33
|
wolfhece/friction_law.py,sha256=MtZJLo-pTj3-Fw-w12z1LSgSIDrH-JGR0iD9wer_fpQ,5498
|
34
34
|
wolfhece/gpuview.py,sha256=Jql8pLZ0PpvZ_ScT-U4jsXANZ9j4-m_RWhsLA2HISuQ,24544
|
35
|
+
wolfhece/images_tiles.py,sha256=w5BX6kRqA0wW9TWyKrJUIRl-XyqHclq_kp5ET2VA0Sg,3227
|
35
36
|
wolfhece/import_ascfiles.py,sha256=6Zl8qBR9c6VtyziookQ8YE9KC0GtW_J9WFt5ubyGp-s,4465
|
36
37
|
wolfhece/ins.py,sha256=uUeLMS1n3GPnfJhxl0Z2l-UXpmPUgthuwct282OOEzk,36184
|
37
38
|
wolfhece/irm_qdf.py,sha256=KyrIk0Gu50Q702EWxRpwKTWI2KGjtHA1l8CL-Y469O0,26394
|
@@ -54,7 +55,7 @@ wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
|
|
54
55
|
wolfhece/wolf_array.py,sha256=_UYxRGF8T0rHTv-1uDJ9opHHwBE7bh39XXnhhUgIcKM,421010
|
55
56
|
wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
|
56
57
|
wolfhece/wolf_texture.py,sha256=DS5eobLxrq9ljyebYfpMSQPn8shkUAZZVfqrOKN_QUU,16951
|
57
|
-
wolfhece/wolf_tiles.py,sha256=
|
58
|
+
wolfhece/wolf_tiles.py,sha256=VWaWtKlS0RMv_qb5qiPmZdKFJRGgJ3DQEeV_ryfCRMo,10398
|
58
59
|
wolfhece/wolf_vrt.py,sha256=NcPZYW4bu06IpqQuiutoAhCvDkeZ3TzOVb8z4wTQ1h8,14319
|
59
60
|
wolfhece/wolf_zi_db.py,sha256=baE0niMCzybWGSvPJc5FNxo9ZxsGfU4p-FmfiavFHAs,12967
|
60
61
|
wolfhece/wolfresults_2D.py,sha256=Z-SKkipwbChyf9V4777nacKNd5p0aimORjC6evg5zeI,184819
|
@@ -79,7 +80,7 @@ wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefg
|
|
79
80
|
wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
|
80
81
|
wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
|
81
82
|
wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
|
82
|
-
wolfhece/apps/version.py,sha256=
|
83
|
+
wolfhece/apps/version.py,sha256=c9nOMzTjOuC2UwtGbI20MfQvPwFWRLi2f8faqmnTTnY,389
|
83
84
|
wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
|
84
85
|
wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
|
85
86
|
wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
|
@@ -153,7 +154,7 @@ wolfhece/lagrangian/particles.py,sha256=S52_-3rzgVhift6l4Gznvsf_RTggzvNaD1dPvQUr
|
|
153
154
|
wolfhece/lagrangian/velocity_field.py,sha256=oGVjNm98gEpawreFIrC1lDyC5bEhkk2CsyYAlF1Kq50,10574
|
154
155
|
wolfhece/lazviewer/__init__.py,sha256=lz60EpQOBZ-zjvYzff6Y11jzAmC7mjOaxRYAfoqizQs,473
|
155
156
|
wolfhece/lazviewer/_add_path.py,sha256=GDwPnzHuGRXGriDNcu1SQ6HetFDGIApeAQZEzYArGvI,605
|
156
|
-
wolfhece/lazviewer/laz_viewer.py,sha256=
|
157
|
+
wolfhece/lazviewer/laz_viewer.py,sha256=XQ7vL8NU-igBEFQHSIQjFbKQYnt4sbZ-J6YLmzaxt3s,43426
|
157
158
|
wolfhece/lazviewer/libs/Qt5Core.dll,sha256=sTJ_ctYFY9KHMNytF-lzH_078zIvnKTjN-71FDkOWPw,4924928
|
158
159
|
wolfhece/lazviewer/libs/Qt5Gui.dll,sha256=07BeaOeYByraGkKYeDiSDYLawHM8tyd55pVJlKbZ4Y0,5436416
|
159
160
|
wolfhece/lazviewer/libs/Qt5Network.dll,sha256=U-9FiLE9LUKru8r8EQxTnwwlMpwS8JzUtenhkKTCox0,1038336
|
@@ -292,8 +293,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
|
|
292
293
|
wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
|
293
294
|
wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
294
295
|
wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
|
295
|
-
wolfhece-2.1.
|
296
|
-
wolfhece-2.1.
|
297
|
-
wolfhece-2.1.
|
298
|
-
wolfhece-2.1.
|
299
|
-
wolfhece-2.1.
|
296
|
+
wolfhece-2.1.107.dist-info/METADATA,sha256=oztMOI4pukBY5To8ukz2RPo2f3K4XEmC0k161JWzdkE,2618
|
297
|
+
wolfhece-2.1.107.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
298
|
+
wolfhece-2.1.107.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
|
299
|
+
wolfhece-2.1.107.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
|
300
|
+
wolfhece-2.1.107.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|