wolfhece 2.1.73__py3-none-any.whl → 2.1.74__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 CHANGED
@@ -8677,6 +8677,8 @@ class WolfMapViewer(wx.Frame):
8677
8677
  'R': _('Arrays : reset the selection and the associated dictionnary'),
8678
8678
 
8679
8679
  '1,2...9': _('Arrays : transfer the selection to the associated dictionary - key 1 to 9'),
8680
+ '>, <' : _('Arrays : dilate/erode the selection'),
8681
+ 'CTRL+>, CTRL+<': _('Arrays : dilate/erode the selection unselecting the values inside the contour'),
8680
8682
 
8681
8683
  'i': _('Arrays : 2D interpolation based on the selection on the current matrix'),
8682
8684
  'CTRL+C': _('Arrays : Set copy source and current selection to clipboard as string'),
@@ -8799,6 +8801,13 @@ class WolfMapViewer(wx.Frame):
8799
8801
  else:
8800
8802
  logging.info(_('Please activate a simulation before search a specific result'))
8801
8803
 
8804
+ elif key == 60 and shiftdown: #'>'
8805
+ if self.active_array is not None:
8806
+ self.active_array.dilate_contour_selection(1)
8807
+ elif key == 60 and not shiftdown: #'<'
8808
+ if self.active_array is not None:
8809
+ self.active_array.erode_contour_selection()
8810
+
8802
8811
  elif key == wx.WXK_F2 and shiftdown:
8803
8812
 
8804
8813
  if self.active_res2d is not None:
@@ -9065,6 +9074,13 @@ class WolfMapViewer(wx.Frame):
9065
9074
  if key == wx.WXK_DELETE:
9066
9075
  self.removeobj()
9067
9076
 
9077
+ elif key == 60 and shiftdown: #'>'
9078
+ if self.active_array is not None:
9079
+ self.active_array.dilate_selection(1)
9080
+ elif key == 60 and not shiftdown: #'<'
9081
+ if self.active_array is not None:
9082
+ self.active_array.erode_selection(1)
9083
+
9068
9084
  elif key == wx.WXK_ESCAPE:
9069
9085
 
9070
9086
  logging.info(_('Escape key pressed -- Set all active objects and "action" to None'))
wolfhece/apps/version.py CHANGED
@@ -5,7 +5,7 @@ class WolfVersion():
5
5
 
6
6
  self.major = 2
7
7
  self.minor = 1
8
- self.patch = 73
8
+ self.patch = 74
9
9
 
10
10
  def __str__(self):
11
11
 
wolfhece/wolf_array.py CHANGED
@@ -1736,6 +1736,9 @@ class Ops_Array(wx.Frame):
1736
1736
  bSizer21 = wx.BoxSizer(wx.HORIZONTAL)
1737
1737
 
1738
1738
  bSizer16 = wx.BoxSizer(wx.VERTICAL)
1739
+ bSizer16_1 = wx.BoxSizer(wx.VERTICAL)
1740
+ bSizer16_2 = wx.BoxSizer(wx.VERTICAL)
1741
+ bSizer16_3 = wx.BoxSizer(wx.VERTICAL)
1739
1742
 
