wolfhece 2.2.28__py3-none-any.whl → 2.2.30__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 +27 -3
- wolfhece/PyCrosssections.py +36 -33
- wolfhece/PyDraw.py +204 -20
- wolfhece/PyVertexvectors.py +417 -121
- wolfhece/PyWMS.py +6 -3
- wolfhece/__init__.py +27 -0
- wolfhece/acceptability/acceptability.py +25 -20
- wolfhece/acceptability/acceptability_gui.py +150 -92
- wolfhece/acceptability/func.py +169 -82
- wolfhece/apps/version.py +1 -1
- wolfhece/irm_qdf.py +71 -7
- wolfhece/lb7208_ntv2/__init__.py +0 -0
- wolfhece/lb7208_ntv2/be_ign_README.txt +36 -0
- wolfhece/lb7208_ntv2/be_ign_bd72lb72_etrs89lb08.tif +0 -0
- wolfhece/lb7208_ntv2/be_ign_hBG18.tif +0 -0
- wolfhece/mesh2d/gpu_2d.py +11 -2
- wolfhece/pyshields.py +166 -105
- wolfhece/report/compare_arrays.py +268 -58
- wolfhece/report/simplesimgpu.py +25 -6
- wolfhece/scenario/config_manager.py +243 -7
- wolfhece/ui/wolf_multiselection_collapsiblepane.py +153 -1
- wolfhece/wolf_array.py +67 -62
- wolfhece/wolf_texture.py +4 -0
- {wolfhece-2.2.28.dist-info → wolfhece-2.2.30.dist-info}/METADATA +1 -1
- {wolfhece-2.2.28.dist-info → wolfhece-2.2.30.dist-info}/RECORD +28 -24
- {wolfhece-2.2.28.dist-info → wolfhece-2.2.30.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.28.dist-info → wolfhece-2.2.30.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.28.dist-info → wolfhece-2.2.30.dist-info}/top_level.txt +0 -0
wolfhece/PyConfig.py
CHANGED
@@ -35,6 +35,8 @@ class ConfigurationKeys(Enum):
|
|
35
35
|
DIRECTORY_DEM = "Default DEM directory"
|
36
36
|
DIRECTORY_DTM = "Default DTM directory"
|
37
37
|
DIRECTORY_LAZ = "Default LAZ directory"
|
38
|
+
ACTIVE_VECTOR_COLOR = "Active vector color"
|
39
|
+
ACTIVE_VECTOR_SIZE_SQUARE = "Active vector square size"
|
38
40
|
|
39
41
|
class WolfConfiguration:
|
40
42
|
""" Holds the PyWolf configuration """
|
@@ -82,7 +84,9 @@ class WolfConfiguration:
|
|
82
84
|
ConfigurationKeys.TICKS_FONTSIZE.value: 12,
|
83
85
|
ConfigurationKeys.DIRECTORY_DEM.value: "",
|
84
86
|
ConfigurationKeys.DIRECTORY_DTM.value: "",
|
85
|
-
ConfigurationKeys.DIRECTORY_LAZ.value: ""
|
87
|
+
ConfigurationKeys.DIRECTORY_LAZ.value: "",
|
88
|
+
ConfigurationKeys.ACTIVE_VECTOR_COLOR.value: [0, 0, 0, 255],
|
89
|
+
ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE.value: 5
|
86
90
|
|
87
91
|
}
|
88
92
|
self._types = {
|
@@ -98,7 +102,9 @@ class WolfConfiguration:
|
|
98
102
|
ConfigurationKeys.TICKS_FONTSIZE.value: int,
|
99
103
|
ConfigurationKeys.DIRECTORY_DEM.value: str,
|
100
104
|
ConfigurationKeys.DIRECTORY_DTM.value: str,
|
101
|
-
ConfigurationKeys.DIRECTORY_LAZ.value: str
|
105
|
+
ConfigurationKeys.DIRECTORY_LAZ.value: str,
|
106
|
+
ConfigurationKeys.ACTIVE_VECTOR_COLOR.value: list,
|
107
|
+
ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE.value: int
|
102
108
|
}
|
103
109
|
|
104
110
|
self._check_config()
|
@@ -145,7 +151,7 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
145
151
|
super(GlobalOptionsDialog, self).__init__(*args, **kw)
|
146
152
|
|
147
153
|
self.InitUI()
|
148
|
-
self.SetSize((600,
|
154
|
+
self.SetSize((600, 550))
|
149
155
|
self.SetTitle(_("Global options"))
|
150
156
|
|
151
157
|
def push_configuration(self, configuration):
|
@@ -161,6 +167,8 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
161
167
|
self.cfg_directory_dem.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_DEM]))
|
162
168
|
self.cfg_directory_dtm.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_DTM]))
|
163
169
|
self.cfg_directory_laz.SetValue(str(configuration[ConfigurationKeys.DIRECTORY_LAZ]))
|
170
|
+
self.cfg_vector_color.SetColour(configuration[ConfigurationKeys.ACTIVE_VECTOR_COLOR])
|
171
|
+
self.cfg_square_size.SetValue(str(configuration[ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE]))
|
164
172
|
|
165
173
|
def pull_configuration(self, configuration):
|
166
174
|
configuration[ConfigurationKeys.PLAY_WELCOME_SOUND] = self.cfg_welcome_voice.IsChecked()
|
@@ -175,6 +183,8 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
175
183
|
configuration[ConfigurationKeys.DIRECTORY_DEM] = str(self.cfg_directory_dem.Value)
|
176
184
|
configuration[ConfigurationKeys.DIRECTORY_DTM] = str(self.cfg_directory_dtm.Value)
|
177
185
|
configuration[ConfigurationKeys.DIRECTORY_LAZ] = str(self.cfg_directory_laz.Value)
|
186
|
+
configuration[ConfigurationKeys.ACTIVE_VECTOR_COLOR] = list(self.cfg_vector_color.GetColour())
|
187
|
+
configuration[ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE] = int(self.cfg_square_size.Value)
|
178
188
|
|
179
189
|
def InitUI(self):
|
180
190
|
|
@@ -298,6 +308,20 @@ class GlobalOptionsDialog(wx.Dialog):
|
|
298
308
|
sbs.Add(dir_dtm, 1, wx.EXPAND, 5)
|
299
309
|
sbs.Add(dir_laz, 1, wx.EXPAND, 5)
|
300
310
|
|
311
|
+
# Vector color
|
312
|
+
color_vector = wx.BoxSizer(wx.HORIZONTAL)
|
313
|
+
self.label_vector_color = wx.StaticText(pnl, label=_('Default vector color'))
|
314
|
+
self.cfg_vector_color = wx.ColourPickerCtrl(pnl, colour=(0, 0, 0, 255))
|
315
|
+
self.cfg_vector_color.SetToolTip(_('Color for active vector in the viewer'))
|
316
|
+
|
317
|
+
self.cfg_square_size = wx.TextCtrl(pnl, value='5', style=wx.TE_CENTRE)
|
318
|
+
self.cfg_square_size.SetToolTip(_('Size of the square for active vector in the viewer'))
|
319
|
+
|
320
|
+
color_vector.Add(self.label_vector_color, 1, wx.EXPAND, 2)
|
321
|
+
color_vector.Add(self.cfg_vector_color, 1, wx.EXPAND, 5)
|
322
|
+
color_vector.Add(self.cfg_square_size, 1, wx.EXPAND, 5)
|
323
|
+
sbs.Add(color_vector, 1, wx.EXPAND, 5)
|
324
|
+
|
301
325
|
pnl.SetSizer(sbs)
|
302
326
|
pnl.Layout()
|
303
327
|
|
wolfhece/PyCrosssections.py
CHANGED
@@ -1759,8 +1759,9 @@ class crosssections(Element_To_Draw):
|
|
1759
1759
|
f=open(myfile,'r')
|
1760
1760
|
lines=f.read().splitlines()
|
1761
1761
|
f.close()
|
1762
|
-
|
1763
|
-
|
1762
|
+
# For other formats (e.g. vecz)
|
1763
|
+
else:
|
1764
|
+
lines=[]
|
1764
1765
|
|
1765
1766
|
self.myprofiles={}
|
1766
1767
|
self.mygenprofiles={}
|
@@ -1880,36 +1881,6 @@ class crosssections(Element_To_Draw):
|
|
1880
1881
|
logging.debug(name)
|
1881
1882
|
|
1882
1883
|
nameprev=name
|
1883
|
-
elif format=='vecz' or format=='zones':
|
1884
|
-
|
1885
|
-
if isinstance(myfile, Zones):
|
1886
|
-
self.filename=myfile.filename
|
1887
|
-
tmpzones=myfile
|
1888
|
-
elif isinstance(myfile, str):
|
1889
|
-
self.filename=myfile
|
1890
|
-
tmpzones=Zones(myfile, find_minmax=False)
|
1891
|
-
|
1892
|
-
curzone:zone
|
1893
|
-
curvec:vector
|
1894
|
-
curzone=tmpzones.myzones[0]
|
1895
|
-
index=0
|
1896
|
-
for curvec in curzone.myvectors:
|
1897
|
-
|
1898
|
-
self.myprofiles[curvec.myname]={}
|
1899
|
-
curdict=self.myprofiles[curvec.myname]
|
1900
|
-
|
1901
|
-
curdict['index']=index
|
1902
|
-
curdict['left']=None
|
1903
|
-
curdict['bed']=None
|
1904
|
-
curdict['right']=None
|
1905
|
-
|
1906
|
-
index+=1
|
1907
|
-
curdict['cs']=profile(name=curvec.myname,parent=self)
|
1908
|
-
cursect:profile
|
1909
|
-
cursect=curdict['cs']
|
1910
|
-
|
1911
|
-
cursect.myvertices = curvec.myvertices
|
1912
|
-
|
1913
1884
|
elif format=='sxy':
|
1914
1885
|
self.format='sxy'
|
1915
1886
|
nbpotsect = int(lines[0])
|
@@ -1982,6 +1953,38 @@ class crosssections(Element_To_Draw):
|
|
1982
1953
|
cursect.bankright=wolfvertex(rbs,rbz)
|
1983
1954
|
curdict['right']=cursect.bankright
|
1984
1955
|
|
1956
|
+
# To make a distinction between cases for vecz
|
1957
|
+
elif len(lines)==0:
|
1958
|
+
if format=='vecz' or format=='zones':
|
1959
|
+
|
1960
|
+
if isinstance(myfile, Zones):
|
1961
|
+
self.filename=myfile.filename
|
1962
|
+
tmpzones=myfile
|
1963
|
+
elif isinstance(myfile, str):
|
1964
|
+
self.filename=myfile
|
1965
|
+
tmpzones=Zones(myfile, find_minmax=False)
|
1966
|
+
|
1967
|
+
curzone:zone
|
1968
|
+
curvec:vector
|
1969
|
+
curzone=tmpzones.myzones[0]
|
1970
|
+
index=0
|
1971
|
+
for curvec in curzone.myvectors:
|
1972
|
+
|
1973
|
+
self.myprofiles[curvec.myname]={}
|
1974
|
+
curdict=self.myprofiles[curvec.myname]
|
1975
|
+
|
1976
|
+
curdict['index']=index
|
1977
|
+
curdict['left']=None
|
1978
|
+
curdict['bed']=None
|
1979
|
+
curdict['right']=None
|
1980
|
+
|
1981
|
+
index+=1
|
1982
|
+
curdict['cs']=profile(name=curvec.myname,parent=self)
|
1983
|
+
cursect:profile
|
1984
|
+
cursect=curdict['cs']
|
1985
|
+
|
1986
|
+
cursect.myvertices = curvec.myvertices
|
1987
|
+
|
1985
1988
|
self.verif_bed()
|
1986
1989
|
self.find_minmax(True)
|
1987
1990
|
self.init_cloud()
|
@@ -2506,7 +2509,7 @@ class crosssections(Element_To_Draw):
|
|
2506
2509
|
self.xmax = 0
|
2507
2510
|
self.ymax = 0
|
2508
2511
|
return
|
2509
|
-
|
2512
|
+
|
2510
2513
|
if update:
|
2511
2514
|
for idx,vect in self.myprofiles.items():
|
2512
2515
|
vect['cs'].find_minmax(only_firstlast = True)
|
wolfhece/PyDraw.py
CHANGED
@@ -76,7 +76,7 @@ try:
|
|
76
76
|
from .PyPalette import wolfpalette
|
77
77
|
from .wolfresults_2D import Wolfresults_2D, views_2D, Extractable_results
|
78
78
|
from .PyTranslate import _
|
79
|
-
from .PyVertex import cloud_vertices, getIfromRGB
|
79
|
+
from .PyVertex import cloud_vertices, getIfromRGB, getRGBfromI
|
80
80
|
from .RatingCurve import SPWMIGaugingStations, SPWDCENNGaugingStations
|
81
81
|
from .wolf_array import WOLF_ARRAY_MB, SelectionData, WolfArray, WolfArrayMB, CropDialog, header_wolf, WolfArrayMNAP, WOLF_ARRAY_FULL_SINGLE, WOLF_ARRAY_FULL_INTEGER8, WOLF_ARRAY_FULL_INTEGER16, WOLF_ARRAY_FULL_DOUBLE, WOLF_ARRAY_FULL_INTEGER
|
82
82
|
from .PyParams import Wolf_Param, key_Param, Type_Param
|
@@ -2306,10 +2306,15 @@ class WolfMapViewer(wx.Frame):
|
|
2306
2306
|
|
2307
2307
|
self.analyzesimsheet.Append(wx.ID_ANY, _("Active simulation..."), _("Generate a summary PDF report for the active simulation"))
|
2308
2308
|
self.analyzesimsheet.Append(wx.ID_ANY, _("All checked simulations..."), _("Generate a summary PDF report for all checked simulations"))
|
2309
|
+
self.analyzesimsheet.AppendSeparator()
|
2310
|
+
self.analyzesimsheet.Append(wx.ID_ANY, _("One simulation from disk..."), _("Generate a summary PDF report for one simulation"))
|
2309
2311
|
self.analyzesimsheet.Append(wx.ID_ANY, _("All simulations in directory..."), _("Generate a summary PDF report for all simulations in the current directory"))
|
2310
2312
|
self.analyzesimsheet.AppendSeparator()
|
2311
2313
|
self.analyzesimsheet.Append(wx.ID_ANY, _("Compare checked simulations..."), _("Generate a summary PDF report for all the loaded simulations"))
|
2312
2314
|
self.analyzesimsheet.Append(wx.ID_ANY, _("Compare all simulations in a directory..."), _("Generate a summary PDF report for all the simulations in a directory"))
|
2315
|
+
self.analyzesimsheet.AppendSeparator()
|
2316
|
+
self.analyzesimsheet.Append(wx.ID_ANY, _("Compare arrays..."), _("Generate a summary PDF report for two loaded arrays"))
|
2317
|
+
self.analyzesimsheet.Append(wx.ID_ANY, _("Compare arrays from files..."), _("Generate a summary PDF report for two arrays from files"))
|
2313
2318
|
|
2314
2319
|
|
2315
2320
|
self.analyzeinpaint.Append(wx.ID_ANY, _("Inpaint active array..."), _("Inpaint active array"))
|
@@ -4194,6 +4199,24 @@ class WolfMapViewer(wx.Frame):
|
|
4194
4199
|
else:
|
4195
4200
|
return None
|
4196
4201
|
|
4202
|
+
@property
|
4203
|
+
def active_vector_color(self) -> list[int]:
|
4204
|
+
""" Return the active vector color from configs """
|
4205
|
+
config = self.get_configuration()
|
4206
|
+
if config is None:
|
4207
|
+
return [0, 0, 0, 255] # Default black color
|
4208
|
+
else:
|
4209
|
+
return config[ConfigurationKeys.ACTIVE_VECTOR_COLOR]
|
4210
|
+
|
4211
|
+
@property
|
4212
|
+
def active_vector_square_size(self) -> list[int]:
|
4213
|
+
""" Return the active vector square size from configs """
|
4214
|
+
config = self.get_configuration()
|
4215
|
+
if config is None:
|
4216
|
+
return 0
|
4217
|
+
else:
|
4218
|
+
return config[ConfigurationKeys.ACTIVE_VECTOR_SIZE_SQUARE]
|
4219
|
+
|
4197
4220
|
@property
|
4198
4221
|
def default_dem(self) -> Path:
|
4199
4222
|
""" Return the default DEM file from configs """
|
@@ -7710,6 +7733,78 @@ class WolfMapViewer(wx.Frame):
|
|
7710
7733
|
self.menu_dike()
|
7711
7734
|
autoscale = True
|
7712
7735
|
|
7736
|
+
def _run_compare_arrays(self, dlg):
|
7737
|
+
""" Run the comparison of two arrays"""
|
7738
|
+
|
7739
|
+
from .ui.wolf_multiselection_collapsiblepane import Wolf_CompareArrays_Selection
|
7740
|
+
|
7741
|
+
assert isinstance(dlg, Wolf_CompareArrays_Selection), 'Dialog must be a wx.Dialog instance'
|
7742
|
+
|
7743
|
+
dlg: Wolf_CompareArrays_Selection
|
7744
|
+
|
7745
|
+
vals = dlg.get_values()
|
7746
|
+
id1 = vals[_('Reference array')][0]
|
7747
|
+
id2 = vals[_('Comparison array')][0]
|
7748
|
+
min_area = dlg.get_min_area()
|
7749
|
+
threshold = dlg.get_threshold()
|
7750
|
+
nb_patches = dlg.get_max_patches()
|
7751
|
+
|
7752
|
+
ref:WolfArray
|
7753
|
+
comp:WolfArray
|
7754
|
+
ref = self.get_obj_from_id(id1, draw_type.ARRAYS)
|
7755
|
+
comp = self.get_obj_from_id(id2, draw_type.ARRAYS)
|
7756
|
+
|
7757
|
+
if ref is None or comp is None:
|
7758
|
+
logging.warning(_('You must select two arrays to compare !'))
|
7759
|
+
return
|
7760
|
+
|
7761
|
+
assert isinstance(ref, WolfArray), 'Reference object must be a WolfArray instance'
|
7762
|
+
assert isinstance(comp, WolfArray), 'Comparison object must be a WolfArray instance'
|
7763
|
+
|
7764
|
+
if not ref.is_like(comp):
|
7765
|
+
logging.error(_('The two arrays must have the same shape and type !'))
|
7766
|
+
return
|
7767
|
+
|
7768
|
+
# if only 2 arrays, we can use the CompareArrays_wx directly
|
7769
|
+
from .report.compare_arrays import CompareArrays_wx
|
7770
|
+
|
7771
|
+
try:
|
7772
|
+
newsheet = CompareArrays_wx(ref, comp,
|
7773
|
+
size=(800, 600),
|
7774
|
+
ignored_patche_area= min_area,
|
7775
|
+
threshold=threshold,
|
7776
|
+
nb_max_patches = nb_patches,)
|
7777
|
+
newsheet.Show()
|
7778
|
+
|
7779
|
+
self.add_object('vector', newobj = newsheet.get_zones(), ToCheck = True, id = 'compare_arrays_{}'.format(ref.idx + comp.idx))
|
7780
|
+
except:
|
7781
|
+
logging.error(_('Error in comparing arrays\n'))
|
7782
|
+
dlg.Destroy()
|
7783
|
+
|
7784
|
+
def _compare_arrays(self):
|
7785
|
+
""" Compare two arrays """
|
7786
|
+
arrays = self.get_list_keys(draw_type.ARRAYS, checked_state = None)
|
7787
|
+
|
7788
|
+
if len(arrays) == 0:
|
7789
|
+
logging.warning(_('No arrays to compare !'))
|
7790
|
+
return
|
7791
|
+
elif len(arrays) == 1:
|
7792
|
+
logging.warning(_('Only one array to compare - Nothing to do !'))
|
7793
|
+
return
|
7794
|
+
|
7795
|
+
from .ui.wolf_multiselection_collapsiblepane import Wolf_CompareArrays_Selection
|
7796
|
+
|
7797
|
+
dlg = Wolf_CompareArrays_Selection(parent = self,
|
7798
|
+
title = _("Choose the arrays to compare"),
|
7799
|
+
info = _("Select the reference and comparison arrays"),
|
7800
|
+
values_dict = {_('Reference array'): arrays,
|
7801
|
+
_('Comparison array'): arrays},
|
7802
|
+
callback= self._run_compare_arrays,
|
7803
|
+
destroyOK = True,
|
7804
|
+
styles = [wx.LB_SINGLE, wx.LB_SINGLE]
|
7805
|
+
)
|
7806
|
+
dlg.ShowModal()
|
7807
|
+
|
7713
7808
|
def OnMenubar(self, event: wx.MenuEvent):
|
7714
7809
|
"""
|
7715
7810
|
Gestion des clicks sur le menu quel que soit le niveau
|
@@ -8354,6 +8449,29 @@ class WolfMapViewer(wx.Frame):
|
|
8354
8449
|
else:
|
8355
8450
|
logging.warning(_('Simulation {} is not a GPU simulation - Not yet implemented for CPU simulations !').format(curmodel.idx))
|
8356
8451
|
|
8452
|
+
elif itemlabel == _("One simulation from disk..."):
|
8453
|
+
dlg = wx.DirDialog(None, _('Choose the directory containing the simulation'), style=wx.DD_DEFAULT_STYLE)
|
8454
|
+
ret = dlg.ShowModal()
|
8455
|
+
if ret == wx.ID_CANCEL:
|
8456
|
+
dlg.Destroy()
|
8457
|
+
return
|
8458
|
+
directory = Path(dlg.GetPath())
|
8459
|
+
dlg.Destroy()
|
8460
|
+
if not directory.exists():
|
8461
|
+
logging.error(_('Directory {} does not exist !').format(directory))
|
8462
|
+
wx.MessageBox(_('Directory {} does not exist !').format(directory), _('Error'), wx.OK | wx.ICON_ERROR)
|
8463
|
+
return
|
8464
|
+
if not directory.is_dir():
|
8465
|
+
logging.error(_('Path {} is not a directory !').format(directory))
|
8466
|
+
wx.MessageBox(_('Path {} is not a directory !').format(directory), _('Error'), wx.OK | wx.ICON_ERROR)
|
8467
|
+
return
|
8468
|
+
|
8469
|
+
from .report.simplesimgpu import SimpleSimGPU_Report_wx
|
8470
|
+
|
8471
|
+
# check if we want to show all wx reports
|
8472
|
+
newsheet = SimpleSimGPU_Report_wx(directory, size=(800, 600), show=True)
|
8473
|
+
|
8474
|
+
|
8357
8475
|
elif itemlabel == _("All simulations in directory..."):
|
8358
8476
|
dlg = wx.DirDialog(None, _('Choose the directory containing the simulations'), style=wx.DD_DEFAULT_STYLE)
|
8359
8477
|
ret = dlg.ShowModal()
|
@@ -8372,7 +8490,6 @@ class WolfMapViewer(wx.Frame):
|
|
8372
8490
|
return
|
8373
8491
|
from .report.simplesimgpu import SimpleSimGPU_Reports_wx
|
8374
8492
|
|
8375
|
-
|
8376
8493
|
# check if we want to show all wx reports
|
8377
8494
|
dlg = wx.MessageDialog(None, _('Do you want to show all reports ?'), _('Show all reports'), style=wx.YES_NO | wx.YES_DEFAULT)
|
8378
8495
|
ret = dlg.ShowModal()
|
@@ -8380,6 +8497,50 @@ class WolfMapViewer(wx.Frame):
|
|
8380
8497
|
|
8381
8498
|
newsheets = SimpleSimGPU_Reports_wx(directory, show = ret == wx.ID_YES, size=(800, 600))
|
8382
8499
|
|
8500
|
+
elif itemlabel == _("Compare arrays..."):
|
8501
|
+
|
8502
|
+
self._compare_arrays()
|
8503
|
+
|
8504
|
+
elif itemlabel == _("Compare arrays from files..."):
|
8505
|
+
|
8506
|
+
from .report.compare_arrays import CompareArrays_wx
|
8507
|
+
|
8508
|
+
dlg = wx.FileDialog(None, _('Choose the reference file'), wildcard='*.tif, *.bin, *.npy|*.tif;*.bin;*.npy|all (*.*)|*.*', style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
8509
|
+
ret = dlg.ShowModal()
|
8510
|
+
if ret == wx.ID_CANCEL:
|
8511
|
+
dlg.Destroy()
|
8512
|
+
return
|
8513
|
+
ref_filename = dlg.GetPath()
|
8514
|
+
dlg.Destroy()
|
8515
|
+
|
8516
|
+
dlg = wx.FileDialog(None, _('Choose the comparison file'), wildcard='*.tif, *.bin, *.npy|*.tif;*.bin;*.npy|all (*.*)|*.*', style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
|
8517
|
+
ret = dlg.ShowModal()
|
8518
|
+
if ret == wx.ID_CANCEL:
|
8519
|
+
dlg.Destroy()
|
8520
|
+
return
|
8521
|
+
comp_filename = dlg.GetPath()
|
8522
|
+
dlg.Destroy()
|
8523
|
+
|
8524
|
+
try:
|
8525
|
+
wa_ref = WolfArray(ref_filename)
|
8526
|
+
wa_comp = WolfArray(comp_filename)
|
8527
|
+
|
8528
|
+
if not (wa_ref.loaded and wa_comp.loaded):
|
8529
|
+
logging.error(_('Error in loading arrays from files'))
|
8530
|
+
wx.MessageBox(_('Error in loading arrays from files'), _('Error'), wx.OK | wx.ICON_ERROR)
|
8531
|
+
return
|
8532
|
+
|
8533
|
+
if wa_ref.is_like(wa_comp):
|
8534
|
+
newsheet = CompareArrays_wx(wa_ref, wa_comp, size=(800, 600))
|
8535
|
+
newsheet.Show()
|
8536
|
+
else:
|
8537
|
+
logging.error(_('The two arrays are not compatible - Cannot compare !'))
|
8538
|
+
wx.MessageBox(_('The two arrays are not compatible - Cannot compare !'), _('Error'), wx.OK | wx.ICON_ERROR)
|
8539
|
+
|
8540
|
+
logging.info(_('Arrays {} and {} compared successfully').format(ref_filename, comp_filename))
|
8541
|
+
except Exception as e:
|
8542
|
+
logging.error(_('Error in comparing arrays from files\n{}'.format(e)))
|
8543
|
+
|
8383
8544
|
elif itemlabel == _("Compare checked simulations..."):
|
8384
8545
|
|
8385
8546
|
sims = self.get_list_keys(draw_type.RES2D, checked_state=True)
|
@@ -12380,6 +12541,7 @@ class WolfMapViewer(wx.Frame):
|
|
12380
12541
|
logging.warning(_('No array available and ctrl is pressed -- Please load a file or create data !'))
|
12381
12542
|
|
12382
12543
|
self.active_vector.add_vertex(wolfvertex(x, y))
|
12544
|
+
self.active_vertex = self.active_vector.myvertices[-1]
|
12383
12545
|
|
12384
12546
|
self.active_vector.find_minmax()
|
12385
12547
|
self.active_zone.find_minmax()
|
@@ -12488,6 +12650,7 @@ class WolfMapViewer(wx.Frame):
|
|
12488
12650
|
|
12489
12651
|
if ctrl:
|
12490
12652
|
if self.active_array is not None:
|
12653
|
+
# Get the value of the array at the position of the vertex
|
12491
12654
|
z = self.active_array.get_value(x, y)
|
12492
12655
|
self.active_vertex.z = z
|
12493
12656
|
else:
|
@@ -13276,6 +13439,8 @@ class WolfMapViewer(wx.Frame):
|
|
13276
13439
|
self.action == 'insert vertices':
|
13277
13440
|
if self.active_vertex is not None:
|
13278
13441
|
if shiftdown:
|
13442
|
+
# Shift key is pressed
|
13443
|
+
# We move/Insert the vertex along the segment linking the first and last vertices of the active vector
|
13279
13444
|
ox = self.active_vector.myvertices[0].x
|
13280
13445
|
oy = self.active_vector.myvertices[0].y
|
13281
13446
|
|
@@ -13500,7 +13665,8 @@ class WolfMapViewer(wx.Frame):
|
|
13500
13665
|
|
13501
13666
|
if self.action is not None:
|
13502
13667
|
locaction = self.action
|
13503
|
-
|
13668
|
+
|
13669
|
+
if 'select by tmp vector' in locaction or 'select by vector' in locaction:
|
13504
13670
|
inside_under = 'inside' in self.action
|
13505
13671
|
|
13506
13672
|
self.end_action(_('End of vector selection'))
|
@@ -13517,7 +13683,7 @@ class WolfMapViewer(wx.Frame):
|
|
13517
13683
|
# we must reset the temporary vector
|
13518
13684
|
self.active_vector.reset()
|
13519
13685
|
|
13520
|
-
|
13686
|
+
elif locaction == 'distance along vector':
|
13521
13687
|
|
13522
13688
|
dlg = wx.MessageDialog(None, _('Memorize the vector ?'), _('Confirm'), wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
|
13523
13689
|
ret = dlg.ShowModal()
|
@@ -13528,17 +13694,17 @@ class WolfMapViewer(wx.Frame):
|
|
13528
13694
|
|
13529
13695
|
self._tmp_vector_distance = None
|
13530
13696
|
|
13531
|
-
elif
|
13697
|
+
elif locaction == 'pick landmap':
|
13532
13698
|
|
13533
13699
|
self.end_action(_('End of landmap picking'))
|
13534
13700
|
|
13535
|
-
elif
|
13701
|
+
elif locaction == 'laz tmp vector':
|
13536
13702
|
self.end_action(_('End of LAZ selection'))
|
13537
13703
|
self.active_vector.myvertices.pop(-1)
|
13538
13704
|
self.plot_laz_around_active_vec()
|
13539
13705
|
self.active_vector.reset()
|
13540
13706
|
|
13541
|
-
elif
|
13707
|
+
elif locaction == 'create polygon - tiles':
|
13542
13708
|
self.end_action(_('End of polygon creation'))
|
13543
13709
|
self.active_vector.myvertices.pop(-1)
|
13544
13710
|
self.active_vector.close_force()
|
@@ -13576,7 +13742,7 @@ class WolfMapViewer(wx.Frame):
|
|
13576
13742
|
|
13577
13743
|
self._create_data_from_tiles_common()
|
13578
13744
|
|
13579
|
-
elif
|
13745
|
+
elif locaction == 'capture vertices':
|
13580
13746
|
self.end_action(_('End of points capturing'))
|
13581
13747
|
self.active_vector.myvertices.pop(-1)
|
13582
13748
|
r = wx.MessageDialog(
|
@@ -13595,7 +13761,7 @@ class WolfMapViewer(wx.Frame):
|
|
13595
13761
|
# C'est donc plus lent mais plus sûr pour que l'affichage dynamique soit correct
|
13596
13762
|
self.active_vector.parentzone.plot(prep = self.linkedList is None or not(self in self.linkedList))
|
13597
13763
|
|
13598
|
-
elif
|
13764
|
+
elif locaction == 'modify vertices':
|
13599
13765
|
|
13600
13766
|
# end of vertices modification
|
13601
13767
|
self.end_action(_('End of vertices modification'))
|
@@ -13609,7 +13775,7 @@ class WolfMapViewer(wx.Frame):
|
|
13609
13775
|
|
13610
13776
|
self.active_vertex = None
|
13611
13777
|
|
13612
|
-
elif
|
13778
|
+
elif locaction == 'insert vertices':
|
13613
13779
|
self.end_action(_('End of vertices insertion'))
|
13614
13780
|
|
13615
13781
|
# force to prepare OpenGL to accelerate the plot
|
@@ -13621,7 +13787,7 @@ class WolfMapViewer(wx.Frame):
|
|
13621
13787
|
|
13622
13788
|
self.active_vertex = None
|
13623
13789
|
|
13624
|
-
elif
|
13790
|
+
elif locaction == 'dynamic parallel':
|
13625
13791
|
self.active_vector.myvertices.pop(-1)
|
13626
13792
|
self.active_zone.parallel_active(self.dynapar_dist)
|
13627
13793
|
|
@@ -13638,11 +13804,11 @@ class WolfMapViewer(wx.Frame):
|
|
13638
13804
|
|
13639
13805
|
self.end_action(_('End of dynamic parallel'))
|
13640
13806
|
|
13641
|
-
elif 'select active vector' in
|
13807
|
+
elif 'select active vector' in locaction:
|
13642
13808
|
|
13643
13809
|
self.end_action(_('End of vector selection'))
|
13644
13810
|
|
13645
|
-
elif 'select node by node' in
|
13811
|
+
elif 'select node by node' in locaction:
|
13646
13812
|
self.end_action(_('End of node by node selection'))
|
13647
13813
|
|
13648
13814
|
self.copyfrom = None
|
@@ -13910,6 +14076,7 @@ class WolfMapViewer(wx.Frame):
|
|
13910
14076
|
""" Message to end action """
|
13911
14077
|
|
13912
14078
|
self.action = None
|
14079
|
+
self.active_vertex = None
|
13913
14080
|
logging.info(_('ACTION : ') + _(message) if message != '' else _('ACTION : End of action') )
|
13914
14081
|
self.msg_action(1)
|
13915
14082
|
|
@@ -14298,7 +14465,7 @@ class WolfMapViewer(wx.Frame):
|
|
14298
14465
|
logging.info(_('Paste selection position'))
|
14299
14466
|
|
14300
14467
|
if cursel == 'all':
|
14301
|
-
self.active_array.SelectionData.
|
14468
|
+
self.active_array.SelectionData.myselection = 'all'
|
14302
14469
|
elif len(cursel) > 0:
|
14303
14470
|
self.active_array.SelectionData.myselection = cursel.copy()
|
14304
14471
|
self.active_array.SelectionData.update_nb_nodes_selection()
|
@@ -14918,13 +15085,29 @@ class WolfMapViewer(wx.Frame):
|
|
14918
15085
|
if self._tmp_vector_distance is not None:
|
14919
15086
|
self._tmp_vector_distance.plot()
|
14920
15087
|
|
14921
|
-
|
14922
|
-
|
14923
|
-
|
14924
|
-
|
14925
|
-
|
15088
|
+
if self.active_vector is not None:
|
15089
|
+
if getIfromRGB(self.active_vector_color) != self.active_vector.myprop.color:
|
15090
|
+
old = self.active_vector.myprop.color
|
15091
|
+
self.active_vector.myprop.color = getIfromRGB(self.active_vector_color)
|
15092
|
+
self.active_vector.plot()
|
15093
|
+
self.active_vector._plot_square_at_vertices(size = self.active_vector_square_size)
|
15094
|
+
self.active_vector.myprop.color = old
|
15095
|
+
else:
|
15096
|
+
self.active_vector._plot_square_at_vertices(size = self.active_vector_square_size)
|
15097
|
+
|
15098
|
+
if self.active_vector.myprop.plot_indices:
|
15099
|
+
self.active_vector._plot_all_indices(sx = self.sx, sy=self.sy,
|
15100
|
+
xmin=self.xmin, ymin=self.ymin,
|
15101
|
+
xmax=self.xmax, ymax=self.ymax,
|
15102
|
+
size = (self.xmax - self.xmin) / 100.)
|
15103
|
+
|
15104
|
+
elif self.active_vertex is not None:
|
15105
|
+
self.active_vector._plot_index_vertex(idx = self.active_vector.myvertices.index(self.active_vertex),
|
15106
|
+
sx = self.sx, sy=self.sy,
|
15107
|
+
xmin=self.xmin, ymin=self.ymin,
|
15108
|
+
xmax=self.xmax, ymax=self.ymax,
|
15109
|
+
size = (self.xmax - self.xmin) / 100.)
|
14926
15110
|
|
14927
|
-
# glFlush()
|
14928
15111
|
self.canvas.SwapBuffers()
|
14929
15112
|
else:
|
14930
15113
|
raise NameError(
|
@@ -15156,6 +15339,7 @@ class WolfMapViewer(wx.Frame):
|
|
15156
15339
|
self.Active_zone(vect.parentzone)
|
15157
15340
|
|
15158
15341
|
self.mimicme()
|
15342
|
+
self.Paint()
|
15159
15343
|
|
15160
15344
|
def Active_zone(self, zone: zone):
|
15161
15345
|
""" Active une zone et son parent si existant """
|