wolfhece 2.2.27__py3-none-any.whl → 2.2.29__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/PyDraw.py +202 -22
- wolfhece/PyPalette.py +18 -0
- wolfhece/PyVertexvectors.py +156 -25
- 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/report/common.py +496 -0
- wolfhece/report/compare_arrays.py +1054 -0
- wolfhece/report/simplesimgpu.py +26 -101
- wolfhece/report/tools.py +121 -16
- wolfhece/scenario/config_manager.py +265 -8
- wolfhece/ui/wolf_multiselection_collapsiblepane.py +153 -1
- wolfhece/wolf_array.py +116 -64
- wolfhece/wolf_texture.py +4 -0
- {wolfhece-2.2.27.dist-info → wolfhece-2.2.29.dist-info}/METADATA +1 -1
- {wolfhece-2.2.27.dist-info → wolfhece-2.2.29.dist-info}/RECORD +29 -23
- {wolfhece-2.2.27.dist-info → wolfhece-2.2.29.dist-info}/WHEEL +0 -0
- {wolfhece-2.2.27.dist-info → wolfhece-2.2.29.dist-info}/entry_points.txt +0 -0
- {wolfhece-2.2.27.dist-info → wolfhece-2.2.29.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/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,15 @@ 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
|
+
|
4197
4211
|
@property
|
4198
4212
|
def default_dem(self) -> Path:
|
4199
4213
|
""" Return the default DEM file from configs """
|
@@ -4300,12 +4314,20 @@ class WolfMapViewer(wx.Frame):
|
|
4300
4314
|
if self.active_array is not None:
|
4301
4315
|
return self.active_array.mypal
|
4302
4316
|
else:
|
4303
|
-
|
4317
|
+
if self.active_res2d is not None:
|
4318
|
+
logging.warning(_('No active array -- Using active 2D result palette instead'))
|
4319
|
+
return self.active_res2d.mypal
|
4320
|
+
else:
|
4321
|
+
return wolfpalette()
|
4304
4322
|
elif act_res2d:
|
4305
4323
|
if self.active_res2d is not None:
|
4306
4324
|
return self.active_res2d.mypal
|
4307
4325
|
else:
|
4308
|
-
|
4326
|
+
if self.active_array is not None:
|
4327
|
+
logging.warning(_('No active 2D result -- Using active array palette instead'))
|
4328
|
+
return self.active_array.mypal
|
4329
|
+
else:
|
4330
|
+
return wolfpalette()
|
4309
4331
|
else:
|
4310
4332
|
return wolfpalette()
|
4311
4333
|
|
@@ -7702,6 +7724,78 @@ class WolfMapViewer(wx.Frame):
|
|
7702
7724
|
self.menu_dike()
|
7703
7725
|
autoscale = True
|
7704
7726
|
|
7727
|
+
def _run_compare_arrays(self, dlg):
|
7728
|
+
""" Run the comparison of two arrays"""
|
7729
|
+
|
7730
|
+
from .ui.wolf_multiselection_collapsiblepane import Wolf_CompareArrays_Selection
|
7731
|
+
|
7732
|
+
assert isinstance(dlg, Wolf_CompareArrays_Selection), 'Dialog must be a wx.Dialog instance'
|
7733
|
+
|
7734
|
+
dlg: Wolf_CompareArrays_Selection
|
7735
|
+
|
7736
|
+
vals = dlg.get_values()
|
7737
|
+
id1 = vals[_('Reference array')][0]
|
7738
|
+
id2 = vals[_('Comparison array')][0]
|
7739
|
+
min_area = dlg.get_min_area()
|
7740
|
+
threshold = dlg.get_threshold()
|
7741
|
+
nb_patches = dlg.get_max_patches()
|
7742
|
+
|
7743
|
+
ref:WolfArray
|
7744
|
+
comp:WolfArray
|
7745
|
+
ref = self.get_obj_from_id(id1, draw_type.ARRAYS)
|
7746
|
+
comp = self.get_obj_from_id(id2, draw_type.ARRAYS)
|
7747
|
+
|
7748
|
+
if ref is None or comp is None:
|
7749
|
+
logging.warning(_('You must select two arrays to compare !'))
|
7750
|
+
return
|
7751
|
+
|
7752
|
+
assert isinstance(ref, WolfArray), 'Reference object must be a WolfArray instance'
|
7753
|
+
assert isinstance(comp, WolfArray), 'Comparison object must be a WolfArray instance'
|
7754
|
+
|
7755
|
+
if not ref.is_like(comp):
|
7756
|
+
logging.error(_('The two arrays must have the same shape and type !'))
|
7757
|
+
return
|
7758
|
+
|
7759
|
+
# if only 2 arrays, we can use the CompareArrays_wx directly
|
7760
|
+
from .report.compare_arrays import CompareArrays_wx
|
7761
|
+
|
7762
|
+
try:
|
7763
|
+
newsheet = CompareArrays_wx(ref, comp,
|
7764
|
+
size=(800, 600),
|
7765
|
+
ignored_patche_area= min_area,
|
7766
|
+
threshold=threshold,
|
7767
|
+
nb_max_patches = nb_patches,)
|
7768
|
+
newsheet.Show()
|
7769
|
+
|
7770
|
+
self.add_object('vector', newobj = newsheet.get_zones(), ToCheck = True, id = 'compare_arrays_{}'.format(ref.idx + comp.idx))
|
7771
|
+
except:
|
7772
|
+
logging.error(_('Error in comparing arrays\n'))
|
7773
|
+
dlg.Destroy()
|
7774
|
+
|
7775
|
+
def _compare_arrays(self):
|
7776
|
+
""" Compare two arrays """
|
7777
|
+
arrays = self.get_list_keys(draw_type.ARRAYS, checked_state = None)
|
7778
|
+
|
7779
|
+
if len(arrays) == 0:
|
7780
|
+
logging.warning(_('No arrays to compare !'))
|
7781
|
+
return
|
7782
|
+
elif len(arrays) == 1:
|
7783
|
+
logging.warning(_('Only one array to compare - Nothing to do !'))
|
7784
|
+
return
|
7785
|
+
|
7786
|
+
from .ui.wolf_multiselection_collapsiblepane import Wolf_CompareArrays_Selection
|
7787
|
+
|
7788
|
+
dlg = Wolf_CompareArrays_Selection(parent = self,
|
7789
|
+
title = _("Choose the arrays to compare"),
|
7790
|
+
info = _("Select the reference and comparison arrays"),
|
7791
|
+
values_dict = {_('Reference array'): arrays,
|
7792
|
+
_('Comparison array'): arrays},
|
7793
|
+
callback= self._run_compare_arrays,
|
7794
|
+
destroyOK = True,
|
7795
|
+
styles = [wx.LB_SINGLE, wx.LB_SINGLE]
|
7796
|
+
)
|
7797
|
+
dlg.ShowModal()
|
7798
|
+
|
7705
7799
|
def OnMenubar(self, event: wx.MenuEvent):
|
7706
7800
|
"""
|
7707
7801
|
Gestion des clicks sur le menu quel que soit le niveau
|
@@ -8346,6 +8440,29 @@ class WolfMapViewer(wx.Frame):
|
|
8346
8440
|
else:
|
8347
8441
|
logging.warning(_('Simulation {} is not a GPU simulation - Not yet implemented for CPU simulations !').format(curmodel.idx))
|
8348
8442
|
|
8443
|
+
elif itemlabel == _("One simulation from disk..."):
|
8444
|
+
dlg = wx.DirDialog(None, _('Choose the directory containing the simulation'), style=wx.DD_DEFAULT_STYLE)
|
8445
|
+
ret = dlg.ShowModal()
|
8446
|
+
if ret == wx.ID_CANCEL:
|
8447
|
+
dlg.Destroy()
|
8448
|
+
return
|
8449
|
+
directory = Path(dlg.GetPath())
|
8450
|
+
dlg.Destroy()
|
8451
|
+
if not directory.exists():
|
8452
|
+
logging.error(_('Directory {} does not exist !').format(directory))
|
8453
|
+
wx.MessageBox(_('Directory {} does not exist !').format(directory), _('Error'), wx.OK | wx.ICON_ERROR)
|
8454
|
+
return
|
8455
|
+
if not directory.is_dir():
|
8456
|
+
logging.error(_('Path {} is not a directory !').format(directory))
|
8457
|
+
wx.MessageBox(_('Path {} is not a directory !').format(directory), _('Error'), wx.OK | wx.ICON_ERROR)
|
8458
|
+
return
|
8459
|
+
|
8460
|
+
from .report.simplesimgpu import SimpleSimGPU_Report_wx
|
8461
|
+
|
8462
|
+
# check if we want to show all wx reports
|
8463
|
+
newsheet = SimpleSimGPU_Report_wx(directory, size=(800, 600), show=True)
|
8464
|
+
|
8465
|
+
|
8349
8466
|
elif itemlabel == _("All simulations in directory..."):
|
8350
8467
|
dlg = wx.DirDialog(None, _('Choose the directory containing the simulations'), style=wx.DD_DEFAULT_STYLE)
|
8351
8468
|
ret = dlg.ShowModal()
|
@@ -8364,7 +8481,6 @@ class WolfMapViewer(wx.Frame):
|
|
8364
8481
|
return
|
8365
8482
|
from .report.simplesimgpu import SimpleSimGPU_Reports_wx
|
8366
8483
|
|
8367
|
-
|
8368
8484
|
# check if we want to show all wx reports
|
8369
8485
|
dlg = wx.MessageDialog(None, _('Do you want to show all reports ?'), _('Show all reports'), style=wx.YES_NO | wx.YES_DEFAULT)
|
8370
8486
|
ret = dlg.ShowModal()
|
@@ -8372,6 +8488,50 @@ class WolfMapViewer(wx.Frame):
|
|
8372
8488
|
|
8373
8489
|
newsheets = SimpleSimGPU_Reports_wx(directory, show = ret == wx.ID_YES, size=(800, 600))
|
8374
8490
|
|
8491
|
+
elif itemlabel == _("Compare arrays..."):
|
8492
|
+
|
8493
|
+
self._compare_arrays()
|
8494
|
+
|
8495
|
+
elif itemlabel == _("Compare arrays from files..."):
|
8496
|
+
|
8497
|
+
from .report.compare_arrays import CompareArrays_wx
|
8498
|
+
|
8499
|
+
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)
|
8500
|
+
ret = dlg.ShowModal()
|
8501
|
+
if ret == wx.ID_CANCEL:
|
8502
|
+
dlg.Destroy()
|
8503
|
+
return
|
8504
|
+
ref_filename = dlg.GetPath()
|
8505
|
+
dlg.Destroy()
|
8506
|
+
|
8507
|
+
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)
|
8508
|
+
ret = dlg.ShowModal()
|
8509
|
+
if ret == wx.ID_CANCEL:
|
8510
|
+
dlg.Destroy()
|
8511
|
+
return
|
8512
|
+
comp_filename = dlg.GetPath()
|
8513
|
+
dlg.Destroy()
|
8514
|
+
|
8515
|
+
try:
|
8516
|
+
wa_ref = WolfArray(ref_filename)
|
8517
|
+
wa_comp = WolfArray(comp_filename)
|
8518
|
+
|
8519
|
+
if not (wa_ref.loaded and wa_comp.loaded):
|
8520
|
+
logging.error(_('Error in loading arrays from files'))
|
8521
|
+
wx.MessageBox(_('Error in loading arrays from files'), _('Error'), wx.OK | wx.ICON_ERROR)
|
8522
|
+
return
|
8523
|
+
|
8524
|
+
if wa_ref.is_like(wa_comp):
|
8525
|
+
newsheet = CompareArrays_wx(wa_ref, wa_comp, size=(800, 600))
|
8526
|
+
newsheet.Show()
|
8527
|
+
else:
|
8528
|
+
logging.error(_('The two arrays are not compatible - Cannot compare !'))
|
8529
|
+
wx.MessageBox(_('The two arrays are not compatible - Cannot compare !'), _('Error'), wx.OK | wx.ICON_ERROR)
|
8530
|
+
|
8531
|
+
logging.info(_('Arrays {} and {} compared successfully').format(ref_filename, comp_filename))
|
8532
|
+
except Exception as e:
|
8533
|
+
logging.error(_('Error in comparing arrays from files\n{}'.format(e)))
|
8534
|
+
|
8375
8535
|
elif itemlabel == _("Compare checked simulations..."):
|
8376
8536
|
|
8377
8537
|
sims = self.get_list_keys(draw_type.RES2D, checked_state=True)
|
@@ -12372,6 +12532,7 @@ class WolfMapViewer(wx.Frame):
|
|
12372
12532
|
logging.warning(_('No array available and ctrl is pressed -- Please load a file or create data !'))
|
12373
12533
|
|
12374
12534
|
self.active_vector.add_vertex(wolfvertex(x, y))
|
12535
|
+
self.active_vertex = self.active_vector.myvertices[-1]
|
12375
12536
|
|
12376
12537
|
self.active_vector.find_minmax()
|
12377
12538
|
self.active_zone.find_minmax()
|
@@ -12480,6 +12641,7 @@ class WolfMapViewer(wx.Frame):
|
|
12480
12641
|
|
12481
12642
|
if ctrl:
|
12482
12643
|
if self.active_array is not None:
|
12644
|
+
# Get the value of the array at the position of the vertex
|
12483
12645
|
z = self.active_array.get_value(x, y)
|
12484
12646
|
self.active_vertex.z = z
|
12485
12647
|
else:
|
@@ -13268,6 +13430,8 @@ class WolfMapViewer(wx.Frame):
|
|
13268
13430
|
self.action == 'insert vertices':
|
13269
13431
|
if self.active_vertex is not None:
|
13270
13432
|
if shiftdown:
|
13433
|
+
# Shift key is pressed
|
13434
|
+
# We move/Insert the vertex along the segment linking the first and last vertices of the active vector
|
13271
13435
|
ox = self.active_vector.myvertices[0].x
|
13272
13436
|
oy = self.active_vector.myvertices[0].y
|
13273
13437
|
|
@@ -13492,7 +13656,8 @@ class WolfMapViewer(wx.Frame):
|
|
13492
13656
|
|
13493
13657
|
if self.action is not None:
|
13494
13658
|
locaction = self.action
|
13495
|
-
|
13659
|
+
|
13660
|
+
if 'select by tmp vector' in locaction or 'select by vector' in locaction:
|
13496
13661
|
inside_under = 'inside' in self.action
|
13497
13662
|
|
13498
13663
|
self.end_action(_('End of vector selection'))
|
@@ -13509,7 +13674,7 @@ class WolfMapViewer(wx.Frame):
|
|
13509
13674
|
# we must reset the temporary vector
|
13510
13675
|
self.active_vector.reset()
|
13511
13676
|
|
13512
|
-
|
13677
|
+
elif locaction == 'distance along vector':
|
13513
13678
|
|
13514
13679
|
dlg = wx.MessageDialog(None, _('Memorize the vector ?'), _('Confirm'), wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
|
13515
13680
|
ret = dlg.ShowModal()
|
@@ -13520,17 +13685,17 @@ class WolfMapViewer(wx.Frame):
|
|
13520
13685
|
|
13521
13686
|
self._tmp_vector_distance = None
|
13522
13687
|
|
13523
|
-
elif
|
13688
|
+
elif locaction == 'pick landmap':
|
13524
13689
|
|
13525
13690
|
self.end_action(_('End of landmap picking'))
|
13526
13691
|
|
13527
|
-
elif
|
13692
|
+
elif locaction == 'laz tmp vector':
|
13528
13693
|
self.end_action(_('End of LAZ selection'))
|
13529
13694
|
self.active_vector.myvertices.pop(-1)
|
13530
13695
|
self.plot_laz_around_active_vec()
|
13531
13696
|
self.active_vector.reset()
|
13532
13697
|
|
13533
|
-
elif
|
13698
|
+
elif locaction == 'create polygon - tiles':
|
13534
13699
|
self.end_action(_('End of polygon creation'))
|
13535
13700
|
self.active_vector.myvertices.pop(-1)
|
13536
13701
|
self.active_vector.close_force()
|
@@ -13568,7 +13733,7 @@ class WolfMapViewer(wx.Frame):
|
|
13568
13733
|
|
13569
13734
|
self._create_data_from_tiles_common()
|
13570
13735
|
|
13571
|
-
elif
|
13736
|
+
elif locaction == 'capture vertices':
|
13572
13737
|
self.end_action(_('End of points capturing'))
|
13573
13738
|
self.active_vector.myvertices.pop(-1)
|
13574
13739
|
r = wx.MessageDialog(
|
@@ -13587,7 +13752,7 @@ class WolfMapViewer(wx.Frame):
|
|
13587
13752
|
# C'est donc plus lent mais plus sûr pour que l'affichage dynamique soit correct
|
13588
13753
|
self.active_vector.parentzone.plot(prep = self.linkedList is None or not(self in self.linkedList))
|
13589
13754
|
|
13590
|
-
elif
|
13755
|
+
elif locaction == 'modify vertices':
|
13591
13756
|
|
13592
13757
|
# end of vertices modification
|
13593
13758
|
self.end_action(_('End of vertices modification'))
|
@@ -13601,7 +13766,7 @@ class WolfMapViewer(wx.Frame):
|
|
13601
13766
|
|
13602
13767
|
self.active_vertex = None
|
13603
13768
|
|
13604
|
-
elif
|
13769
|
+
elif locaction == 'insert vertices':
|
13605
13770
|
self.end_action(_('End of vertices insertion'))
|
13606
13771
|
|
13607
13772
|
# force to prepare OpenGL to accelerate the plot
|
@@ -13613,7 +13778,7 @@ class WolfMapViewer(wx.Frame):
|
|
13613
13778
|
|
13614
13779
|
self.active_vertex = None
|
13615
13780
|
|
13616
|
-
elif
|
13781
|
+
elif locaction == 'dynamic parallel':
|
13617
13782
|
self.active_vector.myvertices.pop(-1)
|
13618
13783
|
self.active_zone.parallel_active(self.dynapar_dist)
|
13619
13784
|
|
@@ -13630,11 +13795,11 @@ class WolfMapViewer(wx.Frame):
|
|
13630
13795
|
|
13631
13796
|
self.end_action(_('End of dynamic parallel'))
|
13632
13797
|
|
13633
|
-
elif 'select active vector' in
|
13798
|
+
elif 'select active vector' in locaction:
|
13634
13799
|
|
13635
13800
|
self.end_action(_('End of vector selection'))
|
13636
13801
|
|
13637
|
-
elif 'select node by node' in
|
13802
|
+
elif 'select node by node' in locaction:
|
13638
13803
|
self.end_action(_('End of node by node selection'))
|
13639
13804
|
|
13640
13805
|
self.copyfrom = None
|
@@ -13902,6 +14067,7 @@ class WolfMapViewer(wx.Frame):
|
|
13902
14067
|
""" Message to end action """
|
13903
14068
|
|
13904
14069
|
self.action = None
|
14070
|
+
self.active_vertex = None
|
13905
14071
|
logging.info(_('ACTION : ') + _(message) if message != '' else _('ACTION : End of action') )
|
13906
14072
|
self.msg_action(1)
|
13907
14073
|
|
@@ -14290,7 +14456,7 @@ class WolfMapViewer(wx.Frame):
|
|
14290
14456
|
logging.info(_('Paste selection position'))
|
14291
14457
|
|
14292
14458
|
if cursel == 'all':
|
14293
|
-
self.active_array.SelectionData.
|
14459
|
+
self.active_array.SelectionData.myselection = 'all'
|
14294
14460
|
elif len(cursel) > 0:
|
14295
14461
|
self.active_array.SelectionData.myselection = cursel.copy()
|
14296
14462
|
self.active_array.SelectionData.update_nb_nodes_selection()
|
@@ -14910,13 +15076,27 @@ class WolfMapViewer(wx.Frame):
|
|
14910
15076
|
if self._tmp_vector_distance is not None:
|
14911
15077
|
self._tmp_vector_distance.plot()
|
14912
15078
|
|
14913
|
-
|
14914
|
-
|
14915
|
-
|
14916
|
-
|
14917
|
-
|
15079
|
+
if self.active_vector is not None:
|
15080
|
+
if getIfromRGB(self.active_vector_color) != self.active_vector.myprop.color:
|
15081
|
+
old = self.active_vector.myprop.color
|
15082
|
+
self.active_vector.myprop.color = getIfromRGB(self.active_vector_color)
|
15083
|
+
self.active_vector.plot()
|
15084
|
+
self.active_vector._plot_square_at_vertices()
|
15085
|
+
self.active_vector.myprop.color = old
|
15086
|
+
|
15087
|
+
if self.active_vector.myprop.plot_indices:
|
15088
|
+
self.active_vector._plot_all_indices(sx = self.sx, sy=self.sy,
|
15089
|
+
xmin=self.xmin, ymin=self.ymin,
|
15090
|
+
xmax=self.xmax, ymax=self.ymax,
|
15091
|
+
size = (self.xmax - self.xmin) / 100.)
|
15092
|
+
|
15093
|
+
elif self.active_vertex is not None:
|
15094
|
+
self.active_vector._plot_index_vertex(idx = self.active_vector.myvertices.index(self.active_vertex),
|
15095
|
+
sx = self.sx, sy=self.sy,
|
15096
|
+
xmin=self.xmin, ymin=self.ymin,
|
15097
|
+
xmax=self.xmax, ymax=self.ymax,
|
15098
|
+
size = (self.xmax - self.xmin) / 100.)
|
14918
15099
|
|
14919
|
-
# glFlush()
|
14920
15100
|
self.canvas.SwapBuffers()
|
14921
15101
|
else:
|
14922
15102
|
raise NameError(
|
wolfhece/PyPalette.py
CHANGED
@@ -278,6 +278,11 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
|
|
278
278
|
logging.warning('No values in palette - Nothing to do !')
|
279
279
|
return None, None
|
280
280
|
|
281
|
+
if len(self.values) ==0:
|
282
|
+
logging.warning('No values in palette - Nothing to do !')
|
283
|
+
logging.info(_('Do you have defined the palette values ?'))
|
284
|
+
logging.info(_('If yes, please check your Global Options. You may not have defined the correct palette to use.'))
|
285
|
+
return None, None
|
281
286
|
|
282
287
|
if fn == '':
|
283
288
|
file = wx.FileDialog(None, "Choose .pal file", wildcard="png (*.png)|*.png|all (*.*)|*.*", style=wx.FD_SAVE)
|
@@ -288,6 +293,7 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
|
|
288
293
|
fn = file.GetPath()
|
289
294
|
|
290
295
|
if h_or_v == 'v':
|
296
|
+
|
291
297
|
if figax is None:
|
292
298
|
fig, ax = plt.subplots(1, 1)
|
293
299
|
else:
|
@@ -636,6 +642,18 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
|
|
636
642
|
|
637
643
|
self.fill_segmentdata()
|
638
644
|
|
645
|
+
def default_difference3(self):
|
646
|
+
""" Palette 3 couleurs pour les différences par défaut dans WOLF """
|
647
|
+
self.nb = 3
|
648
|
+
self.values = np.asarray([-10., 0., 10.], dtype=np.float64)
|
649
|
+
self.colors = np.zeros((self.nb, 4), dtype=int)
|
650
|
+
self.colorsflt = np.zeros((self.nb, 4), dtype=np.float64)
|
651
|
+
self.colors[0, :] = [0, 0, 255, 255] # Bleu
|
652
|
+
self.colors[1, :] = [255, 255, 255, 255] # Blanc
|
653
|
+
self.colors[2, :] = [255, 0, 0, 255] # Rouge
|
654
|
+
self.fill_segmentdata()
|
655
|
+
|
656
|
+
|
639
657
|
def set_values_colors(self,
|
640
658
|
values: typing.Union[list[float], np.ndarray],
|
641
659
|
colors: typing.Union[list[tuple[int]], np.ndarray]):
|