wolfhece 2.1.68__py3-none-any.whl → 2.1.70__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/Model1D.py CHANGED
@@ -1317,15 +1317,12 @@ class Creator_1D:
1317
1317
  - Id : zone index
1318
1318
  - The discretization step is chosen by the user.
1319
1319
 
1320
- .. notes:: The procedure is the following:
1321
- From the 3 vectors of the zone, the center vector is discretized
1322
- based on the discretization step provided by the user (1 length unit by default).
1323
- The number of points is calculated as the length of the center vector divided by the discretization step.
1324
- the number of points selected is the smallest integer greater than the division result.
1325
- The newpoints are then projected on the left and right vectors.
1326
- The distance between the left and right vectors is then calculated,
1327
- and plotted as a function of the distance along the center vector, after a postprocessing check using
1328
- subtrings and vectors.
1320
+ .. note:: The procedure is the following:
1321
+ - From the 3 vectors of the zone, the center vector is discretized based on the discretization step provided by the user (1 length unit by default).
1322
+ - The number of points is calculated as the length of the center vector divided by the discretization step.
1323
+ - The number of points selected is the smallest integer greater than the division result.
1324
+ - The newpoints are then projected on the left and right vectors.
1325
+ - The distance between the left and right vectors is then calculated, and plotted as a function of the distance along the center vector, after a postprocessing check using subtrings and vectors.
1329
1326
 
1330
1327
  :param zones: `Zones` object containing the vectors,
1331
1328
  :type zones: Zones
@@ -1338,8 +1335,7 @@ class Creator_1D:
1338
1335
  :param ticks_spacing: Discretization of the x axis, defaults to 1000
1339
1336
  :type ticks_spacing: int, optional
1340
1337
 
1341
- .. notes::
1342
- FIXME Should be an option in GUI and check whether the substring step is necessary.
1338
+ .. note:: FIXME Should be an option in GUI and check whether the substring step is necessary.
1343
1339
 
1344
1340
  .. todo:: 1) FIXME Add detailed information (legends, title, an so on) to the plot.
1345
1341
  .. todo:: 2) FIXME Think about a test for this method. could it be used in GUI?
@@ -3087,8 +3083,7 @@ class Creator_1D:
3087
3083
  :param directory: Directory path, defaults to ''
3088
3084
  :type directory: str, optional
3089
3085
 
