wolfhece 2.1.20__py3-none-any.whl → 2.1.22__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
@@ -63,6 +63,7 @@ from . import Lidar2002
63
63
  from .picc import Picc_data, Cadaster_data
64
64
  from .wolf_zi_db import ZI_Databse_Elt, PlansTerrier
65
65
  from .math_parser.calculator import Calculator
66
+ from .wintab.wintab import Wintab
66
67
 
67
68
  # try:
68
69
  # from .hydrometry_hece.kiwis_hece import hydrometry_hece as hydrometry
@@ -337,6 +338,7 @@ class WolfMapViewer(wx.Frame):
337
338
  # Gestion des menus
338
339
  self.popupmenu = wx.Menu()
339
340
  self.popupmenu.Bind(wx.EVT_MENU, self.OnPopupItemSelected)
341
+
340
342
  for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Up'), _('Down'), _('Properties')]:
341
343
  item = self.popupmenu.Append(-1, text)
342
344
 
@@ -665,6 +667,32 @@ class WolfMapViewer(wx.Frame):
665
667
 
666
668
  self.InitUI()
667
669
 
670
+ # self._wintab = Wintab(self.GetHandle())
671
+
672
+ # if self._wintab:
673
+
674
+ # import win32gui
675
+ # import win32con
676
+
677
+ # # self.oldWndProc = win32gui.SetWindowLong(self.GetHandle(), win32con.GWL_WNDPROC, self.MyWndProc)
678
+
679
+ # def MyWndProc(self, hWnd, msg, wParam, lParam):
680
+ # import win32con
681
+
682
+ # # Intercept a specific Windows message (for example, WM_KEYDOWN)
683
+ # # if msg == 0x7FF0:
684
+ # # key_code = wParam
685
+ # # print(f"Key pressed: {key_code}")
686
+
687
+ # # # Process the message or do something custom
688
+ # # if key_code == win32con.VK_ESCAPE:
689
+ # # print("Escape key pressed, intercepting the event.")
690
+
691
+ # # # You can return 0 to indicate the message has been processed
692
+ # # return 0
693
+ # # print(msg)
694
+ # return 0
695
+
668
696
  @property
669
697
  def wxlogging(self):
670
698
  return self._wxlogging
@@ -860,7 +888,7 @@ class WolfMapViewer(wx.Frame):
860
888
  self.menu2d_dangermap = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map"), _("Compute the danger map"))
861
889
  self.menu2d_dangermaph = self.menuwolf2d.Append(wx.ID_ANY, _("Danger map - only h"), _("Compute the danger map"))
862
890
 
863
- self.menuwolf2d.AppendSeparator()
891
+ self.menuwolf2d.AppendSeparator()
864
892
 
865
893
  self.menubar.Append(self.menuwolf2d, _('Results 2D'))
866
894
 
@@ -885,9 +913,9 @@ class WolfMapViewer(wx.Frame):
885
913
 
886
914
 
887
915
  def get_canvas_bounds(self, gridsize:float = None):
888
- """
889
- Retourne les limites de la zone d'affichage
890
-
916
+ """
917
+ Retourne les limites de la zone d'affichage
918
+
891
919
  :return: [xmin, ymin, xmax, ymax]
892
920
 
