wolfhece 2.1.116__py3-none-any.whl → 2.1.117__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 +613 -289
- wolfhece/PyParams.py +27 -2
- wolfhece/apps/version.py +1 -1
- wolfhece/lazviewer/laz_viewer.py +4 -0
- wolfhece/wolf_tiles.py +2 -2
- {wolfhece-2.1.116.dist-info → wolfhece-2.1.117.dist-info}/METADATA +1 -1
- {wolfhece-2.1.116.dist-info → wolfhece-2.1.117.dist-info}/RECORD +10 -10
- {wolfhece-2.1.116.dist-info → wolfhece-2.1.117.dist-info}/WHEEL +0 -0
- {wolfhece-2.1.116.dist-info → wolfhece-2.1.117.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.1.116.dist-info → wolfhece-2.1.117.dist-info}/top_level.txt +0 -0
wolfhece/PyDraw.py
CHANGED
@@ -129,6 +129,44 @@ ID_PLOTCS = 1003 #Manageactions ID for profile plots
|
|
129
129
|
|
130
130
|
LIST_1TO9 = [wx.WXK_NUMPAD1, wx.WXK_NUMPAD2, wx.WXK_NUMPAD3, wx.WXK_NUMPAD4, wx.WXK_NUMPAD5, wx.WXK_NUMPAD6, wx.WXK_NUMPAD7, wx.WXK_NUMPAD8, wx.WXK_NUMPAD9 ] + [ord(str(cur)) for cur in range(1,10)]
|
131
131
|
|
132
|
+
PROJECT_ACTION = 'action'
|
133
|
+
PROJECT_CS = 'cross_sections'
|
134
|
+
PROJECT_VECTOR = 'vector'
|
135
|
+
PROJECT_ARRAY = 'array'
|
136
|
+
PROJECT_TILES = 'tiles'
|
137
|
+
PROJECT_LAZ = 'laz_grid'
|
138
|
+
PROJECT_CLOUD = 'cloud'
|
139
|
+
PROJECT_WOLF2D = 'wolf2d'
|
140
|
+
PROJECT_GPU2D = 'gpu2d'
|
141
|
+
PROJECT_PALETTE = 'palette'
|
142
|
+
PROJECT_PALETTE_ARRAY = 'palette-array'
|
143
|
+
PROJECT_LINK_CS = 'cross_sections_link'
|
144
|
+
PROJECT_LINK_VEC_ARRAY = 'vector_array_link'
|
145
|
+
|
146
|
+
PROJECT_GROUP_KEYS = {PROJECT_ACTION : {'which': 'compare_arrays'},
|
147
|
+
PROJECT_CS: {'id - file': 'id to use - full or relative path to CS file',
|
148
|
+
'format': '(mandatory) 2000, 2022, vecz, sxy',
|
149
|
+
'dirlaz': 'Path to LAZ data (prepro Numpy)'},
|
150
|
+
PROJECT_VECTOR: {'id - file': 'id to use - full or relative path to vector file (.vec, .vecz, .shp)'},
|
151
|
+
PROJECT_ARRAY: {'id - file': 'id to use - full or relative path to array file (.bin, .tif, .npy, .npz)'},
|
152
|
+
PROJECT_TILES : {'id': '(mandatory) id to use',
|
153
|
+
'tiles_file': '(mandatory) Path to tiles file',
|
154
|
+
'data_dir': '(mandatory) Path to data directory',
|
155
|
+
'comp_dir': 'Path to comparison directory'},
|
156
|
+
PROJECT_LAZ: {'data_dir': '(mandatory) Path to data directory (prepro Numpy)',
|
157
|
+
'classification': 'Color classification for LAZ data - default SPW-Geofit 2023',},
|
158
|
+
PROJECT_CLOUD: {'id - file': 'id to use - full or relative path to cloud file (.xyz, .txt)'},
|
159
|
+
PROJECT_WOLF2D: {'id - dir': 'id to use - full or relative path to wolf2d simulation directory'},
|
160
|
+
PROJECT_GPU2D: {'id - dir': 'id to use - full or relative path to gpu2d simulation directory'},
|
161
|
+
PROJECT_PALETTE : {'id - file': 'id to use - full or relative path to palette file (.pal)'},
|
162
|
+
PROJECT_PALETTE_ARRAY : {'idarray - idpal': 'id of array - id of palette to link'},
|
163
|
+
PROJECT_LINK_CS : {'linkzones' : '(mandatory) id of vector to link to cross sections',
|
164
|
+
'sortzone' : '(mandatory) id of the zone to use for sorting',
|
165
|
+
'sortname' : '(mandatory) id of the polyline to use for sorting',
|
166
|
+
'downfirst' : 'is the first vertex downstream or upstream? (1 is True, 0 is False - default is False)'},
|
167
|
+
PROJECT_LINK_VEC_ARRAY : {'id - id vector': 'id of array/wolf2d/gpu2d - id of vector to link (only 1 vector in 1 zone)'},
|
168
|
+
}
|
169
|
+
|
132
170
|
class Memory_View():
|
133
171
|
""" Memory view """
|
134
172
|
|
@@ -1232,6 +1270,8 @@ class WolfMapViewer(wx.Frame):
|
|
1232
1270
|
self.linkedList = None
|
1233
1271
|
self.link_params = None
|
1234
1272
|
|
1273
|
+
self.project_pal = None
|
1274
|
+
|
1235
1275
|
self.forcemimic = True
|
1236
1276
|
self.currently_readresults = False
|
1237
1277
|
|
@@ -1269,8 +1309,8 @@ class WolfMapViewer(wx.Frame):
|
|
1269
1309
|
self.menuimagestiles = None
|
1270
1310
|
|
1271
1311
|
self.filemenu = wx.Menu()
|
1272
|
-
openitem = self.filemenu.Append(wx.ID_OPEN, _('Open project'), _('Open a complete project from file'))
|
1273
|
-
saveproject = self.filemenu.Append(wx.ID_ANY, _('Save project'), _('Save the current project to file'))
|
1312
|
+
openitem = self.filemenu.Append(wx.ID_OPEN, _('Open/Add project'), _('Open a complete project from file'))
|
1313
|
+
saveproject = self.filemenu.Append(wx.ID_ANY, _('Save project as...'), _('Save the current project to file'))
|
1274
1314
|
self.filemenu.AppendSeparator()
|
1275
1315
|
saveitem = self.filemenu.Append(wx.ID_SAVE, _('Save'), _('Save all checked arrays or vectors to files'))
|
1276
1316
|
saveasitem = self.filemenu.Append(wx.ID_SAVEAS, _('Save as...'), _('Save all checked arrays or vectors to new files --> one file dialog per data'))
|
@@ -1517,6 +1557,7 @@ class WolfMapViewer(wx.Frame):
|
|
1517
1557
|
# Help
|
1518
1558
|
self.helpmenu = wx.Menu()
|
1519
1559
|
self.helpmenu.Append(wx.ID_ANY, _('Shortcuts'), _('Shortcuts'))
|
1560
|
+
self.helpmenu.Append(wx.ID_ANY, _('Project .proj'), _('A project file ".proj", what is it?'))
|
1520
1561
|
self.helpmenu.Append(wx.ID_ANY, _('Show logs/informations'), _('Logs'))
|
1521
1562
|
self.helpmenu.Append(wx.ID_ANY, _('Show values'), _('Data/Values'))
|
1522
1563
|
self.helpmenu.Append(wx.ID_ANY, _('About'), _('About'))
|
@@ -4872,258 +4913,589 @@ class WolfMapViewer(wx.Frame):
|
|
4872
4913
|
"""
|
4873
4914
|
curdir = Path(os.getcwd())
|
4874
4915
|
|
4875
|
-
|
4876
|
-
|
4877
|
-
mykeys = ['cross_sections', 'vector', 'array']
|
4916
|
+
real_ids = {}
|
4878
4917
|
|
4879
|
-
|
4880
|
-
which = myproject.myparams['which']['action'][key_Param.VALUE]
|
4881
|
-
if which == 'compare':
|
4882
|
-
ListCompare = []
|
4883
|
-
if 'array' in myproject.myparams.keys():
|
4884
|
-
for curid, curname in zip(myproject.myparams['array'].keys(), myproject.myparams['array'].values()):
|
4885
|
-
ListCompare.append(WolfArray(normpath(curname[key_Param.VALUE])))
|
4918
|
+
myproject = Wolf_Param(None, filename=fn, toShow=False)
|
4886
4919
|
|
4887
|
-
|
4888
|
-
return
|
4920
|
+
def check_params(myproject, curgroup) -> bool:
|
4889
4921
|
|
4890
|
-
|
4891
|
-
|
4892
|
-
myproject.myparams['cross_sections'].values()):
|
4893
|
-
if curid != 'format' and curid != 'dirlaz':
|
4894
|
-
mycs = crosssections(curname[key_Param.VALUE],
|
4895
|
-
format=myproject.myparams['cross_sections']['format'][key_Param.VALUE],
|
4896
|
-
dirlaz=myproject.myparams['cross_sections']['dirlaz'][key_Param.VALUE],
|
4897
|
-
mapviewer = self)
|
4922
|
+
check = True
|
4923
|
+
pot_keys = list(PROJECT_GROUP_KEYS[curgroup].keys())
|
4898
4924
|
|
4899
|
-
|
4925
|
+
for curkey in pot_keys:
|
4926
|
+
if 'mandatory' in PROJECT_GROUP_KEYS[curgroup][curkey]:
|
4927
|
+
if not myproject.is_in(curgroup, curkey):
|
4928
|
+
logging.warning(_('Missing key : ')+ curkey)
|
4929
|
+
check = False
|
4930
|
+
return check
|
4900
4931
|
|
4932
|
+
def sanit_id(id:str, drawtype:draw_type) -> str:
|
4933
|
+
existing_id = self.get_list_keys(drawtype, None)
|
4901
4934
|
|
4902
|
-
|
4935
|
+
while id in existing_id:
|
4936
|
+
logging.warning(_('ID already exists - Changing it...'))
|
4937
|
+
id = id + '_'
|
4903
4938
|
|
4904
|
-
|
4905
|
-
curfile = myproject.get_param('tiles', 'tiles_file')
|
4906
|
-
curdatadir = myproject.get_param('tiles', 'data_dir')
|
4907
|
-
curcompdir = myproject.get_param('tiles', 'comp_dir')
|
4939
|
+
return id
|
4908
4940
|
|
4909
|
-
|
4910
|
-
|
4911
|
-
|
4912
|
-
self.add_object('tiles', newobj=mytiles, id=curid)
|
4913
|
-
else:
|
4914
|
-
logging.info(_('Bad parameter in project file - tiles : ')+ curfile)
|
4941
|
+
# COMPLEX ACTIONS
|
4942
|
+
curgroup = PROJECT_ACTION
|
4943
|
+
if myproject.is_in(curgroup):
|
4915
4944
|
|
4916
|
-
|
4945
|
+
pot_keys = list(PROJECT_GROUP_KEYS[curgroup].keys())
|
4917
4946
|
|
4918
|
-
|
4947
|
+
for curkey in pot_keys:
|
4948
|
+
which = myproject[(curgroup, curkey)]
|
4919
4949
|
|
4920
|
-
|
4950
|
+
pot_val = list(PROJECT_GROUP_KEYS[curgroup][curkey].keys())
|
4921
4951
|
|
4922
|
-
|
4923
|
-
|
4924
|
-
if exists(curname[key_Param.VALUE]):
|
4925
|
-
myvec = Zones(curname[key_Param.VALUE], parent=self, mapviewer = self)
|
4926
|
-
self.add_object('vector', newobj=myvec, id=curid)
|
4927
|
-
else:
|
4928
|
-
logging.info(_('Bad parameter in project file - vector : ')+ curname[key_Param.VALUE])
|
4952
|
+
if which in pot_val:
|
4953
|
+
if which == 'compare_arrays':
|
4929
4954
|
|
4930
|
-
|
4931
|
-
for curid, curname in zip(myproject.myparams['array'].keys(), myproject.myparams['array'].values()):
|
4955
|
+
# Comparaison de plusieurs matrices
|
4932
4956
|
|
4933
|
-
|
4934
|
-
|
4935
|
-
|
4936
|
-
|
4937
|
-
|
4957
|
+
logging.info(_('Compare action - Searching for arrays to compare...'))
|
4958
|
+
ListCompare = []
|
4959
|
+
if myproject.is_in('array'):
|
4960
|
+
for curval in myproject.get_group('array').values():
|
4961
|
+
curid = curval[key_Param.NAME]
|
4962
|
+
logging.info(_('Array to compare : ')+ curid)
|
4963
|
+
ListCompare.append(WolfArray(Path(myproject[('array', curid)])))
|
4964
|
+
else:
|
4965
|
+
logging.warning(_('No array to compare - Aborting !'))
|
4966
|
+
return
|
4938
4967
|
|
4939
|
-
|
4940
|
-
|
4941
|
-
|
4942
|
-
|
4943
|
-
self.add_object('cloud', newobj=mycloud, id=curid)
|
4968
|
+
logging.info(_('Setting compare...'))
|
4969
|
+
self.set_compare(ListCompare)
|
4970
|
+
logging.info(_('Compare set !'))
|
4971
|
+
return
|
4944
4972
|
else:
|
4945
|
-
logging.
|
4973
|
+
logging.error(_('Bad parameter in project file - action : ')+ which)
|
4974
|
+
|
4975
|
+
# CROSS SECTIONS
|
4976
|
+
curgroup = PROJECT_CS
|
4977
|
+
if myproject.is_in(curgroup):
|
4978
|
+
if check_params(myproject, curgroup):
|
4979
|
+
for curval in myproject.get_group(curgroup).values():
|
4980
|
+
curid = curval[key_Param.NAME]
|
4981
|
+
if curid != 'format' and curid != 'dirlaz':
|
4982
|
+
mycs = crosssections(myproject[(curgroup, curid)],
|
4983
|
+
format = myproject[(curgroup, 'format')],
|
4984
|
+
dirlaz = myproject[(curgroup, 'dirlaz')],
|
4985
|
+
mapviewer = self)
|
4986
|
+
|
4987
|
+
locid = real_ids[(draw_type.VECTORS, curid)] = sanit_id(curid, draw_type.VECTORS)
|
4988
|
+
|
4989
|
+
self.add_object(curgroup, newobj=mycs, id=locid)
|
4990
|
+
else:
|
4991
|
+
logging.warning(_('Bad parameter in project file - cross_sections'))
|
4992
|
+
|
4993
|
+
# TILES
|
4994
|
+
curgroup = PROJECT_TILES
|
4995
|
+
if myproject.is_in(curgroup):
|
4996
|
+
if check_params(myproject, curgroup):
|
4997
|
+
curid = myproject.get_param(curgroup, 'id')
|
4998
|
+
curfile = myproject.get_param(curgroup, 'tiles_file')
|
4999
|
+
curdatadir = myproject.get_param(curgroup, 'data_dir')
|
5000
|
+
curcompdir = myproject.get_param(curgroup, 'comp_dir')
|
5001
|
+
|
5002
|
+
if exists(curfile):
|
5003
|
+
try:
|
5004
|
+
mytiles = Tiles(filename= curfile, parent=self, linked_data_dir=curdatadir)
|
5005
|
+
mytiles.set_comp_dir(curcompdir)
|
4946
5006
|
|
4947
|
-
|
4948
|
-
|
4949
|
-
|
4950
|
-
|
4951
|
-
self.add_object('res2d', newobj=curwolf, id=curid)
|
5007
|
+
locid = real_ids[(draw_type.TILES, curid)] = sanit_id(curid, draw_type.TILES)
|
5008
|
+
self.add_object(curgroup, newobj=mytiles, id=locid)
|
5009
|
+
except Exception as e:
|
5010
|
+
logging.error(_('Error in tiles import : ')+ str(e))
|
4952
5011
|
else:
|
4953
|
-
logging.
|
5012
|
+
logging.warning(_('File does not exist : ')+ curfile)
|
5013
|
+
else:
|
5014
|
+
logging.warning(_('Bad parameter in project file - tiles'))
|
4954
5015
|
|
4955
|
-
|
5016
|
+
# LAZ GRID
|
5017
|
+
curgroup = PROJECT_LAZ
|
5018
|
+
if myproject.is_in(curgroup):
|
5019
|
+
if check_params(myproject, curgroup):
|
5020
|
+
try:
|
5021
|
+
self.init_laz_from_gridinfos(myproject[curgroup, 'data_dir'], myproject[(curgroup, 'classification')])
|
5022
|
+
except Exception as e:
|
5023
|
+
logging.error(_('Error in laz_grid import : ')+ str(e))
|
5024
|
+
else:
|
5025
|
+
logging.warning(_('Bad parameter in project file - laz_grid'))
|
5026
|
+
|
5027
|
+
# VECTOR DATA
|
5028
|
+
curgroup = PROJECT_VECTOR
|
5029
|
+
if myproject.is_in(curgroup):
|
5030
|
+
if check_params(myproject, curgroup):
|
5031
|
+
for curval in myproject.get_group(curgroup).values():
|
5032
|
+
curid = curval[key_Param.NAME]
|
5033
|
+
name = curval[key_Param.VALUE]
|
5034
|
+
if exists(name):
|
5035
|
+
try:
|
5036
|
+
myvec = Zones(name, parent = self, mapviewer = self)
|
5037
|
+
|
5038
|
+
locid = real_ids[(draw_type.VECTORS, curid)] = sanit_id(curid, draw_type.VECTORS)
|
5039
|
+
self.add_object(curgroup, newobj = myvec, id = locid)
|
5040
|
+
except Exception as e:
|
5041
|
+
logging.error(_('Error in vector import : ')+ str(e))
|
5042
|
+
else:
|
5043
|
+
logging.info(_('File does not exist : ') + name)
|
5044
|
+
else:
|
5045
|
+
logging.warning(_('Bad parameter in project file - vector'))
|
5046
|
+
|
5047
|
+
# ARRAY DATA
|
5048
|
+
curgroup = PROJECT_ARRAY
|
5049
|
+
if myproject.is_in(curgroup):
|
5050
|
+
if check_params(myproject, curgroup):
|
5051
|
+
for curval in myproject.get_group(curgroup).values():
|
5052
|
+
curid = curval[key_Param.NAME]
|
5053
|
+
name = curdir / Path(curval[key_Param.VALUE])
|
5054
|
+
if exists(name):
|
5055
|
+
try:
|
5056
|
+
curarray = WolfArray(name, mapviewer = self)
|
5057
|
+
|
5058
|
+
locid = real_ids[(draw_type.ARRAYS, curid)] = sanit_id(curid, draw_type.ARRAYS)
|
5059
|
+
self.add_object('array', newobj=curarray, id = locid)
|
5060
|
+
except Exception as e:
|
5061
|
+
logging.error(_('Error in array import : ')+ str(e))
|
5062
|
+
else:
|
5063
|
+
logging.info(_('File does not exist : ') + name)
|
5064
|
+
else:
|
5065
|
+
logging.warning(_('Bad parameter in project file - array'))
|
5066
|
+
|
5067
|
+
# CLOUD DATA
|
5068
|
+
curgroup = PROJECT_CLOUD
|
5069
|
+
if myproject.is_in(curgroup):
|
5070
|
+
if check_params(myproject, curgroup):
|
5071
|
+
for curval in myproject.get_group(curgroup).values():
|
5072
|
+
curid = curval[key_Param.NAME]
|
5073
|
+
name = curval[key_Param.VALUE]
|
5074
|
+
if exists(name):
|
5075
|
+
try:
|
5076
|
+
mycloud = cloud_vertices(name, mapviewer = self)
|
5077
|
+
|
5078
|
+
locid = real_ids[(draw_type.CLOUD, curid)] = sanit_id(curid, draw_type.CLOUD)
|
5079
|
+
self.add_object('cloud', newobj = mycloud, id = locid)
|
5080
|
+
except Exception as e:
|
5081
|
+
logging.error(_('Error in cloud import : ') + str(e))
|
5082
|
+
else:
|
5083
|
+
logging.info(_('File does not exist : ') + name)
|
5084
|
+
else:
|
5085
|
+
logging.warning(_('Bad parameter in project file - cloud'))
|
5086
|
+
|
5087
|
+
# 2D RESULTS
|
5088
|
+
|
5089
|
+
# CPU code
|
5090
|
+
curgroup = PROJECT_WOLF2D
|
5091
|
+
if myproject.is_in(curgroup):
|
5092
|
+
if check_params(myproject, curgroup):
|
5093
|
+
for curval in myproject.get_group(curgroup).values():
|
5094
|
+
curid = curval[key_Param.NAME]
|
5095
|
+
simdir = Path(curval[key_Param.VALUE])
|
5096
|
+
if simdir.exists():
|
5097
|
+
try:
|
5098
|
+
curwolf = Wolfresults_2D(simdir, mapviewer = self)
|
5099
|
+
|
5100
|
+
locid = real_ids[(draw_type.RES2D, curid)] = sanit_id(curid, draw_type.RES2D)
|
5101
|
+
self.add_object('res2d', newobj = curwolf, id = locid)
|
5102
|
+
except Exception as e:
|
5103
|
+
logging.error(_('Error in wolf2d import : ')+ str(e))
|
5104
|
+
else:
|
5105
|
+
logging.info(_('Directory does not exist ')) + simdir
|
4956
5106
|
|
4957
|
-
|
5107
|
+
self.menu_wolf2d()
|
5108
|
+
else:
|
5109
|
+
logging.warning(_('Bad parameter in project file - wolf2d'))
|
5110
|
+
|
5111
|
+
# GPU code
|
5112
|
+
curgroup = PROJECT_GPU2D
|
5113
|
+
if myproject.is_in(curgroup):
|
5114
|
+
if check_params(myproject, curgroup):
|
5115
|
+
|
5116
|
+
pgbar = wx.ProgressDialog(_('Loading GPU results'), _('Loading GPU results'), maximum=len(myproject.myparams[curgroup].keys()), parent=self, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE)
|
5117
|
+
|
5118
|
+
for curval in myproject.get_group(curgroup).values():
|
5119
|
+
curid = curval[key_Param.NAME]
|
5120
|
+
simdir = Path(curval[key_Param.VALUE])
|
5121
|
+
if simdir.exists():
|
5122
|
+
try:
|
5123
|
+
curwolf = wolfres2DGPU(curdir / simdir, mapviewer = self)
|
5124
|
+
|
5125
|
+
locid = real_ids[(draw_type.RES2D, curid)] = sanit_id(curid, draw_type.RES2D)
|
5126
|
+
self.add_object('res2d', newobj = curwolf, id = locid)
|
5127
|
+
except Exception as e:
|
5128
|
+
logging.error(_('Error in gpu2d import : ')+ str(e))
|
5129
|
+
else:
|
5130
|
+
logging.info(_('Bad directory : ') + simdir)
|
4958
5131
|
|
4959
|
-
|
5132
|
+
pgbar.Update(pgbar.GetValue() + 1)
|
4960
5133
|
|
4961
|
-
|
4962
|
-
if exists(curname[key_Param.VALUE]):
|
5134
|
+
pgbar.Destroy()
|
4963
5135
|
|
4964
|
-
|
4965
|
-
|
4966
|
-
|
4967
|
-
|
4968
|
-
|
5136
|
+
self.menu_wolf2d()
|
5137
|
+
self.menu_2dgpu()
|
5138
|
+
else:
|
5139
|
+
logging.warning(_('Bad parameter in project file - gpu2d'))
|
5140
|
+
|
5141
|
+
# PALETTE/COLORMAP
|
5142
|
+
curgroup = PROJECT_PALETTE
|
5143
|
+
if myproject.is_in(curgroup):
|
5144
|
+
if check_params(myproject, curgroup):
|
5145
|
+
self.project_pal = {}
|
5146
|
+
for curval in myproject.get_group(curgroup).values():
|
5147
|
+
curid = curval[key_Param.NAME]
|
5148
|
+
name = Path(curval[key_Param.VALUE])
|
5149
|
+
if name.exists():
|
5150
|
+
if name.suffix == '.pal':
|
5151
|
+
mypal = wolfpalette(None, '')
|
5152
|
+
mypal.readfile(name)
|
5153
|
+
mypal.automatic = False
|
5154
|
+
|
5155
|
+
self.project_pal[curid] = mypal
|
4969
5156
|
else:
|
4970
|
-
logging.
|
5157
|
+
logging.warning(_('Bad palette file : ')+ name)
|
5158
|
+
else:
|
5159
|
+
logging.info(_('Bad parameter in project file - palette : ')+ name)
|
5160
|
+
else:
|
5161
|
+
logging.warning(_('Bad parameter in project file - palette'))
|
5162
|
+
|
5163
|
+
# LINKS
|
5164
|
+
curgroup = PROJECT_PALETTE_ARRAY
|
5165
|
+
if myproject.is_in(curgroup):
|
5166
|
+
if check_params(myproject, curgroup):
|
5167
|
+
curarray: WolfArray
|
5168
|
+
if self.project_pal is not None:
|
4971
5169
|
|
4972
|
-
|
5170
|
+
for curval in myproject.get_group(curgroup).keys():
|
5171
|
+
id_array = curval[key_Param.NAME]
|
5172
|
+
id_pal = curval[key_Param.VALUE]
|
5173
|
+
if id_pal in self.project_pal.keys():
|
5174
|
+
try:
|
5175
|
+
curarray = self.getobj_from_id(real_ids[(draw_type.ARRAYS, id_array)])
|
5176
|
+
if curarray is not None:
|
5177
|
+
mypal:wolfpalette
|
5178
|
+
mypal = self.project_pal[id_pal]
|
5179
|
+
curarray.mypal = mypal
|
5180
|
+
if mypal.automatic:
|
5181
|
+
curarray.myops.palauto.SetValue(1)
|
5182
|
+
else:
|
5183
|
+
curarray.myops.palauto.SetValue(0)
|
5184
|
+
curarray.updatepalette(0)
|
5185
|
+
curarray.reset_plot()
|
5186
|
+
else:
|
5187
|
+
logging.warning(_('Bad parameter in project file - palette-array : ')+ id_array)
|
5188
|
+
except Exception as e:
|
5189
|
+
logging.error(_('Error in palette-array link : ')+ str(e))
|
5190
|
+
else:
|
5191
|
+
logging.warning(_('Bad parameter in project file - palette-array : ')+ id_pal)
|
4973
5192
|
else:
|
4974
|
-
logging.
|
5193
|
+
logging.warning(_('No palettes found in project file ! -- Add palette group in the .proj'))
|
5194
|
+
else:
|
5195
|
+
logging.warning(_('Bad parameter in project file - palette-array'))
|
4975
5196
|
|
4976
|
-
|
5197
|
+
curgroup = PROJECT_LINK_CS
|
5198
|
+
if myproject.is_in(curgroup):
|
5199
|
+
if self.active_cs is not None:
|
5200
|
+
if check_params(myproject, curgroup):
|
4977
5201
|
|
4978
|
-
|
5202
|
+
idx = real_ids[(draw_type.VECTORS, myproject[(curgroup, 'linkzones')])]
|
5203
|
+
curzones = self.get_obj_from_id(idx, draw_type.VECTORS)
|
4979
5204
|
|
4980
|
-
|
4981
|
-
|
5205
|
+
if curzones is not None:
|
5206
|
+
self.active_cs.link_external_zones(curzones)
|
5207
|
+
|
5208
|
+
zonename = myproject[(curgroup, 'sortzone')]
|
5209
|
+
vecname = myproject[(curgroup, 'sortname')]
|
5210
|
+
downfirst = myproject[(curgroup, 'downfirst')]
|
4982
5211
|
|
4983
|
-
|
4984
|
-
|
4985
|
-
|
4986
|
-
if exists(curname[key_Param.VALUE]):
|
4987
|
-
mypal = wolfpalette(None, '')
|
4988
|
-
mypal.readfile(curname[key_Param.VALUE])
|
4989
|
-
mypal.automatic = False
|
5212
|
+
downfirst = False
|
5213
|
+
if downfirst == 1 or str(downfirst).lower() == 'true':
|
5214
|
+
downfirst = True
|
4990
5215
|
|
4991
|
-
|
5216
|
+
if zonename != '' and vecname != '':
|
5217
|
+
curvec = curzones[(zonename, vecname)]
|
5218
|
+
if curvec is not None:
|
5219
|
+
try:
|
5220
|
+
self.active_cs.sort_along(curvec.asshapely_ls(), curvec.myname, downfirst)
|
5221
|
+
except Exception as e:
|
5222
|
+
logging.error(_('Error in cross_sections_link sorting : ')+ str(e))
|
5223
|
+
else:
|
5224
|
+
logging.warning(_('Bad id for sorting vector in project file - cross_sections_link'))
|
4992
5225
|
else:
|
4993
|
-
logging.
|
5226
|
+
logging.warning(_('Bad parameter in project file - cross_sections_link'))
|
5227
|
+
else:
|
5228
|
+
logging.warning(_('No active cross section to link !'))
|
4994
5229
|
|
4995
|
-
|
4996
|
-
|
4997
|
-
|
4998
|
-
|
4999
|
-
|
5000
|
-
|
5001
|
-
|
5002
|
-
|
5003
|
-
|
5004
|
-
|
5005
|
-
|
5006
|
-
|
5007
|
-
|
5230
|
+
curgroup = PROJECT_LINK_VEC_ARRAY
|
5231
|
+
# Useful to mask data outside of the linked contour
|
5232
|
+
if myproject.is_in(curgroup):
|
5233
|
+
if check_params(myproject, curgroup):
|
5234
|
+
for curval in myproject.get_group(curgroup).keys():
|
5235
|
+
|
5236
|
+
id_array = real_ids[(draw_type.ARRAYS, curval[key_Param.NAME])]
|
5237
|
+
id_zones = real_ids[(draw_type.VECTORS, curval[key_Param.VALUE])]
|
5238
|
+
|
5239
|
+
locarray:WolfArray
|
5240
|
+
locvec:Zones
|
5241
|
+
|
5242
|
+
locarray = self.get_obj_from_id(id_array, draw_type.ARRAYS)
|
5243
|
+
if locarray is None:
|
5244
|
+
locarray = self.get_obj_from_id(id_array, draw_type.RES2D)
|
5245
|
+
|
5246
|
+
locvec = self.get_obj_from_id(id_zones, draw_type.VECTORS)
|
5247
|
+
|
5248
|
+
if locvec is not None and locarray is not None:
|
5249
|
+
try:
|
5250
|
+
if locvec.nbzones == 1:
|
5251
|
+
if locvec.myzones[0].nbvectors == 1:
|
5252
|
+
locarray.linkedvec = locvec.myzones[0].myvectors[0]
|
5253
|
+
else:
|
5254
|
+
logging.warning(_('In vec-array association, You must have only 1 zone and 1 polyline !'))
|
5008
5255
|
else:
|
5009
|
-
|
5010
|
-
curarray.updatepalette(0)
|
5011
|
-
curarray.delete_lists()
|
5012
|
-
else:
|
5013
|
-
logging.warning(_('Bad parameter in project file - palette-array : ')+ curid)
|
5256
|
+
logging.warning(_('In vec-array association, You must have only 1 zone and 1 polyline !'))
|
5014
5257
|
|
5015
|
-
|
5016
|
-
|
5017
|
-
|
5258
|
+
except Exception as e:
|
5259
|
+
logging.error(_('Error in vector_array_link : ')+ str(e))
|
5260
|
+
else:
|
5261
|
+
logging.warning(_('Bad vec-array association in project file !'))
|
5262
|
+
else:
|
5263
|
+
logging.warning(_('Bad parameter in project file - vector_array_link'))
|
5018
5264
|
|
5019
|
-
|
5020
|
-
|
5021
|
-
if curzones.idx == idx:
|
5022
|
-
self.active_cs.link_external_zones(curzones)
|
5265
|
+
def save_project(self, fn, absolute:bool = True):
|
5266
|
+
""" Save project file """
|
5023
5267
|
|
5024
|
-
|
5025
|
-
vecname = ''
|
5026
|
-
|
5027
|
-
if 'sortzone' in myproject.myparams['cross_sections_link'].keys():
|
5028
|
-
zonename = myproject.myparams['cross_sections_link']['sortzone'][key_Param.VALUE]
|
5029
|
-
if 'sortname' in myproject.myparams['cross_sections_link'].keys():
|
5030
|
-
vecname = myproject.myparams['cross_sections_link']['sortname'][key_Param.VALUE]
|
5031
|
-
|
5032
|
-
if zonename != '' and vecname != '':
|
5033
|
-
names = [cur.myname for cur in curzones.myzones]
|
5034
|
-
idx = names.index(zonename)
|
5035
|
-
curzone = curzones.myzones[idx]
|
5036
|
-
names = [cur.myname for cur in curzone.myvectors]
|
5037
|
-
idx = names.index(vecname)
|
5038
|
-
curvec = curzone.myvectors[idx]
|
5039
|
-
|
5040
|
-
if curvec is not None:
|
5041
|
-
curvec: vector
|
5042
|
-
self.active_cs.sort_along(curvec.asshapely_ls(), curvec.myname, False)
|
5043
|
-
|
5044
|
-
if 'vector_array_link' in myproject.myparams.keys():
|
5045
|
-
for curid, curname in zip(myproject.myparams['vector_array_link'].keys(), myproject.myparams['vector_array_link'].values()):
|
5046
|
-
|
5047
|
-
locvec = None
|
5048
|
-
locarray = None
|
5049
|
-
for curvec in self.myvectors:
|
5050
|
-
if curvec.idx == curname[key_Param.VALUE].lower():
|
5051
|
-
locvec=curvec
|
5052
|
-
break
|
5268
|
+
dirproj = Path(fn).parent
|
5053
5269
|
|
5054
|
-
|
5055
|
-
|
5056
|
-
locarray=curarray
|
5057
|
-
break
|
5270
|
+
def new_path(drawtype:draw_type, id:str) -> str:
|
5271
|
+
logging.info(_('Empty path but I need a path !'))
|
5058
5272
|
|
5059
|
-
|
5273
|
+
path = ''
|
5060
5274
|
|
5061
|
-
|
5275
|
+
ext = 'All files (*.*)|*.*'
|
5276
|
+
if drawtype == draw_type.ARRAYS:
|
5277
|
+
ext += '|Binary files (*.bin)|*.bin|Tiff files (*.tif)|*.tif|Numpy files (*.npy)|*.npy'
|
5278
|
+
elif drawtype == draw_type.VECTORS:
|
5279
|
+
ext += '|VecZ files (*.vecz)|*.vecz|Vec files (*.vec)|*.vec'
|
5280
|
+
elif drawtype == draw_type.CLOUD:
|
5281
|
+
ext += '|Cloud files (*.xyz)|*.xyz'
|
5062
5282
|
|
5063
|
-
|
5283
|
+
dlg = wx.FileDialog(None, _('Choose a filename for ') + id, str(dirproj), '', ext, wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
5284
|
+
ret = dlg.ShowModal()
|
5064
5285
|
|
5065
|
-
|
5066
|
-
|
5067
|
-
logging.warning(curname[key_Param.VALUE])
|
5286
|
+
if ret == wx.ID_OK:
|
5287
|
+
path = Path(dlg.GetPath())
|
5068
5288
|
|
5069
|
-
|
5070
|
-
|
5289
|
+
return path
|
5290
|
+
|
5291
|
+
def sanit_path(path:Path, absolute:bool, drawtype:draw_type) -> str:
|
5292
|
+
|
5293
|
+
path = Path(path)
|
5294
|
+
|
5295
|
+
if not path.exists():
|
5296
|
+
logging.info(_('Path does not exist : ')+ str(path))
|
5297
|
+
|
5298
|
+
if absolute:
|
5299
|
+
return str(path)
|
5300
|
+
else:
|
5301
|
+
try:
|
5302
|
+
return os.path.relpath(path, dirproj)
|
5303
|
+
except:
|
5304
|
+
logging.error(_('Error in relative path : ')+ str(path) + " - " + str(dirproj))
|
5305
|
+
logging.info(_('Returning absolute path instead !'))
|
5306
|
+
return str(path.absolute())
|
5307
|
+
|
5308
|
+
myproject = Wolf_Param(None, toShow=False, to_read=False, filename=fn, init_GUI=False)
|
5071
5309
|
|
5072
|
-
mykeys = ['cross_sections', 'vector', 'array', 'wolf2d']
|
5073
|
-
for curkey in mykeys:
|
5074
|
-
myproject[curkey] = {}
|
5075
|
-
"""
|
5076
|
-
# myproject.myparams['which']={}
|
5077
|
-
# myproject.myparams['which']['action']={}
|
5078
|
-
# myproject.myparams['which']['action'][key_Param.VALUE]
|
5079
|
-
|
5080
|
-
# mycs = self.active_cs
|
5081
|
-
# if mycs is not None:
|
5082
|
-
# myproject.myparams['cross_sections']={}
|
5083
|
-
# myproject.myparams['cross_sections']['mycs']={}
|
5084
|
-
# myproject.myparams['cross_sections']['mycs'][key_Param.VALUE]=mycs.filename
|
5085
|
-
|
5086
|
-
# myproject.myparams['vector']={}
|
5087
|
-
# myproject.myparams['vector']['river']={}
|
5088
|
-
## myproject.myparams['vector']['river'][key_Param.VALUE]=self.added[draw_type.VECTORS.value][0].filename
|
5089
|
-
|
5090
|
-
# if 'array' in myproject.myparams.key():
|
5091
|
-
# for curid,curname in zip(myproject.myparams['array'].keys(),myproject.myparams['array'].values()):
|
5092
|
-
# curarray=WolfArray(curname[key_Param.VALUE])
|
5093
|
-
# self.add_object('array',newobj=curarray,id=curid)
|
5094
|
-
"""
|
5095
5310
|
# matrices
|
5096
5311
|
try:
|
5312
|
+
curgroup = PROJECT_ARRAY
|
5097
5313
|
for curel in self.iterator_over_objects(draw_type.ARRAYS):
|
5098
|
-
|
5099
|
-
|
5314
|
+
curel:WolfArray
|
5315
|
+
if curel.filename == '':
|
5316
|
+
newpath = new_path(draw_type.ARRAYS, curel.idx)
|
5317
|
+
if newpath == '':
|
5318
|
+
logging.warning(_('No path for array : ')+ curel.idx + _(' - Ignoring it !'))
|
5319
|
+
continue
|
5320
|
+
curel.write_all(newpath)
|
5100
5321
|
|
5322
|
+
curpath = sanit_path(curel.filename, absolute, draw_type.ARRAYS)
|
5323
|
+
|
5324
|
+
myproject.add_param(curgroup, curel.idx, curpath)
|
5101
5325
|
except:
|
5102
|
-
|
5326
|
+
logging.error(_('Error in saving arrays'))
|
5103
5327
|
|
5104
5328
|
# résultats 2D
|
5105
5329
|
try:
|
5330
|
+
curgroup = PROJECT_WOLF2D
|
5106
5331
|
for curel in self.iterator_over_objects(draw_type.RES2D):
|
5107
|
-
|
5108
|
-
|
5332
|
+
if type(curel) == Wolfresults_2D:
|
5333
|
+
myproject.add_param(curgroup, curel.idx, sanit_path(curel.filename, absolute, draw_type.RES2D))
|
5109
5334
|
|
5335
|
+
curgroup = PROJECT_GPU2D
|
5336
|
+
for curel in self.iterator_over_objects(draw_type.RES2D):
|
5337
|
+
if type(curel) == wolfres2DGPU:
|
5338
|
+
myproject.add_param(curgroup, curel.idx, sanit_path(curel.filename, absolute, draw_type.RES2D))
|
5110
5339
|
except:
|
5111
|
-
|
5340
|
+
logging.error(_('Error in saving 2D results'))
|
5112
5341
|
|
5113
5342
|
# vecteurs
|
5114
5343
|
try:
|
5344
|
+
curgroup = PROJECT_VECTOR
|
5115
5345
|
for curel in self.iterator_over_objects(draw_type.VECTORS):
|
5116
|
-
|
5117
|
-
|
5346
|
+
if isinstance(curel, crosssections):
|
5347
|
+
continue
|
5348
|
+
|
5349
|
+
curel:Zones
|
5350
|
+
if curel.filename == '':
|
5351
|
+
newpath = new_path(draw_type.VECTORS, curel.idx)
|
5352
|
+
if newpath == '':
|
5353
|
+
logging.warning(_('No path for vector : ')+ curel.idx + _(' - Ignoring it !'))
|
5354
|
+
continue
|
5355
|
+
curel.saveas(newpath)
|
5118
5356
|
|
5357
|
+
myproject.add_param(curgroup, curel.idx, sanit_path(curel.filename, absolute, draw_type.VECTORS))
|
5119
5358
|
except:
|
5120
|
-
|
5359
|
+
logging.error(_('Error in saving vectors'))
|
5360
|
+
|
5361
|
+
# cross sections
|
5362
|
+
try:
|
5363
|
+
curgroup = PROJECT_CS
|
5364
|
+
for curel in self.iterator_over_objects(draw_type.VECTORS):
|
5365
|
+
if isinstance(curel, crosssections):
|
5366
|
+
myproject.add_param(curgroup, curel.idx, sanit_path(curel.filename, absolute, draw_type.VECTORS))
|
5367
|
+
except:
|
5368
|
+
logging.error(_('Error in saving cross sections'))
|
5369
|
+
|
5370
|
+
# nuages de points
|
5371
|
+
try:
|
5372
|
+
curgroup = PROJECT_CLOUD
|
5373
|
+
for curel in self.iterator_over_objects(draw_type.CLOUD):
|
5374
|
+
myproject.add_param(curgroup, curel.idx, sanit_path(curel.filename, absolute, draw_type.CLOUD))
|
5375
|
+
except:
|
5376
|
+
logging.error(_('Error in saving clouds'))
|
5377
|
+
|
5378
|
+
# palettes
|
5379
|
+
try:
|
5380
|
+
if self.project_pal is not None:
|
5381
|
+
curgroup = PROJECT_PALETTE
|
5382
|
+
for curel in self.project_pal.keys():
|
5383
|
+
myproject.add_param(curgroup, curel, sanit_path(self.project_pal[curel].filename, absolute, draw_type.OTHER))
|
5384
|
+
except:
|
5385
|
+
logging.error(_('Error in saving palettes'))
|
5386
|
+
|
5387
|
+
# tiles
|
5388
|
+
try:
|
5389
|
+
curgroup = PROJECT_TILES
|
5390
|
+
for curel in self.iterator_over_objects(draw_type.TILES):
|
5391
|
+
myproject.add_param(curgroup, curel.idx, sanit_path(curel.filename, absolute, draw_type.OTHER))
|
5392
|
+
myproject.add_param(curgroup, 'data_dir', sanit_path(curel.linked_data_dir, absolute, draw_type.OTHER))
|
5393
|
+
myproject.add_param(curgroup, 'comp_dir', sanit_path(curel.linked_data_dir_comp, absolute, draw_type.OTHER))
|
5394
|
+
except:
|
5395
|
+
logging.error(_('Error in saving tiles'))
|
5396
|
+
|
5397
|
+
# LAZ GRID
|
5398
|
+
try:
|
5399
|
+
if self.mylazgrid is not None:
|
5400
|
+
curgroup = PROJECT_LAZ
|
5401
|
+
myproject.add_param(curgroup, 'data_dir', sanit_path(self.mylazgrid.dir, absolute, draw_type.OTHER))
|
5402
|
+
myproject.add_param(curgroup, 'classification', self.mylazgrid.colors.class_name)
|
5403
|
+
except:
|
5404
|
+
logging.error(_('Error in saving laz grid'))
|
5405
|
+
|
5406
|
+
myproject.Save(fn)
|
5407
|
+
|
5408
|
+
|
5409
|
+
def help_project(self):
|
5410
|
+
""" Help for project file.
|
5411
|
+
|
5412
|
+
Define which elements can be saved in a project file.
|
5413
|
+
|
5414
|
+
"""
|
5415
|
+
|
5416
|
+
logging.info(_('Project file help'))
|
5417
|
+
|
5418
|
+
logging.info(_('Project file is a file containing some information about the current project.'))
|
5419
|
+
|
5420
|
+
logging.info(_('It can contain the following informations :'))
|
5421
|
+
|
5422
|
+
logging.info(_(' - Arrays :'))
|
5423
|
+
logging.info(_(' - id'))
|
5424
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5425
|
+
|
5426
|
+
logging.info(_(' - Cross sections :'))
|
5427
|
+
logging.info(_(' - id'))
|
5428
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5429
|
+
|
5430
|
+
logging.info(_(' - Vectors :'))
|
5431
|
+
logging.info(_(' - id'))
|
5432
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5433
|
+
|
5434
|
+
logging.info(_(' - Clouds :'))
|
5435
|
+
logging.info(_(' - id'))
|
5436
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5437
|
+
|
5438
|
+
logging.info(_(' - Tiles :'))
|
5439
|
+
logging.info(_(' - id'))
|
5440
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5441
|
+
|
5442
|
+
logging.info(_(' - LAZ grid :'))
|
5443
|
+
logging.info(_(' - data_dir : directory containing the NUMPY grid'))
|
5444
|
+
logging.info(_(' - classification : classification of the laz files'))
|
5445
|
+
|
5446
|
+
logging.info(_(' - Palettes :'))
|
5447
|
+
logging.info(_(' - id'))
|
5448
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5449
|
+
|
5450
|
+
logging.info(_(' - Wolf2D CPU results :'))
|
5451
|
+
logging.info(_(' - id'))
|
5452
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5453
|
+
|
5454
|
+
logging.info(_(' - Wolf2D GPU results :'))
|
5455
|
+
logging.info(_(' - id'))
|
5456
|
+
logging.info(_(' - filename in relative or absolute path'))
|
5457
|
+
|
5458
|
+
logging.info(_(' - Palette-Array links :'))
|
5459
|
+
logging.info(_(' - id of the array'))
|
5460
|
+
logging.info(_(' - id of the palette'))
|
5461
|
+
|
5462
|
+
logging.info(_(' - Vector-Array links :'))
|
5463
|
+
logging.info(_(' - id of the array'))
|
5464
|
+
logging.info(_(' - id of the vector (containing only 1 zone and 1 vector)'))
|
5465
|
+
|
5466
|
+
logging.info(_(' - Cross section links :'))
|
5467
|
+
logging.info(_(' - id of the cross section'))
|
5468
|
+
logging.info(_(' - id of the vector to sort along'))
|
5469
|
+
logging.info(_(' - id of the zone to link'))
|
5470
|
+
logging.info(_(' - downfirst : True or False'))
|
5471
|
+
|
5472
|
+
logging.info('')
|
5473
|
+
logging.info(_('A tabulation is used to separate the value and the key.'))
|
5474
|
+
logging.info('')
|
5475
|
+
|
5476
|
+
logging.info(_('Exemple :'))
|
5477
|
+
|
5478
|
+
logging.info('')
|
5479
|
+
|
5480
|
+
logging.info('array:')
|
5481
|
+
logging.info('myid1\tmyfilename_array1')
|
5482
|
+
logging.info('myid2\tmy../filename_array2')
|
5483
|
+
logging.info('vector:')
|
5484
|
+
logging.info('myvec1\tmy../../filename_vecz1')
|
5485
|
+
logging.info('myvec2\tmyfilename_vecz2')
|
5486
|
+
logging.info('laz_grid:')
|
5487
|
+
logging.info('data_dir\tD:\\MODREC-Vesdre\\LAZ_Vesdre\\2023\\grids_flt32')
|
5488
|
+
logging.info('classification\tSPW-Geofit 2023')
|
5121
5489
|
|
5122
5490
|
def plot_laz_around_active_vec(self):
|
5491
|
+
""" Plot laz data around active vector """
|
5492
|
+
|
5123
5493
|
if self.active_vector is None:
|
5494
|
+
logging.warning(_('Please activate a vector'))
|
5124
5495
|
return
|
5125
5496
|
|
5126
5497
|
if self.mylazgrid is None:
|
5498
|
+
logging.warning(_('No laz grid'))
|
5127
5499
|
return
|
5128
5500
|
|
5129
5501
|
dlg = wx.NumberEntryDialog(None, _('Enter the size of the window around the active vector [cm]'), _('Window size'),_('Window size'), 500, 0, 2000)
|
@@ -5145,11 +5517,8 @@ class WolfMapViewer(wx.Frame):
|
|
5145
5517
|
s,z = copy_vec.get_sz()
|
5146
5518
|
notmasked = np.where(z != -99999.)
|
5147
5519
|
|
5148
|
-
fig.plot(s,z, c='black', linewidth=2.0)
|
5149
|
-
|
5150
|
-
# ax.plot(s[notmasked], z[notmasked], c='black', linewidth=2.0)
|
5520
|
+
fig.plot(s[notmasked],z[notmasked], c='black', linewidth=2.0)
|
5151
5521
|
|
5152
|
-
# fig.show()
|
5153
5522
|
|
5154
5523
|
def clip_laz_gridded(self):
|
5155
5524
|
""" Clip laz grid on current zoom """
|
@@ -5163,10 +5532,11 @@ class WolfMapViewer(wx.Frame):
|
|
5163
5532
|
|
5164
5533
|
logging.info(_('Clip LAZ grid on current zoom {}-{} {}-{}').format(curbounds[0][0],curbounds[0][1],curbounds[1][0],curbounds[1][1]))
|
5165
5534
|
|
5166
|
-
def
|
5535
|
+
def decimate_laz_data(self, factor:int = 10):
|
5167
5536
|
""" Decimate data """
|
5168
5537
|
|
5169
5538
|
if self.mylazdata is None:
|
5539
|
+
logging.warning(_('No laz data'))
|
5170
5540
|
return
|
5171
5541
|
|
5172
5542
|
self.mylazdata = self.mylazdata[::factor]
|
@@ -5528,7 +5898,7 @@ class WolfMapViewer(wx.Frame):
|
|
5528
5898
|
for curframe in self.linkedList:
|
5529
5899
|
curframe.mylazdata = self.mylazdata
|
5530
5900
|
|
5531
|
-
def init_laz_from_gridinfos(self, dirlaz:str = None):
|
5901
|
+
def init_laz_from_gridinfos(self, dirlaz:str = None, classification:Literal['SPW-Geofit 2023', 'SPW 2013-2014'] = 'SPW-Geofit 2023'):
|
5532
5902
|
|
5533
5903
|
if dirlaz is None:
|
5534
5904
|
dlg = wx.DirDialog(None, _('Choose directory where LAZ data/gridinfo are stored'))
|
@@ -5540,19 +5910,20 @@ class WolfMapViewer(wx.Frame):
|
|
5540
5910
|
|
5541
5911
|
self.mylazgrid = xyz_laz_grids(dirlaz)
|
5542
5912
|
|
5543
|
-
|
5544
|
-
|
5545
|
-
|
5913
|
+
if classification not in ['SPW-Geofit 2023', 'SPW 2013-2014']:
|
5914
|
+
dlg = wx.SingleChoiceDialog(None, _('Choose the classification'), _('Classification'), ['SPW-Geofit 2023', 'SPW 2013-2014'], wx.CHOICEDLG_STYLE)
|
5915
|
+
ret = dlg.ShowModal()
|
5916
|
+
if ret != wx.ID_OK:
|
5917
|
+
dlg.Destroy()
|
5918
|
+
return
|
5919
|
+
classification = dlg.GetStringSelection()
|
5546
5920
|
dlg.Destroy()
|
5547
|
-
return
|
5548
5921
|
|
5549
|
-
if
|
5922
|
+
if classification == 'SPW 2013-2014':
|
5550
5923
|
self.mylazgrid.colors.init_2013()
|
5551
5924
|
else:
|
5552
5925
|
self.mylazgrid.colors.init_2023()
|
5553
5926
|
|
5554
|
-
dlg.Destroy()
|
5555
|
-
|
5556
5927
|
if self.linked:
|
5557
5928
|
if len(self.linkedList) > 0:
|
5558
5929
|
for curframe in self.linkedList:
|
@@ -5806,12 +6177,14 @@ class WolfMapViewer(wx.Frame):
|
|
5806
6177
|
|
5807
6178
|
itemlabel = item.ItemLabel
|
5808
6179
|
|
5809
|
-
autoscale =
|
6180
|
+
autoscale = False
|
5810
6181
|
|
5811
6182
|
if id == wx.ID_OPEN:
|
6183
|
+
autoscale = True
|
5812
6184
|
filterProject = "proj (*.proj)|*.proj|param (*.param)|*.param|all (*.*)|*.*"
|
5813
6185
|
file = wx.FileDialog(self, "Choose file", wildcard=filterProject)
|
5814
|
-
|
6186
|
+
ret = file.ShowModal()
|
6187
|
+
if ret == wx.ID_CANCEL:
|
5815
6188
|
file.Destroy()
|
5816
6189
|
return
|
5817
6190
|
else:
|
@@ -5827,30 +6200,28 @@ class WolfMapViewer(wx.Frame):
|
|
5827
6200
|
elif itemlabel == _('Shortcuts'):
|
5828
6201
|
# show shortcuts in log
|
5829
6202
|
self.print_shortcuts(True)
|
5830
|
-
|
6203
|
+
|
6204
|
+
elif itemlabel == _('Project .proj'):
|
6205
|
+
# show shortcuts in log
|
6206
|
+
self.help_project()
|
5831
6207
|
|
5832
6208
|
elif itemlabel == _('Show logs/informations'):
|
5833
6209
|
self.check_logging()
|
5834
|
-
autoscale = False
|
5835
6210
|
|
5836
6211
|
elif itemlabel == _('Show values'):
|
5837
6212
|
self.check_tooltip()
|
5838
|
-
autoscale = False
|
5839
6213
|
|
5840
6214
|
elif itemlabel == _('About'):
|
5841
6215
|
#print About Frame
|
5842
6216
|
self.print_About()
|
5843
|
-
autoscale = False
|
5844
6217
|
|
5845
6218
|
elif itemlabel == _('Check for updates'):
|
5846
6219
|
# check for new version
|
5847
6220
|
|
5848
6221
|
self.check_for_updates()
|
5849
|
-
autoscale = False
|
5850
6222
|
|
5851
6223
|
elif itemlabel == _("Plot integrated Q along active vector..."):
|
5852
6224
|
""" Integrate Q along active vector """
|
5853
|
-
autoscale = False
|
5854
6225
|
|
5855
6226
|
if self.active_vector is None:
|
5856
6227
|
logging.warning(_('No active vector !'))
|
@@ -5868,7 +6239,6 @@ class WolfMapViewer(wx.Frame):
|
|
5868
6239
|
|
5869
6240
|
elif itemlabel == _("Plot integrated Q along active zone..."):
|
5870
6241
|
""" Integrate Q along active zone """
|
5871
|
-
autoscale = False
|
5872
6242
|
|
5873
6243
|
if self.active_zone is None:
|
5874
6244
|
logging.warning(_('No active zone !'))
|
@@ -5881,7 +6251,6 @@ class WolfMapViewer(wx.Frame):
|
|
5881
6251
|
self.active_res2d.plot_q(self.active_zone.myvectors, ['border'] * self.active_zone.nbvectors, toshow=True)
|
5882
6252
|
|
5883
6253
|
elif itemlabel == _("Export integrated Q along active vector..."):
|
5884
|
-
autoscale = False
|
5885
6254
|
|
5886
6255
|
if self.active_vector is None:
|
5887
6256
|
logging.warning(_('No active vector !'))
|
@@ -5936,7 +6305,6 @@ class WolfMapViewer(wx.Frame):
|
|
5936
6305
|
|
5937
6306
|
|
5938
6307
|
elif itemlabel == _("Export integrated Q along all vectors in active zone..."):
|
5939
|
-
autoscale = False
|
5940
6308
|
|
5941
6309
|
if self.active_zone is None:
|
5942
6310
|
logging.warning(_('No active zone !'))
|
@@ -5991,7 +6359,6 @@ class WolfMapViewer(wx.Frame):
|
|
5991
6359
|
|
5992
6360
|
|
5993
6361
|
elif itemlabel == _("Plot stats unknown (selected nodes)..."):
|
5994
|
-
autoscale = False
|
5995
6362
|
|
5996
6363
|
if self.active_res2d is None:
|
5997
6364
|
logging.warning(_('No active 2D result !'))
|
@@ -6025,7 +6392,6 @@ class WolfMapViewer(wx.Frame):
|
|
6025
6392
|
fig.show()
|
6026
6393
|
|
6027
6394
|
elif itemlabel == _("Plot stats unknown (inside active vector)..."):
|
6028
|
-
autoscale = False
|
6029
6395
|
|
6030
6396
|
if self.active_res2d is None:
|
6031
6397
|
logging.warning(_('No active 2D result !'))
|
@@ -6055,7 +6421,6 @@ class WolfMapViewer(wx.Frame):
|
|
6055
6421
|
fig, ax = self.active_res2d.plot_h(self.active_vector, unknown, toshow=True)
|
6056
6422
|
|
6057
6423
|
elif itemlabel == _("Plot stats unknown (inside active zone)..."):
|
6058
|
-
autoscale = False
|
6059
6424
|
|
6060
6425
|
if self.active_res2d is None:
|
6061
6426
|
logging.warning(_('No active 2D result !'))
|
@@ -6092,7 +6457,6 @@ class WolfMapViewer(wx.Frame):
|
|
6092
6457
|
|
6093
6458
|
elif itemlabel == _("Plot active vector..."):
|
6094
6459
|
""" Plot data along active vector """
|
6095
|
-
autoscale = False
|
6096
6460
|
|
6097
6461
|
if self.active_vector is None:
|
6098
6462
|
logging.warning(_('No active vector !'))
|
@@ -6168,36 +6532,24 @@ class WolfMapViewer(wx.Frame):
|
|
6168
6532
|
fig.canvas.flush_events()
|
6169
6533
|
|
6170
6534
|
elif itemlabel == _("Compute and apply unique colormap on all..."):
|
6171
|
-
autoscale = False
|
6172
|
-
|
6173
6535
|
self.uniquecolormap()
|
6174
6536
|
|
6175
6537
|
elif itemlabel == _("Load and apply unique colormap on all..."):
|
6176
|
-
autoscale = False
|
6177
|
-
|
6178
6538
|
self.uniquecolormap(True)
|
6179
6539
|
|
6180
6540
|
elif itemlabel == _("Force uniform in parts on all..."):
|
6181
|
-
autoscale = False
|
6182
6541
|
self.uniforminparts_all(True)
|
6183
6542
|
|
6184
6543
|
elif itemlabel == _("Force linear interpolation on all..."):
|
6185
|
-
autoscale = False
|
6186
6544
|
self.uniforminparts_all(False)
|
6187
6545
|
|
6188
6546
|
elif itemlabel == _("Load and apply mask (nap)..."):
|
6189
|
-
autoscale = False
|
6190
|
-
|
6191
6547
|
self.loadnap_and_apply()
|
6192
6548
|
|
6193
6549
|
elif itemlabel == _("Filter inundation arrays..."):
|
6194
|
-
autoscale = False
|
6195
|
-
|
6196
6550
|
self.filter_inundation()
|
6197
6551
|
|
6198
6552
|
elif itemlabel == _("Plot active polygons..."):
|
6199
|
-
autoscale = False
|
6200
|
-
|
6201
6553
|
if self.active_zone is None:
|
6202
6554
|
logging.warning(_('No active zone ! -- please select a zone containing polygons !'))
|
6203
6555
|
return
|
@@ -6273,7 +6625,7 @@ class WolfMapViewer(wx.Frame):
|
|
6273
6625
|
fig.show()
|
6274
6626
|
|
6275
6627
|
elif itemlabel == _("Manage banks..."):
|
6276
|
-
|
6628
|
+
|
6277
6629
|
if self.active_vector is None:
|
6278
6630
|
msg = _('Active vector is None\nPlease activate the one desired')
|
6279
6631
|
msg += _('\n')
|
@@ -6284,13 +6636,11 @@ class WolfMapViewer(wx.Frame):
|
|
6284
6636
|
self.managebanks()
|
6285
6637
|
|
6286
6638
|
elif itemlabel == _("Create banks from vertices..."):
|
6287
|
-
autoscale = False
|
6288
6639
|
|
6289
6640
|
self.active_cs.create_zone_from_banksbed()
|
6290
6641
|
self.active_cs.linked_zones.showstructure()
|
6291
6642
|
|
6292
6643
|
elif itemlabel == _("Link cross sections to active zones"):
|
6293
|
-
autoscale = False
|
6294
6644
|
|
6295
6645
|
if self.active_cs is None:
|
6296
6646
|
msg = _('Active cross sections is None\nPlease activate the one desired')
|
@@ -6309,7 +6659,6 @@ class WolfMapViewer(wx.Frame):
|
|
6309
6659
|
self.active_cs.link_external_zones(self.active_zones)
|
6310
6660
|
|
6311
6661
|
elif itemlabel == _("Rename cross sections..."):
|
6312
|
-
autoscale = False
|
6313
6662
|
|
6314
6663
|
dlg = wx.TextEntryDialog(None, _('Which starting point?'))
|
6315
6664
|
ret = dlg.ShowModal()
|
@@ -6325,15 +6674,12 @@ class WolfMapViewer(wx.Frame):
|
|
6325
6674
|
# self.import_3dfaces()
|
6326
6675
|
|
6327
6676
|
elif itemlabel == _("Interpolate on active triangulation..."):
|
6328
|
-
autoscale = False
|
6329
6677
|
self.interpolate_triangulation()
|
6330
6678
|
|
6331
6679
|
elif itemlabel==_("Compare cloud to array..."):
|
6332
|
-
autoscale = False
|
6333
6680
|
self.compare_cloud2array()
|
6334
6681
|
|
6335
6682
|
elif itemlabel==_("Split cloud..."):
|
6336
|
-
autoscale = False
|
6337
6683
|
|
6338
6684
|
if self.active_cloud is None:
|
6339
6685
|
logging.warning(_('No active cloud !'))
|
@@ -6346,26 +6692,21 @@ class WolfMapViewer(wx.Frame):
|
|
6346
6692
|
self.split_cloud_by_vector()
|
6347
6693
|
|
6348
6694
|
elif itemlabel==_("Compare triangles to array..."):
|
6349
|
-
autoscale = False
|
6350
6695
|
self.compare_tri2array()
|
6351
6696
|
|
6352
6697
|
elif itemlabel == _("Move triangles..."):
|
6353
|
-
autoscale = False
|
6354
6698
|
self.move_triangles()
|
6355
6699
|
|
6356
6700
|
elif itemlabel == _("Rotate triangles..."):
|
6357
|
-
autoscale = False
|
6358
6701
|
self.rotate_triangles()
|
6359
6702
|
|
6360
6703
|
elif itemlabel == _("Create contour from checked arrays..."):
|
6361
|
-
autoscale = False
|
6362
6704
|
|
6363
6705
|
# Create contour from checked arrays and add it to the list of objects
|
6364
6706
|
newzones = self.create_Zones_from_arrays(self.get_list_objects(draw_type.ARRAYS, checked_state=True))
|
6365
6707
|
self.add_object('vector', newobj=newzones, ToCheck=True, id='Contours from arrays')
|
6366
6708
|
|
6367
6709
|
elif itemlabel == _("Calculator..."):
|
6368
|
-
autoscale = False
|
6369
6710
|
|
6370
6711
|
if self.calculator is None:
|
6371
6712
|
self.calculator = Calculator(mapviewer = self)
|
@@ -6373,12 +6714,10 @@ class WolfMapViewer(wx.Frame):
|
|
6373
6714
|
self.calculator.Show()
|
6374
6715
|
|
6375
6716
|
elif itemlabel == _('Image digitizer...'):
|
6376
|
-
autoscale = False
|
6377
6717
|
|
6378
6718
|
new_digitizer = Digitizer()
|
6379
6719
|
|
6380
6720
|
elif itemlabel == _("Memory views..."):
|
6381
|
-
autoscale = False
|
6382
6721
|
|
6383
6722
|
if self.memory_views is None:
|
6384
6723
|
self.memory_views = Memory_Views()
|
@@ -6390,7 +6729,6 @@ class WolfMapViewer(wx.Frame):
|
|
6390
6729
|
self._memory_views_gui.Show()
|
6391
6730
|
|
6392
6731
|
elif itemlabel == _("Create bridge and export gltf..."):
|
6393
|
-
autoscale = False
|
6394
6732
|
|
6395
6733
|
if self.active_cs is None:
|
6396
6734
|
msg = _('Active cross sections is None\nPlease activate the one desired')
|
@@ -6402,7 +6740,6 @@ class WolfMapViewer(wx.Frame):
|
|
6402
6740
|
self.start_action('bridge gltf', _('Create bridge and export gltf...'))
|
6403
6741
|
|
6404
6742
|
elif itemlabel == _("Export cross sections to gltf..."):
|
6405
|
-
autoscale = False
|
6406
6743
|
|
6407
6744
|
if self.active_cs is None:
|
6408
6745
|
msg = _('Active cross sections is None\nPlease activate the one desired')
|
@@ -6432,21 +6769,20 @@ class WolfMapViewer(wx.Frame):
|
|
6432
6769
|
self.active_cs.export_gltf(zmin, fn)
|
6433
6770
|
|
6434
6771
|
elif itemlabel == _("New cloud Viewer..."):
|
6435
|
-
|
6772
|
+
|
6436
6773
|
if self.myinterp is not None:
|
6437
6774
|
self.myinterp.viewer_interpolator()
|
6438
6775
|
|
6439
6776
|
elif itemlabel == _("Interpolate on active array..."):
|
6440
|
-
|
6777
|
+
|
6441
6778
|
if self.myinterp is not None:
|
6442
6779
|
self.interpolate_cs()
|
6443
6780
|
|
6444
6781
|
elif itemlabel == _("Interpolate active cloud on active array..."):
|
6445
|
-
autoscale = False
|
6446
6782
|
self.interpolate_cloud()
|
6447
6783
|
|
6448
|
-
elif itemlabel == _('Save project'):
|
6449
|
-
|
6784
|
+
elif itemlabel == _('Save project as...'):
|
6785
|
+
|
6450
6786
|
filterProject = "proj (*.proj)|*.proj|param (*.param)|*.param|all (*.*)|*.*"
|
6451
6787
|
file = wx.FileDialog(self, "Name your file", wildcard=filterProject, style=wx.FD_SAVE)
|
6452
6788
|
if file.ShowModal() == wx.ID_CANCEL:
|
@@ -6457,18 +6793,21 @@ class WolfMapViewer(wx.Frame):
|
|
6457
6793
|
filename = file.GetPath()
|
6458
6794
|
file.Destroy()
|
6459
6795
|
|
6460
|
-
|
6796
|
+
abspath = True
|
6797
|
+
dlg = wx.MessageDialog(None, _('Do you want to save the paths in absolute mode ?'), _('Relative paths'), style=wx.YES_NO)
|
6798
|
+
ret = dlg.ShowModal()
|
6799
|
+
if ret == wx.ID_NO:
|
6800
|
+
abspath = False
|
6801
|
+
|
6802
|
+
self.save_project(filename, absolute= abspath)
|
6461
6803
|
|
6462
6804
|
elif itemlabel == _('Initialize from npz'):
|
6463
|
-
autoscale=False
|
6464
6805
|
self.init_laz_from_numpy()
|
6465
6806
|
|
6466
6807
|
elif itemlabel == _('Initialize from GridInfos'):
|
6467
|
-
autoscale=False
|
6468
6808
|
self.init_laz_from_gridinfos()
|
6469
6809
|
|
6470
6810
|
elif itemlabel == _('Create cloud points from bridges'):
|
6471
|
-
autoscale=False
|
6472
6811
|
if self.mylazdata is None:
|
6473
6812
|
self.init_laz_from_numpy()
|
6474
6813
|
|
@@ -6487,7 +6826,7 @@ class WolfMapViewer(wx.Frame):
|
|
6487
6826
|
self.add_object('cloud', newobj=mycloud, ToCheck=True, id='Bridges')
|
6488
6827
|
|
6489
6828
|
elif itemlabel == _('Create cloud points from buildings'):
|
6490
|
-
|
6829
|
+
|
6491
6830
|
if self.mylazdata is None:
|
6492
6831
|
self.init_laz_from_numpy()
|
6493
6832
|
|
@@ -6506,8 +6845,6 @@ class WolfMapViewer(wx.Frame):
|
|
6506
6845
|
|
6507
6846
|
elif itemlabel == _('Create LAZ viewer'):
|
6508
6847
|
|
6509
|
-
autoscale = False
|
6510
|
-
|
6511
6848
|
laz_source = self._select_laz_source()
|
6512
6849
|
if laz_source is None:
|
6513
6850
|
return
|
@@ -6535,10 +6872,11 @@ class WolfMapViewer(wx.Frame):
|
|
6535
6872
|
self.myviewer = myviewer(laz_source, ass_values[idx]) #, palette_classif = self.mylazdata_colors)
|
6536
6873
|
|
6537
6874
|
elif itemlabel == _('Clip LAZ grid on current zoom'):
|
6875
|
+
|
6538
6876
|
if self.mylazgrid is None:
|
6539
6877
|
logging.warning(_('No gridded LAZ data loaded !'))
|
6540
6878
|
return
|
6541
|
-
|
6879
|
+
|
6542
6880
|
self.clip_laz_gridded()
|
6543
6881
|
|
6544
6882
|
if self.mylazdata is None:
|
@@ -6560,9 +6898,10 @@ class WolfMapViewer(wx.Frame):
|
|
6560
6898
|
dlg.Destroy()
|
6561
6899
|
|
6562
6900
|
if decimate_fact > 0:
|
6563
|
-
self.
|
6901
|
+
self.decimate_laz_data(decimate_fact)
|
6564
6902
|
|
6565
6903
|
elif itemlabel == _('Fill active array from LAZ data'):
|
6904
|
+
|
6566
6905
|
if self.mylazgrid is None:
|
6567
6906
|
logging.warning('')
|
6568
6907
|
return
|
@@ -6570,10 +6909,10 @@ class WolfMapViewer(wx.Frame):
|
|
6570
6909
|
logging.warning(_('No active array -- select an array first and retry!'))
|
6571
6910
|
return
|
6572
6911
|
|
6573
|
-
autoscale = False
|
6574
6912
|
self.fill_active_array_from_laz(self.active_array)
|
6575
6913
|
|
6576
6914
|
elif itemlabel == _('Count LAZ data in cells'):
|
6915
|
+
|
6577
6916
|
if self.mylazgrid is None:
|
6578
6917
|
logging.warning('')
|
6579
6918
|
return
|
@@ -6581,7 +6920,6 @@ class WolfMapViewer(wx.Frame):
|
|
6581
6920
|
logging.warning(_('No active array -- select an array first and retry!'))
|
6582
6921
|
return
|
6583
6922
|
|
6584
|
-
autoscale = False
|
6585
6923
|
self.count_active_array_from_laz(self.active_array)
|
6586
6924
|
|
6587
6925
|
elif itemlabel == _('Select cells in array from LAZ data'):
|
@@ -6592,15 +6930,13 @@ class WolfMapViewer(wx.Frame):
|
|
6592
6930
|
logging.warning(_('No active array -- select an array first and retry!'))
|
6593
6931
|
return
|
6594
6932
|
|
6595
|
-
autoscale = False
|
6596
6933
|
self.select_active_array_from_laz(self.active_array)
|
6597
6934
|
|
6598
6935
|
elif itemlabel == _('Plot LAZ around active vector'):
|
6599
|
-
autoscale = False
|
6600
6936
|
self.plot_laz_around_active_vec()
|
6601
6937
|
|
6602
6938
|
elif itemlabel == _('Plot LAZ around temporary vector'):
|
6603
|
-
|
6939
|
+
|
6604
6940
|
self.active_vector = vector()
|
6605
6941
|
self.active_vector.add_vertex(wolfvertex(0.,0.))
|
6606
6942
|
self.mimicme()
|
@@ -6610,11 +6946,10 @@ class WolfMapViewer(wx.Frame):
|
|
6610
6946
|
elif itemlabel == _('Change colors - Classification'):
|
6611
6947
|
|
6612
6948
|
if self.mylazgrid is not None:
|
6613
|
-
autoscale = False
|
6614
6949
|
self.mylazgrid.colors.interactive_update_colors()
|
6615
6950
|
|
6616
6951
|
elif itemlabel == _('Multiviewer'):
|
6617
|
-
|
6952
|
+
|
6618
6953
|
dlg = wx.NumberEntryDialog(self, _("Additional viewers"), _("How many?"), _("How many additional viewers?"),1, 0, 5)
|
6619
6954
|
ret = dlg.ShowModal()
|
6620
6955
|
|
@@ -6658,8 +6993,6 @@ class WolfMapViewer(wx.Frame):
|
|
6658
6993
|
self.active_viewer3d.add_array(curarray.idx, curarray._array3d)
|
6659
6994
|
self.active_viewer3d.autoscale()
|
6660
6995
|
|
6661
|
-
pass
|
6662
|
-
|
6663
6996
|
elif itemlabel == _('Create/Open multiblock model'):
|
6664
6997
|
|
6665
6998
|
self.create_2D_MB_model()
|
@@ -6678,6 +7011,8 @@ class WolfMapViewer(wx.Frame):
|
|
6678
7011
|
|
6679
7012
|
elif itemlabel == _('Set comparison'):
|
6680
7013
|
|
7014
|
+
autoscale = True
|
7015
|
+
|
6681
7016
|
# Comparaison de deux résultats ou de deux matrices
|
6682
7017
|
|
6683
7018
|
self.compare_results = Compare_Arrays_Results(self, share_cmap_array= True, share_cmap_diff= True)
|
@@ -6694,6 +7029,7 @@ class WolfMapViewer(wx.Frame):
|
|
6694
7029
|
self.compare_results.bake()
|
6695
7030
|
|
6696
7031
|
elif id == wx.ID_EXIT:
|
7032
|
+
|
6697
7033
|
dlg = wx.MessageDialog(None,_('Do you really want to quit?'), style = wx.YES_NO|wx.NO_DEFAULT)
|
6698
7034
|
ret=dlg.ShowModal()
|
6699
7035
|
if ret == wx.ID_YES:
|
@@ -6779,6 +7115,7 @@ class WolfMapViewer(wx.Frame):
|
|
6779
7115
|
self.add_object(which='array_lidar_second', ToCheck=True)
|
6780
7116
|
|
6781
7117
|
elif id == wx.ID_FILE5:
|
7118
|
+
|
6782
7119
|
def addscandir(mydir):
|
6783
7120
|
for entry in scandir(mydir):
|
6784
7121
|
if entry.is_dir():
|
@@ -6801,7 +7138,7 @@ class WolfMapViewer(wx.Frame):
|
|
6801
7138
|
ToCheck=True,
|
6802
7139
|
id=join(mydir, entry.name))
|
6803
7140
|
|
6804
|
-
elif entry.name.endswith('.bin'):
|
7141
|
+
elif entry.name.endswith(('.bin', '.tif', '.npy')):
|
6805
7142
|
self.add_object(which='array',
|
6806
7143
|
filename=join(mydir, entry.name),
|
6807
7144
|
ToCheck=True,
|
@@ -6825,26 +7162,22 @@ class WolfMapViewer(wx.Frame):
|
|
6825
7162
|
self.add_object('array', newobj=newarray)
|
6826
7163
|
|
6827
7164
|
elif itemlabel == _('Create view...'):
|
6828
|
-
autoscale = False
|
6829
7165
|
|
6830
7166
|
# Création d'une nouvelle vue
|
6831
7167
|
newview = WolfViews(mapviewer=self)
|
6832
7168
|
self.add_object('views', newobj=newview)
|
6833
7169
|
|
6834
7170
|
elif itemlabel==_('Create Wolf2D manager ...'):
|
6835
|
-
autoscale = False
|
6836
7171
|
|
6837
7172
|
from .mesh2d.config_manager import config_manager_2D
|
6838
7173
|
newmanager = config_manager_2D(mapviewer=self)
|
6839
7174
|
|
6840
7175
|
elif itemlabel==_('Create scenarios manager ...'):
|
6841
|
-
autoscale = False
|
6842
7176
|
|
6843
7177
|
from .scenario.config_manager import Config_Manager_2D_GPU
|
6844
7178
|
newmanager = Config_Manager_2D_GPU(mapviewer=self, create_ui_if_wx=True)
|
6845
7179
|
|
6846
7180
|
elif itemlabel == _('Create acceptability manager...'):
|
6847
|
-
autoscale = False
|
6848
7181
|
|
6849
7182
|
from .acceptability.acceptability_gui import AcceptabilityGui
|
6850
7183
|
newmanager = AcceptabilityGui()
|
@@ -6852,7 +7185,6 @@ class WolfMapViewer(wx.Frame):
|
|
6852
7185
|
newmanager.Show()
|
6853
7186
|
|
6854
7187
|
elif itemlabel==_('Create BC manager Wolf2D...'):
|
6855
|
-
autoscale = False
|
6856
7188
|
|
6857
7189
|
if self.active_array is not None:
|
6858
7190
|
|
@@ -6885,27 +7217,26 @@ class WolfMapViewer(wx.Frame):
|
|
6885
7217
|
self.active_bc = self.mybc[-1]
|
6886
7218
|
|
6887
7219
|
elif itemlabel == _('Create Wolf1D...'):
|
6888
|
-
|
7220
|
+
|
6889
7221
|
self.frame_create1Dfrom2D = GuiNotebook1D(mapviewer= self)
|
6890
7222
|
logging.info(_(f'New window available - Wolf1D.'))
|
6891
7223
|
|
6892
7224
|
elif id == wx.ID_FILE7:
|
6893
|
-
|
7225
|
+
|
6894
7226
|
# Création de nouveaux vecteurs
|
6895
7227
|
newzones = Zones(parent=self)
|
6896
7228
|
self.add_object('vector', newobj=newzones)
|
7229
|
+
|
6897
7230
|
elif id == wx.ID_FILE8:
|
6898
|
-
autoscale = False
|
6899
7231
|
# Création d'un nouveau nuage de point
|
6900
7232
|
newcloud = cloud_vertices()
|
6901
7233
|
self.add_object('cloud', newobj=newcloud)
|
7234
|
+
|
6902
7235
|
elif id in self.tools.keys():
|
6903
7236
|
# gestion des actions
|
6904
7237
|
self.ManageActions(id)
|
6905
|
-
autoscale = False
|
6906
7238
|
|
6907
7239
|
elif id == wx.ID_SAVE:
|
6908
|
-
autoscale = False
|
6909
7240
|
|
6910
7241
|
for obj in self.iterator_over_objects(draw_type.ARRAYS):
|
6911
7242
|
obj: WolfArray
|
@@ -6924,7 +7255,6 @@ class WolfMapViewer(wx.Frame):
|
|
6924
7255
|
obj.saveas()
|
6925
7256
|
|
6926
7257
|
elif itemlabel == 'Save to image...':
|
6927
|
-
autoscale = False
|
6928
7258
|
|
6929
7259
|
fn, ds = self.save_canvasogl(mpl=True)
|
6930
7260
|
|
@@ -6932,11 +7262,11 @@ class WolfMapViewer(wx.Frame):
|
|
6932
7262
|
self.assembly_images(all_images, mode= self.assembly_mode)
|
6933
7263
|
|
6934
7264
|
elif itemlabel == _('Copy image...'):
|
6935
|
-
|
7265
|
+
|
6936
7266
|
self.copy_canvasogl()
|
6937
7267
|
|
6938
7268
|
elif itemlabel == _('Export...'):
|
6939
|
-
|
7269
|
+
|
6940
7270
|
curarray: WolfArray
|
6941
7271
|
curvec: vector
|
6942
7272
|
|
@@ -6984,7 +7314,7 @@ class WolfMapViewer(wx.Frame):
|
|
6984
7314
|
del wait
|
6985
7315
|
|
6986
7316
|
elif itemlabel == _('Import...'):
|
6987
|
-
|
7317
|
+
|
6988
7318
|
curarray: WolfArray
|
6989
7319
|
|
6990
7320
|
msg = ''
|
@@ -7038,7 +7368,7 @@ class WolfMapViewer(wx.Frame):
|
|
7038
7368
|
del wait
|
7039
7369
|
|
7040
7370
|
elif itemlabel == _('Compare...'):
|
7041
|
-
|
7371
|
+
|
7042
7372
|
msg = ''
|
7043
7373
|
if self.active_array is None:
|
7044
7374
|
msg += _('Active array is None\n')
|
@@ -7055,7 +7385,6 @@ class WolfMapViewer(wx.Frame):
|
|
7055
7385
|
self.update_blender_sculpting()
|
7056
7386
|
|
7057
7387
|
elif itemlabel == _('Update...'):
|
7058
|
-
autoscale = False
|
7059
7388
|
|
7060
7389
|
msg = ''
|
7061
7390
|
if self.active_array is None:
|
@@ -7071,7 +7400,7 @@ class WolfMapViewer(wx.Frame):
|
|
7071
7400
|
self.update_blender_sculpting()
|
7072
7401
|
|
7073
7402
|
elif id == wx.ID_SAVEAS:
|
7074
|
-
|
7403
|
+
|
7075
7404
|
for obj in self.iterator_over_objects(draw_type.ARRAYS):
|
7076
7405
|
obj: WolfArray
|
7077
7406
|
|
@@ -7095,11 +7424,6 @@ class WolfMapViewer(wx.Frame):
|
|
7095
7424
|
if ret == wx.ID_OK:
|
7096
7425
|
obj.saveas(fdlg.GetPath())
|
7097
7426
|
|
7098
|
-
# elif id == ID_RUN_SIMULATION:
|
7099
|
-
# from ..debug.test_glsim.wolf_gpu import load_sim_to_gpu
|
7100
|
-
# print("Simulation")
|
7101
|
-
# load_sim_to_gpu()
|
7102
|
-
|
7103
7427
|
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:
|
7104
7428
|
# Trouve les bornzs si un seul élément est présent, sinon on conserve l'état du zoom
|
7105
7429
|
self.Autoscale()
|