3090
- .. notes::
3091
- FIXME delete from_steady arguments wherever it's still implemented in this module.
3086
+ .. note:: FIXME delete from_steady arguments wherever it's still implemented in this module.
3092
3087
  """
3093
3088
 
3094
3089
  if directory == '':
wolfhece/PyDraw.py CHANGED
@@ -369,7 +369,7 @@ class WolfMapViewer(wx.Frame):
369
369
  self.popupmenu = wx.Menu()
370
370
  self.popupmenu.Bind(wx.EVT_MENU, self.OnPopupItemSelected)
371
371
 
372
- for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Up'), _('Down'), _('Properties')]:
372
+ for text in [_('Save'), _('Save as'), _('Rename'), _('Duplicate'), _('Delete'), _('Up'), _('Down'), _('Properties')]:
373
373
  item = self.popupmenu.Append(-1, text)
374
374
 
375
375
  self.menubar = wx.MenuBar()
@@ -590,7 +590,9 @@ class WolfMapViewer(wx.Frame):
590
590
  self.active_particle_system = None
591
591
  self.active_viewer3d = None
592
592
  self.active_landmap:PlansTerrier = None
593
+ self.active_tile = None
593
594
  self.selected_treeitem = None
595
+ self.selected_object = None
594
596
 
595
597
  curtool = self.tools[ID_SORTALONG] = {}
596
598
  curtool['menu'] = self.sortalong
@@ -634,8 +636,7 @@ class WolfMapViewer(wx.Frame):
634
636
 
635
637
  # ajout d'une liste en arbre des objets
636
638
  self.treelist = TreeListCtrl(self, style= wx.dataview.TL_CHECKBOX | wx.LC_EDIT_LABELS | wx.TR_FULL_ROW_HIGHLIGHT)
637
- self._lbl_selecteditem = StaticText(self, style=wx.ALIGN_CENTER_HORIZONTAL)
638
- self.selected_object = None
639
+ self._lbl_selecteditem = StaticText(self, style=wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
639
640
 
640
641
  self.root = self.treelist.GetRootItem()
641
642
  self.treelist.AppendColumn(_('Objects to plot'))
@@ -2621,13 +2622,8 @@ class WolfMapViewer(wx.Frame):
2621
2622
  # self.canvas.Bind(wx.EVT_CONTEXT_MENU, self.OnShowPopup)
2622
2623
  self.canvas.Bind(wx.EVT_PAINT, self.OnPaint)
2623
2624
 
2624
- self.treelist.Bind(wx.EVT_CHAR_HOOK, self.OnHotKey)
2625
- self.treelist.Bind(dataview.EVT_TREELIST_SELECTION_CHANGED,self.onselectitem)
2626
2625
  self.canvas.Bind(wx.EVT_CHAR_HOOK, self.OnHotKey)
2627
2626
 
2628
- # self.treelist.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
2629
- # self.canvas.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
2630
-
2631
2627
  self.canvas.Bind(wx.EVT_BUTTON, self.OnButton)
2632
2628
  self.canvas.Bind(wx.EVT_RIGHT_DCLICK, self.OnRDClick)
2633
2629
  self.canvas.Bind(wx.EVT_LEFT_DCLICK, self.OnLDClick)
@@ -2640,8 +2636,10 @@ class WolfMapViewer(wx.Frame):
2640
2636
  self.canvas.Bind(wx.EVT_MOUSEWHEEL, self.OnButton)
2641
2637
 
2642
2638
  self.treelist.Bind(dataview.EVT_TREELIST_ITEM_CHECKED, self.OnCheckItem)
2643
- self.treelist.Bind(dataview.EVT_TREELIST_ITEM_ACTIVATED, self.OnActivateTreeElem)
2639
+ self.treelist.Bind(dataview.EVT_TREELIST_ITEM_ACTIVATED, self.OnActivateTreeElem)
2644
2640
  self.treelist.Bind(dataview.EVT_TREELIST_ITEM_CONTEXT_MENU, self.OntreeRight)
2641
+ self.treelist.Bind(wx.EVT_CHAR_HOOK, self.OnHotKey)
2642
+ self.treelist.Bind(dataview.EVT_TREELIST_SELECTION_CHANGED,self.OnSelectItem)
2645
2643
  # dispo dans wxpython 4.1 self.Bind(wx.EVT_GESTURE_ZOOM,self.OnZoomGesture)
2646
2644
 
2647
2645
  self.Centre()
@@ -4448,24 +4446,30 @@ class WolfMapViewer(wx.Frame):
4448
4446
  elif itemlabel == _('Shortcuts'):
4449
4447
  # show shortcuts in log
4450
4448
  self.print_shortcuts(True)
4449
+ autoscale = False
4451
4450
 
4452
4451
  elif itemlabel == _('Show logs/informations'):
4453
4452
  self.check_logging()
4453
+ autoscale = False
4454
4454
 
4455
4455
  elif itemlabel == _('Show values'):
4456
4456
  self.check_tooltip()
4457
+ autoscale = False
4457
4458
 
4458
4459
  elif itemlabel == _('About'):
4459
4460
  #print About Frame
4460
4461
  self.print_About()
4462
+ autoscale = False
4461
4463
 
4462
4464
  elif itemlabel == _('Check for updates'):
4463
4465
  # check for new version
4464
4466
 
4465
4467
  self.check_for_updates()
4468
+ autoscale = False
4466
4469
 
4467
4470
  elif itemlabel == _("Integrate Q along active vector..."):
4468
4471
  """ Integrate Q along active vector """
4472
+ autoscale = False
4469
4473
 
4470
4474
  if self.active_vector is None:
4471
4475
  logging.warning(_('No active vector !'))
@@ -4479,6 +4483,7 @@ class WolfMapViewer(wx.Frame):
4479
4483
 
4480
4484
  elif itemlabel == _("Integrate Q along active zone..."):
4481
4485
  """ Integrate Q along active zone """
4486
+ autoscale = False
4482
4487
 
4483
4488
  if self.active_zone is None:
4484
4489
  logging.warning(_('No active zone !'))
@@ -4491,6 +4496,7 @@ class WolfMapViewer(wx.Frame):
4491
4496
  self.active_res2d.plot_q(self.active_zone.myvectors, ['border'] * self.active_zone.nbvectors, toshow=True)
4492
4497
 
4493
4498
  elif itemlabel == _("Plot stats unknown (selected nodes)..."):
4499
+ autoscale = False
4494
4500
 
4495
4501
  if self.active_res2d is None:
4496
4502
  logging.warning(_('No active 2D result !'))
@@ -4524,6 +4530,7 @@ class WolfMapViewer(wx.Frame):
4524
4530
  fig.show()
4525
4531
 
4526
4532
  elif itemlabel == _("Plot stats unknown (inside active vector)..."):
4533
+ autoscale = False
4527
4534
 
4528
4535
  if self.active_res2d is None:
4529
4536
  logging.warning(_('No active 2D result !'))
@@ -4553,6 +4560,7 @@ class WolfMapViewer(wx.Frame):
4553
4560
  fig, ax = self.active_res2d.plot_h(self.active_vector, unknown, toshow=True)
4554
4561
 
4555
4562
  elif itemlabel == _("Plot stats unknown (inside active zone)..."):
4563
+ autoscale = False
4556
4564
 
4557
4565
  if self.active_res2d is None:
4558
4566
  logging.warning(_('No active 2D result !'))
@@ -4589,6 +4597,7 @@ class WolfMapViewer(wx.Frame):
4589
4597
 
4590
4598
  elif itemlabel == _("Plot active vector..."):
4591
4599
  """ Plot data along active vector """
4600
+ autoscale = False
4592
4601
 
4593
4602
  if self.active_vector is None:
4594
4603
  logging.warning(_('No active vector !'))
@@ -4634,6 +4643,18 @@ class WolfMapViewer(wx.Frame):
4634
4643
 
4635
4644
  linkedarrays = self.get_linked_arrays()
4636
4645
 
4646
+ with wx.MultiChoiceDialog(None, _('Choose the arrays to plot'), _('Arrays'), [curarray for curarray in list(linkedarrays.keys())]) as dlg:
4647
+ if dlg.ShowModal() == wx.ID_CANCEL:
4648
+ dlg.Destroy()
4649
+ return
4650
+
4651
+ selected = dlg.GetSelections()
4652
+ keys = list(linkedarrays.keys())
4653
+ selected = [keys[cur] for cur in selected]
4654
+ dlg.Destroy()
4655
+
4656
+ linkedarrays = {curkey:curval for curkey, curval in linkedarrays.items() if curkey in selected}
4657
+
4637
4658
  self.active_vector.plot_linked(fig, ax, linkedarrays)
4638
4659
 
4639
4660
  if add_cloud:
@@ -4650,36 +4671,45 @@ class WolfMapViewer(wx.Frame):
4650
4671
  fig.canvas.flush_events()
4651
4672
 
4652
4673
  elif itemlabel == _("Export arrays as Geotif..."):
4674
+ autoscale = False
4653
4675
 
4654
4676
  self.export_results_as('geotiff')
4655
4677
 
4656
4678
  elif itemlabel == _("Export arrays as Shapefile..."):
4679
+ autoscale = False
4657
4680
 
4658
4681
  self.export_results_as('shape')
4659
4682
 
4660
4683
  elif itemlabel == _("Compute and apply unique colormap on all..."):
4684
+ autoscale = False
4661
4685
 
4662
4686
  self.uniquecolormap()
4663
4687
 
4664
4688
  elif itemlabel == _("Load and apply unique colormap on all..."):
4689
+ autoscale = False
4665
4690
 
4666
4691
  self.uniquecolormap(True)
4667
4692
 
4668
4693
  elif itemlabel == _("Force uniform in parts on all..."):
4694
+ autoscale = False
4669
4695
  self.uniforminparts_all(True)
4670
4696
 
4671
4697
  elif itemlabel == _("Force linear interpolation on all..."):
4698
+ autoscale = False
4672
4699
  self.uniforminparts_all(False)
4673
4700
 
4674
4701
  elif itemlabel == _("Load and apply mask (nap)..."):
4702
+ autoscale = False
4675
4703
 
4676
4704
  self.loadnap_and_apply()
4677
4705
 
4678
4706
  elif itemlabel == _("Filter inundation arrays..."):
4707
+ autoscale = False
4679
4708
 
4680
4709
  self.filter_inundation()
4681
4710
 
4682
4711
  elif itemlabel == _("Plot active polygons..."):
4712
+ autoscale = False
4683
4713
 
4684
4714
  if self.active_zone is None:
4685
4715
  logging.warning(_('No active zone ! -- please select a zone containing polygons !'))
@@ -4755,143 +4785,8 @@ class WolfMapViewer(wx.Frame):
4755
4785
  ax.legend()
4756
4786
  fig.show()
4757
4787
 
4758
- # elif itemlabel == _("Change current view"):
4759
-
4760
- # # Change view for results
4761
-
4762
- # autoscale = False
4763
- # choices = [cur.value for cur in views_2D]
4764
- # dlg = wx.SingleChoiceDialog(None, _("Pick a view"), "Choices", choices)
4765
- # ret = dlg.ShowModal()
4766
- # if ret == wx.ID_CANCEL:
4767
- # dlg.Destroy()
4768
- # return
4769
-
4770
- # method = dlg.GetStringSelection()
4771
-
4772
- # method = list(views_2D)[choices.index(method)]
4773
-
4774
- # dlg.Destroy()
4775
-
4776
- # diamsize = None
4777
- # if method == views_2D.SHIELDS_NUMBER :
4778
-
4779
- # if self.active_res2d is not None:
4780
- # sediment_diam = self.active_res2d.sediment_diameter
4781
- # sediment_density = self.active_res2d.sediment_density
4782
- # elif self.compare_results is not None:
4783
- # sediment_diam = 0.001
4784
- # sediment_density = 2.650
4785
- # else:
4786
- # logging.warning(_('No active 2D result or comparison !'))
4787
- # return
4788
-
4789
- # dlg = wx.TextEntryDialog(None,_("Diameter grain size [m] ?"), value = str(sediment_diam))
4790
- # ret = dlg.ShowModal()
4791
- # if ret == wx.ID_CANCEL:
4792
- # dlg.Destroy()
4793
- # return
4794
- # try:
4795
- # diamsize = float(dlg.GetValue())
4796
- # except:
4797
- # dlg.Destroy()
4798
- # logging.warning(_("Bad value -- Rety"))
4799
- # return
4800
-
4801
- # dlg = wx.TextEntryDialog(None,_("Density grain [-] ?"), value = str(sediment_density))
4802
- # ret = dlg.ShowModal()
4803
- # if ret == wx.ID_CANCEL:
4804
- # dlg.Destroy()
4805
- # return
4806
- # try:
4807
- # density = float(dlg.GetValue())
4808
- # except:
4809
- # dlg.Destroy()
4810
- # logging.warning(_("Bad value -- Rety"))
4811
- # return
4812
-
4813
- # if len(self.myres2D)>1:
4814
-
4815
- # dlg = wx.MessageDialog(None, _('Apply to all results?'), style=wx.YES_NO)
4816
- # ret = dlg.ShowModal()
4817
- # if ret == wx.ID_NO:
4818
- # if diamsize is not None:
4819
- # self.active_res2d.sediment_diameter = diamsize
4820
- # self.active_res2d.sediment_density = density
4821
- # self.active_res2d.load_default_colormap('shields_cst')
4822
-
4823
- # self.active_res2d.set_currentview(method, force_wx = True, force_updatepal = True)
4824
- # else:
4825
- # for curarray in self.iterator_over_objects(draw_type.RES2D):
4826
- # curarray:Wolfresults_2D
4827
- # if diamsize is not None:
4828
- # curarray.sediment_diameter = diamsize
4829
- # curarray.sediment_density = density
4830
- # curarray.load_default_colormap('shields_cst')
4831
-
4832
- # curarray.set_currentview(method, force_wx = True, force_updatepal = True)
4833
-
4834
- # else:
4835
- # if self.active_res2d is not None:
4836
- # if diamsize is not None:
4837
- # self.active_res2d.sediment_diameter = diamsize
4838
- # self.active_res2d.sediment_density = density
4839
- # self.active_res2d.load_default_colormap('shields_cst')
4840
- # self.active_res2d.set_currentview(method, force_wx = True, force_updatepal = True)
4841
-
4842
- # if self.compare_results is not None:
4843
- # # update compare results
4844
- # if diamsize is not None:
4845
- # self.compare_results.set_shields_param(diamsize, density)
4846
- # self.compare_results.update_type_result(method)
4847
-
4848
- # elif itemlabel == _("Read last result"):
4849
-
4850
- # self.read_last_result()
4851
-
4852
- # elif itemlabel == _("Filter independent"):
4853
-
4854
- # self.menu_filter_independent.IsChecked = not self.menu_filter_independent.IsChecked
4855
-
4856
- # for curmodel in self.iterator_over_objects(draw_type.RES2D):
4857
- # curmodel: Wolfresults_2D
4858
- # curmodel.to_filter_independent = not self.menu_filter_independent.IsChecked
4859
-
4860
- # elif itemlabel == _("Set epsilon water depth"):
4861
-
4862
- # dlg = wx.TextEntryDialog(self, _('Enter an epsilon [m]'),value='0.0')
4863
-
4864
- # ret = dlg.ShowModal()
4865
-
4866
- # if ret == wx.ID_CANCEL:
4867
- # dlg.Destroy()
4868
- # return
4869
-
4870
- # try:
4871
- # neweps = float(dlg.GetValue())
4872
- # dlg.Destroy()
4873
- # except:
4874
- # logging.error(_('Bad value -- retry !'))
4875
- # dlg.Destroy()
4876
- # return
4877
-
4878
- # for curmodel in self.iterator_over_objects(draw_type.RES2D):
4879
- # curmodel: Wolfresults_2D
4880
- # curmodel.epsilon = neweps
4881
- # curmodel._epsilon_default = neweps
4882
- # curmodel.read_oneresult(curmodel.current_result)
4883
- # curmodel.set_currentview()
4884
-
4885
- # elif itemlabel == _("Manage boundary conditions..."):
4886
-
4887
- # if self.active_res2d is not None:
4888
- # self.active_res2d.myparams.editing_bc(self.myres2D)
4889
-
4890
- # elif itemlabel ==_("Create video..."):
4891
- # if self.active_res2d is not None:
4892
- # self.create_video()
4893
-
4894
4788
  elif itemlabel == _("Manage banks..."):
4789
+ autoscale = False
4895
4790
  if self.active_vector is None:
4896
4791
  msg = _('Active vector is None\nPlease activate the one desired')
4897
4792
  msg += _('\n')
@@ -4902,11 +4797,13 @@ class WolfMapViewer(wx.Frame):
4902
4797
  self.managebanks()
4903
4798
 
4904
4799
  elif itemlabel == _("Create banks from vertices..."):
4800
+ autoscale = False
4905
4801
 
4906
4802
  self.active_cs.create_zone_from_banksbed()
4907
4803
  self.active_cs.linked_zones.showstructure()
4908
4804
 
4909
4805
  elif itemlabel == _("Link cross sections to active zones"):
4806
+ autoscale = False
4910
4807
 
4911
4808
  if self.active_cs is None:
4912
4809
  msg = _('Active cross sections is None\nPlease activate the one desired')
@@ -4924,8 +4821,8 @@ class WolfMapViewer(wx.Frame):
4924
4821
 
4925
4822
  self.active_cs.link_external_zones(self.active_zones)
4926
4823
 
4927
-
4928
4824
  elif itemlabel == _("Rename cross sections..."):
4825
+ autoscale = False
4929
4826
 
4930
4827
  dlg = wx.TextEntryDialog(None, _('Which starting point?'))
4931
4828
  ret = dlg.ShowModal()
@@ -4941,21 +4838,26 @@ class WolfMapViewer(wx.Frame):
4941
4838
  # self.import_3dfaces()
4942
4839
 
4943
4840
  elif itemlabel == _("Interpolate on active triangulation..."):
4841
+ autoscale = False
4944
4842
  self.interpolate_triangulation()
4945
4843
 
4946
4844
  elif itemlabel==_("Compare cloud to array..."):
4845
+ autoscale = False
4947
4846
  self.compare_cloud2array()
4948
4847
 
4949
4848
  elif itemlabel==_("Compare triangles to array..."):
4849
+ autoscale = False
4950
4850
  self.compare_tri2array()
4951
4851
 
4952
4852
  elif itemlabel == _("Create contour from checked arrays..."):
4853
+ autoscale = False
4953
4854
 
4954
4855
  # Create contour from checked arrays and add it to the list of objects
4955
4856
  newzones = self.create_Zones_from_arrays(self.get_list_objects(draw_type.ARRAYS, checked_state=True))
4956
4857
  self.add_object('vector', newobj=newzones, ToCheck=True, id='Contours from arrays')
4957
4858
 
4958
4859
  elif itemlabel == _("Calculator..."):
4860
+ autoscale = False
4959
4861
 
4960
4862
  if self.calculator is None:
4961
4863
  self.calculator = Calculator(mapviewer = self)
@@ -4963,6 +4865,7 @@ class WolfMapViewer(wx.Frame):
4963
4865
  self.calculator.Show()
4964
4866
 
4965
4867
  elif itemlabel == _("Create bridge and export gltf..."):
4868
+ autoscale = False
4966
4869
 
4967
4870
  if self.active_cs is None:
4968
4871
  msg = _('Active cross sections is None\nPlease activate the one desired')
@@ -4974,6 +4877,7 @@ class WolfMapViewer(wx.Frame):
4974
4877
  self.start_action('bridge gltf', _('Create bridge and export gltf...'))
4975
4878
 
4976
4879
  elif itemlabel == _("Export cross sections to gltf..."):
4880
+ autoscale = False
4977
4881
 
4978
4882
  if self.active_cs is None:
4979
4883
  msg = _('Active cross sections is None\nPlease activate the one desired')
@@ -5003,17 +4907,21 @@ class WolfMapViewer(wx.Frame):
5003
4907
  self.active_cs.export_gltf(zmin, fn)
5004
4908
 
5005
4909
  elif itemlabel == _("New cloud Viewer..."):
4910
+ autoscale = False
5006
4911
  if self.myinterp is not None:
5007
4912
  self.myinterp.viewer_interpolator()
5008
4913
 
5009
4914
  elif itemlabel == _("Interpolate on active array..."):
4915
+ autoscale = False
5010
4916
  if self.myinterp is not None:
5011
4917
  self.interpolate_cs()
5012
4918
 
5013
4919
  elif itemlabel == _("Interpolate active cloud on active array..."):
4920
+ autoscale = False
5014
4921
  self.interpolate_cloud()
5015
4922
 
5016
4923
  elif itemlabel == _('Save project'):
4924
+ autoscale = False
5017
4925
  filterProject = "proj (*.proj)|*.proj|param (*.param)|*.param|all (*.*)|*.*"
5018
4926
  file = wx.FileDialog(self, "Name your file", wildcard=filterProject, style=wx.FD_SAVE)
5019
4927
  if file.ShowModal() == wx.ID_CANCEL:
@@ -5196,7 +5104,7 @@ class WolfMapViewer(wx.Frame):
5196
5104
 
5197
5105
  # Comparaison de deux résultats ou de deux matrices
5198
5106
 
5199
- self.compare_results = Compare_Arrays_Results(self, True, True)
5107
+ self.compare_results = Compare_Arrays_Results(self, share_cmap_array= True, share_cmap_diff= True)
5200
5108
 
5201
5109
  add_elt = True
5202
5110
  while add_elt:
@@ -5338,19 +5246,26 @@ class WolfMapViewer(wx.Frame):
5338
5246
  self.add_object('array', newobj=newarray)
5339
5247
 
5340
5248
  elif itemlabel == _('Create view...'):
5249
+ autoscale = False
5250
+
5341
5251
  # Création d'une nouvelle vue
5342
5252
  newview = WolfViews(mapviewer=self)
5343
5253
  self.add_object('array', newobj=newarray)
5344
5254
 
5345
5255
  elif itemlabel==_('Create Wolf2D manager ...'):
5256
+ autoscale = False
5257
+
5346
5258
  from .mesh2d.config_manager import config_manager_2D
5347
5259
  newmanager = config_manager_2D(mapviewer=self)
5348
5260
 
5349
5261
  elif itemlabel==_('Create scenarios manager ...'):
5262
+ autoscale = False
5263
+
5350
5264
  from .scenario.config_manager import Config_Manager_2D_GPU
5351
5265
  newmanager = Config_Manager_2D_GPU(mapviewer=self)
5352
5266
 
5353
5267
  elif itemlabel == _('Create acceptability manager...'):
5268
+ autoscale = False
5354
5269
 
5355
5270
  from .acceptability.acceptability_gui import AcceptabilityGui
5356
5271
  newmanager = AcceptabilityGui()
@@ -5358,6 +5273,7 @@ class WolfMapViewer(wx.Frame):
5358
5273
  newmanager.Show()
5359
5274
 
5360
5275
  elif itemlabel==_('Create BC manager Wolf2D...'):
5276
+ autoscale = False
5361
5277
 
5362
5278
  if self.active_array is not None:
5363
5279
 
@@ -5390,21 +5306,27 @@ class WolfMapViewer(wx.Frame):
5390
5306
  self.active_bc = self.mybc[-1]
5391
5307
 
5392
5308
  elif itemlabel == _('Create Wolf1D...'):
5309
+ autoscale = False
5393
5310
  self.frame_create1Dfrom2D = GuiNotebook1D(mapviewer= self)
5394
5311
  logging.info(_(f'New window available - Wolf1D.'))
5395
5312
 
5396
5313
  elif id == wx.ID_FILE7:
5314
+ autoscale = False
5397
5315
  # Création de nouveaux vecteurs
5398
5316
  newzones = Zones(parent=self)
5399
5317
  self.add_object('vector', newobj=newzones)
5400
5318
  elif id == wx.ID_FILE8:
5319
+ autoscale = False
5401
5320
  # Création d'un nouveau nuage de point
5402
5321
  newcloud = cloud_vertices()
5403
5322
  self.add_object('cloud', newobj=newcloud)
5404
5323
  elif id in self.tools.keys():
5405
5324
  # gestion des actions
5406
5325
  self.ManageActions(id)
5326
+ autoscale = False
5327
+
5407
5328
  elif id == wx.ID_SAVE:
5329
+ autoscale = False
5408
5330
 
5409
5331
  for obj in self.iterator_over_objects(draw_type.ARRAYS):
5410
5332
  obj: WolfArray
@@ -5432,7 +5354,7 @@ class WolfMapViewer(wx.Frame):
5432
5354
  self.copy_canvasogl()
5433
5355
 
5434
5356
  elif itemlabel == _('Export...'):
5435
-
5357
+ autoscale = False
5436
5358
  curarray: WolfArray
5437
5359
  curvec: vector
5438
5360
 
@@ -5480,7 +5402,7 @@ class WolfMapViewer(wx.Frame):
5480
5402
  del wait
5481
5403
 
5482
5404
  elif itemlabel == _('Import...'):
5483
-
5405
+ autoscale = False
5484
5406
  curarray: WolfArray
5485
5407
 
5486
5408
  msg = ''
@@ -5534,7 +5456,7 @@ class WolfMapViewer(wx.Frame):
5534
5456
  del wait
5535
5457
 
5536
5458
  elif itemlabel == _('Compare...'):
5537
-
5459
+ autoscale = False
5538
5460
  msg = ''
5539
5461
  if self.active_array is None:
5540
5462
  msg += _('Active array is None\n')
@@ -5567,7 +5489,7 @@ class WolfMapViewer(wx.Frame):
5567
5489
  self.update_blender_sculpting()
5568
5490
 
5569
5491
  elif id == wx.ID_SAVEAS:
5570
-
5492
+ autoscale = False
5571
5493
  for obj in self.iterator_over_objects(draw_type.ARRAYS):
5572
5494
  obj: WolfArray
5573
5495
 
@@ -5938,14 +5860,21 @@ class WolfMapViewer(wx.Frame):
5938
5860
  band.ComputeStatistics(True)
5939
5861
  k+=1
5940
5862
 
5941
- def get_linked_arrays(self) -> dict:
5863
+ def get_linked_arrays(self, linked:bool = True) -> dict:
5864
+ """ Get all arrays in the viewer and linked viewers """
5865
+
5942
5866
  linkedarrays = {}
5943
5867
 
5944
- for locarray in self.iterator_over_objects(draw_type.ARRAYS):
5945
- linkedarrays[locarray.idx] = locarray
5868
+ if self.linked and linked:
5869
+ all_dicts = [curviewer.get_linked_arrays(linked = False) for curviewer in self.linkedList]
5870
+ for curdict in all_dicts:
5871
+ linkedarrays.update(curdict)
5872
+ else:
5873
+ for locarray in self.iterator_over_objects(draw_type.ARRAYS):
5874
+ linkedarrays[locarray.idx] = locarray
5946
5875
 
5947
- for locarray in self.iterator_over_objects(draw_type.RES2D):
5948
- linkedarrays[locarray.idx] = locarray
5876
+ for locarray in self.iterator_over_objects(draw_type.RES2D):
5877
+ linkedarrays[locarray.idx] = locarray
5949
5878
 
5950
5879
  return linkedarrays
5951
5880
 
@@ -6798,7 +6727,6 @@ class WolfMapViewer(wx.Frame):
6798
6727
  yield obj
6799
6728
 
6800
6729
  def gettreeitem(self, obj):
6801
-
6802
6730
  """ Find the tree item associated with obj """
6803
6731
 
6804
6732
  up = self.treelist.GetFirstItem()
@@ -6811,7 +6739,6 @@ class WolfMapViewer(wx.Frame):
6811
6739
  return up
6812
6740
 
6813
6741
  def removeobj(self):
6814
-
6815
6742
  """Remove selected item from general tree"""
6816
6743
 
6817
6744
  if self.selected_treeitem is None:
@@ -6822,7 +6749,6 @@ class WolfMapViewer(wx.Frame):
6822
6749
  self.removeobj_from_id(id)
6823
6750
 
6824
6751
  def removeobj_from_id(self, id:str):
6825
-
6826
6752
  """ Remove object from id """
6827
6753
 
6828
6754
  myobj = self.getobj_from_id(id)
@@ -6835,8 +6761,44 @@ class WolfMapViewer(wx.Frame):
6835
6761
 
6836
6762
  myobj.hide_properties()
6837
6763
 
6838
- def upobj(self):
6764
+ if myobj is self.active_array:
6765
+ self.active_array = None
6766
+ self.set_label_selecteditem('')
6767
+ elif myobj is self.active_res2d:
6768
+ self.active_res2d = None
6769
+ self.set_label_selecteditem('')
6770
+ elif myobj is self.active_tri:
6771
+ self.active_tri = None
6772
+ self.set_label_selecteditem('')
6773
+ elif myobj is self.active_particle_system:
6774
+ self.active_particle_system = None
6775
+ self.set_label_selecteditem('')
6776
+ elif myobj is self.active_cloud:
6777
+ self.active_cloud = None
6778
+ self.set_label_selecteditem('')
6779
+ elif myobj is self.active_cs:
6780
+ self.active_cs = None
6781
+ self.set_label_selecteditem('')
6782
+ elif myobj is self.active_tile:
6783
+ self.active_tile = None
6784
+ self.set_label_selecteditem('')
6785
+ elif myobj is self.active_bc:
6786
+ self.active_bc = None
6787
+ self.set_label_selecteditem('')
6788
+ elif myobj is self.active_vector:
6789
+ self.active_vector = None
6790
+ self.set_label_selecteditem('')
6791
+ elif myobj is self.active_view:
6792
+ self.active_view = None
6793
+ self.set_label_selecteditem('')
6794
+ elif myobj is self.active_zone:
6795
+ self.active_zone = None
6796
+ self.set_label_selecteditem('')
6797
+ elif myobj is self.active_zones:
6798
+ self.active_zones = None
6799
+ self.set_label_selecteditem('')
6839
6800
 
6801
+ def upobj(self):
6840
6802
  """Up selected item into general tree"""
6841
6803
 
6842
6804
  if self.selected_treeitem is None:
@@ -6887,7 +6849,6 @@ class WolfMapViewer(wx.Frame):
6887
6849
  curlist.insert(idx-1,myobj)
6888
6850
 
6889
6851
  def downobj(self):
6890
-
6891
6852
  """Down selected item into general tree"""
6892
6853
 
6893
6854
  if self.selected_treeitem is None:
@@ -6938,6 +6899,8 @@ class WolfMapViewer(wx.Frame):
6938
6899
  self.PopupMenu(self.popupmenu, pos)
6939
6900
 
6940
6901
  def OnPopupItemSelected(self, event):
6902
+ """ Action to do when an item is selected in the popup menu """
6903
+
6941
6904
  item = self.popupmenu.FindItemById(event.GetId())
6942
6905
  text = item.ItemLabel
6943
6906
 
@@ -6953,23 +6916,32 @@ class WolfMapViewer(wx.Frame):
6953
6916
  self.selected_object.save()
6954
6917
  elif text==_('Up'):
6955
6918
  self.upobj()
6919
+
6956
6920
  elif text == _('Down'):
6957
6921
  self.downobj()
6958
- elif text == _('Rename'):
6959
6922
 
6923
+ elif text == _('Delete'):
6924
+ self.removeobj()
6925
+
6926
+ elif text == _('Rename'):
6960
6927
  #Modification du nom de l'objet sélectionné
6961
6928
  if self.selected_object is not None:
6962
6929
  #récupération de l'id courant
6963
6930
  label = self.selected_object.idx
6964
6931
  dlg = wx.TextEntryDialog(self, message=_('Chose a new label :'), value=label)
6965
6932
  ret=dlg.ShowModal()
6966
- newlab = dlg.GetValue()
6967
- dlg.Destroy()
6968
6933
 
6969
- #MAJ de l'id dans l'objet
6970
- self.selected_object.idx = newlab
6971
- #MAJ de l'arbre
6972
- self.treelist.SetItemText(self.selected_treeitem, newlab)
6934
+ if ret == wx.ID_OK:
6935
+ newlab = dlg.GetValue()
6936
+ #MAJ de l'id dans l'objet
6937
+ self.selected_object.idx = newlab
6938
+ #MAJ de l'arbre
6939
+ self.treelist.SetItemText(self.selected_treeitem, newlab)
6940
+
6941
+ if self.get_label_selecteditem() == _("Active : ") + label:
6942
+ self.set_label_selecteditem(_("Active : ") + newlab)
6943
+
6944
+ dlg.Destroy()
6973
6945
 
6974
6946
  elif text == _('Duplicate'):
6975
6947
 
@@ -6979,6 +6951,11 @@ class WolfMapViewer(wx.Frame):
6979
6951
  label = self.selected_object.idx + '_copy'
6980
6952
  dlg = wx.TextEntryDialog(self, message=_('Chose a label for the copy:'), value=label)
6981
6953
  ret=dlg.ShowModal()
6954
+
6955
+ if ret != wx.ID_OK:
6956
+ dlg.Destroy()
6957
+ return
6958
+
6982
6959
  newlab = dlg.GetValue()
6983
6960
  dlg.Destroy()
6984
6961
 
@@ -7150,6 +7127,8 @@ class WolfMapViewer(wx.Frame):
7150
7127
 
7151
7128
 
7152
7129
  def OnClose(self, event):
7130
+ """ Close the application """
7131
+
7153
7132
  nb = 0
7154
7133
  if self.linked:
7155
7134
  if self.linkedList is not None:
@@ -7172,24 +7151,31 @@ class WolfMapViewer(wx.Frame):
7172
7151
  return
7173
7152
  self.Destroy()
7174
7153
 
7175
- def onselectitem(self,event):
7176
- myitem = event.GetItem()
7154
+ def OnSelectItem(self, event):
7155
+ """ Select the item in the tree list """
7177
7156
 
7178
- self.selected_treeitem = myitem
7157
+ ctrl = wx.GetKeyState(wx.WXK_CONTROL)
7158
+ alt = wx.GetKeyState(wx.WXK_ALT)
7159
+
7160
+ myitem = event.GetItem()
7179
7161
 
7180
7162
  nameitem = self.treelist.GetItemText(myitem).lower()
7181
7163
  curobj = self.getobj_from_id(nameitem)
7164
+ myobj = self.treelist.GetItemData(myitem)
7182
7165
 
7183
- if isinstance(curobj, PlansTerrier):
7184
- self.active_landmap = curobj
7166
+ assert curobj is myobj, 'curobj is not myobj'
7185
7167
 
7186
- elif isinstance(curobj, Zones):
7187
- self.active_zones = curobj
7168
+ self.treelist.SetToolTip(self.treelist.GetItemText(myitem))
7188
7169
 
7170
+ myparent = self.treelist.GetItemParent(myitem)
7171
+ check = self.treelist.GetCheckedState(myitem)
7172
+ nameparent = self.treelist.GetItemText(myparent).lower()
7189
7173
 
7190
- self.treelist.SetToolTip(self.treelist.GetItemText(myitem))
7174
+ self.selected_object = curobj
7175
+ self.selected_treeitem = myitem
7191
7176
 
7192
7177
  def OnCheckItem(self, event:TreeListEvent):
7178
+ """ Check the item in the tree list """
7193
7179
 
7194
7180
  myitem = event.GetItem()
7195
7181
  myparent = self.treelist.GetItemParent(myitem)
@@ -7750,6 +7736,10 @@ class WolfMapViewer(wx.Frame):
7750
7736
  """ Set the label of the selected item in the tree list """
7751
7737
  self._lbl_selecteditem.SetLabel(nameitem)
7752
7738
 
7739
+ def get_label_selecteditem(self):
7740
+ """ Get the label of the selected item in the tree list """
7741
+ return self._lbl_selecteditem.GetLabel()
7742
+
7753
7743
  def OnActivateTreeElem(self, e): #:dataview.TreeListEvent ):
7754
7744
  """ Activate the selected item in the tree list """
7755
7745
  curzones: Zones
@@ -7769,13 +7759,18 @@ class WolfMapViewer(wx.Frame):
7769
7759
 
7770
7760
  myobj = self.treelist.GetItemData(myitem)
7771
7761
  self.selected_object = myobj
7772
- self.set_label_selecteditem(nameitem)
7762
+ self.set_label_selecteditem(_('Active : ') + nameitem)
7773
7763
 
7774
7764
  #FIXME : To generalize using draw_type
7775
7765
  if type(myobj) == Zones:
7766
+ self.active_zones = myobj
7767
+
7776
7768
  if ctrl:
7777
7769
  myobj.show_properties()
7778
7770
 
7771
+ elif isinstance(myobj, PlansTerrier):
7772
+ self.active_landmap = myobj
7773
+
7779
7774
  elif type(myobj) == hydrometry_wolfgui:
7780
7775
  if ctrl:
7781
7776
  myobj.show_properties()
@@ -8204,7 +8199,7 @@ class WolfMapViewer(wx.Frame):
8204
8199
 
8205
8200
  if self.IsMaximized():
8206
8201
  # Frame is maximized -> tooltip must be on the Screen
8207
- self.mytooltip.SetWindowStyle(wx.STAY_ON_TOP)
8202
+ self.mytooltip.SetWindowStyle(wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE)
8208
8203
  else:
8209
8204
 
8210
8205
  if self._oldpos_tooltip is None:
@@ -8230,8 +8225,8 @@ class WolfMapViewer(wx.Frame):
8230
8225
  # Force the position
8231
8226
  self.mytooltip.SetPosition(pos_tooltip)
8232
8227
 
8233
- self.mytooltip.SetIcon(self.GetIcon()) # update icon
8234
- self.mytooltip.SetWindowStyle(wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP) # on top, with Title bar
8228
+ # self.mytooltip.SetIcon(self.GetIcon()) # update icon
8229
+ self.mytooltip.SetWindowStyle(wx.DEFAULT_FRAME_STYLE) # | wx.STAY_ON_TOP) # on top, with Title bar
8235
8230
 
8236
8231
  # self.mytooltip.Show(True)
8237
8232
 
@@ -9564,8 +9559,10 @@ class WolfMapViewer(wx.Frame):
9564
9559
  curFrame.setbounds()
9565
9560
 
9566
9561
  if curFrame.link_shareopsvect:
9567
- curFrame.Active_vector(self.active_vector)
9568
- curFrame.active_array.myops.Active_vector(self.active_vector, False)
9562
+ if curFrame.active_vector is not self.active_vector:
9563
+ curFrame.Active_vector(self.active_vector)
9564
+ if curFrame.active_array.myops.active_vector is not self.active_vector:
9565
+ curFrame.active_array.myops.Active_vector(self.active_vector, False)
9569
9566
  curFrame.action = self.action
9570
9567
 
9571
9568
  for curFrame in self.linkedList:
@@ -9862,6 +9859,7 @@ class Compare_Arrays_Results():
9862
9859
  elif self.type == Comp_Type.ARRAYS_MB:
9863
9860
  self.elements = [WolfArrayMB(cur[1], plotted=False, idx = cur[1].name + '_' + str(idx)) for idx, cur in enumerate(self.paths)]
9864
9861
 
9862
+
9865
9863
  def set_diff(self):
9866
9864
  """ Set the differential between the elements and the first one, which is the reference """
9867
9865
 
@@ -9975,6 +9973,8 @@ class Compare_Arrays_Results():
9975
9973
 
9976
9974
  if self.share_cmap_array:
9977
9975
  for curelt in elts[1:]:
9976
+ curelt.mypal.automatic = False
9977
+ curelt.myops.palauto.SetValue(0)
9978
9978
  ref.add_crosslinked_array(curelt)
9979
9979
  ref.share_palette()
9980
9980
  else:
@@ -9998,6 +9998,8 @@ class Compare_Arrays_Results():
9998
9998
 
9999
9999
  if self.share_cmap_diff:
10000
10000
  for curelt in self.diff[1:]:
10001
+ curelt.mypal.automatic = False
10002
+ curelt.myops.palauto.SetValue(0)
10001
10003
  diff.add_crosslinked_array(curelt)
10002
10004
  diff.share_palette()
10003
10005
  else:
wolfhece/PyParams.py CHANGED
@@ -598,13 +598,13 @@ class Wolf_Param(wx.Frame):
598
598
  else:
599
599
  self.prop = pg.PropertyGridManager(self,
600
600
  style = pg.PG_BOLD_MODIFIED|pg.PG_SPLITTER_AUTO_CENTER|
601
- # Include toolbar.
602
- pg.PG_TOOLBAR if toolbar else 0 |
603
601
  # Include description box.
604
602
  pg.PG_DESCRIPTION |
605
603
  pg.PG_TOOLTIPS |
606
604
  # Plus defaults.
607
- pg.PGMAN_DEFAULT_STYLE
605
+ pg.PGMAN_DEFAULT_STYLE |
606
+ # Include toolbar.
607
+ pg.PG_TOOLBAR if toolbar else 0
608
608
  )
609
609
 
610
610
  self.prop.Bind(pg.EVT_PG_DOUBLE_CLICK,self.OnDblClick)
@@ -628,15 +628,11 @@ class Wolf_Param(wx.Frame):
628
628
  self.sizer.Fit(self)
629
629
 
630
630
  self.SetSize(0,0,w,h)
631
+ # self.prop.SetDescBoxHeight(80)
631
632
 
632
633
  #affichage de la page
633
634
  self.Show(toShow)
634
635
 
635
- def mask_toolbar(self):
636
- """ Mask the toolbar """
637
-
638
- self.prop.SetSt
639
-
640
636
  def _set_only_prop(self, wxparent):
641
637
  """ Set only the property grid """
642
638
 
@@ -759,15 +759,12 @@ class vectorproperties:
759
759
  """