1740
1743
  selectmethodChoices = [_("by clicks"), _("inside active vector"), _("inside active zone"),
1741
1744
  _("inside temporary vector"), _("along active vector"), _("along active zone"),
@@ -1763,28 +1766,30 @@ class Ops_Array(wx.Frame):
1763
1766
  self.LaunchSelection.SetFont(font)
1764
1767
 
1765
1768
  bSizer16.Add(self.LaunchSelection, 0, wx.EXPAND)
1769
+
1766
1770
  self.AllSelection = wx.Button(self.selection, wx.ID_ANY,
1767
1771
  _("Select all nodes"), wx.DefaultPosition,
1768
1772
  wx.DefaultSize, 0)
1769
1773
  self.AllSelection.SetToolTip(_("Select all nodes in one click - store 'All' in the selection list"))
1770
- bSizer16.Add(self.AllSelection, 0, wx.EXPAND)
1774
+ bSizer16_1.Add(self.AllSelection, 0, wx.EXPAND)
1775
+
1771
1776
  self.MoveSelection = wx.Button(self.selection, wx.ID_ANY,
1772
1777
  _("Move current selection to..."), wx.DefaultPosition,
1773
1778
  wx.DefaultSize, 0)
1774
1779
  self.MoveSelection.SetToolTip(_("Store the current selection in an indexed list -- useful for some interpolation methods"))
1775
- bSizer16.Add(self.MoveSelection, 0, wx.EXPAND)
1780
+ bSizer16_1.Add(self.MoveSelection, 0, wx.EXPAND)
1781
+
1776
1782
  self.ResetSelection = wx.Button(self.selection, wx.ID_ANY,
1777
1783
  _("Reset"), wx.DefaultPosition,
1778
1784
  wx.DefaultSize, 0)
1779
1785
  self.ResetSelection.SetToolTip(_("Reset the current selection list (keyboard shortcut r)"))
1780
-
1781
- bSizer16.Add(self.ResetSelection, 0, wx.EXPAND)
1786
+ bSizer16_1.Add(self.ResetSelection, 0, wx.EXPAND)
1782
1787
 
1783
1788
  self.ResetAllSelection = wx.Button(self.selection, wx.ID_ANY,
1784
1789
  _("Reset All"), wx.DefaultPosition,
1785
1790
  wx.DefaultSize, 0)
1786
1791
  self.ResetAllSelection.SetToolTip(_("Reset the current selection list and the indexed lists (keyboard shortcut R)"))
1787
- bSizer16.Add(self.ResetAllSelection, 0, wx.EXPAND)
1792
+ bSizer16_1.Add(self.ResetAllSelection, 0, wx.EXPAND)
1788
1793
 
1789
1794
  self.to_clipboard_str = wx.Button(self.selection, wx.ID_ANY, _("To clipboard (str)"), wx.DefaultPosition,
1790
1795
  wx.DefaultSize, 0)
@@ -1794,8 +1799,45 @@ class Ops_Array(wx.Frame):
1794
1799
  wx.DefaultSize, 0)
1795
1800
  self.to_clipboard_script.SetToolTip(_("Copy the current selection to the clipboard as a script"))
1796
1801
 
1797
- bSizer16.Add(self.to_clipboard_str, 0, wx.EXPAND)
1798
- bSizer16.Add(self.to_clipboard_script, 0, wx.EXPAND)
1802
+ bSizer16_2.Add(self.to_clipboard_str, 0, wx.EXPAND, 2)
1803
+ bSizer16_2.Add(self.to_clipboard_script, 0, wx.EXPAND, 2)
1804
+
1805
+ erode_dilate_sizer = wx.BoxSizer(wx.VERTICAL)
1806
+ self.expand_selection = wx.Button(self.selection, wx.ID_ANY, _("Expand/Dilate selection"), wx.DefaultPosition,
1807
+ wx.DefaultSize, 0)
1808
+ self.expand_selection.SetToolTip(_("Expand the current selection to the nearest nodes"))
1809
+
1810
+ self.contract_selection = wx.Button(self.selection, wx.ID_ANY, _("Contract/Erode selection"), wx.DefaultPosition,
1811
+ wx.DefaultSize, 0)
1812
+ self.contract_selection.SetToolTip(_("Contract the current selection to the nearest nodes"))
1813
+
1814
+ self.expand_unselect_interior = wx.Button(self.selection, wx.ID_ANY, _("Expand/Dilate contour"), wx.DefaultPosition,
1815
+ wx.DefaultSize, 0)
1816
+ self.expand_unselect_interior.SetToolTip(_("Expand the contour of the current selection and unselect the interior nodes"))
1817
+
1818
+ self.unselect_interior = wx.Button(self.selection, wx.ID_ANY, _("Unselect interior"), wx.DefaultPosition,
1819
+ wx.DefaultSize, 0)
1820
+ self.unselect_interior.SetToolTip(_("Conserve the contour of the current selection and unselect the interior nodes"))
1821
+
1822
+ erode_dilate_sizer.Add(self.expand_selection, 0, wx.EXPAND)
1823
+ erode_dilate_sizer.Add(self.contract_selection, 0, wx.EXPAND)
1824
+ erode_dilate_sizer.Add(self.expand_unselect_interior, 0, wx.EXPAND)
1825
+ erode_dilate_sizer.Add(self.unselect_interior, 0, wx.EXPAND)
1826
+
1827
+ erode_dilate_options = wx.BoxSizer(wx.HORIZONTAL)
1828
+ self._label_passes = wx.StaticText(self.selection, wx.ID_ANY, _("Passes"), wx.DefaultPosition, wx.DefaultSize, 0)
1829
+ self._erode_dilate_value = wx.TextCtrl(self.selection, wx.ID_ANY, u"1", wx.DefaultPosition, wx.DefaultSize, style=wx.TE_CENTER)
1830
+ self._erode_dilate_value.SetToolTip(_("Number of passes for the erode/dilate operation"))
1831
+
1832
+ erode_dilate_options.Add(self._label_passes, 0, wx.EXPAND)
1833
+ erode_dilate_options.Add(self._erode_dilate_value, 0, wx.EXPAND)
1834
+
1835
+ self._erode_dilate_structure = wx.ComboBox(self.selection, wx.ID_ANY, _("Cross"), wx.DefaultPosition, wx.DefaultSize,
1836
+ ["Cross", "Square"], wx.CB_READONLY)
1837
+ self._erode_dilate_structure.SetToolTip(_("Structuring element for the erode/dilate operation"))
1838
+ erode_dilate_options.Add(self._erode_dilate_structure, 1, wx.EXPAND)
1839
+
1840
+ erode_dilate_sizer.Add(erode_dilate_options, 0, wx.EXPAND)
1799
1841
 
