wolfhece 2.1.81__py3-none-any.whl → 2.1.83__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 CHANGED
@@ -27,6 +27,8 @@ class ConfigurationKeys(Enum):
27
27
  TICKS_SIZE = "TicksSize"
28
28
  TICKS_BOUNDS = "TicksBounds"
29
29
  COLOR_BACKGROUND = "ColorBackground"
30
+ ACTIVE_ARRAY_PALETTE_FOR_IMAGE = "Use active array palette for image"
31
+ ACTIVE_RES2D_PALETTE_FOR_IMAGE = "Use active result palette for image"
30
32
 
31
33
  class WolfConfiguration:
32
34
  """ Holds the PyWolf configuration.
@@ -66,6 +68,8 @@ class WolfConfiguration:
66
68
  ConfigurationKeys.VERSION.value: 1,
67
69
  ConfigurationKeys.PLAY_WELCOME_SOUND.value: True,
68
70
  ConfigurationKeys.TICKS_SIZE.value: 500.,
71
+ ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE.value: True,
72
+ ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE.value: False,
69
73
  ConfigurationKeys.TICKS_BOUNDS.value: True,
70
74
  ConfigurationKeys.COLOR_BACKGROUND.value: [255, 255, 255, 255]
71
75
  }
@@ -73,6 +77,8 @@ class WolfConfiguration:
73
77
  ConfigurationKeys.VERSION.value: int,
74
78
  ConfigurationKeys.PLAY_WELCOME_SOUND.value: bool,
75
79
  ConfigurationKeys.TICKS_SIZE.value: float,
80
+ ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE.value: bool,
81
+ ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE.value: bool,
76
82
  ConfigurationKeys.TICKS_BOUNDS.value: bool,
77
83
  ConfigurationKeys.COLOR_BACKGROUND.value: list
78
84
  }
@@ -116,12 +122,13 @@ class WolfConfiguration:
116
122
 
117
123
 
118
124
  class GlobalOptionsDialog(wx.Dialog):
125
+ """ A dialog to set global options for a WolfMapViewer. """
119
126
 
120
127
  def __init__(self, *args, **kw):
121
128
  super(GlobalOptionsDialog, self).__init__(*args, **kw)
122
129
 
123
130
  self.InitUI()
124
- self.SetSize((400, 200))
131
+ self.SetSize((400, 300))
125
132
  self.SetTitle(_("Global options"))
126
133
 
127
134
  def push_configuration(self, configuration):
@@ -129,12 +136,16 @@ class GlobalOptionsDialog(wx.Dialog):
129
136
  self.cfg_ticks_size.SetValue(str(configuration[ConfigurationKeys.TICKS_SIZE]))
130
137
  self.cfg_ticks_bounds.SetValue(configuration[ConfigurationKeys.TICKS_BOUNDS])
131
138
  self.cfg_bkg_color.SetColour(configuration[ConfigurationKeys.COLOR_BACKGROUND])
139
+ self.cfg_active_array_pal.SetValue(configuration[ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE])
140
+ self.cfg_active_res_pal.SetValue(configuration[ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE])
132
141
 
133
142
  def pull_configuration(self, configuration):
134
143
  configuration[ConfigurationKeys.PLAY_WELCOME_SOUND] = self.cfg_welcome_voice.IsChecked()
135
144
  configuration[ConfigurationKeys.TICKS_SIZE] = float(self.cfg_ticks_size.Value)
136
145
  configuration[ConfigurationKeys.TICKS_BOUNDS] = self.cfg_ticks_bounds.IsChecked()
137
146
  configuration[ConfigurationKeys.COLOR_BACKGROUND] = list(self.cfg_bkg_color.GetColour())
147
+ configuration[ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE] = self.cfg_active_array_pal.IsChecked()
148
+ configuration[ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE] = self.cfg_active_res_pal.IsChecked()
138
149
 
139
150
  def InitUI(self):
140
151
 
@@ -147,13 +158,26 @@ class GlobalOptionsDialog(wx.Dialog):
147
158
  sbs = wx.StaticBoxSizer(sb , orient=wx.VERTICAL)
148
159
 
149
160
  self.cfg_welcome_voice = wx.CheckBox(pnl, label=_('Welcome voice'))
161
+ self.cfg_welcome_voice.SetToolTip(_('Play a welcome message when opening the application'))
150
162
  sbs.Add(self.cfg_welcome_voice)
151
163
 
164
+ sbs.AddSpacer(5)
165
+
166
+ hsizer = wx.BoxSizer(wx.HORIZONTAL)
167
+ self.label_background_color = wx.StaticText(pnl, label=_('Background color'))
152
168
  self.cfg_bkg_color = wx.ColourPickerCtrl(pnl, colour=(255,255,255,255))
153
- sbs.Add(self.cfg_bkg_color)
169
+ self.cfg_bkg_color.SetToolTip(_('Background color for the viewer'))
170
+
171
+ hsizer.Add(self.label_background_color, 1, wx.EXPAND)
172
+ hsizer.Add(self.cfg_bkg_color, 1, wx.EXPAND)
173
+
174
+ sbs.Add(hsizer, 1, wx.EXPAND)
175
+
176
+ sbs.AddSpacer(5)
154
177
 
155
178
  pnl.SetSizer(sbs)
156
179
  pnl.Layout()
180
+
157
181
  vbox.Add(pnl, proportion=1, flag=wx.ALL|wx.EXPAND, border=5)
158
182
 
159
183
  ### Panel 'Copy to clipboard'
@@ -163,19 +187,29 @@ class GlobalOptionsDialog(wx.Dialog):
163
187
  sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)
164
188
 
165
189
  hboxticks = wx.BoxSizer(wx.HORIZONTAL)
166
- self.label_ticks_size = wx.StaticText(pnl, label=_('Default ticks size for copy to clipboard'))
190
+ self.label_ticks_size = wx.StaticText(pnl, label=_('Default ticks size [m]'))
167
191
  self.cfg_ticks_size = wx.TextCtrl(pnl, value='500.',style = wx.TE_CENTRE )
192
+
168
193
  hboxticks.Add(self.label_ticks_size, 1, wx.EXPAND)
169
- hboxticks.AddSpacer(5)
170
- hboxticks.Add(self.cfg_ticks_size, 0, wx.EXPAND)
194
+ hboxticks.Add(self.cfg_ticks_size, 1, wx.EXPAND)
171
195
 
172
196
  sbs.Add(hboxticks, 1, wx.EXPAND)
173
197
 
174
198
  self.cfg_ticks_bounds = wx.CheckBox(pnl, label=_('Add bounds to ticks'))
199
+ self.cfg_ticks_bounds.SetToolTip(_('If not checked, the extreme values of the ticks will not be displayed'))
175
200
  sbs.Add(self.cfg_ticks_bounds, 1, wx.EXPAND, 5)
176
201
 
202
+ self.cfg_active_array_pal = wx.CheckBox(pnl, label=_('Use active array palette for image'))
203
+ self.cfg_active_array_pal.SetToolTip(_('If checked, the active array palette will be used for the image'))
204
+ sbs.Add(self.cfg_active_array_pal, 1, wx.EXPAND, 5)
205
+
206
+ self.cfg_active_res_pal = wx.CheckBox(pnl, label=_('Use active result palette for image'))
207
+ self.cfg_active_res_pal.SetToolTip(_('If checked, the active result palette will be used for the image (but priority to active array palette if checked)'))
208
+ sbs.Add(self.cfg_active_res_pal, 1, wx.EXPAND, 5)
209
+
177
210
  pnl.SetSizer(sbs)
178
211
  pnl.Layout()
212
+
179
213
  vbox.Add(pnl, proportion=1, flag=wx.ALL|wx.EXPAND, border=5)
180
214
 
181
215
  # Buttons
wolfhece/PyDraw.py CHANGED
@@ -2059,6 +2059,34 @@ class WolfMapViewer(wx.Frame):
2059
2059
  else:
2060
2060
  return config[ConfigurationKeys.TICKS_BOUNDS]
2061
2061
 
2062
+ @property
2063
+ def palette_for_copy(self) -> wolfpalette:
2064
+ """ Return the palette for copy from configs """
2065
+
2066
+ config = self.get_configuration()
2067
+ if config is None:
2068
+ if self.active_array is not None:
2069
+ return self.active_array.palette
2070
+ elif self.active_res2d is not None:
2071
+ return self.active_res2d.palette
2072
+ else:
2073
+ return wolfpalette()
2074
+ else:
2075
+ act_array = config[ConfigurationKeys.ACTIVE_ARRAY_PALETTE_FOR_IMAGE]
2076
+ act_res2d = config[ConfigurationKeys.ACTIVE_RES2D_PALETTE_FOR_IMAGE]
2077
+
2078
+ if act_array:
2079
+ if self.active_array is not None:
2080
+ return self.active_array.mypal
2081
+ else:
2082
+ return wolfpalette()
2083
+ elif act_res2d:
2084
+ if self.active_res2d is not None:
2085
+ return self.active_res2d.mypal
2086
+ else:
2087
+ return wolfpalette()
2088
+ else:
2089
+ return wolfpalette()
2062
2090
 
2063
2091
  def GlobalOptionsDialog(self, event):
2064
2092
  handle_configuration_dialog(self, self.get_configuration())
@@ -2191,29 +2219,33 @@ class WolfMapViewer(wx.Frame):
2191
2219
 
2192
2220
  self.active_array.compare_tri(self.active_tri)
2193
2221
 
2194
- def copy_canvasogl(self, mpl=True, ds=0., figsizes=[10.,10.], palette:wolfpalette = None):
2222
+ def copy_canvasogl(self, mpl:bool= True, ds:float= 0., figsizes= [10.,10.], palette:wolfpalette = None):
2195
2223
  """