760
760
 
761
761
  if self.myprops is None:
762
- self.myprops=Wolf_Param(title='Vector Properties', w=500, h=800, to_read=False)
762
+ self.myprops=Wolf_Param(title='Vector Properties', w= 500, h= 800, to_read= False, ontop= False)
763
763
  self.myprops.show_in_active_if_default = True
764
764
  self.myprops._callbackdestroy = self.destroyprop
765
765
  self.myprops._callback=self.fill_property
766
766
 
767
767
  self.myprops.hide_selected_buttons() # only 'Apply' button
768
- # self.myprops.saveme.Disable()
769
- # self.myprops.loadme.Disable()
770
- # self.myprops.reloadme.Disable()
771
768
 
772
769
  self.myprops.addparam('Draw','Color',(0,0,0),'Color','Drawing color',whichdict='Default')
773
770
  self.myprops.addparam('Draw','Width',1,'Integer','Drawing width',whichdict='Default')
@@ -1678,6 +1675,7 @@ class vector:
1678
1675
 
1679
1676
  glPolygonMode(GL_FRONT_AND_BACK,GL_LINE)
1680
1677
  glDisable(GL_BLEND)
1678
+ glLineWidth(1.0)
1681
1679
 
1682
1680
  def plot_legend(self, sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None):
1683
1681
  """
@@ -2537,13 +2535,15 @@ class zone:
2537
2535
  curvect:vector
2538
2536
  nb_treated = 0
2539
2537
  i=0
2540
-
2538
+ idx_vect = 0
2541
2539
  while nb_treated < self.nbvectors:
2542
- curvect = self.get_vector(lines[i])
2540
+ curvect = self.myvectors[idx_vect]
2541
+ assert curvect.myname == lines[i], _('Vector name mismatch')
2543
2542
  i+=1
2544
2543
  ret = curvect.myprop.load_extra(lines[i:])
2545
2544
  i+=ret
2546
2545
  nb_treated += 1
2546
+ idx_vect += 1
2547
2547
 
2548
2548
  return i
2549
2549
 
@@ -3951,7 +3951,8 @@ class Zones(wx.Frame, Element_To_Draw):
3951
3951
  mapviewer=None,
3952
3952
  need_for_wx: bool = False,
3953
3953
  bbox:Polygon = None,
3954
- find_minmax:bool = True) -> None:
3954
+ find_minmax:bool = True,
3955
+ shared:bool = False) -> None:
3955
3956
  """
3956
3957
  Objet de gestion et d'affichage d'informations vectorielles
3957
3958
 
@@ -3968,6 +3969,7 @@ class Zones(wx.Frame, Element_To_Draw):
3968
3969
  :param need_for_wx: si True --> permet l'affichage de la structure via WX car une app WX existe et est en cours d'exécution
3969
3970
  :param bbox: bounding box
3970
3971
  :param find_minmax: si True --> recherche des valeurs min et max
3972
+ :param shared: si True --> les vecteurs sont partagés entre plusieurs autres objets --> pas de préparation de la liste OGL
3971
3973
 
3972
3974
  wx_exists : si True --> permet l'affichage de la structure via WX car une app WX existe et est en cours d'exécution
3973
3975
 
@@ -3986,6 +3988,7 @@ class Zones(wx.Frame, Element_To_Draw):
3986
3988
  self._myprops = None # common properties of all zones
3987
3989
 
3988
3990
  self.loaded=True
3991
+ self.shared = shared # shared betwwen several WolfArray, wolfresults2d...
3989
3992
 
3990
3993
  self.active_vector:vector = None
3991
3994
  self.active_zone:zone = None
@@ -4072,20 +4075,39 @@ class Zones(wx.Frame, Element_To_Draw):
4072
4075
  try:
4073
4076
  nblines = len(lines)
4074
4077
  i=0
4078
+ idx_zone = 0
4075
4079
  while i<nblines:
4076
- curzone = self.get_zone(lines[i])
4080
+ curzone = self.myzones[idx_zone]
4081
+ assert curzone.myname == lines[i], _('Error while reading extra properties of {}'.format(self.filename))
4077
4082
  i+=1
4078
4083
  ret = curzone.load_extra(lines[i:])
4079
4084
  i+=ret
4085
+ idx_zone += 1
4080
4086
  except:
4081
4087
  logging.warning(_('Error while reading extra properties of {}'.format(self.filename)))
4082
4088
 
4083
4089
  if find_minmax:
4084
4090
  self.find_minmax(True)
4085
4091
 
4086
- if plotted and self.has_OGLContext:
4092
+ if plotted and self.has_OGLContext and not self.shared:
4087
4093
  self.prep_listogl()
4088
4094
 
4095
+ def force_unique_zone_name(self):
4096
+ """
4097
+ Check if all zones have a unique id
4098
+
4099
+ If not, the id will be set to the index of the zone in the list
4100
+ """
4101
+
4102
+ names = [curzone.myname for curzone in self.myzones]
4103
+ unique_names = set(names)
4104
+
4105
+ if len(unique_names) != len(names):
4106
+ for idx, curzone in enumerate(self.myzones):
4107
+ if names.count(curzone.myname)>1:
4108
+ curzone.myname += '_'+str(idx)
4109
+
4110
+
4089
4111
  @property
4090
4112
  def nbzones(self):
4091
4113
  return len(self.myzones)
@@ -4996,6 +5018,10 @@ class Zones(wx.Frame, Element_To_Draw):
4996
5018
  curv = self.active_vector
4997
5019
  n_rows = self.xls.GetNumberRows()
4998
5020
 
5021
+ if n_rows < 2:
5022
+ logging.warning(_('You need at least 2 points to interpolate the XY coordinates from the SZ coordinates'))
5023
+ return
5024
+
4999
5025
  # Getting the 2 first XY coordinates
5000
5026
  X =[]
5001
5027
  Y = []
@@ -6038,9 +6064,19 @@ class Zones(wx.Frame, Element_To_Draw):
6038
6064
  return
6039
6065
 
6040
6066
  actzone =self.active_zone
6041
- actzone.myvectors.pop(int(actzone.myvectors.index(self.active_vector)))
6042
- self.fill_structure()
6043
- self.find_minmax(True)
6067
+
6068
+ if actzone.nbvectors==0:
6069
+ return
6070
+
6071
+ idx = int(actzone.myvectors.index(self.active_vector))
6072
+ if idx >= 0 and idx < actzone.nbvectors:
6073
+ actzone.myvectors.pop(idx)
6074
+
6075
+ if actzone.nbvectors==0:
6076
+ self.Activate_vector(None)
6077
+
6078
+ self.fill_structure()
6079
+ self.find_minmax(True)
6044
6080
 
6045
6081
  def OnClickup_vector(self, event:wx.MouseEvent):
6046
6082
  """Remonte le vecteur actif dans la liste de la zone"""
@@ -6217,7 +6253,13 @@ class Zones(wx.Frame, Element_To_Draw):
6217
6253
 
6218
6254
  if self.active_vector is None:
6219
6255
  logging.info(_('Active vector is now set to None'))
6256
+ self.labelactvect.SetLabel('None')
6220
6257
  self.xls.ClearGrid()
6258
+ if self.parent is not None:
6259
+ try:
6260
+ self.parent.Active_vector(self.active_vector)
6261
+ except:
6262
+ raise Warning(_('Not supported in the current parent -- see PyVertexVectors in Activate_vector function'))
6221
6263
  return
6222
6264
 
6223
6265
  self.xls_active_vector()
@@ -6249,6 +6291,7 @@ class Zones(wx.Frame, Element_To_Draw):
6249
6291
 
6250
6292
  if self.active_zone is None:
6251
6293
  logging.info(_('Active zone is now set to None'))
6294
+ self.labelactzone.SetLabel('None')
6252
6295
  self.xls.ClearGrid()
6253
6296
  return
6254
6297
 
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 = 68
8
+ self.patch = 70
9
9
 
10
10
  def __str__(self):
11
11
 
@@ -554,7 +554,9 @@ class hydrometry():
554
554
  return self.realstations.iloc[index[0]]
555
555
 
556
556
  def get_timeseries_group(self, rfw:Literal['rain','waterdepth','flowrate'], time:Literal['5min','5or10min','1h','1d','1m']):
557
- """Obtention des stations pour le groupe souhaité
557
+ """Obtention des stations pour le groupe souhaité.
558
+
559
+ Temps retourné en UTC
558
560
 
559
561
  :param rfw: type de groupe - rain, flowrate, waterdepth
560
562
  :param time: type de série - 5min, 5or10min, 1h, 1d, 1m
wolfhece/wolf_array.py CHANGED
@@ -46,9 +46,14 @@ from os.path import dirname,basename,join
46
46
  import logging
47
47
  from typing import Literal
48
48
  from copy import deepcopy
49
- from osgeo import gdal
50
49
  from enum import Enum
51
50
 
51
+ try:
52
+ from osgeo import gdal
53
+ except ImportError as e:
54
+ print(e)
55
+ raise Exception(_('Error importing GDAL library'))
56
+
52
57
  try:
53
58
  from .Coordinates_operations import reproject_and_resample_raster
54
59
  except ImportError as e:
@@ -1458,7 +1463,14 @@ class Ops_Array(wx.Frame):
1458
1463
 
1459
1464
  def get_linked_arrays(self):
1460
1465
  """ Pour compatibilité avec la gestion de vecteur et WolfMapViewer """
1461
- return {self.parentarray.idx: self.parentarray}
1466
+ if self.is_shared:
1467
+ comp, diff = self._get_comp_elts_diff()
1468
+ ret = {}
1469
+ for elt in comp + diff:
1470
+ ret[elt.idx] = elt
1471
+ return ret
1472
+ else:
1473
+ return {self.parentarray.idx: self.parentarray}
1462
1474
 
1463
1475
  def set_GUI(self):
1464
1476
  """Set the wx GUI"""
@@ -1628,7 +1640,7 @@ class Ops_Array(wx.Frame):
1628
1640
 
1629
1641
  self.interp2D = wx.Button(self.Interpolation, wx.ID_ANY, _("2D Interpolation on selection"), wx.DefaultPosition,
1630
1642
  wx.DefaultSize, 0)
1631
- self.interp2D.SetToolTip(_('Spatial interpolation based on nodes stored in named groups. \n The interpolation apply only on the current selection.'))
1643
+ self.interp2D.SetToolTip(_('Spatial interpolation based on nodes stored in the named groups. \n The interpolation apply only on the current selection.'))
1632
1644
  gSizer1.Add(self.interp2D, 0, wx.EXPAND)
1633
1645
  self.interp2D.Bind(wx.EVT_BUTTON, self.interpolation2D)
1634
1646
 
@@ -2042,7 +2054,19 @@ class Ops_Array(wx.Frame):
2042
2054
  def interpolation2D(self, event: wx.MouseEvent):
2043
2055
  """ calling Interpolation 2D """
2044
2056
 
2045
- self.parentarray.interpolation2D()
2057
+ keys = list(self.parentarray.SelectionData.selections.keys())
2058
+ keys = [k for k in keys if len(self.parentarray.SelectionData.selections[k]) >0]
2059
+
2060
+ if len(keys) > 0:
2061
+ if len(keys) == 1:
2062
+ self.parentarray.interpolation2D(keys[0])
2063
+ else:
2064
+ with wx.SingleChoiceDialog(self, 'Choose the selection to interpolate', 'Selections', keys) as dlg:
2065
+ if dlg.ShowModal() == wx.ID_OK:
2066
+ selection = dlg.GetStringSelection()
2067
+ self.parentarray.interpolation2D(selection)
2068
+
2069
+ dlg.Destroy()
2046
2070
 
2047
2071
  def Unmaskall(self, event: wx.MouseEvent):
2048
2072
  """
@@ -2408,6 +2432,72 @@ class Ops_Array(wx.Frame):
2408
2432
  except Exception as e:
2409
2433
  logging.error('Error in hide_properties : %s' % e)
2410
2434
 
2435
+ @property
2436
+ def is_shared(self):
2437
+ """ Check if the vector manager is shared """
2438
+
2439
+ if self.mapviewer is not None:
2440
+ if self.mapviewer.linked:
2441
+ if not self.mapviewer.linkedList is None:
2442
+ comp = None
2443
+ for curviewer in self.mapviewer.linkedList:
2444
+ if curviewer.compare_results is not None:
2445
+ comp = curviewer.compare_results
2446
+ break
2447
+
2448
+ if comp is not None:
2449
+ elts = comp.elements
2450
+ diff = comp.diff
2451
+ if self.parentarray in elts or self.parentarray in diff and self.mapviewer.link_shareopsvect:
2452
+ return True
2453
+
2454
+ return False
2455
+
2456
+ def _get_comp_elts_diff(self):
2457
+ """ Get the elements and the differences of the linked arrays """
2458
+
2459
+ if self.mapviewer is not None:
2460
+ if self.mapviewer.linked:
2461
+ if not self.mapviewer.linkedList is None:
2462
+ comp = None
2463
+ for curviewer in self.mapviewer.linkedList:
2464
+ if curviewer.compare_results is not None:
2465
+ comp = curviewer.compare_results
2466
+ break
2467
+
2468
+ if comp is not None:
2469
+ return comp.elements, comp.diff
2470
+
2471
+ return [], []
2472
+
2473
+ def _link_zones(self):
2474
+ """ Link the same vector manager to all the linked arrays """
2475
+
2476
+ if self.mapviewer is not None:
2477
+ if self.mapviewer.linked:
2478
+ if not self.mapviewer.linkedList is None:
2479
+ comp = None
2480
+ for curviewer in self.mapviewer.linkedList:
2481
+ if curviewer.compare_results is not None:
2482
+ comp = curviewer.compare_results
2483
+ break
2484
+
2485
+ if comp is not None:
2486
+ elts = comp.elements
2487
+ for curelt in elts:
2488
+ if self.parentarray is not curelt:
2489
+ curelt.myops.myzones = self.myzones
2490
+ curelt.myops.fnsave = self.fnsave
2491
+
2492
+ diff = comp.diff
2493
+ for curelt in diff:
2494
+ if self.parentarray is not curelt:
2495
+ curelt.myops.myzones = self.myzones
2496
+ curelt.myops.fnsave = self.fnsave
2497
+
2498
+ for curviewer in self.mapviewer.linkedList:
2499
+ curviewer.Refresh()
2500
+
2411
2501
  def OnLoadvec(self, event:wx.MouseEvent):
2412
2502
  """ Load vector file """
2413
2503
 
@@ -2421,18 +2511,15 @@ class Ops_Array(wx.Frame):
2421
2511
 
2422
2512
  self.fnsave = dlg.GetPath()
2423
2513
  dlg.Destroy()
2424
- self.myzones = Zones(self.fnsave, parent=self)
2514
+
2515
+ self.myzones = Zones(self.fnsave, parent= self, shared= self.is_shared)
2425
2516
 
2426
2517
  # Link the same vector manager to all the linked arrays
2427
- #FIXME : only works if the active_array is the good one
2428
2518
  if self.mapviewer is not None:
2429
2519
  if self.mapviewer.linked:
2430
- if not self.mapviewer.linkedList is None:
2431
- for curViewer in self.mapviewer.linkedList:
2432
- if curViewer.link_shareopsvect:
2433
- curViewer.active_array.myops.myzones = self.myzones
2434
- curViewer.active_array.myops.fnsave = self.fnsave
2435
- self.mapviewer.Refresh()
2520
+ self._link_zones()
2521
+ else:
2522
+ self.mapviewer.Refresh()
2436
2523
 
2437
2524
  def OnSaveasvec(self, event:wx.MouseEvent):
2438
2525
  """ Save vector file """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.68
3
+ Version: 2.1.70
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
@@ -4,19 +4,19 @@ wolfhece/GraphNotebook.py,sha256=2TR8qjEwpMtl34QWgYNVe_PgTnuwhUxT5f9Y2zrmN2U,282
4
4
  wolfhece/GraphProfile.py,sha256=OCgJo0YFFBI6H1z-5egJsOOoWF_iziiza0-bbPejNMc,69656
5
5
  wolfhece/Lidar2002.py,sha256=bX-nIzdpjD7rOfEgJpTeaW6rIdAXwDp_z4YTM9CgANY,6068
6
6
  wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
- wolfhece/Model1D.py,sha256=iy9slhUvP5gXOhsAwjFhX83Rb9pMIDarkUAj9reNRCw,477027
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=xn1yWjsNc5HOf9HAzLPlMG7YfB7xuO1dyIL7l0GePTE,411137
10
+ wolfhece/PyDraw.py,sha256=qKdjRbAWIwDw5UqdiY8xJ0tlZE_2sgh7CQMwCT7nkpQ,411126
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
14
14
  wolfhece/PyPalette.py,sha256=3ehK6H2PvqSe0zICR1HyNs6KQokR1DmnAh4LwYnLIcU,28009
15
- wolfhece/PyParams.py,sha256=Zxf3baM4TFNapcDqgrtM4IZ4vwCGVd3penwgwWUtG40,97775
15
+ wolfhece/PyParams.py,sha256=LGt9uBFRVeS0F_kObJw8bPkWFqYSzf5pUTscxVU5Mxo,97725
16
16
  wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
17
17
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
18
18
  wolfhece/PyVertex.py,sha256=MtZVjIWIi62QX_oqNosb56xPgjhOGVeGz-XsD82tsNg,40614
19
- wolfhece/PyVertexvectors.py,sha256=6rUVRMbar-2s59DrbnGncUOj5dR5ovMYxi8LXLd9PzA,236833
19
+ wolfhece/PyVertexvectors.py,sha256=z6MTKabo3cvIq-qKUjdHbgqeoHagbK6nBU_x-fFGG7A,238671
20
20
  wolfhece/PyWMS.py,sha256=fyyzm2HFwq8aRwVYHKiBatcZOeKnFi6DWhv4nfscySQ,4602
21
21
  wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
22
22
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
@@ -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=QmAcZNRMdGwqXRO3MsRMREYW_3ZdJ41i9gg4WMtAbLM,376746
51
+ wolfhece/wolf_array.py,sha256=tJT0Hd--eWg23c01wZYUA494-6f1v7NZEvbvXLcT8M8,380039
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=9pKM_R-pqYp94pRjkkob738cc9PnIms77Dp-TKGaTB0,388
75
+ wolfhece/apps/version.py,sha256=TLK8WpRHDziujrX3W7jQ4NRLffIcA4WHifPcuYSKkRM,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
@@ -126,7 +126,7 @@ wolfhece/hydrology/read.py,sha256=itMat6MMn4Y14C3SMU_9JMBtpXFjG4mLNMfXXd5U6Ns,93
126
126
  wolfhece/hydrology/slope_manager.py,sha256=vlek0z8qcqB61eleiksyOe3QR1vpbtwfeowy6ms7_Fg,5580
127
127
  wolfhece/hydrology/wolfMap_treatment.py,sha256=eAxr24zJGwmDof1aZpcxewVvv_bWDvoO8t9Wwf99Mlo,10606
128
128
  wolfhece/hydrometry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
- wolfhece/hydrometry/kiwis.py,sha256=m3LGNxmB_ZY_ug-8BCM8jK_VqN6LtWRGpbPWtgRYFSE,46460
129
+ wolfhece/hydrometry/kiwis.py,sha256=jW5ivM0h_wZ_jM6OWh994iwQtsCZdwmQsMA7TMnCxMg,46495
130
130
  wolfhece/hydrometry/kiwis_gui.py,sha256=lApsSeBMJNAR1yocggdoHwz_xe6M_oaZ_E13CfHAlQA,23124
131
131
  wolfhece/hydrometry/kiwis_wolfgui.py,sha256=GPa5YNp2V2ZlxYQjPiCXERgPuWB_zij4ec2yHpRvoFA,4027
132
132
  wolfhece/hydrometry/kiwispie.py,sha256=akOaV46WwzISVlCcPz_phjsBrI_rDACUzdELtjx-xNg,13498
@@ -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.68.dist-info/METADATA,sha256=yFi2FGPJlzNBz_938XrVtCvrDzn2supoFh-NQY-fyLs,2570
287
- wolfhece-2.1.68.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
288
- wolfhece-2.1.68.dist-info/entry_points.txt,sha256=Q5JuIWV4odeIJI3qc6fV9MwRoz0ezqPVlFC1Ppm_vdQ,395
289
- wolfhece-2.1.68.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
290
- wolfhece-2.1.68.dist-info/RECORD,,
286
+ wolfhece-2.1.70.dist-info/METADATA,sha256=X-FGlbXULKqEr5VJOxfzSt8-BUMb01SI7dx1wNvssWE,2570
287
+ wolfhece-2.1.70.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
288
+ wolfhece-2.1.70.dist-info/entry_points.txt,sha256=Q5JuIWV4odeIJI3qc6fV9MwRoz0ezqPVlFC1Ppm_vdQ,395
289
+ wolfhece-2.1.70.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
290
+ wolfhece-2.1.70.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (72.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5