1800
1842
  # MultiBlocks
1801
1843
  # ----------------
@@ -1821,7 +1863,9 @@ class Ops_Array(wx.Frame):
1821
1863
 
1822
1864
  # bSizer16.Add(self._open_block, 0, wx.EXPAND)
1823
1865
 
1824
-
1866
+ bSizer16_1.Add(erode_dilate_sizer, 1, wx.EXPAND, 5)
1867
+ bSizer16.Add(bSizer16_1, 1, wx.EXPAND, 5)
1868
+ bSizer16.Add(bSizer16_2, 1, wx.EXPAND, 5)
1825
1869
  bSizer21.Add(bSizer16, 1, wx.EXPAND, 5)
1826
1870
 
1827
1871
  # VECTORS Manager
@@ -2024,6 +2068,11 @@ class Ops_Array(wx.Frame):
2024
2068
  self.histoupdatezoom.Bind(wx.EVT_BUTTON, self.OnClickHistoUpdate)
2025
2069
  self.histoupdateerase.Bind(wx.EVT_BUTTON, self.OnClickHistoUpdate)
2026
2070
 
2071
+ self.contract_selection.Bind(wx.EVT_BUTTON, self.OnContractSelection)
2072
+ self.expand_selection.Bind(wx.EVT_BUTTON, self.OnExpandSelection)
2073
+ self.expand_unselect_interior.Bind(wx.EVT_BUTTON, self.OnExpandUnselectInterior)
2074
+ self.unselect_interior.Bind(wx.EVT_BUTTON, self.OnUnselectInterior)
2075
+
2027
2076
  icon = wx.Icon()
2028
2077
  icon_path = Path(__file__).parent / "apps/wolf_logo2.bmp"
2029
2078
  icon.CopyFromBitmap(wx.Bitmap(str(icon_path), wx.BITMAP_TYPE_ANY))
@@ -2201,6 +2250,48 @@ class Ops_Array(wx.Frame):
2201
2250
 
2202
2251
  self.parentarray.SelectionData.move_selectionto(idtxt, color.GetColour())
2203
2252
 