2196
-
2197
2224
  Generate image based on UI context and copy to the Clipboard
2198
2225
 
2199
- Args:
2200
- mpl (bool, optional): Using Matplolib as renderer. Defaults to True.
2201
- ds (float, optional): Ticks size. Defaults to 0..
2202
- figsizes : fig size in inches
2226
+ :param mpl: Using Matplolib as renderer. Defaults to True.
2227
+ :type mpl: bool, optional
2228
+ :parem ds: Ticks size. Defaults to 0..
2229
+ :type ds: float, optional
2230
+ :parem figsizes: fig size in inches
2231
+ :type figsizes: list, optional
2203
2232
  """
2233
+
2204
2234
  if wx.TheClipboard.Open():
2205
2235
  self.Paint()
2206
2236
 
2207
2237
  if self.SetCurrentContext():
2208
2238
 
2209
- # Récupération du buffer OpenGL
2210
- glPixelStorei(GL_PACK_ALIGNMENT, 1)
2211
- data = glReadPixels(0, 0, self.canvaswidth, self.canvasheight, GL_RGBA, GL_UNSIGNED_BYTE)
2212
- # Création d'une image sur base du buffer
2213
- myimage: Image.Image
2214
- myimage = Image.frombuffer("RGBA", (self.canvaswidth, self.canvasheight), data)
2215
- # On tranpose car OpenGL travaille avec comme référence le coin inférieur gauche
2216
- myimage = myimage.transpose(1)
2239
+ myimage = self.get_canvas_as_image()
2240
+
2241
+ # # Récupération du buffer OpenGL
2242
+ # glPixelStorei(GL_PACK_ALIGNMENT, 1)
2243
+ # data = glReadPixels(0, 0, self.canvaswidth, self.canvasheight, GL_RGBA, GL_UNSIGNED_BYTE)
2244
+ # # Création d'une image sur base du buffer
2245
+ # myimage: Image.Image
2246
+ # myimage = Image.frombuffer("RGBA", (self.canvaswidth, self.canvasheight), data)
2247
+ # # On tranpose car OpenGL travaille avec comme référence le coin inférieur gauche
2248
+ # myimage = myimage.transpose(1)
2217
2249
 
2218
2250
  metadata = PngInfo()
2219
2251
  metadata.add_text('xmin', str(self.xmin))
@@ -2223,20 +2255,17 @@ class WolfMapViewer(wx.Frame):
2223
2255
 
2224
2256
  if mpl:
2225
2257
  if ds == 0.:
2226
- ds = self.ticks_size
2227
- # dlg = wx.NumberEntryDialog(self,
2228
- # _("xmin : {:.3f} \nxmax : {:.3f} \nymin : {:.3f} \nymax : {:.3f} \n\n dx : {:.3f}\n dy : {:.3f}").format(
2229
- # self.xmin, self.xmax, self.ymin, self.ymax, self.xmax - self.xmin,
2230
- # self.ymax - self.ymin),
2231
- # _("Interval [m]"), _("Ticks interval ?"), 500, 1, 10000)
2232
- # ret = dlg.ShowModal()
2258
+ ds = self.ticks_size # Global parameters
2259
+
2260
+ if ds == 0.:
2261
+ ds = 100.
2233
2262
 
2234
- # if ret == wx.ID_CANCEL:
2235
- # dlg.Destroy()
2236
- # return
2263
+ nb_ticks_x = (self.xmax - self.xmin) // ds
2264
+ nb_ticks_y = (self.ymax - self.ymin) // ds
2237
2265
 
2238
- # ds = float(dlg.GetValue())
2239
- # dlg.Destroy()
2266
+ if nb_ticks_x > 10 or nb_ticks_y > 10:
2267
+ logging.error(_('Too many ticks for the image. Please raise the ticks size in the global options.'))
2268
+ return
2240
2269
 
2241
2270
  # Création d'une graphique Matplotlib
2242
2271
  extent = (self.xmin, self.xmax, self.ymin, self.ymax)
@@ -2253,7 +2282,6 @@ class WolfMapViewer(wx.Frame):
2253
2282
  pos = ax.imshow(myimage,
2254
2283
  origin='upper',
2255
2284
  extent=extent)
2256
- # fig.colorbar(pos,ax=ax)
2257
2285
 
2258
2286
  x1 = np.ceil((self.xmin // ds) * ds)
2259
2287
  if x1 < self.xmin:
@@ -2301,10 +2329,11 @@ class WolfMapViewer(wx.Frame):
2301
2329
  im = Image.open(buf)
2302
2330
 
2303
2331
  if palette is None:
2304
- if self.active_array is not None:
2305
- palette = self.active_array.mypal
2306
- elif self.active_res2d is not None:
2307
- palette = self.active_res2d.mypal
2332
+ palette = self.palette_for_copy
2333
+ # if self.active_array is not None:
2334
+ # palette = self.active_array.mypal
2335
+ # elif self.active_res2d is not None:
2336
+ # palette = self.active_res2d.mypal
2308
2337
 
2309
2338
  if palette is not None:
2310
2339
  bufpal = io.BytesIO()
@@ -2360,6 +2389,7 @@ class WolfMapViewer(wx.Frame):
2360
2389
  This method takes a matplotlib figure and axe and,
2361
2390
  returns a clear screenshot of the information displayed in the wolfpy GUI.
2362
2391
  """