893
921
  """
@@ -1206,21 +1234,21 @@ class WolfMapViewer(wx.Frame):
1206
1234
 
1207
1235
  if dlg.ShowModal() == wx.ID_CANCEL:
1208
1236
  return
1209
-
1237
+
1210
1238
  start_step = dlg.GetValue()
1211
-
1239
+
1212
1240
  with wx.NumberEntryDialog(None, _('Danger map'), _('To step'), _('Danger map'), self.active_res2d.get_nbresults(), start_step, self.active_res2d.get_nbresults()) as dlg:
1213
1241
 
1214
1242
  if dlg.ShowModal() == wx.ID_CANCEL:
1215
1243
  return
1216
-
1244
+
1217
1245
  end_step = dlg.GetValue()
1218
1246
 
1219
1247
  with wx.NumberEntryDialog(None, _('Danger map'), _('Every'), _('Danger map'), 1, 1, 60) as dlg:
1220
-
1248
+
1221
1249
  if dlg.ShowModal() == wx.ID_CANCEL:
1222
1250
  return
1223
-
1251
+
1224
1252
  every = dlg.GetValue()
1225
1253
 
1226
1254
  danger_map = self.active_res2d.danger_map_only_h(start_step-1, end_step-1, every)
@@ -1229,7 +1257,7 @@ class WolfMapViewer(wx.Frame):
1229
1257
 
1230
1258
  if dlg.ShowModal() == wx.ID_CANCEL:
1231
1259
  return
1232
-
1260
+
1233
1261
  outdir = dlg.GetPath()
1234
1262
 
1235
1263
  danger_map.write_all(Path(outdir) / 'danger_h.tif')
@@ -1243,21 +1271,21 @@ class WolfMapViewer(wx.Frame):
1243
1271
 
1244
1272
  if dlg.ShowModal() == wx.ID_CANCEL:
1245
1273
  return
1246
-
1274
+
1247
1275
  start_step = dlg.GetValue()
1248
-
1276
+
1249
1277
  with wx.NumberEntryDialog(None, _('Danger map'), _('To step'), _('Danger map'), self.active_res2d.get_nbresults(), start_step, self.active_res2d.get_nbresults()) as dlg:
1250
1278
 
1251
1279
  if dlg.ShowModal() == wx.ID_CANCEL:
1252
1280
  return
1253
-
1281
+
1254
1282
  end_step = dlg.GetValue()
1255
1283
 
1256
1284
  with wx.NumberEntryDialog(None, _('Danger map'), _('Every'), _('Danger map'), 1, 1, 60) as dlg:
1257
-
1285
+
1258
1286
  if dlg.ShowModal() == wx.ID_CANCEL:
1259
1287
  return
1260
-
1288
+
1261
1289
  every = dlg.GetValue()
1262
1290
 
1263
1291
  danger_maps = self.active_res2d.danger_map(start_step-1, end_step-1, every)
@@ -1266,7 +1294,7 @@ class WolfMapViewer(wx.Frame):
1266
1294
 
1267
1295
  if dlg.ShowModal() == wx.ID_CANCEL:
1268
1296
  return
1269
-
1297
+
1270
1298
  outdir = dlg.GetPath()
1271
1299
 
1272
1300
  names = ['danger_h.tif', 'danger_u.tif', 'danger_q.tif', 'danger_Z.tif']
@@ -2782,10 +2810,10 @@ class WolfMapViewer(wx.Frame):
2782
2810
  '2021': 'ORTHO_2021', '2022 printemps': 'ORTHO_2022_PRINTEMPS', '2022 été': 'ORTHO_2022_ETE',
2783
2811
  '2023 été': 'ORTHO_2023_ETE',
2784
2812
  }}
2785
- data_2021 = {'EAU': {'IDW': 'ZONES_INONDEES_IDW',
2786
- 'Emprise': 'ZONES_INONDEES',
2813
+ data_2021 = {'EAU': {'IDW': 'ZONES_INONDEES_IDW',
2814
+ 'Emprise': 'ZONES_INONDEES',
2787
2815
  'Emprise wo Alea': 'ZONES_INONDEES_wo_alea'}}
2788
-
2816
+
2789
2817
  for idx, (k, item) in enumerate(orthos.items()):
2790
2818
  for kdx, (m, subitem) in enumerate(item.items()):
2791
2819
  self.add_object(which='wmsback',
@@ -5248,7 +5276,7 @@ class WolfMapViewer(wx.Frame):
5248
5276
  if obj.idx=='grid':
5249
5277
  pass
5250
5278
  else:
5251
- filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|all (*.*)|*.*"
5279
+ filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|Shapefile (*.shp)|*.shp|all (*.*)|*.*"
5252
5280
  fdlg = wx.FileDialog(self, "Choose file name for Vector :" + obj.idx, wildcard=filterArray,
5253
5281
  style=wx.FD_SAVE)
5254
5282
  ret = fdlg.ShowModal()
@@ -5468,13 +5496,27 @@ class WolfMapViewer(wx.Frame):
5468
5496
 
5469
5497
  if which =='geotiff':
5470
5498
  self.export_geotif(outdir,curarray.idx,myarrays,mynames)
5499
+
5471
5500
  elif which=='shape':
5472
5501
  self.export_shape(outdir,curarray.idx,myarrays,mynames,curarray)
5473
5502
  del wait
5474
5503
 
5475
- def export_shape(self,outdir='',fn = '',myarrays=[], descr=[],mask:WolfArray=None):
5504
+ def export_shape(self, outdir='', fn = '', myarrays=[], descr=[], mask:WolfArray=None):
5505
+ """ Export multiple arrays to shapefile
5506
+
5507
+ :param outdir: output directory
5508
+ :param fn: filename -- .shp will be added if not present
5509
+ :param myarrays: list of Wolfarrays to export
5510
+ :param descr: list of descriptions
5511
+ :param mask: mask array -- export only where mask > 0
5512
+ """
5476
5513
 
5477
5514
  if len(myarrays)==0:
5515
+ logging.warning(_('No arrays provided for shapefile export'))
5516
+ return
5517
+
5518
+ if mask is None:
5519
+ logging.warning(_('No mask provided for shapefile export'))
5478
5520
  return
5479
5521
 
5480
5522
  from osgeo import gdal, osr, gdalconst,ogr
@@ -5488,7 +5530,10 @@ class WolfMapViewer(wx.Frame):
5488
5530
  driver = ogr.GetDriverByName("ESRI Shapefile")
5489
5531
 
5490
5532
  # create the data source
5491
- filename = join(outdir,fn)+'.shp'
5533
+ filename = join(outdir,fn)
5534
+ if not filename.endswith('.shp'):
5535
+ filename+='.shp'
5536
+
5492
5537
  ds = driver.CreateDataSource(filename)
5493
5538
 
5494
5539
  # create one layer
@@ -5533,9 +5578,18 @@ class WolfMapViewer(wx.Frame):
5533
5578
  # Save and close DataSource
5534
5579
  ds = None
5535
5580
 
5536
- def export_geotif(self,outdir='',fn = '',myarrays=[], descr=[]):
5581
+ def export_geotif(self, outdir='', fn = '', myarrays=[], descr=[]):
5582
+ """ Export multiple arrays to geotiff
5583
+
5584
+ :param outdir: output directory
5585
+ :param fn: filename -- .tif will be added if not present
5586
+ :param myarrays: list of Wolfarrays to export
5587
+ :param descr: list of descriptions -- Bands names
5588
+
5589
+ """
5537
5590
 
5538
5591
  if len(myarrays)==0:
5592
+ logging.warning(_('No arrays provided for geotiff export'))
5539
5593
  return
5540
5594
 
5541
5595
  from osgeo import gdal, osr, gdalconst
@@ -5543,7 +5597,9 @@ class WolfMapViewer(wx.Frame):
5543
5597
  srs = osr.SpatialReference()
5544
5598
  srs.ImportFromEPSG(31370)
5545
5599
 
5546
- filename = join(outdir,fn)+'.tif'
5600
+ filename = join(outdir,fn)
5601
+ if not filename.endswith('.tif'):
5602
+ filename+='.tif'
5547
5603
 
5548
5604
  arr=myarrays[0].array
5549
5605
  if arr.dtype == np.float32:
@@ -6200,7 +6256,7 @@ class WolfMapViewer(wx.Frame):
6200
6256
  logging.warning('No object to add in "WMS foreground" category -- Please provide an object to add or check your code')
6201
6257
 
6202
6258
  elif which.lower() == 'particlesystem':
6203
-
6259
+
6204
6260
  curdict = self.mypartsystems
6205
6261
  curtree = self.myitemsps
6206
6262
  if newobj is None:
@@ -6688,7 +6744,7 @@ class WolfMapViewer(wx.Frame):
6688
6744
  self.selected_object.write_all()
6689
6745
  fdlg.Destroy()
6690
6746
  elif type(self.selected_object) is Zones:
6691
- filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|all (*.*)|*.*"
6747
+ filterArray = "vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|Shapefile (*.shp)|*.shp|all (*.*)|*.*"
6692
6748
  fdlg = wx.FileDialog(self, "Choose file name for Vector :" + self.selected_object.idx, wildcard=filterArray,
6693
6749
  style=wx.FD_SAVE)
6694
6750
  ret = fdlg.ShowModal()
@@ -6758,6 +6814,29 @@ class WolfMapViewer(wx.Frame):
6758
6814
  self.add_object('array', newobj=mb, id=self.selected_object.idx + '_mb')
6759
6815
  else:
6760
6816
  logging.warning(_('Convert to multi-blocks not yet implemented for this type of object'))
6817
+
6818
+ elif _('Export to Shape file') in text:
6819
+
6820
+ if isinstance(self.selected_object, Zones):
6821
+ filterArray = "Shapefile (*.shp)|*.shp"
6822
+ fdlg = wx.FileDialog(self, "Choose file name for Zones :" + self.selected_object.idx, wildcard=filterArray,
6823
+ style=wx.FD_SAVE)
6824
+ ret = fdlg.ShowModal()
6825
+ if ret == wx.ID_OK:
6826
+ self.selected_object.export_to_shapefile(fdlg.GetPath())
6827
+ fdlg.Destroy()
6828
+
6829
+ elif _('Export active zone to Shape file') in text:
6830
+
6831
+ if isinstance(self.selected_object, Zones):
6832
+
6833
+ filterArray = "Shapefile (*.shp)|*.shp"
6834
+ fdlg = wx.FileDialog(self, "Choose file name for Vector :" + self.selected_object.idx, wildcard=filterArray,
6835
+ style=wx.FD_SAVE)
6836
+ ret = fdlg.ShowModal()
6837
+ if ret == wx.ID_OK:
6838
+ self.selected_object.export_active_zone_to_shapefile(fdlg.GetPath())
6839
+ fdlg.Destroy()
6761
6840
 
6762
6841
 
6763
6842
  def OnClose(self, event):
@@ -6931,6 +7010,13 @@ class WolfMapViewer(wx.Frame):
6931
7010
 
6932
7011
 
6933
7012
  def OnRightDown(self, e: wx.MouseEvent):
7013
+ """
7014
+ Event when the right button of the mouse is pressed.
7015
+
7016
+ We use this event to manage "action" set by others objects.
7017
+
7018
+ """
7019
+
6934
7020
  pos = e.GetPosition()
6935
7021
  x, y = self.getXY(pos)
6936
7022
 
@@ -6951,6 +7037,7 @@ class WolfMapViewer(wx.Frame):
6951
7037
  self.rightdown = (x, y)
6952
7038
 
6953
7039
  elif 'pick landmap' in self.action:
7040
+ # Pick a landmap if loaded
6954
7041
 
6955
7042
  if self.active_landmap is None:
6956
7043
  logging.warning(_('No landmap available -- Please activate the data and retry !'))
@@ -6963,6 +7050,7 @@ class WolfMapViewer(wx.Frame):
6963
7050
  self.Refresh()
6964
7051
 
6965
7052
  elif self.action == 'bridge gltf':
7053
+ # Create a bridge in gltf format
6966
7054
 
6967
7055
  self.bridgepar = (x, y)
6968
7056
 
@@ -6989,11 +7077,13 @@ class WolfMapViewer(wx.Frame):
6989
7077
 
6990
7078
  self.start_action('', 'None')
6991
7079
 
6992
- # Profile plots
6993
7080
  elif self.action == 'Plot cross section':
7081
+ # Plot cross section
6994
7082
  self.plot_cross(x, y)
6995
7083
 
6996
7084
  elif self.action == 'Set 1D profile':
7085
+ # Set 1D profile
7086
+
6997
7087
  if self.active_cs is None:
6998
7088
  self.active_cs = self.get_cross_sections()
6999
7089
 
@@ -7032,6 +7122,8 @@ class WolfMapViewer(wx.Frame):
7032
7122
  self.Paint()
7033
7123
 
7034
7124
  elif self.action == 'Select nearest profile':
7125
+ # Select nearest profile
7126
+
7035
7127
  if self.active_cs is None:
7036
7128
  self.active_cs = self.get_cross_sections()
7037
7129
 
@@ -7068,6 +7160,7 @@ class WolfMapViewer(wx.Frame):
7068
7160
  self.Refresh()
7069
7161
 
7070
7162
  elif self.action == 'select active tile':
7163
+ # Select active tile from Lidar data
7071
7164
 
7072
7165
  self.active_tile.select_vectors_from_point(x, y, True)
7073
7166
  self.active_vector = self.active_tile.get_selected_vectors()
@@ -7083,9 +7176,10 @@ class WolfMapViewer(wx.Frame):
7083
7176
  self.add_object('array', newobj = tilearray, ToCheck=True, id=id_label)
7084
7177
 
7085
7178
  elif self.action.find('select active vector') > -1:
7179
+ # Select active vector
7086
7180
 
7087
- inside = self.action.find('inside') > -1
7088
- onlyonezone = self.action.find('2') > -1
7181
+ inside = self.action.find('inside') > -1 # only polygons/closed polyline if 'inside' is in the action name
7182
+ onlyonezone = self.action.find('2') > -1 # only the active zone if '2' is in the action name, all zones otherwise
7089
7183
 
7090
7184
  if onlyonezone:
7091
7185
  self.active_zone.select_vectors_from_point(x, y, inside)
@@ -7105,6 +7199,7 @@ class WolfMapViewer(wx.Frame):
7105
7199
  self.active_zones.expand_tree(self.active_zone)
7106
7200
 
7107
7201
  elif 'select node by node' in self.action:
7202
+ # Select node by node
7108
7203
 
7109
7204
  if 'results' in self.action:
7110
7205
  curobj:Wolfresults_2D
@@ -7118,7 +7213,7 @@ class WolfMapViewer(wx.Frame):
7118
7213
  self.Paint()
7119
7214
 
7120
7215
  elif 'select by tmp vector' in self.action or 'select by vector' in self.action:
7121
-
7216
+ # Select nodes by vector or temporary vector
7122
7217
  self.active_vector.add_vertex(wolfvertex(x, y))
7123
7218
 
7124
7219
  elif 'laz tmp vector' == self.action:
@@ -7144,7 +7239,7 @@ class WolfMapViewer(wx.Frame):
7144
7239
  self.active_zone.find_minmax()
7145
7240
 
7146
7241
  elif self.action == 'dynamic parallel':
7147
-
7242
+ # Create a dynamic parallel line
7148
7243
  if ctrl:
7149
7244
  if self.active_array is not None:
7150
7245
  z = self.active_array.get_value(x, y)
@@ -7309,6 +7404,7 @@ class WolfMapViewer(wx.Frame):
7309
7404
  self.Refresh()
7310
7405
 
7311
7406
  def OnLDown(self, e):
7407
+
7312
7408
  if not self.move:
7313
7409
  pos = e.GetPosition()
7314
7410
  x, y = self.getXY(pos)
@@ -7387,7 +7483,7 @@ class WolfMapViewer(wx.Frame):
7387
7483
  #Print info in the status bar
7388
7484
  txt = 'Dx : {:4f} ; Dy : {:4f}'.format(self.active_array.dx, self.active_array.dy)
7389
7485
  txt += ' ; Xmin : {:4f} ; Ymin : {:4f}'.format(self.active_array.origx, self.active_array.origy)
7390
- txt += ' ; Xmax : {:4f} ; Ymax : {:4f}'.format(self.active_array.origx + self.active_array.dx * float(self.active_array.nbx),
7486
+ txt += ' ; Xmax : {:4f} ; Ymax : {:4f}'.format(self.active_array.origx + self.active_array.dx * float(self.active_array.nbx),
7391
7487
  self.active_array.origy + self.active_array.dy * float(self.active_array.nby))
7392
7488
  txt += ' ; Nx : {:d} ; Ny : {:d}'.format(self.active_array.nbx, self.active_array.nby)
7393
7489
 
@@ -7688,6 +7784,7 @@ class WolfMapViewer(wx.Frame):
7688
7784
 
7689
7785
  def OnMotion(self, e: wx.MouseEvent):
7690
7786
  """ Mouse move event """
7787
+
7691
7788
  # Déplacement de la souris sur le canvas OpenGL
7692
7789
  posframe = self.GetPosition()
7693
7790
  pos = e.GetPosition()
@@ -7836,6 +7933,7 @@ class WolfMapViewer(wx.Frame):
7836
7933
 
7837
7934
  Each action must call self.end_action() to nullify the action and print a message.
7838
7935
  """