2253
+ def OnContractSelection(self, event):
2254
+ """ Contract selection """
2255
+
2256
+ nb = int(self._erode_dilate_value.GetValue())
2257
+ if self._erode_dilate_structure.GetValue() == 'Cross':
2258
+ structure = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
2259
+ else:
2260
+ structure = np.ones((3, 3))
2261
+
2262
+ usemask = self.selectrestricttomask.GetValue()
2263
+
2264
+ self.parentarray.erode_selection(nb, usemask = usemask, structure = structure)
2265
+
2266
+ def OnExpandSelection(self, event):
2267
+ """ Expand selection """
2268
+ nb = int(self._erode_dilate_value.GetValue())
2269
+ if self._erode_dilate_structure.GetValue() == 'Cross':
2270
+ structure = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
2271
+ else:
2272
+ structure = np.ones((3, 3))
2273
+
2274
+ usemask = self.selectrestricttomask.GetValue()
2275
+
2276
+ self.parentarray.dilate_selection(nb, usemask, structure)
2277
+
2278
+ def OnExpandUnselectInterior(self, event):
2279
+ """ Expand contour """
2280
+
2281
+ nb = int(self._erode_dilate_value.GetValue())
2282
+ if self._erode_dilate_structure.GetValue() == 'Cross':
2283
+ structure = np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
2284
+ else:
2285
+ structure = np.ones((3, 3))
2286
+
2287
+ usemask = self.selectrestricttomask.GetValue()
2288
+
2289
+ self.parentarray.dilate_contour_selection(nb, usemask, structure)
2290
+
2291
+ def OnUnselectInterior(self, event):
2292
+ """ Contract contour """
2293
+ self.parentarray.erode_contour_selection()
2294
+
2204
2295
  def reset_selection(self):
