wolfhece 2.2.32__py3-none-any.whl → 2.2.34__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/PyDraw.py +329 -4
- wolfhece/PyGui.py +35 -1
- wolfhece/PyPictures.py +420 -3
- wolfhece/PyVertexvectors.py +153 -11
- wolfhece/Results2DGPU.py +10 -1
- wolfhece/apps/version.py +1 -1
- wolfhece/pydownloader.py +82 -0
- wolfhece/textpillow.py +1 -1
- wolfhece/wolf_texture.py +81 -13
- wolfhece/wolf_zi_db.py +586 -2
- {wolfhece-2.2.32.dist-info → wolfhece-2.2.34.dist-info}/METADATA +1 -1
- {wolfhece-2.2.32.dist-info → wolfhece-2.2.34.dist-info}/RECORD +16 -16
- {wolfhece-2.2.32.dist-info → wolfhece-2.2.34.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.32.dist-info → wolfhece-2.2.34.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.32.dist-info → wolfhece-2.2.34.dist-info}/top_level.txt +0 -0
wolfhece/PyConfig.py
CHANGED
@@ -37,6 +37,7 @@ class ConfigurationKeys(Enum):
|
|
37
37
|
DIRECTORY_LAZ = "Default LAZ directory"
|
38
38
|
ACTIVE_VECTOR_COLOR = "Active vector color"
|
39
39
|
ACTIVE_VECTOR_SIZE_SQUARE = "Active vector square size"
|
40
|
+
XLSX_HECE_DATABASE = "Hece Database XLSX file"
|
40
41
|
|
41
42
|
class WolfConfiguration:
|
42
43
|
""" Holds the PyWolf configuration """
|
@@ -86,8 +87,8 @@ class WolfConfiguration:
|
|
86
87
|
ConfigurationKeys.DIRECTORY_DTM.value: "",
|
87
88
|
ConfigurationKeys.DIRECTORY_LAZ.value: "",
|
88
89
|
ConfigurationKeys.ACTIVE_VECTOR_COLOR.value: [0, 0, 0, 255],
|
89
|
-
ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE.value: 5
|
90
|
-
|
90
|
+
ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE.value: 5,
|
91
|
+
ConfigurationKeys.XLSX_HECE_DATABASE.value: ""
|
91
92
|
}
|
92
93
|
self._types = {
|
93
94
|
ConfigurationKeys.VERSION.value: int,
|
@@ -104,7 +105,8 @@ class WolfConfiguration:
|
|
104
105
|
ConfigurationKeys.DIRECTORY_DTM.value: str,
|
105
106
|
ConfigurationKeys.DIRECTORY_LAZ.value: str,
|
106
107
|
ConfigurationKeys.ACTIVE_VECTOR_COLOR.value: list,
|
107
|
-
ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE.value: int
|
108
|
+
ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE.value: int,
|
109
|
+
ConfigurationKeys.XLSX_HECE_DATABASE.value: str
|
108
110
|
}
|
109
111
|
|
110
112
|
self._check_config()
|
@@ -169,6 +171,7 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
169
171
|
self.cfg_directory_laz.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_LAZ]))
|
170
172
|
self.cfg_vector_color.SetColour(configuration[ConfigurationKeys.ACTIVE_VECTOR_COLOR])
|
171
173
|
self.cfg_square_size.SetValue(str(configuration[ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE]))
|
174
|
+
self.cfg_xlsx_hece_database.SetValue(str(configuration[ConfigurationKeys.XLSX_HECE_DATABASE]))
|
172
175
|
|
173
176
|
def pull_configuration(self, configuration):
|
174
177
|
configuration[ConfigurationKeys.PLAY_WELCOME_SOUND] = self.cfg_welcome_voice.IsChecked()
|
@@ -185,6 +188,7 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
185
188
|
configuration[ConfigurationKeys.DIRECTORY_LAZ] = str(self.cfg_directory_laz.Value)
|
186
189
|
configuration[ConfigurationKeys.ACTIVE_VECTOR_COLOR] = list(self.cfg_vector_color.GetColour())
|
187
190
|
configuration[ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE] = int(self.cfg_square_size.Value)
|
191
|
+
configuration[ConfigurationKeys.XLSX_HECE_DATABASE] = str(self.cfg_xlsx_hece_database.Value)
|
188
192
|
|
189
193
|
def InitUI(self):
|
190
194
|
|
@@ -304,9 +308,20 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
304
308
|
dir_laz.Add(self.cfg_directory_laz, 1, wx.EXPAND, 5)
|
305
309
|
dir_laz.Add(self.btn_choose_laz, 1, wx.EXPAND, 5)
|
306
310
|
|
311
|
+
# XLSX HECE database
|
312
|
+
dir_xlsx = wx.BoxSizer(wx.HORIZONTAL)
|
313
|
+
self.label_xlsx_hece_database = wx.StaticText(pnl, label=_('HECE Database file'))
|
314
|
+
self.cfg_xlsx_hece_database = wx.TextCtrl(pnl, value='', style=wx.TE_CENTRE)
|
315
|
+
self.btn_choose_xlsx = wx.Button(pnl, label=_('Choose'))
|
316
|
+
self.btn_choose_xlsx.Bind(wx.EVT_BUTTON, self.OnChooseXLSX)
|
317
|
+
dir_xlsx.Add(self.label_xlsx_hece_database, 1, wx.EXPAND, 2)
|
318
|
+
dir_xlsx.Add(self.cfg_xlsx_hece_database, 1, wx.EXPAND, 5)
|
319
|
+
dir_xlsx.Add(self.btn_choose_xlsx, 1, wx.EXPAND, 5)
|
320
|
+
|
307
321
|
sbs.Add(dir_dem, 1, wx.EXPAND, 5)
|
308
322
|
sbs.Add(dir_dtm, 1, wx.EXPAND, 5)
|
309
323
|
sbs.Add(dir_laz, 1, wx.EXPAND, 5)
|
324
|
+
sbs.Add(dir_xlsx, 1, wx.EXPAND, 5)
|
310
325
|
|
311
326
|
# Vector color
|
312
327
|
color_vector = wx.BoxSizer(wx.HORIZONTAL)
|
@@ -364,6 +379,14 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
364
379
|
self.cfg_directory_laz.SetValue(str(dlg.GetPath()))
|
365
380
|
dlg.Destroy()
|
366
381
|
|
382
|
+
def OnChooseXLSX(self, e):
|
383
|
+
""" Choose a XLSX file for HECE database """
|
384
|
+
dlg = wx.FileDialog(self, _("Choose a HECE database file"), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
385
|
+
dlg.SetWildcard("Excel files (*.xlsx)|*.xlsx")
|
386
|
+
if dlg.ShowModal() == wx.ID_OK:
|
387
|
+
self.cfg_xlsx_hece_database.SetValue(str(dlg.GetPath()))
|
388
|
+
dlg.Destroy()
|
389
|
+
|
367
390
|
def OnOk(self, e):
|
368
391
|
if self.IsModal():
|
369
392
|
self.EndModal(wx.ID_OK)
|
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
|
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:
|
@@ -4244,6 +4321,15 @@ class WolfMapViewer(wx.Frame):
|
|
4244
4321
|
else:
|
4245
4322
|
return Path(config[ConfigurationKeys.DIRECTORY_LAZ])
|
4246
4323
|
|
4324
|
+
@property
|
4325
|
+
def default_hece_database(self) -> Path:
|
4326
|
+
""" Return the default HECE database file from configs """
|
4327
|
+
config = self.get_configuration()
|
4328
|
+
if config is None:
|
4329
|
+
return Path('')
|
4330
|
+
else:
|
4331
|
+
return Path(config[ConfigurationKeys.XLSX_HECE_DATABASE])
|
4332
|
+
|
4247
4333
|
@property
|
4248
4334
|
def bkg_color(self):
|
4249
4335
|
""" Return the background color from configs """
|
@@ -5158,6 +5244,7 @@ class WolfMapViewer(wx.Frame):
|
|
5158
5244
|
self.mylazdata = []
|
5159
5245
|
self.mydrownings = []
|
5160
5246
|
self.mydikes = []
|
5247
|
+
self.mypicturecollections = []
|
5161
5248
|
|
5162
5249
|
self.mymplfigs = []
|
5163
5250
|
|
@@ -8639,7 +8726,7 @@ class WolfMapViewer(wx.Frame):
|
|
8639
8726
|
return
|
8640
8727
|
|
8641
8728
|
try:
|
8642
|
-
plotzone:list[zone]
|
8729
|
+
# plotzone:list[zone]
|
8643
8730
|
plotzone = []
|
8644
8731
|
zonename = self.active_zone.myname
|
8645
8732
|
if '_left_' in zonename or '_right_' in zonename:
|
@@ -9426,6 +9513,77 @@ class WolfMapViewer(wx.Frame):
|
|
9426
9513
|
elif itemlabel in [_('Create dike...'), _('Add dike...')]:
|
9427
9514
|
self.new_dike(itemlabel)
|
9428
9515
|
|
9516
|
+
elif itemlabel in [_('Add picture collection...')]:
|
9517
|
+
# Création d'une nouvelle collection de photos
|
9518
|
+
|
9519
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the type of picture collection'), _('Picture Collection'),
|
9520
|
+
[_('Pictures + shapefile'),
|
9521
|
+
_('Wolf vec format'),
|
9522
|
+
_('Georeferenced pictures'),
|
9523
|
+
_('Pictures + Excel'),
|
9524
|
+
_('URL zip file')])
|
9525
|
+
ret = dlg.ShowModal()
|
9526
|
+
if ret == wx.ID_CANCEL:
|
9527
|
+
dlg.Destroy()
|
9528
|
+
return
|
9529
|
+
|
9530
|
+
itemlabel = dlg.GetStringSelection()
|
9531
|
+
dlg.Destroy()
|
9532
|
+
|
9533
|
+
if itemlabel in [_('Pictures + shapefile'), _('Georeferenced pictures'), _('Pictures + Excel')]:
|
9534
|
+
dlgdir = wx.DirDialog(self, _('Choose directory to scan for pictures'))
|
9535
|
+
if dlgdir.ShowModal() == wx.ID_CANCEL:
|
9536
|
+
dlgdir.Destroy()
|
9537
|
+
return
|
9538
|
+
mydir = dlgdir.GetPath()
|
9539
|
+
dlgdir.Destroy()
|
9540
|
+
elif itemlabel == _('URL zip file'):
|
9541
|
+
# Demande de l'URL du fichier zip
|
9542
|
+
dlgurl = wx.TextEntryDialog(self, _('Enter the URL of the zip file containing the pictures'), _('URL zip file'))
|
9543
|
+
if dlgurl.ShowModal() == wx.ID_CANCEL:
|
9544
|
+
dlgurl.Destroy()
|
9545
|
+
return
|
9546
|
+
mydir = dlgurl.GetValue()
|
9547
|
+
dlgurl.Destroy()
|
9548
|
+
else:
|
9549
|
+
dlgfile = wx.FileDialog(self, _('Choose shapefile'), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
|
9550
|
+
wildcard='Wolf vec (*.vec)| *.vec|Wolf vecz (*.vecz)|*.vecz|All files (*.*)|*.*')
|
9551
|
+
if dlgfile.ShowModal() == wx.ID_CANCEL:
|
9552
|
+
dlgfile.Destroy()
|
9553
|
+
return
|
9554
|
+
mydir = dlgfile.GetPath()
|
9555
|
+
dlgfile.Destroy()
|
9556
|
+
|
9557
|
+
if itemlabel == _('Pictures + shapefile'):
|
9558
|
+
# Création d'une nouvelle collection de photos avec shapefile
|
9559
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9560
|
+
newcollection.load_from_directory_with_shapefile(mydir)
|
9561
|
+
elif itemlabel == _('Georeferenced pictures'):
|
9562
|
+
# Création d'une nouvelle collection de photos géoréférencées
|
9563
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9564
|
+
newcollection.load_from_directory_georef_pictures(mydir)
|
9565
|
+
elif itemlabel == _('Pictures + Excel'):
|
9566
|
+
# Création d'une nouvelle collection de photos avec Excel
|
9567
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9568
|
+
newcollection.load_from_directory_with_excel(mydir)
|
9569
|
+
elif itemlabel == _('Wolf vec format'):
|
9570
|
+
# Création d'une nouvelle collection de photos avec format Wolf vec
|
9571
|
+
newcollection = PictureCollection(filename = mydir, parent=self, mapviewer=self)
|
9572
|
+
elif itemlabel == _('URL zip file'):
|
9573
|
+
# Création d'une nouvelle collection de photos à partir d'un fichier zip
|
9574
|
+
newcollection = PictureCollection(parent=self, mapviewer=self)
|
9575
|
+
newcollection.load_from_url_zipfile(mydir)
|
9576
|
+
|
9577
|
+
count = 0
|
9578
|
+
for zone in newcollection.myzones:
|
9579
|
+
count += zone.nbvectors
|
9580
|
+
|
9581
|
+
if count == 0:
|
9582
|
+
logging.warning(_('No usable pictures found in the collection !'))
|
9583
|
+
return
|
9584
|
+
|
9585
|
+
self.add_object('picture_collection', newobj=newcollection, ToCheck=True)
|
9586
|
+
|
9429
9587
|
elif itemlabel in [_('Create a drowning...'), _('Add a drowning result...')]:
|
9430
9588
|
|
9431
9589
|
self.newdrowning(itemlabel)
|
@@ -10229,7 +10387,8 @@ class WolfMapViewer(wx.Frame):
|
|
10229
10387
|
'wmsfore',
|
10230
10388
|
'drowning',
|
10231
10389
|
'imagestiles',
|
10232
|
-
'dike'
|
10390
|
+
'dike',
|
10391
|
+
'picture_collection'] = 'array',
|
10233
10392
|
filename='',
|
10234
10393
|
newobj=None,
|
10235
10394
|
ToCheck=True,
|
@@ -10290,6 +10449,8 @@ class WolfMapViewer(wx.Frame):
|
|
10290
10449
|
file = wx.DirDialog(self, "Choose directory containing the drowning")
|
10291
10450
|
elif which.lower() == 'dike':
|
10292
10451
|
file = wx.DirDialog(self, "Choose directory", wildcard=filterall)
|
10452
|
+
elif which.lower() == 'picture_collection':
|
10453
|
+
file = wx.DirDialog(self, "Choose directory containing pictures")
|
10293
10454
|
|
10294
10455
|
# FIXME : particularize filters for wmsback and wmsfore
|
10295
10456
|
elif which.lower() == 'wmsback':
|
@@ -10440,6 +10601,19 @@ class WolfMapViewer(wx.Frame):
|
|
10440
10601
|
self.active_array = newobj
|
10441
10602
|
self._set_active_bc()
|
10442
10603
|
|
10604
|
+
elif which.lower() == 'picture_collection':
|
10605
|
+
|
10606
|
+
curdict = self.mypicturecollections
|
10607
|
+
curtree = self.myitemspictcollection
|
10608
|
+
|
10609
|
+
if newobj is None:
|
10610
|
+
newobj = PictureCollection(parent=self, mapviewer=self)
|
10611
|
+
newobj.load_from_directory_with_shapefile(filename)
|
10612
|
+
|
10613
|
+
curdict.append(newobj)
|
10614
|
+
self.active_picturecollection = newobj
|
10615
|
+
self.menu_pictcollection()
|
10616
|
+
|
10443
10617
|
elif which.lower() == 'array_tiles':
|
10444
10618
|
|
10445
10619
|
res = wolfres2DGPU(filename, plotted=False)
|
@@ -11081,10 +11255,11 @@ class WolfMapViewer(wx.Frame):
|
|
11081
11255
|
# RES2D = 'wolf2d'
|
11082
11256
|
# WMSBACK = 'wms-background'
|
11083
11257
|
# WMSFORE = 'wms-foreground'
|
11258
|
+
# PICTURE_COLLECTION = 'picture collections'
|
11084
11259
|
|
11085
11260
|
if drawing_type is None:
|
11086
11261
|
# 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
|
11262
|
+
return self.myarrays + self.myvectors + self.myclouds + self.mytri + self.mypartsystems + self.myothers + self.myviews + self.myres2D + self.mydikes + self.mydrownings + self.mypicturecollections
|
11088
11263
|
|
11089
11264
|
if drawing_type == draw_type.ARRAYS:
|
11090
11265
|
return self.myarrays
|
@@ -11116,6 +11291,8 @@ class WolfMapViewer(wx.Frame):
|
|
11116
11291
|
return self.mydrownings
|
11117
11292
|
elif drawing_type == draw_type.DIKE:
|
11118
11293
|
return self.mydikes
|
11294
|
+
elif drawing_type == draw_type.PICTURECOLLECTION:
|
11295
|
+
return self.mypicturecollections
|
11119
11296
|
else:
|
11120
11297
|
logging.error('Unknown drawing type : ' + drawing_type)
|
11121
11298
|
return None
|
@@ -11576,6 +11753,16 @@ class WolfMapViewer(wx.Frame):
|
|
11576
11753
|
if ret == wx.ID_OK:
|
11577
11754
|
self.selected_object.saveas(fdlg.GetPath())
|
11578
11755
|
fdlg.Destroy()
|
11756
|
+
|
11757
|
+
elif type(self.selected_object) in [PictureCollection, Particularites, Enquetes, Ouvrages]:
|
11758
|
+
filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz"
|
11759
|
+
fdlg = wx.FileDialog(self, "Choose file name for Collection :" + self.selected_object.idx, wildcard=filterArray,
|
11760
|
+
style=wx.FD_SAVE)
|
11761
|
+
ret = fdlg.ShowModal()
|
11762
|
+
if ret == wx.ID_OK:
|
11763
|
+
self.selected_object.saveas(fdlg.GetPath())
|
11764
|
+
fdlg.Destroy()
|
11765
|
+
|
11579
11766
|
elif type(self.selected_object) is Triangulation:
|
11580
11767
|
filterArray = "tri (*.tri)|*.tri|all (*.*)|*.*"
|
11581
11768
|
fdlg = wx.FileDialog(self, "Choose file name for triangulation :" + self.selected_object.idx, wildcard=filterArray,
|
@@ -12118,6 +12305,27 @@ class WolfMapViewer(wx.Frame):
|
|
12118
12305
|
else:
|
12119
12306
|
logging.warning(_('Landmap not initialized'))
|
12120
12307
|
|
12308
|
+
elif isinstance(curobj, Ouvrages):
|
12309
|
+
if curobj.initialized:
|
12310
|
+
self.menu_pictcollection()
|
12311
|
+
logging.info(_('Ouvrages collection initialized'))
|
12312
|
+
else:
|
12313
|
+
logging.warning(_('Ouvrages collection not initialized'))
|
12314
|
+
|
12315
|
+
elif isinstance(curobj, Particularites):
|
12316
|
+
if curobj.initialized:
|
12317
|
+
self.menu_pictcollection()
|
12318
|
+
logging.info(_('Particularites collection initialized'))
|
12319
|
+
else:
|
12320
|
+
logging.warning(_('Particularites collection not initialized'))
|
12321
|
+
|
12322
|
+
elif isinstance(curobj, Enquetes):
|
12323
|
+
if curobj.initialized:
|
12324
|
+
self.menu_pictcollection()
|
12325
|
+
logging.info(_('Enquetes collection initialized'))
|
12326
|
+
else:
|
12327
|
+
logging.warning(_('Enquetes collection not initialized'))
|
12328
|
+
|
12121
12329
|
except Exception as ex:
|
12122
12330
|
wx.LogMessage(str(ex))
|
12123
12331
|
wx.MessageBox(str(ex), _("Error"), wx.ICON_ERROR)
|
@@ -12338,6 +12546,28 @@ class WolfMapViewer(wx.Frame):
|
|
12338
12546
|
self.active_landmap.load_texture(x,y, which='low')
|
12339
12547
|
self.Refresh()
|
12340
12548
|
|
12549
|
+
elif self.action == 'pick a picture':
|
12550
|
+
# Pick a picture
|
12551
|
+
|
12552
|
+
if self.active_picturecollection is None:
|
12553
|
+
logging.warning(_('No picture collection available -- Please activate the data and retry !'))
|
12554
|
+
return
|
12555
|
+
|
12556
|
+
vec = self.active_picturecollection.find_vector_containing_point(x, y)
|
12557
|
+
vec.myprop.imagevisible = not vec.myprop.imagevisible
|
12558
|
+
|
12559
|
+
if shiftdown:
|
12560
|
+
# show/hide the legend
|
12561
|
+
vec.myprop.legendvisible = not vec.myprop.legendvisible
|
12562
|
+
|
12563
|
+
vec.myprop.update_myprops()
|
12564
|
+
# vec.myprop.load_unload_image()
|
12565
|
+
vec.parentzone.reset_listogl()
|
12566
|
+
|
12567
|
+
self.active_picturecollection.Activate_vector(vec)
|
12568
|
+
|
12569
|
+
self.Refresh()
|
12570
|
+
|
12341
12571
|
elif self.action == 'pick bridge':
|
12342
12572
|
self.pick_bridge(x, y)
|
12343
12573
|
|
@@ -12546,6 +12776,28 @@ class WolfMapViewer(wx.Frame):
|
|
12546
12776
|
self.active_vector.find_minmax()
|
12547
12777
|
self.active_zone.find_minmax()
|
12548
12778
|
|
12779
|
+
elif self.action == 'offset/scale image':
|
12780
|
+
|
12781
|
+
if self.active_vector is None:
|
12782
|
+
logging.warning(_('No vector selected -- Please select a vector first !'))
|
12783
|
+
return
|
12784
|
+
|
12785
|
+
if self.active_vector.myprop.textureimage is None:
|
12786
|
+
logging.warning(_('No image available -- Please load an image first !'))
|
12787
|
+
return
|
12788
|
+
|
12789
|
+
if self.active_vector._move_start is None:
|
12790
|
+
self.active_vector._move_start = (x, y)
|
12791
|
+
return
|
12792
|
+
|
12793
|
+
delta_x = x - self.active_vector._move_start[0]
|
12794
|
+
delta_y = y - self.active_vector._move_start[1]
|
12795
|
+
|
12796
|
+
self.active_vector.myprop.offset_image(delta_x, delta_y)
|
12797
|
+
self.active_vector.myprop.update_myprops()
|
12798
|
+
self.active_vector._move_start = None
|
12799
|
+
self.end_action(_('End offset/scale image'))
|
12800
|
+
|
12549
12801
|
elif self.action == 'move vector':
|
12550
12802
|
|
12551
12803
|
if self.active_vector is None:
|
@@ -12749,6 +13001,24 @@ class WolfMapViewer(wx.Frame):
|
|
12749
13001
|
self.Refresh()
|
12750
13002
|
return
|
12751
13003
|
|
13004
|
+
elif shiftdown:
|
13005
|
+
|
13006
|
+
if self.active_vector is None:
|
13007
|
+
logging.warning(_('No vector selected -- Please select a vector first !'))
|
13008
|
+
return
|
13009
|
+
|
13010
|
+
if self.active_vector.myprop.textureimage is None:
|
13011
|
+
logging.warning(_('No image available -- Please load an image first !'))
|
13012
|
+
return
|
13013
|
+
|
13014
|
+
self.active_vector.myprop.image_scale /= (1 - .1 * (r / max(d, 1)))
|
13015
|
+
# limit to 1. or upper
|
13016
|
+
self.active_vector.myprop.image_scale = max(self.active_vector.myprop.image_scale, 1.)
|
13017
|
+
self.active_vector.myprop.update_myprops()
|
13018
|
+
self.active_vector.myprop.update_image_texture()
|
13019
|
+
self.Refresh()
|
13020
|
+
return
|
13021
|
+
|
12752
13022
|
# Allow the user to zoom onto the pixel where the
|
12753
13023
|
# mouse cursor is
|
12754
13024
|
|
@@ -12780,6 +13050,13 @@ class WolfMapViewer(wx.Frame):
|
|
12780
13050
|
self.setbounds()
|
12781
13051
|
|
12782
13052
|
def On_Right_Double_Clicks(self, e):
|
13053
|
+
|
13054
|
+
pos = e.GetPosition()
|
13055
|
+
ctrldown = e.ControlDown()
|
13056
|
+
altdown = e.AltDown()
|
13057
|
+
shiftdown = e.ShiftDown()
|
13058
|
+
x, y = self.getXY(pos)
|
13059
|
+
|
12783
13060
|
self._endactions()
|
12784
13061
|
|
12785
13062
|
def On_Left_Double_Clicks(self, e:wx.MouseEvent):
|
@@ -12892,6 +13169,12 @@ class WolfMapViewer(wx.Frame):
|
|
12892
13169
|
if ctrl:
|
12893
13170
|
myobj.show_properties()
|
12894
13171
|
|
13172
|
+
elif type(myobj) == PictureCollection:
|
13173
|
+
self.active_picturecollection = myobj
|
13174
|
+
|
13175
|
+
if ctrl:
|
13176
|
+
myobj.show_properties()
|
13177
|
+
|
12895
13178
|
elif type(myobj) == Wolf_LAZ_Data:
|
12896
13179
|
|
12897
13180
|
self.active_laz = myobj
|
@@ -12914,6 +13197,9 @@ class WolfMapViewer(wx.Frame):
|
|
12914
13197
|
elif isinstance(myobj, PlansTerrier):
|
12915
13198
|
self.active_landmap = myobj
|
12916
13199
|
|
13200
|
+
elif isinstance(myobj, Particularites | Enquetes | Ouvrages):
|
13201
|
+
self.active_picturecollection = myobj
|
13202
|
+
|
12917
13203
|
elif type(myobj) == hydrometry_wolfgui:
|
12918
13204
|
if ctrl:
|
12919
13205
|
myobj.show_properties()
|
@@ -13397,6 +13683,22 @@ class WolfMapViewer(wx.Frame):
|
|
13397
13683
|
if self.mousedown[0] == -99999: # only if the mouse was clicked before
|
13398
13684
|
self.mousedown = [x, y]
|
13399
13685
|
|
13686
|
+
if shiftdown:
|
13687
|
+
if self.active_vector is None:
|
13688
|
+
logging.warning(_('Shift key pressed but no active vector -- Please select a vector first !'))
|
13689
|
+
return
|
13690
|
+
if self.active_vector.myprop.textureimage is None:
|
13691
|
+
logging.warning(_('Shift key pressed but no image texture -- Please select a vector with an image first !'))
|
13692
|
+
return
|
13693
|
+
# We move the image texture
|
13694
|
+
delta_x = x - self.mousedown[0]
|
13695
|
+
delta_y = y - self.mousedown[1]
|
13696
|
+
self.active_vector.myprop._offset_image_texture(delta_x, delta_y)
|
13697
|
+
self.active_vector.myprop.update_myprops()
|
13698
|
+
self.active_vector.myprop.update_image_texture()
|
13699
|
+
self.Refresh()
|
13700
|
+
return
|
13701
|
+
|
13400
13702
|
self.mousex -= x - self.mousedown[0]
|
13401
13703
|
self.mousey -= y - self.mousedown[1]
|
13402
13704
|
|
@@ -13544,6 +13846,10 @@ class WolfMapViewer(wx.Frame):
|
|
13544
13846
|
# Store the position of the mouse as last known position
|
13545
13847
|
self._last_mouse_pos = (x,y,pos)
|
13546
13848
|
|
13849
|
+
if self.active_vector is not None:
|
13850
|
+
if self.active_vector.myprop.textureimage is not None:
|
13851
|
+
self.active_vector.myprop._reset_cached_offset()
|
13852
|
+
|
13547
13853
|
# Update the tooltip with the values of the active arrays and results at position x,y
|
13548
13854
|
self._update_mytooltip()
|
13549
13855
|
|
@@ -15078,6 +15384,9 @@ class WolfMapViewer(wx.Frame):
|
|
15078
15384
|
# Dessin du Front
|
15079
15385
|
self._plotting(draw_type.WMSFORE)
|
15080
15386
|
|
15387
|
+
# Dessin des images
|
15388
|
+
self._plotting(draw_type.PICTURECOLLECTION)
|
15389
|
+
|
15081
15390
|
# Gestion des BC (si actif)
|
15082
15391
|
if self.active_bc is not None:
|
15083
15392
|
self.active_bc.plot()
|
@@ -15171,6 +15480,15 @@ class WolfMapViewer(wx.Frame):
|
|
15171
15480
|
ymax = max(locvector.ymax, ymax)
|
15172
15481
|
k += 1
|
15173
15482
|
|
15483
|
+
for locvector in self.mypicturecollections:
|
15484
|
+
if locvector.plotted or force:
|
15485
|
+
locvector.find_minmax()
|
15486
|
+
xmin = min(locvector.xmin, xmin)
|
15487
|
+
xmax = max(locvector.xmax, xmax)
|
15488
|
+
ymin = min(locvector.ymin, ymin)
|
15489
|
+
ymax = max(locvector.ymax, ymax)
|
15490
|
+
k += 1
|
15491
|
+
|
15174
15492
|
for locvector in self.mytiles:
|
15175
15493
|
if locvector.plotted or force:
|
15176
15494
|
if locvector.idx != 'grid':
|
@@ -15252,6 +15570,13 @@ class WolfMapViewer(wx.Frame):
|
|
15252
15570
|
ymin = min(locothers.ymin, ymin)
|
15253
15571
|
ymax = max(locothers.ymax, ymax)
|
15254
15572
|
k += 1
|
15573
|
+
elif type(locothers) in [Particularites, Enquetes, Ouvrages]:
|
15574
|
+
if locothers.initialized:
|
15575
|
+
xmin = min(locothers.xmin, xmin)
|
15576
|
+
xmax = max(locothers.xmax, xmax)
|
15577
|
+
ymin = min(locothers.ymin, ymin)
|
15578
|
+
ymax = max(locothers.ymax, ymax)
|
15579
|
+
k += 1
|
15255
15580
|
|
15256
15581
|
for drown in self.mydrownings:
|
15257
15582
|
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
|
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,40 @@ 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
|
+
|
249
|
+
self.mapviewer.add_object(which='other',
|
250
|
+
newobj=self.ouvragesponts,
|
251
|
+
ToCheck=False,
|
252
|
+
id=_('Pictures "bridge"'))
|
253
|
+
self.mapviewer.add_object(which='other',
|
254
|
+
newobj=self.ouvragessuiles,
|
255
|
+
ToCheck=False,
|
256
|
+
id=_('Pictures "weirs"'))
|
257
|
+
self.mapviewer.add_object(which='other',
|
258
|
+
newobj=self.enquetes,
|
259
|
+
ToCheck=False,
|
260
|
+
id=_('Pictures "surveys"'))
|
261
|
+
self.mapviewer.add_object(which='other',
|
262
|
+
newobj=self.particularites,
|
263
|
+
ToCheck=False,
|
264
|
+
id=_('Pictures "features"'))
|
231
265
|
except:
|
232
266
|
logging.warning("Can't load some data (hydrometry, picc, cadaster, landmaps) -- Please check the data directories and/or report the issue")
|
233
267
|
|