7936
+
7839
7937
  if self.action is not None:
7840
7938
  locaction = self.action
7841
7939
  if 'select by tmp vector' in self.action or 'select by vector' in self.action:
@@ -7965,10 +8063,8 @@ class WolfMapViewer(wx.Frame):
7965
8063
 
7966
8064
  self.end_action(_('End of dynamic parallel'))
7967
8065
 
7968
- elif self.action == 'select active vector' :
7969
- self.end_action(_('End of vector selection'))
8066
+ elif 'select active vector' in self.action:
7970
8067
 
7971
- elif self.action == 'select active vector2':
7972
8068
  self.end_action(_('End of vector selection'))
7973
8069
 
7974
8070
  elif 'select node by node' in self.action:
@@ -8124,8 +8220,9 @@ class WolfMapViewer(wx.Frame):
8124
8220
 
8125
8221
  def msg_action(self, which:int = 0):
8126
8222
  """ Message to end action """
8223
+
8127
8224
  if which == 0:
8128
- self.StatusBar.SetStatusText(_('Action in progress... -- To quit, press "RETURN" or "double clicks RIGHT"'))
8225
+ self.StatusBar.SetStatusText(_('Action in progress... -- To quit, press "RETURN" or "double clicks RIGHT" or press "ESC"'))
8129
8226
  else:
8130
8227
  self.StatusBar.SetStatusText('')
8131
8228
 
@@ -8142,6 +8239,7 @@ class WolfMapViewer(wx.Frame):
8142
8239
 
8143
8240
  def end_action(self, message:str=''):
8144
8241
  """ Message to end action """
8242
+
8145
8243
  self.action = None
8146
8244
  logging.info(_('ACTION : ') + _(message) if message != '' else _('ACTION : End of action') )
8147
8245
  self.msg_action(1)
@@ -8595,7 +8693,13 @@ class WolfMapViewer(wx.Frame):
8595
8693
  self.setbounds()
8596
8694
 
8597
8695
  def paste_values(self,fromarray:WolfArray):
8598
- logging.info(_('Copy selection values'))
8696
+ """ Paste selected values from a WolfArray to the active array """
8697
+
8698
+ if self.active_array is None:
8699
+ logging.warning(_('The active array is None - Please active an array into which to paste the values !'))
8700
+ return
8701
+
8702
+ logging.info(_('Paste selection values'))
8599
8703
  cursel = fromarray.SelectionData.myselection
8600
8704
  if cursel == 'all':
8601
8705
  self.active_array.paste_all(fromarray)
@@ -8604,6 +8708,12 @@ class WolfMapViewer(wx.Frame):
8604
8708
  self.active_array.set_values_sel(cursel, z)
8605
8709
 
8606
8710
  def paste_selxy(self,fromarray:WolfArray):
8711
+ """ Paste selected nodes from a WolfArray to the active array """
8712
+
8713
+ if self.active_array is None:
8714
+ logging.warning(_('The active array is None - Please active an array into which to paste the selection !'))
8715
+ return
8716
+
8607
8717
  logging.info(_('Paste selection position'))
8608
8718
  cursel = fromarray.SelectionData.myselection
8609
8719
  if cursel == 'all':
@@ -8626,6 +8736,8 @@ class WolfMapViewer(wx.Frame):
8626
8736
  tracks.append(_('Convert to mono-block'))
8627
8737
  tracks.append(_('Convert to mono-block (result)'))
8628
8738
  tracks.append(_('Convert to multi-blocks (result)'))
8739
+ tracks.append(_('Export to Shape file'))
8740
+ tracks.append(_('Export active zone to Shape file'))
8629
8741
 
8630
8742
  # Récupération des items du menu contextuel
8631
8743
  menuitems = self.popupmenu.GetMenuItems()
@@ -8660,9 +8772,18 @@ class WolfMapViewer(wx.Frame):
8660
8772
  self.popupmenu.Append(wx.ID_ANY, _('Convert to mono-block (result)'), _('Convert to mono-block'))
8661
8773
  self.popupmenu.Append(wx.ID_ANY, _('Convert to multi-blocks (result)'), _('Convert to multi-blocks'))
8662
8774
 
8775
+ if isinstance(self.selected_object, Zones):
8776
+ self.popupmenu.Append(wx.ID_ANY, _('Export to Shape file'), _('Export to Shape file'))
8777
+ self.popupmenu.Append(wx.ID_ANY, _('Export active zone to Shape file'), _('Export active zone to Shape file'))
8778
+
8663
8779
  self.treelist.PopupMenu(self.popupmenu)
8664
8780
 
8665
8781
  def update(self):
8782
+ """
8783
+ Update backgournd et foreground elements and arrays if local minmax is checked.
8784
+
8785
+ """
8786
+
8666
8787
  # dessin du background
8667
8788
  for obj in self.iterator_over_objects(draw_type.WMSBACK):
8668
8789
  obj.reload()
@@ -8682,7 +8803,6 @@ class WolfMapViewer(wx.Frame):
8682
8803
  curarray.delete_lists()
8683
8804
 
8684
8805
  self.Paint()
8685
- # self.Refresh()
8686
8806
 
8687
8807
  def _plotting(self, drawing_type: draw_type, checked_state: bool = True):
8688
8808
  """ Drawing objets on canvas"""
@@ -8722,6 +8842,7 @@ class WolfMapViewer(wx.Frame):
8722
8842
  return self.canvas.SetCurrent(self.context)
8723
8843
 
8724
8844
  def Paint(self):
8845
+ """ Dessin des éléments ajoutés au viewer """
8725
8846
 
8726
8847
  if self.currently_readresults:
8727
8848
  return
@@ -8806,6 +8927,7 @@ class WolfMapViewer(wx.Frame):
8806
8927
 
8807
8928
  def OnPaint(self, e):
8808
8929
  """ event handler for paint event"""
8930
+
8809
8931
  self.Paint()
8810
8932
  if e is not None:
8811
8933
  e.Skip()
@@ -8938,7 +9060,13 @@ class WolfMapViewer(wx.Frame):
8938
9060
  self.ymin = ymin
8939
9061
  self.ymax = ymax
8940
9062
 
8941
- def resizeFrame(self, w, h):
9063
+ def resizeFrame(self, w:int, h:int):
9064
+ """ Resize the frame
9065
+
9066
+ :param w: width in pixels
9067
+ :param h: height in pixels
9068
+ """
9069
+
8942
9070
  self.SetClientSize(w, h)
8943
9071
 
8944
9072
  def mimicme(self):
@@ -8990,6 +9118,8 @@ class WolfMapViewer(wx.Frame):
8990
9118
  curFrame.forcemimic = True
8991
9119
 
8992
9120
  def Active_vector(self, vect):
9121
+ """ Active un vecteur et sa zone parent si existante """
9122
+
8993
9123
  self.active_vector = vect
8994
9124
 
8995
9125
  if vect is not None:
@@ -9000,6 +9130,8 @@ class WolfMapViewer(wx.Frame):
9000
9130
  self.mimicme()
9001
9131
 
9002
9132
  def Active_zone(self, zone: zone):
9133
+ """ Active une zone et son parent si existant """
9134
+
9003
9135
  self.active_zone = zone
9004
9136
  self.active_zones = zone.parent
9005
9137
  logging.info(_('Activating zone : ' + zone.myname))
wolfhece/PyGui.py CHANGED
@@ -82,7 +82,6 @@ class GenMapManager(wx.Frame):
82
82
  # super().__init__(*args)
83
83
  self.mylogs = create_wxlogwindow(_('Informations'))
84
84
 
85
-
86
85
  def setup_mapviewer(self, title:str, wolfparent):
87
86
  """ Setup of a WolfMapViewer """
88
87
 
@@ -282,7 +281,7 @@ class HydrologyModel(GenMapManager):
282
281
 
283
282
  for curfile in self.files_hydrology_array['Characteristic_maps']:
284
283
  curext=curfile[0]
285
- curidx=curfile[1]
284
+ curidx=curfile[1]
286
285
  self.mapviewer.add_object(which='array',filename=self.mydircharact+curext,id=curidx,ToCheck=False)
287
286
 
288
287
 
@@ -298,7 +297,7 @@ class HydrologyModel(GenMapManager):
298
297
  cur_vect = cur_zone.myvectors[0]
299
298
  cur_vect.set_legend_to_centroid(cur_sub.name + ' - ' + str(cur_sub.iDSorted), visible=True)
300
299
  cur_vect.myprop.legendfontsize = 12
301
-
300
+
302
301
  delimit.reset_listogl()
303
302
 
304
303
  self.mapviewer.add_object(which='vector',newobj = delimit, id=curidx, ToCheck=True)