wolfhece 2.1.67__py3-none-any.whl → 2.1.69__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
@@ -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
 
@@ -8500,8 +8495,8 @@ class WolfMapViewer(wx.Frame):
8500
8495
  # \n \
8501
8496
  # !! ACTIONs !!\n \
8502
8497
  # N : sélection noeud par noeud de la matrice courante\n \
8503
- # b, B : sélection par vecteur de la matrice courante - zone intérieure\n \
8504
- # v, V : sélection par vecteur de la matrice courante - trace du vecteur\n \
8498
+ # b, B : sélection par vecteur de la matrice courante - trace du vecteur\n \
8499
+ # v, V : sélection par vecteur de la matrice courante - zone intérieure\n \
8505
8500
  # r : reset de la sélection de la matrice courante\n \
8506
8501
  # R : reset de toutes les sélections de la matrice courante\n \
8507
8502
  # P : sélection de la section transversale par click souris\n \
@@ -8558,8 +8553,9 @@ class WolfMapViewer(wx.Frame):
8558
8553
  'F11': _('Arrays : select by criteria'),
8559
8554
  'F12': _('Arrays : operations'),
8560
8555
  'n or N': _('Arrays : node-by-node selection'),
8561
- 'b or B': _('Arrays : temporary/active vector selection - inside polygon'),
8562
- 'v or V': _('Arrays : temporary/active vector selection - along polyline'),
8556
+
8557
+ 'b or B': _('Arrays : temporary/active vector selection - along polyline'),
8558
+ 'v or V': _('Arrays : temporary/active vector selection - inside polygon'),
8563
8559
 
8564
8560
  'r': _('Arrays : reset the selection'),
8565
8561
  'R': _('Arrays : reset the selection and the associated dictionnary'),
@@ -9563,8 +9559,10 @@ class WolfMapViewer(wx.Frame):
9563
9559
  curFrame.setbounds()
9564
9560
 
9565
9561
  if curFrame.link_shareopsvect:
9566
- curFrame.Active_vector(self.active_vector)
9567
- 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)
9568
9566
  curFrame.action = self.action
9569
9567
 
9570
9568
  for curFrame in self.linkedList:
@@ -9861,6 +9859,7 @@ class Compare_Arrays_Results():
9861
9859
  elif self.type == Comp_Type.ARRAYS_MB:
9862
9860
  self.elements = [WolfArrayMB(cur[1], plotted=False, idx = cur[1].name + '_' + str(idx)) for idx, cur in enumerate(self.paths)]
9863
9861
 
9862
+
9864
9863
  def set_diff(self):
9865
9864
  """ Set the differential between the elements and the first one, which is the reference """
9866
9865
 
@@ -9974,6 +9973,8 @@ class Compare_Arrays_Results():
9974
9973
 
9975
9974
  if self.share_cmap_array:
9976
9975
  for curelt in elts[1:]:
9976
+ curelt.mypal.automatic = False
9977
+ curelt.myops.palauto.SetValue(0)
9977
9978
  ref.add_crosslinked_array(curelt)
9978
9979
  ref.share_palette()
9979
9980
  else:
@@ -9997,6 +9998,8 @@ class Compare_Arrays_Results():
9997
9998
 
9998
9999
  if self.share_cmap_diff:
9999
10000
  for curelt in self.diff[1:]:
10001
+ curelt.mypal.automatic = False
10002
+ curelt.myops.palauto.SetValue(0)
10000
10003
  diff.add_crosslinked_array(curelt)
10001
10004
  diff.share_palette()
10002
10005
  else: