wolfhece 2.2.33__py3-none-any.whl → 2.2.35__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/PyConfig.py +26 -3
- wolfhece/PyCrosssections.py +293 -16
- wolfhece/PyDraw.py +349 -7
- wolfhece/PyGui.py +43 -1
- wolfhece/PyPictures.py +420 -3
- wolfhece/PyVertexvectors.py +128 -12
- wolfhece/__init__.py +1 -0
- wolfhece/analyze_poly.py +1 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/textpillow.py +1 -1
- wolfhece/wolf_array.py +1233 -305
- wolfhece/wolf_texture.py +81 -13
- wolfhece/wolf_zi_db.py +741 -2
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/METADATA +1 -1
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/RECORD +18 -18
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.33.dist-info → wolfhece-2.2.35.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -88,11 +88,12 @@ try:
|
|
88
88
|
from .lazviewer.laz_viewer import myviewer, read_laz, clip_data_xyz, xyz_laz_grids, choices_laz_colormap, Classification_LAZ, Wolf_LAZ_Data, viewer as viewerlaz
|
89
89
|
from . import Lidar2002
|
90
90
|
from .picc import Picc_data, Cadaster_data
|
91
|
-
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier
|
91
|
+
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier, Ouvrages, Particularites, Enquetes, Profils
|
92
92
|
from .math_parser.calculator import Calculator
|
93
93
|
from .wintab.wintab import Wintab
|
94
94
|
from .images_tiles import ImagesTiles
|
95
95
|
from .PyWMS import Alaro_Navigator, get_Alaro_legend
|
96
|
+
from .PyPictures import PictureCollection
|
96
97
|
|
97
98
|
except ImportError as e:
|
98
99
|
print(e)
|
@@ -617,6 +618,7 @@ class draw_type(Enum):
|
|
617
618
|
LAZ = 'laz'
|
618
619
|
DROWNING = 'drowning'
|
619
620
|
DIKE = 'dike'
|
621
|
+
PICTURECOLLECTION = 'picture_collection'
|
620
622
|
|
621
623
|
class Colors_1to9(wx.Frame):
|
622
624
|
|
@@ -1924,6 +1926,7 @@ class WolfMapViewer(wx.Frame):
|
|
1924
1926
|
mylazdata:list[Wolf_LAZ_Data]
|
1925
1927
|
mydrownings: list[Drowning_victim_Viewer]
|
1926
1928
|
mydikes: list[DikeWolf]
|
1929
|
+
mypicturecollections: list[PictureCollection]
|
1927
1930
|
|
1928
1931
|
mymplfigs:list[MplFigViewer]
|
1929
1932
|
|
@@ -1960,6 +1963,7 @@ class WolfMapViewer(wx.Frame):
|
|
1960
1963
|
active_laz : Wolf_LAZ_Data
|
1961
1964
|
active_drowning: Drowning_victim_Viewer
|
1962
1965
|
active_dike : DikeWolf
|
1966
|
+
active_picturecollection: PictureCollection
|
1963
1967
|
|
1964
1968
|
active_fig: MplFigViewer
|
1965
1969
|
|
@@ -2098,6 +2102,7 @@ class WolfMapViewer(wx.Frame):
|
|
2098
2102
|
self.menuimagestiles = None
|
2099
2103
|
self.menudrowning = None
|
2100
2104
|
self.menudike = None
|
2105
|
+
self.menupicturecollections = None
|
2101
2106
|
|
2102
2107
|
self.alaro_navigator = None
|
2103
2108
|
|
@@ -2191,6 +2196,7 @@ class WolfMapViewer(wx.Frame):
|
|
2191
2196
|
addarraycrop = self.menuaddobj.Append(wx.ID_ANY, _('Add array and crop...'),
|
2192
2197
|
_('Add array and crop (binary file - real)'))
|
2193
2198
|
addvector = self.menuaddobj.Append(wx.ID_FILE2, _('Add vectors...'), _('Add vectors'))
|
2199
|
+
addpictcollection = self.menuaddobj.Append(wx.ID_ANY, _('Add picture collection...'), _('Add a collection of pictures'))
|
2194
2200
|
addtiles = self.menuaddobj.Append(wx.ID_ANY, _('Add tiles...'), _('Add tiles'))
|
2195
2201
|
addimagestiles = self.menuaddobj.Append(wx.ID_ANY, _('Add images tiles...'), _('Add georeferenced images tiles'))
|
2196
2202
|
addtilescomp = self.menuaddobj.Append(wx.ID_ANY, _('Add tiles comparator...'), _('Add tiles comparator'))
|
@@ -2396,6 +2402,7 @@ class WolfMapViewer(wx.Frame):
|
|
2396
2402
|
self.active_weir = None
|
2397
2403
|
self.active_laz = None
|
2398
2404
|
self.active_dike = None
|
2405
|
+
self.active_picturecollection = None
|
2399
2406
|
|
2400
2407
|
self.active_fig = None
|
2401
2408
|
self.active_drowning = None
|
@@ -2460,6 +2467,7 @@ class WolfMapViewer(wx.Frame):
|
|
2460
2467
|
self.myitemswmsfore = self.treelist.AppendItem(self.root, _("WMS-foreground"))
|
2461
2468
|
self.myitemsdrowning = self.treelist.AppendItem(self.root,_("Drowning"))
|
2462
2469
|
self.myitemsdike = self.treelist.AppendItem(self.root, _("Dikes"))
|
2470
|
+
self.myitemspictcollection = self.treelist.AppendItem(self.root, _("Pictures"))
|
2463
2471
|
|
2464
2472
|
width, height = self.GetClientSize()
|
2465
2473
|
self.bordersize = int((w - width + self.treewidth) / 2)
|
@@ -2786,6 +2794,75 @@ class WolfMapViewer(wx.Frame):
|
|
2786
2794
|
self.action = 'select active image tile'
|
2787
2795
|
logging.info(_('Select active image tile'))
|
2788
2796
|
|
2797
|
+
def menu_pictcollection(self):
|
2798
|
+
""" Menu for picture collections """
|
2799
|
+
|
2800
|
+
if self.menupicturecollections is None:
|
2801
|
+
self.menupicturecollections = wx.Menu()
|
2802
|
+
self.menubar.Append(self.menupicturecollections, _('&Pictures'))
|
2803
|
+
|
2804
|
+
scaleall = self.menupicturecollections.Append(wx.ID_ANY, _('Scale all pictures'), _('Scale all pictures in the collection'))
|
2805
|
+
pick = self.menupicturecollections.Append(wx.ID_ANY, _('Pick a picture'), _('Right click to pick a picture'))
|
2806
|
+
hide = self.menupicturecollections.Append(wx.ID_ANY, _('Hide all pictures'), _('Reset the picture collection'))
|
2807
|
+
allvisible = self.menupicturecollections.Append(wx.ID_ANY, _('Show all pictures'), _('Set all pictures in the collection visible'))
|
2808
|
+
extract = self.menupicturecollections.Append(wx.ID_ANY, _('Extract pictures'), _('Extract all visible pictures from the collection'))
|
2809
|
+
|
2810
|
+
self.Bind(wx.EVT_MENU, self.action_pictcollections, pick)
|
2811
|
+
self.Bind(wx.EVT_MENU, self.action_pictcollections, scaleall)
|
2812
|
+
self.Bind(wx.EVT_MENU, self.action_pictcollections, hide)
|
2813
|
+
self.Bind(wx.EVT_MENU, self.action_pictcollections, allvisible)
|
2814
|
+
self.Bind(wx.EVT_MENU, self.action_pictcollections, extract)
|
2815
|
+
|
2816
|
+
def action_pictcollections(self, event: wx.Event):
|
2817
|
+
""" Action for picture collections """
|
2818
|
+
|
2819
|
+
if self.active_picturecollection is None:
|
2820
|
+
logging.warning(_('No active picture collection -- Please load data first'))
|
2821
|
+
return
|
2822
|
+
|
2823
|
+
item = event.GetEventObject().FindItemById(event.GetId())
|
2824
|
+
itemlabel = item.ItemLabel
|
2825
|
+
|
2826
|
+
if itemlabel == _('Pick a picture'):
|
2827
|
+
self.action = 'pick a picture'
|
2828
|
+
logging.info(_('Pick a picture from the collection'))
|
2829
|
+
|
2830
|
+
elif itemlabel == _('Scale all pictures'):
|
2831
|
+
|
2832
|
+
scalefactor = wx.GetTextFromUser(_('Enter the scale factor (default is 1.0)'), _('Scale factor'), '1.0', self)
|
2833
|
+
if scalefactor == '':
|
2834
|
+
scalefactor = '1.0'
|
2835
|
+
try:
|
2836
|
+
scalefactor = float(scalefactor)
|
2837
|
+
except ValueError:
|
2838
|
+
logging.error(_('Invalid scale factor: {}').format(scalefactor))
|
2839
|
+
wx.MessageBox(_('Invalid scale factor: {}').format(scalefactor), _('Error'), wx.OK | wx.ICON_ERROR)
|
2840
|
+
return
|
2841
|
+
|
2842
|
+
self.active_picturecollection.scale_all_pictures(scalefactor)
|
2843
|
+
|
2844
|
+
self.Refresh()
|
2845
|
+
|
2846
|
+
elif itemlabel == _('Hide all pictures'):
|
2847
|
+
self.active_picturecollection.hide_all_pictures()
|
2848
|
+
self.Refresh()
|
2849
|
+
|
2850
|
+
elif itemlabel == _('Show all pictures'):
|
2851
|
+
self.active_picturecollection.show_all_pictures()
|
2852
|
+
self.Refresh()
|
2853
|
+
|
2854
|
+
elif itemlabel == _('Extract pictures'):
|
2855
|
+
|
2856
|
+
dlg = wx.DirDialog(self, _('Choose directory to extract picture collection'), style= wx.DD_DEFAULT_STYLE)
|
2857
|
+
if dlg.ShowModal() == wx.ID_CANCEL:
|
2858
|
+
dlg.Destroy()
|
2859
|
+
|
2860
|
+
else:
|
2861
|
+
dirpath = dlg.GetPath()
|
2862
|
+
dlg.Destroy()
|
2863
|
+
self.active_picturecollection.extract_pictures(dirpath)
|
2864
|
+
logging.info(_('Pictures extracted to {}').format(dirpath))
|
2865
|
+
|
2789
2866
|
def menu_imagestiles(self):
|
2790
2867
|
""" Menu for image tiles """
|
2791
2868
|
if self.menuimagestiles is None:
|
@@ -2828,6 +2905,7 @@ class WolfMapViewer(wx.Frame):
|
|
2828
2905
|
if len(glob_vrt) == 0:
|
2829
2906
|
file_vrt = r'tmp.vrt'
|
2830
2907
|
create_vrt(dirdata, fout=file_vrt)
|
2908
|
+
glob_vrt = file_vrt
|
2831
2909
|
else:
|
2832
2910
|
glob_vrt = glob_vrt[0]
|
2833
2911
|
|
@@ -4244,6 +4322,15 @@ class WolfMapViewer(wx.Frame):
|
|
4244
4322
|
else:
|
4245
4323
|
return Path(config[ConfigurationKeys.DIRECTORY_LAZ])
|
4246
4324
|
|
4325
|
+
@property
|
4326
|
+
def default_hece_database(self) -> Path:
|
4327
|
+
""" Return the default HECE database file from configs """
|
4328
|
+
config = self.get_configuration()
|
4329
|
+
if config is None:
|
4330
|
+
return Path('')
|
4331
|
+
else:
|
4332
|
+
return Path(config[ConfigurationKeys.XLSX_HECE_DATABASE])
|
4333
|
+
|
4247
4334
|
@property
|
4248
4335
|
def bkg_color(self):
|
4249
4336
|
""" Return the background color from configs """
|
@@ -5158,6 +5245,7 @@ class WolfMapViewer(wx.Frame):
|
|
5158
5245
|
self.mylazdata = []
|
5159
5246
|
self.mydrownings = []
|
5160
5247
|
self.mydikes = []
|
5248
|
+
self.mypicturecollections = []
|
5161
5249
|
|
5162
5250
|
self.mymplfigs = []
|
5163
5251
|
|
@@ -8639,7 +8727,7 @@ class WolfMapViewer(wx.Frame):
|
|
8639
8727
|
return
|
8640
8728
|
|
8641
8729
|
try:
|
8642
|
-
plotzone:list[zone]
|
8730
|
+
# plotzone:list[zone]
|
8643
8731
|
plotzone = []
|
8644
8732
|
zonename = self.active_zone.myname
|
8645
8733
|
if '_left_' in zonename or '_right_' in zonename:
|
@@ -9426,6 +9514,77 @@ class WolfMapViewer(wx.Frame):
|
|
9426
9514
|
elif itemlabel in [_('Create dike...'), _('Add dike...')]:
|
9427
9515
|
self.new_dike(itemlabel)
|
9428
9516
|
|
9517
|
+
elif itemlabel in [_('Add picture collection...')]:
|
9518
|
+
# Création d'une nouvelle collection de photos
|
9519
|
+
|
9520
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the type of picture collection'), _('Picture Collection'),
|
9521
|
+
[_('Pictures + shapefile'),
|
9522
|
+
_('Wolf vec format'),
|
9523
|
+
_('Georeferenced pictures'),
|
9524
|
+
_('Pictures + Excel'),
|
9525
|
+
_('URL zip file')])
|
9526
|
+
ret = dlg.ShowModal()
|
9527
|
+
if ret == wx.ID_CANCEL:
|
9528
|
+
dlg.Destroy()
|
9529
|
+
return
|
9530
|
+
|
9531
|
+
itemlabel = dlg.GetStringSelection()
|
9532
|
+
dlg.Destroy()
|
9533
|
+
|
9534
|
+
if itemlabel in [_('Pictures + shapefile'), _('Georeferenced pictures'), _('Pictures + Excel')]:
|
9535
|
+
dlgdir = wx.DirDialog(self, _('Choose directory to scan for pictures'))
|
9536
|
+
if dlgdir.ShowModal() == wx.ID_CANCEL:
|
9537
|
+
dlgdir.Destroy()
|
9538
|
+
return
|
9539
|
+
mydir = dlgdir.GetPath()
|
9540
|
+
dlgdir.Destroy()
|
9541
|
+
elif itemlabel == _('URL zip file'):
|
9542
|
+
# Demande de l'URL du fichier zip
|
9543
|
+
dlgurl = wx.TextEntryDialog(self, _('Enter the URL of the zip file containing the pictures'), _('URL zip file'))
|
9544
|
+
if dlgurl.ShowModal() == wx.ID_CANCEL:
|
9545
|
+
dlgurl.Destroy()
|
9546
|
+
return
|
9547
|
+
mydir = dlgurl.GetValue()
|
9548
|
+
dlgurl.Destroy()
|
9549
|
+
else:
|
9550
|
+
dlgfile = wx.FileDialog(self, _('Choose shapefile'), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
|
9551
|
+
wildcard='Wolf vec (*.vec)| *.vec|Wolf vecz (*.vecz)|*.vecz|All files (*.*)|*.*')
|
9552
|
+
if dlgfile.ShowModal() == wx.ID_CANCEL:
|
9553
|
+
dlgfile.Destroy()
|
9554
|
+
return
|
9555
|
+
mydir = dlgfile.GetPath()
|
9556
|
+
dlgfile.Destroy()
|
9557
|
+
|
9558
|
+
if itemlabel == _('Pictures + shapefile'):
|
9559
|
+
# Création d'une nouvelle collection de photos avec shapefile
|
9560
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9561
|
+
newcollection.load_from_directory_with_shapefile(mydir)
|
9562
|
+
elif itemlabel == _('Georeferenced pictures'):
|
9563
|
+
# Création d'une nouvelle collection de photos géoréférencées
|
9564
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9565
|
+
newcollection.load_from_directory_georef_pictures(mydir)
|
9566
|
+
elif itemlabel == _('Pictures + Excel'):
|
9567
|
+
# Création d'une nouvelle collection de photos avec Excel
|
9568
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9569
|
+
newcollection.load_from_directory_with_excel(mydir)
|
9570
|
+
elif itemlabel == _('Wolf vec format'):
|
9571
|
+
# Création d'une nouvelle collection de photos avec format Wolf vec
|
9572
|
+
newcollection = PictureCollection(filename = mydir, parent=self, mapviewer=self)
|
9573
|
+
elif itemlabel == _('URL zip file'):
|
9574
|
+
# Création d'une nouvelle collection de photos à partir d'un fichier zip
|
9575
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9576
|
+
newcollection.load_from_url_zipfile(mydir)
|
9577
|
+
|
9578
|
+
count = 0
|
9579
|
+
for zone in newcollection.myzones:
|
9580
|
+
count += zone.nbvectors
|
9581
|
+
|
9582
|
+
if count == 0:
|
9583
|
+
logging.warning(_('No usable pictures found in the collection !'))
|
9584
|
+
return
|
9585
|
+
|
9586
|
+
self.add_object('picture_collection', newobj=newcollection, ToCheck=True)
|
9587
|
+
|
9429
9588
|
elif itemlabel in [_('Create a drowning...'), _('Add a drowning result...')]:
|
9430
9589
|
|
9431
9590
|
self.newdrowning(itemlabel)
|
@@ -10229,7 +10388,8 @@ class WolfMapViewer(wx.Frame):
|
|
10229
10388
|
'wmsfore',
|
10230
10389
|
'drowning',
|
10231
10390
|
'imagestiles',
|
10232
|
-
'dike'
|
10391
|
+
'dike',
|
10392
|
+
'picture_collection'] = 'array',
|
10233
10393
|
filename='',
|
10234
10394
|
newobj=None,
|
10235
10395
|
ToCheck=True,
|
@@ -10247,7 +10407,7 @@ class WolfMapViewer(wx.Frame):
|
|
10247
10407
|
filterCloud = "xyz (*.xyz)|*.xyz|dxf (*.dxf)|*.dxf|text (*.txt)|*.txt|shp (*.shp)|*.shp|all (*.*)|*.*"
|
10248
10408
|
filterlaz = "laz (*.laz)|*.laz|las (*.las)|*.las|Numpy (*.npz)|*.npz|all (*.*)|*.*"
|
10249
10409
|
filtertri = "tri (*.tri)|*.tri|text (*.txt)|*.txt|dxf (*.dxf)|*.dxf|gltf (*.gltf)|*.gltf|gltf binary (*.glb)|*.glb|*.*'all (*.*)|*.*"
|
10250
|
-
filterCs = "vecz WOLF (*.vecz)|*.vecz|txt 2022 (*.txt)|*.txt|WOLF (*.sxy)|*.sxy|text 2000 (*.txt)|*.txt|all (*.*)|*.*"
|
10410
|
+
filterCs = "vecz WOLF (*.vecz)|*.vecz|txt 2022 (*.txt)|*.txt|WOLF (*.sxy)|*.sxy|text 2000 (*.txt)|*.txt|xlsx 2025 (*.xlsx)|*.xlsx|all (*.*)|*.*"
|
10251
10411
|
filterimage = "Geotif (*.tif)|*.tif|all (*.*)|*.*"
|
10252
10412
|
|
10253
10413
|
if filename == '' and newobj is None:
|
@@ -10290,6 +10450,8 @@ class WolfMapViewer(wx.Frame):
|
|
10290
10450
|
file = wx.DirDialog(self, "Choose directory containing the drowning")
|
10291
10451
|
elif which.lower() == 'dike':
|
10292
10452
|
file = wx.DirDialog(self, "Choose directory", wildcard=filterall)
|
10453
|
+
elif which.lower() == 'picture_collection':
|
10454
|
+
file = wx.DirDialog(self, "Choose directory containing pictures")
|
10293
10455
|
|
10294
10456
|
# FIXME : particularize filters for wmsback and wmsfore
|
10295
10457
|
elif which.lower() == 'wmsback':
|
@@ -10440,6 +10602,19 @@ class WolfMapViewer(wx.Frame):
|
|
10440
10602
|
self.active_array = newobj
|
10441
10603
|
self._set_active_bc()
|
10442
10604
|
|
10605
|
+
elif which.lower() == 'picture_collection':
|
10606
|
+
|
10607
|
+
curdict = self.mypicturecollections
|
10608
|
+
curtree = self.myitemspictcollection
|
10609
|
+
|
10610
|
+
if newobj is None:
|
10611
|
+
newobj = PictureCollection(parent=self, mapviewer=self)
|
10612
|
+
newobj.load_from_directory_with_shapefile(filename)
|
10613
|
+
|
10614
|
+
curdict.append(newobj)
|
10615
|
+
self.active_picturecollection = newobj
|
10616
|
+
self.menu_pictcollection()
|
10617
|
+
|
10443
10618
|
elif which.lower() == 'array_tiles':
|
10444
10619
|
|
10445
10620
|
res = wolfres2DGPU(filename, plotted=False)
|
@@ -10776,8 +10951,13 @@ class WolfMapViewer(wx.Frame):
|
|
10776
10951
|
newobj = crosssections(filename, format='vecz', dirlaz=dirlaz, mapviewer=self)
|
10777
10952
|
elif curfilter == 2: # sxy
|
10778
10953
|
newobj = crosssections(filename, format='sxy', dirlaz=dirlaz, mapviewer=self)
|
10779
|
-
|
10954
|
+
elif curfilter == 3: # txt 2000
|
10780
10955
|
newobj = crosssections(filename, format='2000', dirlaz=dirlaz, mapviewer=self)
|
10956
|
+
elif curfilter == 4: # xlsx
|
10957
|
+
newobj = crosssections(filename, format='2025_xlsx', dirlaz=dirlaz, mapviewer=self)
|
10958
|
+
else:
|
10959
|
+
newobj = crosssections(filename, format='2000', dirlaz=dirlaz, mapviewer=self)
|
10960
|
+
|
10781
10961
|
del wait
|
10782
10962
|
self.myvectors.append(newobj)
|
10783
10963
|
newobj.mapviewer = self
|
@@ -11081,10 +11261,11 @@ class WolfMapViewer(wx.Frame):
|
|
11081
11261
|
# RES2D = 'wolf2d'
|
11082
11262
|
# WMSBACK = 'wms-background'
|
11083
11263
|
# WMSFORE = 'wms-foreground'
|
11264
|
+
# PICTURE_COLLECTION = 'picture collections'
|
11084
11265
|
|
11085
11266
|
if drawing_type is None:
|
11086
11267
|
# return all_lists
|
11087
|
-
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D + self.mydikes + self.mydrownings
|
11268
|
+
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D + self.mydikes + self.mydrownings + self.mypicturecollections
|
11088
11269
|
|
11089
11270
|
if drawing_type == draw_type.ARRAYS:
|
11090
11271
|
return self.myarrays
|
@@ -11116,6 +11297,8 @@ class WolfMapViewer(wx.Frame):
|
|
11116
11297
|
return self.mydrownings
|
11117
11298
|
elif drawing_type == draw_type.DIKE:
|
11118
11299
|
return self.mydikes
|
11300
|
+
elif drawing_type == draw_type.PICTURECOLLECTION:
|
11301
|
+
return self.mypicturecollections
|
11119
11302
|
else:
|
11120
11303
|
logging.error('Unknown drawing type : ' + drawing_type)
|
11121
11304
|
return None
|
@@ -11576,6 +11759,16 @@ class WolfMapViewer(wx.Frame):
|
|
11576
11759
|
if ret == wx.ID_OK:
|
11577
11760
|
self.selected_object.saveas(fdlg.GetPath())
|
11578
11761
|
fdlg.Destroy()
|
11762
|
+
|
11763
|
+
elif type(self.selected_object) in [PictureCollection, Particularites, Enquetes, Ouvrages, Profils]:
|
11764
|
+
filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz"
|
11765
|
+
fdlg = wx.FileDialog(self, "Choose file name for Collection :" + self.selected_object.idx, wildcard=filterArray,
|
11766
|
+
style=wx.FD_SAVE)
|
11767
|
+
ret = fdlg.ShowModal()
|
11768
|
+
if ret == wx.ID_OK:
|
11769
|
+
self.selected_object.saveas(fdlg.GetPath())
|
11770
|
+
fdlg.Destroy()
|
11771
|
+
|
11579
11772
|
elif type(self.selected_object) is Triangulation:
|
11580
11773
|
filterArray = "tri (*.tri)|*.tri|all (*.*)|*.*"
|
11581
11774
|
fdlg = wx.FileDialog(self, "Choose file name for triangulation :" + self.selected_object.idx, wildcard=filterArray,
|
@@ -12118,6 +12311,34 @@ class WolfMapViewer(wx.Frame):
|
|
12118
12311
|
else:
|
12119
12312
|
logging.warning(_('Landmap not initialized'))
|
12120
12313
|
|
12314
|
+
elif isinstance(curobj, Ouvrages):
|
12315
|
+
if curobj.initialized:
|
12316
|
+
self.menu_pictcollection()
|
12317
|
+
logging.info(_('Ouvrages collection initialized'))
|
12318
|
+
else:
|
12319
|
+
logging.warning(_('Ouvrages collection not initialized'))
|
12320
|
+
|
12321
|
+
elif isinstance(curobj, Particularites):
|
12322
|
+
if curobj.initialized:
|
12323
|
+
self.menu_pictcollection()
|
12324
|
+
logging.info(_('Particularites collection initialized'))
|
12325
|
+
else:
|
12326
|
+
logging.warning(_('Particularites collection not initialized'))
|
12327
|
+
|
12328
|
+
elif isinstance(curobj, Enquetes):
|
12329
|
+
if curobj.initialized:
|
12330
|
+
self.menu_pictcollection()
|
12331
|
+
logging.info(_('Enquetes collection initialized'))
|
12332
|
+
else:
|
12333
|
+
logging.warning(_('Enquetes collection not initialized'))
|
12334
|
+
|
12335
|
+
elif isinstance(curobj, Profils):
|
12336
|
+
if curobj.initialized:
|
12337
|
+
self.menu_pictcollection()
|
12338
|
+
logging.info(_('Profils collection initialized'))
|
12339
|
+
else:
|
12340
|
+
logging.warning(_('Profils collection not initialized'))
|
12341
|
+
|
12121
12342
|
except Exception as ex:
|
12122
12343
|
wx.LogMessage(str(ex))
|
12123
12344
|
wx.MessageBox(str(ex), _("Error"), wx.ICON_ERROR)
|
@@ -12338,6 +12559,28 @@ class WolfMapViewer(wx.Frame):
|
|
12338
12559
|
self.active_landmap.load_texture(x,y, which='low')
|
12339
12560
|
self.Refresh()
|
12340
12561
|
|
12562
|
+
elif self.action == 'pick a picture':
|
12563
|
+
# Pick a picture
|
12564
|
+
|
12565
|
+
if self.active_picturecollection is None:
|
12566
|
+
logging.warning(_('No picture collection available -- Please activate the data and retry !'))
|
12567
|
+
return
|
12568
|
+
|
12569
|
+
vec = self.active_picturecollection.find_vector_containing_point(x, y)
|
12570
|
+
vec.myprop.imagevisible = not vec.myprop.imagevisible
|
12571
|
+
|
12572
|
+
if shiftdown:
|
12573
|
+
# show/hide the legend
|
12574
|
+
vec.myprop.legendvisible = not vec.myprop.legendvisible
|
12575
|
+
|
12576
|
+
vec.myprop.update_myprops()
|
12577
|
+
# vec.myprop.load_unload_image()
|
12578
|
+
vec.parentzone.reset_listogl()
|
12579
|
+
|
12580
|
+
self.active_picturecollection.Activate_vector(vec)
|
12581
|
+
|
12582
|
+
self.Refresh()
|
12583
|
+
|
12341
12584
|
elif self.action == 'pick bridge':
|
12342
12585
|
self.pick_bridge(x, y)
|
12343
12586
|
|
@@ -12546,6 +12789,28 @@ class WolfMapViewer(wx.Frame):
|
|
12546
12789
|
self.active_vector.find_minmax()
|
12547
12790
|
self.active_zone.find_minmax()
|
12548
12791
|
|
12792
|
+
elif self.action == 'offset/scale image':
|
12793
|
+
|
12794
|
+
if self.active_vector is None:
|
12795
|
+
logging.warning(_('No vector selected -- Please select a vector first !'))
|
12796
|
+
return
|
12797
|
+
|
12798
|
+
if self.active_vector.myprop.textureimage is None:
|
12799
|
+
logging.warning(_('No image available -- Please load an image first !'))
|
12800
|
+
return
|
12801
|
+
|
12802
|
+
if self.active_vector._move_start is None:
|
12803
|
+
self.active_vector._move_start = (x, y)
|
12804
|
+
return
|
12805
|
+
|
12806
|
+
delta_x = x - self.active_vector._move_start[0]
|
12807
|
+
delta_y = y - self.active_vector._move_start[1]
|
12808
|
+
|
12809
|
+
self.active_vector.myprop.offset_image(delta_x, delta_y)
|
12810
|
+
self.active_vector.myprop.update_myprops()
|
12811
|
+
self.active_vector._move_start = None
|
12812
|
+
self.end_action(_('End offset/scale image'))
|
12813
|
+
|
12549
12814
|
elif self.action == 'move vector':
|
12550
12815
|
|
12551
12816
|
if self.active_vector is None:
|
@@ -12749,6 +13014,24 @@ class WolfMapViewer(wx.Frame):
|
|
12749
13014
|
self.Refresh()
|
12750
13015
|
return
|
12751
13016
|
|
13017
|
+
elif shiftdown:
|
13018
|
+
|
13019
|
+
if self.active_vector is None:
|
13020
|
+
logging.warning(_('No vector selected -- Please select a vector first !'))
|
13021
|
+
return
|
13022
|
+
|
13023
|
+
if self.active_vector.myprop.textureimage is None:
|
13024
|
+
logging.warning(_('No image available -- Please load an image first !'))
|
13025
|
+
return
|
13026
|
+
|
13027
|
+
self.active_vector.myprop.image_scale /= (1 - .1 * (r / max(d, 1)))
|
13028
|
+
# limit to 1. or upper
|
13029
|
+
self.active_vector.myprop.image_scale = max(self.active_vector.myprop.image_scale, 1.)
|
13030
|
+
self.active_vector.myprop.update_myprops()
|
13031
|
+
self.active_vector.myprop.update_image_texture()
|
13032
|
+
self.Refresh()
|
13033
|
+
return
|
13034
|
+
|
12752
13035
|
# Allow the user to zoom onto the pixel where the
|
12753
13036
|
# mouse cursor is
|
12754
13037
|
|
@@ -12780,6 +13063,13 @@ class WolfMapViewer(wx.Frame):
|
|
12780
13063
|
self.setbounds()
|
12781
13064
|
|
12782
13065
|
def On_Right_Double_Clicks(self, e):
|
13066
|
+
|
13067
|
+
pos = e.GetPosition()
|
13068
|
+
ctrldown = e.ControlDown()
|
13069
|
+
altdown = e.AltDown()
|
13070
|
+
shiftdown = e.ShiftDown()
|
13071
|
+
x, y = self.getXY(pos)
|
13072
|
+
|
12783
13073
|
self._endactions()
|
12784
13074
|
|
12785
13075
|
def On_Left_Double_Clicks(self, e:wx.MouseEvent):
|
@@ -12892,6 +13182,12 @@ class WolfMapViewer(wx.Frame):
|
|
12892
13182
|
if ctrl:
|
12893
13183
|
myobj.show_properties()
|
12894
13184
|
|
13185
|
+
elif type(myobj) == PictureCollection:
|
13186
|
+
self.active_picturecollection = myobj
|
13187
|
+
|
13188
|
+
if ctrl:
|
13189
|
+
myobj.show_properties()
|
13190
|
+
|
12895
13191
|
elif type(myobj) == Wolf_LAZ_Data:
|
12896
13192
|
|
12897
13193
|
self.active_laz = myobj
|
@@ -12914,6 +13210,9 @@ class WolfMapViewer(wx.Frame):
|
|
12914
13210
|
elif isinstance(myobj, PlansTerrier):
|
12915
13211
|
self.active_landmap = myobj
|
12916
13212
|
|
13213
|
+
elif isinstance(myobj, Particularites | Enquetes | Ouvrages | Profils):
|
13214
|
+
self.active_picturecollection = myobj
|
13215
|
+
|
12917
13216
|
elif type(myobj) == hydrometry_wolfgui:
|
12918
13217
|
if ctrl:
|
12919
13218
|
myobj.show_properties()
|
@@ -13397,6 +13696,22 @@ class WolfMapViewer(wx.Frame):
|
|
13397
13696
|
if self.mousedown[0] == -99999: # only if the mouse was clicked before
|
13398
13697
|
self.mousedown = [x, y]
|
13399
13698
|
|
13699
|
+
if shiftdown:
|
13700
|
+
if self.active_vector is None:
|
13701
|
+
logging.warning(_('Shift key pressed but no active vector -- Please select a vector first !'))
|
13702
|
+
return
|
13703
|
+
if self.active_vector.myprop.textureimage is None:
|
13704
|
+
logging.warning(_('Shift key pressed but no image texture -- Please select a vector with an image first !'))
|
13705
|
+
return
|
13706
|
+
# We move the image texture
|
13707
|
+
delta_x = x - self.mousedown[0]
|
13708
|
+
delta_y = y - self.mousedown[1]
|
13709
|
+
self.active_vector.myprop._offset_image_texture(delta_x, delta_y)
|
13710
|
+
self.active_vector.myprop.update_myprops()
|
13711
|
+
self.active_vector.myprop.update_image_texture()
|
13712
|
+
self.Refresh()
|
13713
|
+
return
|
13714
|
+
|
13400
13715
|
self.mousex -= x - self.mousedown[0]
|
13401
13716
|
self.mousey -= y - self.mousedown[1]
|
13402
13717
|
|
@@ -13544,6 +13859,10 @@ class WolfMapViewer(wx.Frame):
|
|
13544
13859
|
# Store the position of the mouse as last known position
|
13545
13860
|
self._last_mouse_pos = (x,y,pos)
|
13546
13861
|
|
13862
|
+
if self.active_vector is not None:
|
13863
|
+
if self.active_vector.myprop.textureimage is not None:
|
13864
|
+
self.active_vector.myprop._reset_cached_offset()
|
13865
|
+
|
13547
13866
|
# Update the tooltip with the values of the active arrays and results at position x,y
|
13548
13867
|
self._update_mytooltip()
|
13549
13868
|
|
@@ -13668,6 +13987,7 @@ class WolfMapViewer(wx.Frame):
|
|
13668
13987
|
|
13669
13988
|
if 'select by tmp vector' in locaction or 'select by vector' in locaction:
|
13670
13989
|
inside_under = 'inside' in self.action
|
13990
|
+
outside_under = 'outside' in self.action
|
13671
13991
|
|
13672
13992
|
self.end_action(_('End of vector selection'))
|
13673
13993
|
|
@@ -13676,6 +13996,9 @@ class WolfMapViewer(wx.Frame):
|
|
13676
13996
|
if inside_under:
|
13677
13997
|
self.active_vector.close_force()
|
13678
13998
|
self.active_array.SelectionData.select_insidepoly(self.active_vector)
|
13999
|
+
elif outside_under:
|
14000
|
+
self.active_vector.close_force()
|
14001
|
+
self.active_array.SelectionData.select_outsidepoly(self.active_vector)
|
13679
14002
|
else:
|
13680
14003
|
self.active_array.SelectionData.select_underpoly(self.active_vector)
|
13681
14004
|
|
@@ -14468,7 +14791,7 @@ class WolfMapViewer(wx.Frame):
|
|
14468
14791
|
self.active_array.SelectionData.myselection = 'all'
|
14469
14792
|
elif len(cursel) > 0:
|
14470
14793
|
self.active_array.SelectionData.myselection = cursel.copy()
|
14471
|
-
self.active_array.SelectionData.update_nb_nodes_selection()
|
14794
|
+
# self.active_array.SelectionData.update_nb_nodes_selection()
|
14472
14795
|
|
14473
14796
|
else:
|
14474
14797
|
logging.info(_('Paste selection values'))
|
@@ -15078,6 +15401,9 @@ class WolfMapViewer(wx.Frame):
|
|
15078
15401
|
# Dessin du Front
|
15079
15402
|
self._plotting(draw_type.WMSFORE)
|
15080
15403
|
|
15404
|
+
# Dessin des images
|
15405
|
+
self._plotting(draw_type.PICTURECOLLECTION)
|
15406
|
+
|
15081
15407
|
# Gestion des BC (si actif)
|
15082
15408
|
if self.active_bc is not None:
|
15083
15409
|
self.active_bc.plot()
|
@@ -15171,6 +15497,15 @@ class WolfMapViewer(wx.Frame):
|
|
15171
15497
|
ymax = max(locvector.ymax, ymax)
|
15172
15498
|
k += 1
|
15173
15499
|
|
15500
|
+
for locvector in self.mypicturecollections:
|
15501
|
+
if locvector.plotted or force:
|
15502
|
+
locvector.find_minmax()
|
15503
|
+
xmin = min(locvector.xmin, xmin)
|
15504
|
+
xmax = max(locvector.xmax, xmax)
|
15505
|
+
ymin = min(locvector.ymin, ymin)
|
15506
|
+
ymax = max(locvector.ymax, ymax)
|
15507
|
+
k += 1
|
15508
|
+
|
15174
15509
|
for locvector in self.mytiles:
|
15175
15510
|
if locvector.plotted or force:
|
15176
15511
|
if locvector.idx != 'grid':
|
@@ -15252,6 +15587,13 @@ class WolfMapViewer(wx.Frame):
|
|
15252
15587
|
ymin = min(locothers.ymin, ymin)
|
15253
15588
|
ymax = max(locothers.ymax, ymax)
|
15254
15589
|
k += 1
|
15590
|
+
elif type(locothers) in [Particularites, Enquetes, Ouvrages, Profils]:
|
15591
|
+
if locothers.initialized:
|
15592
|
+
xmin = min(locothers.xmin, xmin)
|
15593
|
+
xmax = max(locothers.xmax, xmax)
|
15594
|
+
ymin = min(locothers.ymin, ymin)
|
15595
|
+
ymax = max(locothers.ymax, ymax)
|
15596
|
+
k += 1
|
15255
15597
|
|
15256
15598
|
for drown in self.mydrownings:
|
15257
15599
|
if drown.plotted or force:
|
wolfhece/PyGui.py
CHANGED
@@ -70,7 +70,7 @@ try:
|
|
70
70
|
from .hydrology.forcedexchanges import forced_exchanges
|
71
71
|
from .PyParams import Wolf_Param
|
72
72
|
from .picc import Picc_data, Cadaster_data
|
73
|
-
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier
|
73
|
+
from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier, Ouvrages, Enquetes, Particularites, Profils
|
74
74
|
from .CpGrid import CpGrid
|
75
75
|
from .mesh2d.gpu_2d import Sim_2D_GPU
|
76
76
|
from .mesh2d.wolf2dprev import prev_sim2D
|
@@ -228,6 +228,48 @@ class MapManager(GenMapManager):
|
|
228
228
|
newobj=self.landmaps,
|
229
229
|
ToCheck=False,
|
230
230
|
id='Land maps')
|
231
|
+
|
232
|
+
config = self.get_configuration()
|
233
|
+
if config is None:
|
234
|
+
hece_db_path = None
|
235
|
+
else:
|
236
|
+
hece_db_path = Path(config[ConfigurationKeys.XLSX_HECE_DATABASE])
|
237
|
+
|
238
|
+
if hece_db_path is not None:
|
239
|
+
|
240
|
+
self.ouvragesponts = Ouvrages(mapviewer=self.mapviewer, parent = self.mapviewer, idx='Pictures - bridge', plotted=True)
|
241
|
+
logging.info("MapManager - Ouvrages Ponts created")
|
242
|
+
self.ouvragessuiles= Ouvrages(mapviewer=self.mapviewer, parent = self.mapviewer, idx='Pictures - weirs', plotted=True)
|
243
|
+
logging.info("MapManager - Ouvrages Seuils created")
|
244
|
+
self.enquetes = Enquetes(mapviewer=self.mapviewer, parent = self.mapviewer, idx='Surveys', plotted=True)
|
245
|
+
logging.info("MapManager - Enquetes created")
|
246
|
+
self.particularites = Particularites(mapviewer=self.mapviewer, parent = self.mapviewer, idx='Features', plotted=True)
|
247
|
+
logging.info("MapManager - Particularites created")
|
248
|
+
self.profils = Profils(mapviewer=self.mapviewer, parent = self.mapviewer, idx='CrossSections', plotted=True)
|
249
|
+
logging.info("MapManager - PlansTerrier created")
|
250
|
+
|
251
|
+
self.mapviewer.add_object(which='other',
|
252
|
+
newobj=self.ouvragesponts,
|
253
|
+
ToCheck=False,
|
254
|
+
id=_('Pictures "bridge"'))
|
255
|
+
self.mapviewer.add_object(which='other',
|
256
|
+
newobj=self.ouvragessuiles,
|
257
|
+
ToCheck=False,
|
258
|
+
id=_('Pictures "weirs"'))
|
259
|
+
self.mapviewer.add_object(which='other',
|
260
|
+
newobj=self.enquetes,
|
261
|
+
ToCheck=False,
|
262
|
+
id=_('Pictures "surveys"'))
|
263
|
+
self.mapviewer.add_object(which='other',
|
264
|
+
newobj=self.particularites,
|
265
|
+
ToCheck=False,
|
266
|
+
id=_('Pictures "features"'))
|
267
|
+
|
268
|
+
self.mapviewer.add_object(which='other',
|
269
|
+
newobj=self.profils,
|
270
|
+
ToCheck=False,
|
271
|
+
id='Pictures "Cross sections"')
|
272
|
+
|
231
273
|
except:
|
232
274
|
logging.warning("Can't load some data (hydrometry, picc, cadaster, landmaps) -- Please check the data directories and/or report the issue")
|
233
275
|
|