2392
+
2363
2393
  self.Paint()
2364
2394
  myax = ax
2365
2395
  if redraw:
@@ -2431,18 +2461,21 @@ class WolfMapViewer(wx.Frame):
2431
2461
 
2432
2462
  def get_mpl_plot(self, center = [0., 0.], width = 500., height = 500., title='', toshow=True) -> tuple[Figure, Axes]:
2433
2463
  """
2434
- Récupère un graphique matplotlib sur base de la fenêtre OpenGL et de la palette de la matrice active
2464
+ Récupère un graphique matplotlib sur base de la fenêtre OpenGL et de la palette de la matrice/résultat actif.
2435
2465
  """
2436
- self.zoom_on(center=center, width=width, height= height, canvas_height=self.canvasheight, forceupdate=True)
2437
2466
 
2467
+ self.zoom_on(center=center, width=width, height= height, canvas_height=self.canvasheight, forceupdate=True)
2438
2468
 
2439
2469
  fig,axes = plt.subplots(1,2, gridspec_kw={'width_ratios': [20, 1]})
2440
2470
  self.display_canvasogl(fig=fig,ax=axes[0])
2441
2471
 
2442
- if self.active_array is not None:
2443
- self.active_array.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2444
- elif self.active_res2d is not None:
2445
- self.active_res2d.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2472
+ palette = self.palette_for_copy
2473
+ palette.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2474
+
2475
+ # if self.active_array is not None:
2476
+ # self.active_array.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2477
+ # elif self.active_res2d is not None:
2478
+ # self.active_res2d.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2446
2479
 