2205
2296
  """
2206
2297
  Reset of current selection
@@ -4610,6 +4701,55 @@ class WolfArray(Element_To_Draw, header_wolf):
4610
4701
 
4611
4702
  self.add_ops_sel() # Ajout d'un gestionnaire de sélection et d'opérations
4612
4703
 
4704
+ def erode_selection(self, nbiter:int= 1, usemask:bool = True, structure:np.ndarray = np.ones((3,3))):
4705
+ """ Erode the selection """
4706
+
4707
+ if self.SelectionData is not None:
4708
+ if self.SelectionData.nb > 0:
4709
+ self.SelectionData.erode_selection(nbiter, usemask, structure)
4710
+ self.SelectionData.update_nb_nodes_selection()
4711
+ self.reset_plot()
4712
+ else:
4713
+ logging.info('No selection to contract/erode')
4714
+
4715
+ def dilate_selection(self, nbiter:int= 1, usemask:bool = True, structure:np.ndarray = np.ones((3,3))):
4716
+ """ Dilate the selection """
4717
+
4718
+ if self.SelectionData is not None:
4719
+ if self.SelectionData.nb > 0:
4720
+ self.SelectionData.dilate_selection(nbiter, usemask, structure)
4721
+ self.SelectionData.update_nb_nodes_selection()
4722
+ self.reset_plot()
4723
+ else:
4724
+ logging.info('No selection to dilate')
4725
+
4726
+ def dilate_contour_selection(self, nbiter:int= 1, usemask:bool = True, structure:np.ndarray = np.ones((3,3))):
4727
+ """ Dilate the contour of the selection """
4728
+
4729
+ if self.SelectionData is not None:
4730
+ if self.SelectionData.nb > 0:
4731
+ oldsel = self.SelectionData.myselection.copy()
4732
+ self.SelectionData.dilate_selection(nbiter, usemask, structure)
4733
+ newsel = self.SelectionData.myselection.copy()
4734
+ self.SelectionData.myselection = [cur for cur in newsel if cur not in oldsel]
4735
+ self.SelectionData.update_nb_nodes_selection()
4736
+ self.reset_plot()
4737
+ else:
4738
+ logging.info('No selection to expand/dilate')
4739
+
4740
+ def erode_contour_selection(self):
4741
+ """ Erode the contour of the selection """
4742
+ if self.SelectionData is not None:
4743
+ if self.SelectionData.nb > 0:
4744
+ oldselect = self.SelectionData.myselection.copy()
4745
+ self.SelectionData.erode_selection(1)
4746
+ newselect = self.SelectionData.myselection.copy()
4747
+ self.SelectionData.myselection = [cur for cur in oldselect if cur not in newselect]
4748
+ self.SelectionData.update_nb_nodes_selection()
4749
+ self.reset_plot()
4750
+ else:
4751
+ logging.info('No selection to contract/erode')
4752
+
4613
4753
  def set_opacity(self, alpha:float):
4614
4754
  """ Set the transparency of the array """
4615
4755
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.73
3
+ Version: 2.1.74
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  License: Copyright (c) 2024 University of Liege. All rights reserved.
6
6
  Project-URL: Homepage, https://uee.uliege.be/hece
@@ -7,7 +7,7 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
7
  wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
8
8
  wolfhece/PyConfig.py,sha256=FB8u0belXOXTb03Ln6RdVWvMgjzi3oGPCmw2dWa3lNg,8332
9
9
  wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
10
- wolfhece/PyDraw.py,sha256=CADHhvy_Pe9EY56-99U7xYTMIUUPfxc2uVseJxd2fQ8,415540
10
+ wolfhece/PyDraw.py,sha256=nud0raPc9AYDLgA3dYNOaOXQCWzLzCicxmxp7VihYtQ,416394
11
11
  wolfhece/PyGui.py,sha256=oBIBpgBQRR_XXucKE5-RFrtqKj0DRg9VlUCRo8Mzalc,105009
12
12
  wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
13
13
  wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
@@ -48,7 +48,7 @@ wolfhece/pywalous.py,sha256=yRaWJjKckXef1d9D5devP0yFHC9uc6kRV4G5x9PNq9k,18972
48
48
  wolfhece/rain_SPWMI.py,sha256=qCfcmF7LajloOaCwnTrrSMzyME03YyilmRUOqrPrv3U,13846
49
49
  wolfhece/textpillow.py,sha256=map7HsGYML_o5NHRdFg2s_TVQed_lDnpYNDv27MM0Vw,14130
50
50
  wolfhece/tools_mpl.py,sha256=gQ3Jg1iuZiecmMqa5Eli2ZLSkttu68VXL8YmMDBaEYU,564
51
- wolfhece/wolf_array.py,sha256=NV1pGcGsXXGIVSjFBsfpenvmBUSTkjPWbgZ2vbWuELA,385914
51
+ wolfhece/wolf_array.py,sha256=Oze4IYwE19LnxERNi48duYdp3qLXENg8p3_f5KuC1ho,393076
52
52
  wolfhece/wolf_hist.py,sha256=7jeVrgSkM3ErJO6SRMH_PGzfLjIdw8vTy87kesldggk,3582
53
53
  wolfhece/wolf_texture.py,sha256=DS5eobLxrq9ljyebYfpMSQPn8shkUAZZVfqrOKN_QUU,16951
54
54
  wolfhece/wolf_tiles.py,sha256=2Ho2I20rHRY81KXxjgLOYISdF4OkJ2d6omeY4shDoGI,10386
@@ -72,7 +72,7 @@ wolfhece/apps/check_install.py,sha256=Xoi_d8MzKzNAy2xqEpERdsqgRPu0hbBWukI0WkIYzD
72
72
  wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefgmk,5334
73
73
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
74
74
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
75
- wolfhece/apps/version.py,sha256=K5FlL3HX_hFeMskXGwFzxy4hM7Wn_1EOyEO590JGKvc,388
75
+ wolfhece/apps/version.py,sha256=T9oL1EY3HMV5ZVLUeJEU1FuT__QAQ0iSx8HOFn7mc4Y,388
76
76
  wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
77
77
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
78
78
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -283,8 +283,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
283
283
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
284
284
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
285
285
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
286
- wolfhece-2.1.73.dist-info/METADATA,sha256=ic8qSOuRT0LzlneOYjg45t_qPWzkKrlbqaFMnUp_En8,2570
287
- wolfhece-2.1.73.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
288
- wolfhece-2.1.73.dist-info/entry_points.txt,sha256=Q5JuIWV4odeIJI3qc6fV9MwRoz0ezqPVlFC1Ppm_vdQ,395
289
- wolfhece-2.1.73.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
290
- wolfhece-2.1.73.dist-info/RECORD,,
286
+ wolfhece-2.1.74.dist-info/METADATA,sha256=7aW4jIl11xOINRkPpa0QcgwbJNb_2AE0CRq8JJ3wy9o,2570
287
+ wolfhece-2.1.74.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
288
+ wolfhece-2.1.74.dist-info/entry_points.txt,sha256=Q5JuIWV4odeIJI3qc6fV9MwRoz0ezqPVlFC1Ppm_vdQ,395
289
+ wolfhece-2.1.74.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
290
+ wolfhece-2.1.74.dist-info/RECORD,,