2447
2480
  axes[0].xaxis.set_ticks_position('bottom')
2448
2481
  axes[0].xaxis.set_label_position('bottom')
@@ -2594,17 +2627,16 @@ class WolfMapViewer(wx.Frame):
2594
2627
 
2595
2628
  return myimage
2596
2629
 
2597
- def save_canvasogl(self, fn:str='', mpl:bool=True, ds:float=0.):
2630
+ def save_canvasogl(self, fn:str='', mpl:bool=True, ds:float=0., dpi:int= 300):
2598
2631
  """
2599
2632
  Sauvegarde de la fenêtre d'affichage dans un fichier
2600
2633
 
2601
- fn : File name (.png file)
2634
+ :param fn: File name (.png or .jpg file)
2635
+ :param mpl: Using Matplotlib as renderer
2636
+ :param ds: Ticks interval
2602
2637
  """
2603
2638
 
2604
- if not fn.endswith('.png'):
2605
- fn += '.png'
2606
-
2607
- self.Paint()
2639
+ fn = str(fn)
2608
2640
 
2609
2641
  if fn == '':
2610
2642
  dlg = wx.FileDialog(None, _('Choose file name'), wildcard='PNG (*.png)|*.png|JPG (*.jpg)|*.jpg',
@@ -2615,13 +2647,17 @@ class WolfMapViewer(wx.Frame):
2615
2647
  return
2616
2648
  fn = dlg.GetPath()
2617
2649
  dlg.Destroy()
2650
+ elif not fn.endswith('.png'):
2651
+ fn += '.png'
2618
2652
 
2619
2653
  if self.SetCurrentContext():
2620
- glPixelStorei(GL_PACK_ALIGNMENT, 1)
2621
- data = glReadPixels(0, 0, self.canvaswidth, self.canvasheight, GL_RGBA, GL_UNSIGNED_BYTE)
2622
- myimage: Image.Image
2623
- myimage = Image.frombuffer("RGBA", (self.canvaswidth, self.canvasheight), data)
2624
- myimage = myimage.transpose(1)
2654
+ # glPixelStorei(GL_PACK_ALIGNMENT, 1)
2655
+ # data = glReadPixels(0, 0, self.canvaswidth, self.canvasheight, GL_RGBA, GL_UNSIGNED_BYTE)
2656
+ # myimage: Image.Image
2657
+ # myimage = Image.frombuffer("RGBA", (self.canvaswidth, self.canvasheight), data)
2658
+ # myimage = myimage.transpose(1)
2659
+
2660
+ myimage = self.get_canvas_as_image()
2625
2661
 
2626
2662
  metadata = PngInfo()
2627
2663
  metadata.add_text('xmin', str(self.xmin))
@@ -2646,9 +2682,14 @@ class WolfMapViewer(wx.Frame):
2646
2682
  dlg.Destroy()
2647
2683
 
2648
2684
  extent = (self.xmin, self.xmax, self.ymin, self.ymax)
2649
- fig, ax = plt.subplots(1, 1)
2650
- pos = ax.imshow(myimage, origin='upper',
2651
- extent=extent)
2685
+ # fig, ax = plt.subplots(1, 1)
2686
+ fig,axes = plt.subplots(1,2, gridspec_kw={'width_ratios': [20, 1]})
2687
+
2688
+ ax = axes[0]
2689
+ self.display_canvasogl(fig=fig,ax=axes[0])
2690
+
2691
+ # pos = ax.imshow(myimage, origin='upper',
2692
+ # extent=extent)
2652
2693
  # fig.colorbar(pos,ax=ax)
2653
2694
 
2654
2695
  x1 = np.ceil((self.xmin // ds) * ds)
@@ -2683,7 +2724,19 @@ class WolfMapViewer(wx.Frame):
2683
2724
  ax.set_xlabel('X [m]')
2684
2725
  ax.set_ylabel('Y [m]')
2685
2726
 
2686
- plt.savefig(fn, dpi=300)
2727
+ self.palette_for_copy.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2728
+
2729
+ # if self.active_array is not None:
2730
+ # self.active_array.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2731
+ # elif self.active_res2d is not None:
2732
+ # self.active_res2d.mypal.export_image(None, h_or_v='v', figax=(fig,axes[1]))
2733
+
2734
+ # self.Paint()
2735
+
2736
+ fig.set_size_inches(12, 10)
2737
+ fig.tight_layout()
2738
+
2739
+ fig.savefig(fn, dpi=dpi)
2687
2740
  else:
2688
2741
  myimage.save(fn, pnginfo=metadata)
2689
2742
 
@@ -2693,6 +2746,9 @@ class WolfMapViewer(wx.Frame):
2693
2746
  'Opengl setcurrent -- maybe a conflict with an existing opengl32.dll file - please rename the opengl32.dll in the libs directory and retry')
2694
2747
 
2695
2748
  def reporting(self, dir=''):
2749
+ """ Firsdt attempr to create a reporting.
2750
+ !! Must be improved !!
2751
+ """
2696
2752
  if dir == '':
2697
2753
  dlg = wx.DirDialog(None, "Choose directory to store reporting", style=wx.FD_SAVE)
2698
2754
  ret = dlg.ShowModal()
@@ -2736,6 +2792,7 @@ class WolfMapViewer(wx.Frame):
2736
2792
  curvec.myprop.width = oldwidth
2737
2793
 
2738
2794
  def InitUI(self):
2795
+ """ Initialisation de l'interface utilisateur """
2739
2796
 
2740
2797
  self.Bind(wx.EVT_SIZE, self.OnSize)
2741
2798
  self.Bind(wx.EVT_CLOSE, self.OnClose)
@@ -6134,6 +6191,8 @@ class WolfMapViewer(wx.Frame):
6134
6191
  return linkedarrays
6135
6192
 
6136
6193
  def save_linked_canvas(self, fn, mpl=True, ds=0.):
6194
+ """ Save canvas of all linked viewers """
6195
+
6137
6196
  if self.linked:
6138
6197
  for idx, curel in enumerate(self.linkedList):
6139
6198
  curel.save_canvasogl(fn + '_' + str(idx) + '.png', mpl, ds)
@@ -9602,6 +9661,14 @@ class WolfMapViewer(wx.Frame):
9602
9661
 
9603
9662
  return self.canvas.SetCurrent(self.context)
9604
9663
 
9664
+ def _set_gl_projection_matrix(self):
9665
+ glMatrixMode(GL_PROJECTION)
9666
+ glLoadIdentity()
9667
+ glOrtho(self.xmin, self.xmax, self.ymin, self.ymax, -99999, 99999)
9668
+
9669
+ glMatrixMode(GL_MODELVIEW)
9670
+ glLoadIdentity()
9671
+
9605
9672
  def Paint(self):
9606
9673
  """ Dessin des éléments ajoutés au viewer """
9607
9674
 
@@ -9626,12 +9693,7 @@ class WolfMapViewer(wx.Frame):
9626
9693
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
9627
9694
  glViewport(0, 0, int(width), int(height))
9628
9695
 
9629
- glMatrixMode(GL_PROJECTION)
9630
- glLoadIdentity()
9631
- glOrtho(self.xmin, self.xmax, self.ymin, self.ymax, -99999, 99999)
9632
-
9633
- glMatrixMode(GL_MODELVIEW)
9634
- glLoadIdentity()
9696
+ self._set_gl_projection_matrix()
9635
9697
 
9636
9698
  # dessin du background
9637
9699
  self._plotting(draw_type.WMSBACK)
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 = 81
8
+ self.patch = 83
9
9
 
10
10
  def __str__(self):
11
11
 
wolfhece/gpuview.py CHANGED
@@ -523,6 +523,7 @@ class VectorField(Element_To_Draw):
523
523
  glMatrixMode(GL_PROJECTION)
524
524
  # glPopMatrix()
525
525
  # glLoadIdentity()
526
+ self.get_mapviewer()._set_gl_projection_matrix()
526
527
 
527
528
  def _plot(self, projection_matrix):
528
529
  assert self._gl_texture is not None, "Did you set the data ?"
@@ -9488,8 +9488,7 @@ class prev_sim2D():
9488
9488
  """ Common mask for multiblock arrays """
9489
9489
 
9490
9490
  if self.mymnap is not None:
9491
- # return [cur.array.mask for cur in self.mymnap.myblocks.values()]
9492
- return [cur.array.data != 1 for cur in self.mymnap.myblocks.values()]
9491
+ return self.mymnap.get_all_masks()
9493
9492
  else:
9494
9493
  return None
9495
9494
 
wolfhece/pyviews.py CHANGED
@@ -27,15 +27,17 @@ class WolfViews(Element_To_Draw):
27
27
 
28
28
  super().__init__(idx, plotted, mapviewer, need_for_wx)
29
29
 
30
- self.view = []
31
- self.pals = []
30
+ self.view = [] # list of elements to plot
31
+ self.pals = [] # list of palettes to use for the elements
32
+ self.fix = [] # list of boolean to fix some elements - avoid to delete OpenGL lists during "delete_lists"
32
33
 
33
34
  def delete_lists(self):
34
35
  """ Delete the lists of elements and palettes."""
35
36
 
36
- for cur in self.view:
37
- if isinstance(cur, WolfArray) or isinstance(cur, WolfArrayMB):
38
- cur.delete_lists()
37
+ for cur, fix in zip(self.view, self.fix):
38
+ if not fix:
39
+ if isinstance(cur, WolfArray) or isinstance(cur, WolfArrayMB):
40
+ cur.delete_lists()
39
41
 
40
42
  def read_from_file(self, fn):
41
43
  myproject = Wolf_Param(None, filename=fn, toShow=False)
@@ -181,7 +183,7 @@ class WolfViews(Element_To_Draw):
181
183
  else:
182
184
  cur.mapviewer = newmapviewer
183
185
 
184
- def add_elemt(self, added_elemt, pal=None):
186
+ def add_elemt(self, added_elemt, pal= None, fix= False):
185
187
  """ Add an element to the view.
186
188
 
187
189
  :param added_elemt: Element to add.
@@ -192,8 +194,9 @@ class WolfViews(Element_To_Draw):
192
194
 
193
195
  self.view.append(added_elemt)
194
196
  self.pals.append(pal)
197
+ self.fix.append(fix)
195
198
 
196
- def add_elemts(self, added_elemts: list, pals=None):
199
+ def add_elemts(self, added_elemts: list, pals=None, fixes=None):
197
200
  """ Add a list of elements to the view.
198
201
 
199
202
  :param added_elemts: List of elements to add.
@@ -220,6 +223,21 @@ class WolfViews(Element_To_Draw):
220
223
 
221
224
  self.pals += pals
222
225
 
226
+ if fixes is None:
227
+ self.fix += [False]*len(added_elemts)
228
+ else:
229
+ if len(fixes) != len(added_elemts):
230
+ logging.warning('The number of fixes must be the same as the number of elements.')
231
+
232
+ if len(fixes) < len(added_elemts):
233
+ logging.warning('The missing fixes will be set to None.')
234
+ fixes += [False]*(len(added_elemts)-len(fixes))
235
+ else:
236
+ logging.warning('The extra fixes will be ignored.')
237
+ fixes = fixes[:len(added_elemts)]
238
+
239
+ self.fix += fixes
240
+
223
241
  def plot(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
224
242
  """ Plot the view. """
225
243
 
wolfhece/wolf_array.py CHANGED
@@ -10165,3 +10165,22 @@ class WolfArrayMNAP(WolfArrayMB):
10165
10165
 
10166
10166
  # Imposition du type de stockage
10167
10167
  self.wolftype = WOLF_ARRAY_MNAP_INTEGER
10168
+
10169
+ def get_one_mask(self, which:int | str):
10170
+ """
10171
+ Return the mask of the block `which`
10172
+ """
10173
+
10174
+ if isinstance(which, int):
10175
+ key = getkeyblock(which)
10176
+ else:
10177
+ key = which
10178
+
10179
+ return self.myblocks[key].array.data != 1
10180
+
10181
+ def get_all_masks(self):
10182
+ """
10183
+ Return all masks
10184
+ """
10185
+
10186
+ return [curblock.array.data != 1 for curblock in self.myblocks.values()]
@@ -2278,7 +2278,7 @@ class Wolfresults_2D(Element_To_Draw):
2278
2278
  """ Common mask for multiblock arrays """
2279
2279
 
2280
2280
  if self.mymnap is not None:
2281
- return [cur.array.data !=1 for cur in self.mymnap.myblocks.values()]
2281
+ return self.mymnap.get_all_masks()
2282
2282
  else:
2283
2283
  return None
2284
2284
 
@@ -4178,35 +4178,8 @@ class Wolfresults_2D(Element_To_Draw):
4178
4178
  """Dessin OpenGL"""
4179
4179
  self.mimic_plotdata(True)
4180
4180
 
4181
- if self._which_current_view in VIEWS_COMPLEX:
4182
- # FIXME : Force to plot all blocks in complex views.
4183
- # There is an issue with GPUVIEW
4184
- if self.plotted:
4185
- lists = []
4186
- pals = []
4187
- for i in range(len(self.myblocks[getkeyblock(0)]._view.view)):
4188
- lists.append([cur._view.view[i] for cur in self.myblocks.values()])
4189
- pals.append([cur._view.pals[i] for cur in self.myblocks.values()])
4190
-
4191
- for curlist, curpal in zip(lists, pals):
4192
- for cur, pal in zip(curlist, curpal):
4193
- oldplotted = cur.plotted
4194
- cur.plotted = True
4195
- # force True even if not "plotted",
4196
- # we must plot all the arrays in a complex view,
4197
- # which can use some objects that are not plotted
4198
- # as individual arrays (e.g. Topography)
4199
- if pal is None:
4200
- cur.plot(sx, sy,xmin,ymin,xmax,ymax,size)
4201
- else:
4202
- oldpal = cur.mypal
4203
- cur.mypal = pal
4204
- cur.plot(sx, sy,xmin,ymin,xmax,ymax,size)
4205
- cur.mypal = oldpal
4206
- cur.plotted = oldplotted
4207
- else:
4208
- for curblock in self.myblocks.values():
4209
- curblock.plot(sx, sy,xmin,ymin,xmax,ymax)
4181
+ for curblock in self.myblocks.values():
4182
+ curblock.plot(sx, sy,xmin,ymin,xmax,ymax)
4210
4183
 
4211
4184
  if self.myparam is not None:
4212
4185
  #conditions limites faibles
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.81
3
+ Version: 2.1.83
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
@@ -5,9 +5,9 @@ wolfhece/GraphProfile.py,sha256=OCgJo0YFFBI6H1z-5egJsOOoWF_iziiza0-bbPejNMc,6965
5
5
  wolfhece/Lidar2002.py,sha256=bX-nIzdpjD7rOfEgJpTeaW6rIdAXwDp_z4YTM9CgANY,6068
6
6
  wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
7
  wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
8
- wolfhece/PyConfig.py,sha256=FB8u0belXOXTb03Ln6RdVWvMgjzi3oGPCmw2dWa3lNg,8332
8
+ wolfhece/PyConfig.py,sha256=UNtl5UzZ399JqjJT67-4DWaIkv76sc1FiEsSDJpXlL0,10458
9
9
  wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
10
- wolfhece/PyDraw.py,sha256=Pwjn5TFcO4OgyA1sdKjfnf-xMnXphiqmdih4_gtr19Q,422813
10
+ wolfhece/PyDraw.py,sha256=3pd5ynlveRs43Qr5eOhcNdkywxPifuq-qnsT5gabImo,425009
11
11
  wolfhece/PyGui.py,sha256=HY0beOMSp1JEyq8-vfVynzVrmKxvaO_sJSMwlNqCNrg,105289
12
12
  wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
13
13
  wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
@@ -30,7 +30,7 @@ wolfhece/color_constants.py,sha256=Snc5RX11Ydi756EkBp_83C7DiAQ_Z1aHD9jFIBsosAU,3
30
30
  wolfhece/drawing_obj.py,sha256=7vY04B6r08nurTTFmBXHyR5tVIF1YzAEw_uz4pqTDIw,4233
31
31
  wolfhece/flow_SPWMI.py,sha256=XDAelwAY-3rYOR0WKW3fgYJ_r8DU4IP6Y5xULW421tk,20956
32
32
  wolfhece/friction_law.py,sha256=MtZJLo-pTj3-Fw-w12z1LSgSIDrH-JGR0iD9wer_fpQ,5498
33
- wolfhece/gpuview.py,sha256=3QD2GOxbZSsCgGy3krBkH8zBrS5r7oz5KszL2Op8MuY,24142
33
+ wolfhece/gpuview.py,sha256=ggFoxBntUjHqsoxwTZQOE-UsbtC8YAIwZD1i3veAe-o,24204
34
34
  wolfhece/import_ascfiles.py,sha256=6Zl8qBR9c6VtyziookQ8YE9KC0GtW_J9WFt5ubyGp-s,4465
35
35
  wolfhece/ins.py,sha256=0aU1mo4tYbw64Gwzrqbh-NCTH1tukmk0mpPHjRPHZXU,12661
36
36
  wolfhece/irm_qdf.py,sha256=gDuM9sEowQndLTL8vzbZW879M1go2xiKeE4EAJD2bA4,16532
@@ -43,18 +43,18 @@ wolfhece/pydike.py,sha256=hPBQsmSTW4QAp1wcOzb-TL3L7eet2WT1sJx2q-WNQ-Q,2241
43
43
  wolfhece/pylogging.py,sha256=4TI8hgBB65z-zpvU5Rfa2jkPXPhJaqXjHVPwbcdzTNc,4528
44
44
  wolfhece/pypolygons_scen.py,sha256=x-tnYLNq3MPV51NbaU14trgRj8qyUyOrMdF1zDsUX3I,37444
45
45
  wolfhece/pyshields.py,sha256=7k-qe2EJgr9fJE62jyPmlWQwRj8T0DK4iuMU844ZhYs,23281
46
- wolfhece/pyviews.py,sha256=lNoK0LydFbQzVzsLEVGj1Ma1ynoXiUHK10yTBeTeL6M,12824
46
+ wolfhece/pyviews.py,sha256=5Hqqo9MRw1eiomYkmc7QywNu1KmEkytLJG-wH_aG38Y,13748
47
47
  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=Vw9z4QWUHH0jXG2WXT0k6BaAjsjldppGbOOaY7bEGLU,401353
51
+ wolfhece/wolf_array.py,sha256=L6OV70nFSmzfO_beNbPRQ_VoklC_cx6fyhoslI3AMXg,401812
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
55
55
  wolfhece/wolf_vrt.py,sha256=89XoDhCJMHiwPQUuOduxtTRKuIa8RDxgNqX65S4xp9M,10569
56
56
  wolfhece/wolf_zi_db.py,sha256=baE0niMCzybWGSvPJc5FNxo9ZxsGfU4p-FmfiavFHAs,12967
57
- wolfhece/wolfresults_2D.py,sha256=icmrgbzRn0mMozx1GLrrFJFghzz-MuLgdmi-Kf3vh6Q,169941
57
+ wolfhece/wolfresults_2D.py,sha256=Iq_eOcQ_UkgfWN386oFt_VZysMt8uyYrqd36iAkkM2Q,168473
58
58
  wolfhece/xyz_file.py,sha256=Se4nCPwYAYLSA5i0zsbnZUKoAMAD0mK1FJea5WSZUkk,5755
59
59
  wolfhece/acceptability/Parallels.py,sha256=h4tu3SpC_hR5Hqa68aruxhtAyhs8u666YuZ40_fR5zg,3979
60
60
  wolfhece/acceptability/__init__.py,sha256=hfgoPKLDpX7drN1Vpvux-_5Lfyc_7feT2C2zQr5v-Os,258
@@ -74,7 +74,7 @@ wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefg
74
74
  wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
75
75
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
76
76
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
77
- wolfhece/apps/version.py,sha256=84BbOWuyjD0m7UKJmKJ4diPd2VS3kshthkwN_wFUto8,388
77
+ wolfhece/apps/version.py,sha256=KzR1Tx9_pol7yT3-9TgcRyZl_hDj4MJt6tFSuPhNaS0,388
78
78
  wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
79
79
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
80
80
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -220,7 +220,7 @@ wolfhece/mesh2d/bc_manager.py,sha256=QTGkb5TR8Y5xVnGUXPXzscGyTEQ6PA8CZPkVNwrlR1Y
220
220
  wolfhece/mesh2d/cell_tracker.py,sha256=mPmnD5lEf3gLPuLqtAIo-Gp-ipAwQdPxzjWOGt0b7jM,8958
221
221
  wolfhece/mesh2d/config_manager.py,sha256=DcdxCIIs_dyC6ayJOBULeY364LONogL9PBaqBtC9eQ4,14736
222
222
  wolfhece/mesh2d/cst_2D_boundary_conditions.py,sha256=Y4DF68uAklF3fXJgf05nb_JvJk2pvzcu_wu5nFXpWJo,5008
223
- wolfhece/mesh2d/wolf2dprev.py,sha256=kAqRxVlMEkDciEXTgbX6xz6Ck3OqQsSz1IF8NTbnbmM,491575
223
+ wolfhece/mesh2d/wolf2dprev.py,sha256=CvCsutTwLr-BIxzYpzbg3YxIASJtMMtJpuZ77gxCue8,491460
224
224
  wolfhece/models/5_coul.pal,sha256=OI1UqcNIDBpJn2k_VDel__r-hKjjvdob0eqinGCI3QY,160
225
225
  wolfhece/models/6_coul.pal,sha256=z7NK2dg0tAQBUweRQV54dIwJbPM1U5y1AR2LLw19Idw,148
226
226
  wolfhece/models/7_coul.pal,sha256=XTnnUyCE8ONokScB2YzYDnSTft7E6sppmr7P-XwMsCE,205
@@ -284,8 +284,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
284
284
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
285
285
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
286
286
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
287
- wolfhece-2.1.81.dist-info/METADATA,sha256=82JlbxS-qLm_YgV4kDhs_mxseccct_N3ktWr2kCqQeU,2570
288
- wolfhece-2.1.81.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
289
- wolfhece-2.1.81.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
290
- wolfhece-2.1.81.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
291
- wolfhece-2.1.81.dist-info/RECORD,,
287
+ wolfhece-2.1.83.dist-info/METADATA,sha256=RlMzEF3E8tKoXAC9knM-5KQ9yNAfbnhG0fZPg_pa6oc,2570
288
+ wolfhece-2.1.83.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
289
+ wolfhece-2.1.83.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
290
+ wolfhece-2.1.83.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
291
+ wolfhece-2.1.83.dist-info/RECORD,,