wolfhece 2.1.43__py3-none-any.whl → 2.1.44__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.
@@ -12,6 +12,7 @@ from os import path
12
12
  from typing import Union
13
13
  import numpy as np
14
14
  import wx
15
+ import wx._dataview
15
16
  from wx.dataview import *
16
17
  from wx.core import BoxSizer, FlexGridSizer, TreeItemId
17
18
  from OpenGL.GL import *
@@ -304,6 +305,9 @@ class Triangulation(Element_To_Draw):
304
305
  triangles.tofile(f,"")
305
306
 
306
307
  def read(self,fn:str):
308
+ """ Read a binary '.TRI' file """
309
+
310
+ fn = str(fn)
307
311
 
308
312
  if fn.endswith('.dxf'):
309
313
  self.import_dxf(fn)
@@ -1182,7 +1186,7 @@ class vector:
1182
1186
 
1183
1187
  coords=self.asnparray()
1184
1188
  return Polygon(coords)
1185
-
1189
+
1186
1190
  def asshapely_pol3D(self) -> Polygon:
1187
1191
  """
1188
1192
  Conversion des coordonnées en Polygon Shapely
@@ -1190,7 +1194,7 @@ class vector:
1190
1194
 
1191
1195
  coords=self.asnparray3d()
1192
1196
  return Polygon(coords)
1193
-
1197
+
1194
1198
  def asshapely_ls3d(self) -> LineString:
1195
1199
  """
1196
1200
  Conversion des coordonnées en Linestring Shapely
@@ -1593,9 +1597,9 @@ class vector:
1593
1597
  if self.myprop.filled:
1594
1598
 
1595
1599
  import triangle
1596
-
1600
+
1597
1601
  ls = self.asshapely_pol()
1598
-
1602
+
1599
1603
  if False:
1600
1604
 
1601
1605
  #FIXME : Shapely have not constrained Delaunay triangulation -- using Delaunay from Wolf Fortran instead
@@ -2422,6 +2426,8 @@ class zone:
2422
2426
 
2423
2427
  from osgeo import gdal, osr, gdalconst,ogr
2424
2428
 
2429
+ fn = str(fn)
2430
+
2425
2431
  # create the spatial reference system, Lambert72
2426
2432
  srs = osr.SpatialReference()
2427
2433
  srs.ImportFromEPSG(31370)
@@ -2600,7 +2606,7 @@ class zone:
2600
2606
  if len(self.myvectors) == 0:
2601
2607
  logging.warning(_('No vector in zone -- {}').format(self.myname))
2602
2608
  return
2603
-
2609
+
2604
2610
  try:
2605
2611
  if self.idgllist==-99999:
2606
2612
  self.idgllist = glGenLists(1)
@@ -3178,27 +3184,47 @@ class zone:
3178
3184
  self.parent.fill_structure()
3179
3185
 
3180
3186
  def create_sliding_polygon_from_parallel(self,
3181
- ds:float,
3187
+ poly_length:float,
3182
3188
  ds_sliding:float,
3183
- dpar:float,
3184
- dspar:float=None,
3189
+ farthest_parallel:float,
3190
+ interval_parallel:float=None,
3185
3191
  intersect=None,
3186
3192
  howmanypoly=1,
3187
- eps_inter:float=0.25):
3193
+ eps_offset:float=0.25):
3188
3194
  """
3189
- Création de polygones depuis des vecteurs parallèles
3195
+ Create sliding polygons from a support vector.
3190
3196
 
3191
- La zone à traiter ne peut contenir qu'un seul vecteur
3197
+ "poly_length" is the length of the polygons.
3198
+ "ds_sliding" is the sliding length.
3192
3199
 
3193
- Une zone de résultat est ajouté à l'objet
3200
+ If "ds_sliding" is lower than "ds", the polygons are overlapping.
3201
+ If "ds_sliding" is greater than "ds", the polygons are separated.
3202
+ If "ds_sliding" is equal to "ds", the polygons are adjacent.
3203
+
3204
+ The zone to be processed can only contain 1 vector.
3205
+ A result zone is added to the object.
3206
+
3207
+ The sliding polygons are created on the basis of the left
3208
+ and right parallels of the central vector.
3209
+
3210
+ "farthest_parallel" is the farthest parallel.
3211
+ "interval_parallel" is the distance between each parallels. If not defined, it is equal to "farthest_parallel".
3194
3212
 
3195
- ds : size/length of the polygon, adjusted on the basis of a number of polygons rounded up to the nearest integer
3196
- ds_sliding : sliding length
3197
- dpar : position of the parallels
3198
- dspar : parallel intervals (internal computation)
3199
- intersect : zone class containing constraints
3200
- howmanypoly : number of transversal polygons (1 = one large polygon, 2 = 2 polygons - one left and one right)
3201
- eps_inter : space width impose to the "intersect"
3213
+ Lateral sides of the polygons are defined by projecting the
3214
+ points/vertices of the support vector onto the parallels,
3215
+ from the nearest to the farthest.
3216
+
3217
+ The method first creates the parallels.
3218
+ Then, it intersects the parallels with the constraints defined in the "intersect" zone.
3219
+ The intersection is done with an offset defined by "eps_offset".
3220
+
3221
+ :param poly_length: size/length of the polygon, adjusted on the basis of a number of polygons rounded up to the nearest integer
3222
+ :param ds_sliding: sliding length
3223
+ :param farthest_parallel: position of the parallels
3224
+ :param interval_parallel: parallel intervals (internal computation)
3225
+ :param intersect: zone class containing constraints
3226
+ :param howmanypoly: number of transversal polygons (1 = one large polygon, 2 = 2 polygons - one left and one right)
3227
+ :param eps_offset: space width impose to the "intersect"
3202
3228
  """
3203
3229
 
3204
3230
  assert self.nbvectors==1, _('The zone must contain 1 and only 1 vector')
@@ -3215,12 +3241,16 @@ class zone:
3215
3241
  # Returned zone
3216
3242
  myparallels = zone()
3217
3243
 
3218
- if dspar is None :
3219
- dspar : dpar
3244
+ if interval_parallel is None :
3245
+ interval_parallel : farthest_parallel
3246
+
3247
+ if interval_parallel > farthest_parallel:
3248
+ logging.warning(_('dspar is greater than dpar --> dspar is set to dpar'))
3249
+ interval_parallel = farthest_parallel
3220
3250
 
3221
3251
  # All parallel distances
3222
- all_par = np.arange(0, dpar, dspar)[1:]
3223
- all_par = np.concatenate((all_par,[dpar]))
3252
+ all_par = np.arange(0, farthest_parallel, interval_parallel)[1:]
3253
+ all_par = np.concatenate((all_par,[farthest_parallel]))
3224
3254
 
3225
3255
  for curpar in tqdm(all_par):
3226
3256
  # add current parallel to the dicts
@@ -3231,10 +3261,12 @@ class zone:
3231
3261
  myparallels.add_vector(vecright[curpar], forceparent=True)
3232
3262
 
3233
3263
  if isinstance(intersect, zone):
3264
+ # Some constraints are defined
3265
+ #
3234
3266
  # gestion de vecteurs d'intersection
3235
3267
  for curint in intersect.myvectors:
3236
3268
  # bouclage sur les vecteurs
3237
- curint2 = curint.parallel_offset(eps_inter, side='right')
3269
+ curint2 = curint.parallel_offset(eps_offset, side='right')
3238
3270
 
3239
3271
  # recherche si une intersection existe
3240
3272
  pt, dist = vecleft[curpar].intersection(curint, eval_dist=True, force_single=True)
@@ -3262,7 +3294,6 @@ class zone:
3262
3294
 
3263
3295
  # mise à jour des caractéristiques
3264
3296
  vecleft[curpar].find_minmax()
3265
- vecleft[curpar].nbvertices = len(vecleft[curpar].myvertices)
3266
3297
  vecleft[curpar].update_lengths()
3267
3298
 
3268
3299
  pt, dist = vecright[curpar].intersection(curint, eval_dist=True, force_single=True)
@@ -3279,7 +3310,6 @@ class zone:
3279
3310
 
3280
3311
  vecright[curpar].myvertices = vec1.myvertices.copy() + subs2.myvertices.copy() + subs.myvertices.copy() + vec2.myvertices.copy()
3281
3312
 
3282
- vecright[curpar].nbvertices = len(vecright[curpar].myvertices)
3283
3313
  vecright[curpar].update_lengths()
3284
3314
  vecright[curpar].find_minmax()
3285
3315
 
@@ -3293,7 +3323,7 @@ class zone:
3293
3323
 
3294
3324
  #Dimensional distances along center vector
3295
3325
  sloc = np.asarray([float(ds_sliding) * cur for cur in range(nb)])
3296
- sloc2 = sloc + float(ds)
3326
+ sloc2 = sloc + float(poly_length)
3297
3327
  sloc2[sloc2>veccenter.length2D]=veccenter.length2D
3298
3328
 
3299
3329
  #Points along center vector
@@ -3358,8 +3388,8 @@ class zone:
3358
3388
  curvec=vector(name='poly'+str(i), parentzone=zonepoly)
3359
3389
 
3360
3390
  #Substring for Left and Right
3361
- sublsl=vecleft[dpar].substring(pt1[-1], pt2[-1], is3D=False, adim=False)
3362
- sublsr=vecright[dpar].substring(pt3[-1], pt4[-1], is3D=False, adim=False)
3391
+ sublsl=vecleft[farthest_parallel].substring(pt1[-1], pt2[-1], is3D=False, adim=False)
3392
+ sublsr=vecright[farthest_parallel].substring(pt3[-1], pt4[-1], is3D=False, adim=False)
3363
3393
  sublsr.reverse()
3364
3394
  sublsc=veccenter.substring(ptc1,ptc2,is3D=False, adim=False)
3365
3395
 
@@ -3373,7 +3403,6 @@ class zone:
3373
3403
  curvec.myvertices = sublsl.myvertices.copy() + downl[1:].copy() + [sublsc.myvertices[-1].copy()] + downr[:-1].copy() + sublsr.myvertices.copy() + upr[1:].copy() + [sublsc.myvertices[0].copy()] + upl[:-1].copy()
3374
3404
  for curvert in curvec.myvertices:
3375
3405
  curvert.z = smean
3376
- curvec.nbvertices = len(curvec.myvertices)
3377
3406
 
3378
3407
  #force to close the polygon
3379
3408
  curvec.close_force()
@@ -3403,8 +3432,8 @@ class zone:
3403
3432
  curvecright=vector(name='poly'+str(i+1),parentzone=zonepolyright)
3404
3433
 
3405
3434
  #Substring for Left and Right
3406
- sublsl=vecleft[dpar].substring(pt1[-1], pt2[-1], is3D=False, adim=False)
3407
- sublsr=vecright[dpar].substring(pt3[-1], pt4[-1], is3D=False, adim=False)
3435
+ sublsl=vecleft[farthest_parallel].substring(pt1[-1], pt2[-1], is3D=False, adim=False)
3436
+ sublsr=vecright[farthest_parallel].substring(pt3[-1], pt4[-1], is3D=False, adim=False)
3408
3437
  sublsr.reverse()
3409
3438
 
3410
3439
  sublsc=veccenter.substring(ptc1,ptc2,is3D=False, adim=False)
@@ -3425,8 +3454,6 @@ class zone:
3425
3454
  curvert.z = smean
3426
3455
  for curvert in curvecright.myvertices:
3427
3456
  curvert.z = smean
3428
- curvecleft.nbvertices = len(curvecleft.myvertices)
3429
- curvecright.nbvertices = len(curvecright.myvertices)
3430
3457
 
3431
3458
  curvecleft.close_force()
3432
3459
  curvecright.close_force()
@@ -3993,9 +4020,9 @@ class Zones(wx.Frame, Element_To_Draw):
3993
4020
  return len(self.myzones)
3994
4021
 
3995
4022
  def import_shapefile(self, fn:str, bbox:Polygon = None):
3996
- """
3997
- Import shapefile by using geopandas
3998
-
4023
+ """
4024
+ Import shapefile by using geopandas
4025
+
3999
4026
  Shapefile == 1 zone
4000
4027
 
4001
4028
  """
@@ -4019,13 +4046,13 @@ class Zones(wx.Frame, Element_To_Draw):
4019
4046
  self.add_zone(newzone)
4020
4047
 
4021
4048
  def export_to_shapefile(self, filename:str):
4022
- """
4049
+ """
4023
4050
  Export to shapefile.
4024
4051
 
4025
4052
  The first vector of each zone will be exported.
4026
4053
 
4027
4054
  If you want to export all vectors, you have to use "export_shape" of the zone object.
4028
-
4055
+
4029
4056
  FIXME: Add support of data fields
4030
4057
  """
4031
4058
 
@@ -4039,7 +4066,7 @@ class Zones(wx.Frame, Element_To_Draw):
4039
4066
  if curzone.nbvectors == 0:
4040
4067
  logging.warning(_('Zone {} contains no vector'.format(curzone.myname)))
4041
4068
  continue
4042
-
4069
+
4043
4070
  elif curzone.nbvectors>1:
4044
4071
  logging.warning(_('Zone {} contains more than one vector -- only the first one will be exported'.format(curzone.myname)))
4045
4072
 
@@ -4062,16 +4089,16 @@ class Zones(wx.Frame, Element_To_Draw):
4062
4089
  gdf.to_file(filename)
4063
4090
 
4064
4091
  def export_active_zone_to_shapefile(self, filename:str):
4065
- """
4092
+ """
4066
4093
  Export the active_zone to shapefile.
4067
4094
  """
4068
4095
 
4069
4096
  if self.active_zone is None:
4070
4097
  logging.warning(_('No active zone'))
4071
4098
  return
4072
-
4099
+
4073
4100
  self.active_zone.export_shape(filename)
4074
-
4101
+
4075
4102
  def import_gdb(self, fn:str, bbox:Polygon = None):
4076
4103
  """ Import gdb by using geopandas and Fiona"""
4077
4104
 
@@ -4395,6 +4422,9 @@ class Zones(wx.Frame, Element_To_Draw):
4395
4422
 
4396
4423
  si c'est le cas, self.filename est modifié
4397
4424
  """
4425
+
4426
+ filename = str(filename)
4427
+
4398
4428
  if filename!='':
4399
4429
  self.filename=filename
4400
4430
 
@@ -4538,7 +4568,7 @@ class Zones(wx.Frame, Element_To_Draw):
4538
4568
  self.xls=CpGrid(self,-1,wx.WANTS_CHARS)
4539
4569
  self.xls.CreateGrid(10,6)
4540
4570
 
4541
- self.addrows = wx.Button(self,label=_('Add rows'))
4571
+ self.addrows = wx.Button(self,label=_('Add rows to grid'))
4542
4572
  self.addrows.SetToolTip(_("Add rows to the grid --> Useful for manually adding some points to a vector"))
4543
4573
  self.addrows.Bind(wx.EVT_BUTTON,self.Onaddrows)
4544
4574
 
@@ -4618,6 +4648,10 @@ class Zones(wx.Frame, Element_To_Draw):
4618
4648
  self.polyfrompar.SetToolTip(_("Create polygons in a new zone from parallels defined by " + _('Add and parallel') + _(" and a 2D curvilinear distance \n Useful for plotting some results or analyse data inside each polygon")))
4619
4649
  self.polyfrompar.Bind(wx.EVT_BUTTON,self.Oncreatepolygons)
4620
4650
 
4651
+ self.slidingpoly = wx.Button(self,label=_('Create sliding polygons'))
4652
+ self.slidingpoly.SetToolTip(_("Create sliding polygons in a new zone"))
4653
+ self.slidingpoly.Bind(wx.EVT_BUTTON,self.Oncreateslidingpoly)
4654
+
4621
4655
  # Added
4622
4656
  self.getxyfromsz = wx.Button(self, label = _('Get xy from sz'))
4623
4657
  self.getxyfromsz.SetToolTip(_("Populate the X an Y columns based on: \n - Given sz coordinates, \n - The X and Y coordinates of the initial point (s = 0) and, \n - The X and Y coordinates of a second point (any other point with an S coordinate)"))
@@ -4625,20 +4659,29 @@ class Zones(wx.Frame, Element_To_Draw):
4625
4659
 
4626
4660
  boxright.Add(self.xls,1,wx.EXPAND)
4627
4661
  boxright.Add(self.addrows,0,wx.EXPAND)
4628
- boxright.Add(self.capturevertices,0,wx.EXPAND)
4629
- boxright.Add(self.dynapar,0,wx.EXPAND)
4662
+
4663
+ boxright.Add(self.updatevertices,0,wx.EXPAND)
4664
+
4665
+ subboxadd = BoxSizer(orient=wx.HORIZONTAL)
4666
+ subboxadd.Add(self.capturevertices,1,wx.EXPAND)
4667
+ subboxadd.Add(self.dynapar,1,wx.EXPAND)
4668
+ boxright.Add(subboxadd,0,wx.EXPAND)
4669
+
4670
+ subboxmod = wx.BoxSizer(wx.HORIZONTAL)
4671
+ subboxmod.Add(self.modifyvertices,1,wx.EXPAND)
4672
+ subboxmod.Add(self.insertvertices,1,wx.EXPAND)
4673
+ boxright.Add(subboxmod,0,wx.EXPAND)
4674
+
4630
4675
  boxright.Add(self.createapar,0,wx.EXPAND)
4631
4676
  boxright.Add(self.reverseorder,0,wx.EXPAND)
4632
- boxright.Add(self.modifyvertices,0,wx.EXPAND)
4633
- boxright.Add(self.insertvertices,0,wx.EXPAND)
4634
4677
  boxright.Add(self.splitvertices,0,wx.EXPAND)
4678
+
4635
4679
  # boxright.Add(self.zoomonactive,0,wx.EXPAND)
4636
4680
  boxright.Add(boxzoom,0,wx.EXPAND)
4637
- boxright.Add(self.sascending,0,wx.EXPAND)
4638
4681
  boxright.Add(self.evaluates,0,wx.EXPAND)
4639
- boxright.Add(self.getxyfromsz,0,wx.EXPAND) # Added
4640
4682
  boxright.Add(self.interpxyz,0,wx.EXPAND)
4641
- boxright.Add(self.updatevertices,0,wx.EXPAND)
4683
+ boxright.Add(self.sascending,0,wx.EXPAND)
4684
+ boxright.Add(self.getxyfromsz,0,wx.EXPAND) # Added
4642
4685
 
4643
4686
  self.butgetval = wx.Button(self,label=_('Get values (self or active array)'))
4644
4687
  self.butgetval.SetToolTip(_("Get values of the attached/active array on each vertex of the active vector and update the editor"))
@@ -4674,9 +4717,9 @@ class Zones(wx.Frame, Element_To_Draw):
4674
4717
  self.addzone = wx.Button(self,label=_('Add zone'))
4675
4718
  self.addvector = wx.Button(self,label=_('Add vector'))
4676
4719
  self.deletezone = wx.Button(self,label=_('Delete zone'))
4677
- self.findactivevector = wx.Button(self,label=_('Find in whole zones'))
4720
+ self.findactivevector = wx.Button(self,label=_('Find in all'))
4678
4721
  self.findactivevector.SetToolTip(_("Search and activate the nearest vector by mouse click (Searching window : all zones)"))
4679
- self.findactivevectorcurz = wx.Button(self,label=_('Find in active zone'))
4722
+ self.findactivevectorcurz = wx.Button(self,label=_('Find in active'))
4680
4723
  self.findactivevectorcurz.SetToolTip(_("Search and activate the nearest vector by mouse click (Searching window : active zone)"))
4681
4724
  self.deletevector = wx.Button(self,label=_('Delete vector'))
4682
4725
 
@@ -4704,11 +4747,17 @@ class Zones(wx.Frame, Element_To_Draw):
4704
4747
  boxadd.Add(self.labelactzone,1,wx.EXPAND)
4705
4748
  boxadd.Add(self.addzone,1,wx.EXPAND)
4706
4749
  boxadd.Add(self.addvector,1,wx.EXPAND)
4707
- boxadd.Add(self.findactivevector,1,wx.EXPAND)
4708
- boxadd.Add(self.findactivevectorcurz,1,wx.EXPAND)
4709
- boxdelete.Add(self.deletezone,1,wx.EXPAND)
4710
- boxdelete.Add(self.deletevector,1,wx.EXPAND)
4711
- boxdelete.Add(boxupdown,1,wx.EXPAND)
4750
+
4751
+ subboxadd = wx.BoxSizer(wx.HORIZONTAL)
4752
+ subboxadd.Add(self.findactivevector,1,wx.EXPAND)
4753
+ subboxadd.Add(self.findactivevectorcurz,1,wx.EXPAND)
4754
+ boxadd.Add(subboxadd,1,wx.EXPAND)
4755
+
4756
+ subboxdelete = wx.BoxSizer(wx.HORIZONTAL)
4757
+ subboxdelete.Add(self.deletezone,1,wx.EXPAND)
4758
+ subboxdelete.Add(self.deletevector,1,wx.EXPAND)
4759
+
4760
+ boxdelete.Add(subboxdelete,1,wx.EXPAND)
4712
4761
 
4713
4762
  boxupdown.Add(boxupdownz,1,wx.EXPAND)
4714
4763
  boxupdown.Add(boxupdownv,1,wx.EXPAND)
@@ -4719,15 +4768,19 @@ class Zones(wx.Frame, Element_To_Draw):
4719
4768
  boxupdownz.Add(self.downzone,1,wx.EXPAND)
4720
4769
 
4721
4770
  # boxdelete.Add(self.interpolate,1,wx.EXPAND)
4722
- boxdelete.Add(self.saveimages,1,wx.EXPAND)
4723
- boxdelete.Add(self.binfrom3,1,wx.EXPAND)
4724
- boxdelete.Add(self.trifromall,1,wx.EXPAND)
4725
- boxdelete.Add(self.trifromall_proj,1,wx.EXPAND)
4726
- boxdelete.Add(self.polyfrompar,1,wx.EXPAND)
4771
+ boxtri = wx.BoxSizer(wx.VERTICAL)
4772
+ boxtri.Add(self.saveimages,1,wx.EXPAND)
4773
+ boxtri.Add(self.binfrom3,1,wx.EXPAND)
4774
+ boxtri.Add(self.trifromall,1,wx.EXPAND)
4775
+ boxtri.Add(self.trifromall_proj,1,wx.EXPAND)
4776
+ boxtri.Add(self.polyfrompar,1,wx.EXPAND)
4777
+ boxtri.Add(self.slidingpoly,1,wx.EXPAND)
4727
4778
 
4728
4779
  boxleft.Add(self.treelist,1,wx.EXPAND)
4729
4780
  boxleft.Add(boxadd,0,wx.EXPAND)
4730
4781
  boxleft.Add(boxdelete,0,wx.EXPAND)
4782
+ boxleft.Add(boxupdown,0,wx.EXPAND)
4783
+ boxleft.Add(boxtri,0,wx.EXPAND)
4731
4784
 
4732
4785
  box.Add(boxleft,1,wx.EXPAND)
4733
4786
  box.Add(boxright,1,wx.EXPAND)
@@ -4932,6 +4985,10 @@ class Zones(wx.Frame, Element_To_Draw):
4932
4985
  """
4933
4986
 
4934
4987
  def store_tree_state(tree:TreeListCtrl):
4988
+ """ Store the state of the tree control.
4989
+
4990
+ Recursively store the state of the tree control in a list of item data.
4991
+ """
4935
4992
 
4936
4993
  expended_items = []
4937
4994
  root = tree.GetRootItem()
@@ -4939,23 +4996,27 @@ class Zones(wx.Frame, Element_To_Draw):
4939
4996
  if root is None:
4940
4997
  return
4941
4998
 
4942
- def traverse_and_store(item):
4999
+ def traverse_and_store(item:wx._dataview.TreeListItem):
4943
5000
  if not item.IsOk():
4944
5001
  return
5002
+
4945
5003
  if tree.IsExpanded(item):
4946
5004
  expended_items.append(tree.GetItemData(item))
4947
5005
 
4948
- child = tree.GetFirstChild(item)
4949
- while child.IsOk():
4950
- traverse_and_store(child)
4951
- child = tree.GetNextItem(child)
5006
+ item = tree.GetNextItem(item)
5007
+
5008
+ traverse_and_store(item)
4952
5009
 
4953
5010
  traverse_and_store(root)
4954
5011
 
4955
5012
  return expended_items
4956
5013
 
4957
5014
  def restore_tree_state(tree:TreeListCtrl, expended_items):
4958
-
5015
+ """ Restore the state of the tree control.
5016
+
5017
+ Recursively restore the state of the tree control from a list of item data.
5018
+ """
5019
+
4959
5020
  if len(expanded)==0:
4960
5021
  # Nothing to do
4961
5022
  return
@@ -4972,10 +5033,8 @@ class Zones(wx.Frame, Element_To_Draw):
4972
5033
  if tree.GetItemData(item) in expended_items:
4973
5034
  tree.Expand(item)
4974
5035
 
4975
- child = tree.GetFirstChild(item)
4976
- while child.IsOk():
4977
- traverse_and_restore(child)
4978
- child = tree.GetNextItem(child)
5036
+ item = tree.GetNextItem(item)
5037
+ traverse_and_restore(item)
4979
5038
 
4980
5039
  traverse_and_restore(root)
4981
5040
 
@@ -4999,10 +5058,11 @@ class Zones(wx.Frame, Element_To_Draw):
4999
5058
 
5000
5059
  def expand_tree(self, objzone=None):
5001
5060
  """
5002
- Développe la structure pour un objet spécifique stocké dans la self.treelist
5061
+ Développe la structure pour un objet spécifique stocké dans la self.treelist.
5003
5062
 
5004
- L'objet peut être une 'zone' ou un 'vector' --> see more in 'fill_structure'
5063
+ L'objet peut être une 'zone' ou un 'vector' --> see more in 'fill_structure'.
5005
5064
  """
5065
+
5006
5066
  if self.wx_exists:
5007
5067
  if self.xls is not None:
5008
5068
  root = self.treelist.GetRootItem()
@@ -5023,6 +5083,7 @@ class Zones(wx.Frame, Element_To_Draw):
5023
5083
  Ajoute de nouveaux vertices au vecteur courant
5024
5084
  Fonctionne par clicks souris via le GUI wx de WolfMapViewer
5025
5085
  """
5086
+
5026
5087
  if self.wx_exists:
5027
5088
  # N'est pas à strictement parlé dépendant de wx mais n'a de sens
5028
5089
  # que si le mapviewer est défini --> si un GUI wx existe
@@ -5039,6 +5100,7 @@ class Zones(wx.Frame, Element_To_Draw):
5039
5100
  """
5040
5101
  Renverse le vecteur courant
5041
5102
  """
5103
+
5042
5104
  if self.wx_exists:
5043
5105
  # N'est pas à strictement parlé dépendant de wx mais n'a de sens
5044
5106
  # que si le mapviewer est défini --> si un GUI wx existe
@@ -5052,6 +5114,7 @@ class Zones(wx.Frame, Element_To_Draw):
5052
5114
  """
5053
5115
  Ajout d'une parallèle au vecteur courant via le bouton adhoc
5054
5116
  """
5117
+
5055
5118
  if self.wx_exists:
5056
5119
  if self.verify_activevec():
5057
5120
  return
@@ -5075,6 +5138,7 @@ class Zones(wx.Frame, Element_To_Draw):
5075
5138
  """
5076
5139
  Ajoute des vertices au vecteur courant et crée des parallèles gauche-droite
5077
5140
  """
5141
+
5078
5142
  if self.wx_exists:
5079
5143
  if self.verify_activevec():
5080
5144
  return
@@ -5093,6 +5157,7 @@ class Zones(wx.Frame, Element_To_Draw):
5093
5157
 
5094
5158
  Retourne un message avec les valeurs modifiées le cas échéant
5095
5159
  """
5160
+
5096
5161
  if self.wx_exists:
5097
5162
  if self.verify_activevec():
5098
5163
  return
@@ -5117,6 +5182,7 @@ class Zones(wx.Frame, Element_To_Draw):
5117
5182
 
5118
5183
  --> action active jusqu'à sélectionne une autre action ou touche Entrée
5119
5184
  """
5185
+
5120
5186
  if self.wx_exists:
5121
5187
  if self.verify_activevec():
5122
5188
  return
@@ -5129,6 +5195,7 @@ class Zones(wx.Frame, Element_To_Draw):
5129
5195
  """
5130
5196
  Zoom sur le vecteur actif dans le mapviewer
5131
5197
  """
5198
+
5132
5199
  if self.wx_exists:
5133
5200
  if self.verify_activevec():
5134
5201
  return
@@ -5139,6 +5206,7 @@ class Zones(wx.Frame, Element_To_Draw):
5139
5206
  """
5140
5207
  Zoom sur le vertex actif dans le mapviewer
5141
5208
  """
5209
+
5142
5210
  if self.wx_exists:
5143
5211
  if self.verify_activevec():
5144
5212
  return
@@ -5152,6 +5220,7 @@ class Zones(wx.Frame, Element_To_Draw):
5152
5220
  --> soit la matrice courante
5153
5221
  --> soit la matrice active de l'interface parent
5154
5222
  """
5223
+
5155
5224
  if self.verify_activevec():
5156
5225
  return
5157
5226
 
@@ -5172,6 +5241,7 @@ class Zones(wx.Frame, Element_To_Draw):
5172
5241
  Crée une nouvelle zone contenant une copie du vecteur
5173
5242
  Le nombre de vertices est conservé
5174
5243
  """
5244
+
5175
5245
  if self.parent is not None:
5176
5246
  if self.verify_activevec():
5177
5247
  return
@@ -5217,12 +5287,14 @@ class Zones(wx.Frame, Element_To_Draw):
5217
5287
  """
5218
5288
  Enregistrement d'une image pour tous les vecteurs
5219
5289
  """
5290
+
5220
5291
  self.save_images_fromvec()
5221
5292
 
5222
5293
  def Oncreatepolygons(self, event:wx.MouseEvent):
5223
5294
  """
5224
5295
  Création de polygones depuis des paralèles contenues dans la zone active
5225
5296
  """
5297
+
5226
5298
  if self.active_zone is None:
5227
5299
  return
5228
5300
 
@@ -5253,6 +5325,89 @@ class Zones(wx.Frame, Element_To_Draw):
5253
5325
 
5254
5326
  self.active_zone.create_polygon_from_parallel(ds,nb)
5255
5327
 
5328
+ def Oncreateslidingpoly(self, event:wx.MouseEvent):
5329
+ """
5330
+ Create sliding polygons from a support vector
5331
+ """
5332
+
5333
+ if self.active_zone is None:
5334
+ logging.warning(_('No active zone - Nothing to do !'))
5335
+ return
5336
+
5337
+ if self.active_zone.nbvectors!=1:
5338
+ logging.error(_('The active zone must contain 1 vector and only 1'))
5339
+ dlg = wx.MessageDialog(None,_('The active zone must contain 1 vector and only 1'),style=wx.OK)
5340
+ dlg.ShowModal()
5341
+ dlg.Destroy()
5342
+ return
5343
+
5344
+ #dialog box for length, sliding length, farthest parallel and parallel interval
5345
+ dlg=wx.NumberEntryDialog(None,_('What is the desired longitudinal size [cm] ?'),'ds','ds size',5000,1,100000)
5346
+ ret=dlg.ShowModal()
5347
+ if ret==wx.ID_CANCEL:
5348
+ dlg.Destroy()
5349
+ return
5350
+
5351
+ ds=float(dlg.GetValue())/100.
5352
+
5353
+ dlg.Destroy()
5354
+
5355
+ dlg=wx.NumberEntryDialog(None,_('What is the desired sliding length [cm] ?'),'sliding','sliding size',5000,1,100000)
5356
+ ret=dlg.ShowModal()
5357
+ if ret==wx.ID_CANCEL:
5358
+ dlg.Destroy()
5359
+ return
5360
+
5361
+ sliding=float(dlg.GetValue())/100.
5362
+
5363
+ dlg.Destroy()
5364
+
5365
+ dlg=wx.NumberEntryDialog(None,_('What is the desired farthest parallel [cm] ?'),'farthest','farthest size',10000,1,100000)
5366
+ ret=dlg.ShowModal()
5367
+ if ret==wx.ID_CANCEL:
5368
+ dlg.Destroy()
5369
+ return
5370
+
5371
+ farthest=float(dlg.GetValue())/100.
5372
+
5373
+ dlg.Destroy()
5374
+
5375
+ dlg=wx.NumberEntryDialog(None,_('What is the desired parallel interval [cm] ?'),'interval','interval size',int(farthest*10.),1,int(farthest*100.))
5376
+ ret=dlg.ShowModal()
5377
+ if ret==wx.ID_CANCEL:
5378
+ dlg.Destroy()
5379
+ return
5380
+
5381
+ interval=float(dlg.GetValue())/100.
5382
+
5383
+ dlg.Destroy()
5384
+
5385
+ zones_names=[curz.myname for curz in self.myzones]
5386
+ if "intersect" in zones_names:
5387
+ dlg = wx.MessageDialog(None,_('Do you want to use the intersect zone ?'),style=wx.YES_NO)
5388
+ ret=dlg.ShowModal()
5389
+ if ret==wx.ID_YES:
5390
+ inter = True
5391
+ else:
5392
+ inter = False
5393
+ dlg.Destroy()
5394
+ else:
5395
+ inter = False
5396
+
5397
+ inter_zone = None
5398
+ if inter:
5399
+ inter_zone = self.myzones[zones_names.index("intersect")]
5400
+
5401
+ dlg = wx.MessageDialog(None,_('Do you want to separate left and right polygons ?'),style=wx.YES_NO)
5402
+ ret=dlg.ShowModal()
5403
+ if ret==wx.ID_YES:
5404
+ howmany = 2
5405
+ else:
5406
+ howmany = 1
5407
+
5408
+ self.active_zone.create_sliding_polygon_from_parallel(ds, sliding, farthest, interval, inter_zone, howmany)
5409
+
5410
+
5256
5411
  def Oncreatebin(self,event:wx.MouseEvent):
5257
5412
  """
5258
5413
  Création d'un canal sur base de 3 parallèles
@@ -5985,7 +6140,7 @@ class Zones(wx.Frame, Element_To_Draw):
5985
6140
 
5986
6141
  Pousse la même information dans l'objet parent s'il existe
5987
6142
  """
5988
-
6143
+
5989
6144
  if self.wx_exists:
5990
6145
  self.active_zone = object
5991
6146
 
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 = 43
8
+ self.patch = 44
9
9
 
10
10
  def __str__(self):
11
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wolfhece
3
- Version: 2.1.43
3
+ Version: 2.1.44
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
@@ -15,7 +15,7 @@ wolfhece/PyParams.py,sha256=wwgmP-_7wiiPLTcyX8a5jR6FyC1D2c4oBPc1VWQqtSA,97383
15
15
  wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
16
16
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
17
17
  wolfhece/PyVertex.py,sha256=vJ-NbnhPiTuFvDfAF7wfrEzVmladx5Ts0zKsyfySV3Q,40390
18
- wolfhece/PyVertexvectors.py,sha256=a-e3nXcFxlhYz99N-7ID006fmhFZVHPqu5shwYI-kkY,228768
18
+ wolfhece/PyVertexvectors.py,sha256=9MT7Qa37dnItmL4ml9O0NUY4SAee2SMWLd2FfL1oMTg,233710
19
19
  wolfhece/PyWMS.py,sha256=fyyzm2HFwq8aRwVYHKiBatcZOeKnFi6DWhv4nfscySQ,4602
20
20
  wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
21
21
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
@@ -71,7 +71,7 @@ wolfhece/apps/check_install.py,sha256=icFpkjfwNGDX-0NZVa-ijrCrqmGHEKDiFphjN8uTyh
71
71
  wolfhece/apps/curvedigitizer.py,sha256=_hRR2PWow7PU7rTHIbc6ykZ08tCXcK9uy7RFrb4EKkE,5196
72
72
  wolfhece/apps/isocurrent.py,sha256=MuwTodHxdc6PrqNpphR2ntYf1NLL2n9klTPndGrOHDQ,4109
73
73
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
74
- wolfhece/apps/version.py,sha256=bdB4GLg3IhfwQHauAp6z5E9rLmkR59cxO5aUkbNU2TU,388
74
+ wolfhece/apps/version.py,sha256=42X8KC4MhMsyZkkbTyYj1S26AzOp9fQtCIqVNikPw5o,388
75
75
  wolfhece/apps/wolf.py,sha256=mM6Tyi4DlKQILmO49cDUCip9fYVy-hLXkY3YhZgIeUQ,591
76
76
  wolfhece/apps/wolf2D.py,sha256=yPQGee7fsegoQ8GfWKrWEjX1Az_ApL-UWlBiqPvaIyY,565
77
77
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -276,8 +276,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
276
276
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
277
277
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
278
278
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
279
- wolfhece-2.1.43.dist-info/METADATA,sha256=FUr3BN23BBFsn9AwKtIf3LAphvxPmNW5opQgwtJZAVU,2463
280
- wolfhece-2.1.43.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
281
- wolfhece-2.1.43.dist-info/entry_points.txt,sha256=yggeO1Fa80pi2BrOd9k5dTkiFlefGPwG6HztZhY0-qw,366
282
- wolfhece-2.1.43.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
283
- wolfhece-2.1.43.dist-info/RECORD,,
279
+ wolfhece-2.1.44.dist-info/METADATA,sha256=z3vYq9zp0CQf9Rg8X1x3H2PER-At8R863VPkddKCfYo,2463
280
+ wolfhece-2.1.44.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
281
+ wolfhece-2.1.44.dist-info/entry_points.txt,sha256=yggeO1Fa80pi2BrOd9k5dTkiFlefGPwG6HztZhY0-qw,366
282
+ wolfhece-2.1.44.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
283
+ wolfhece-2.1.44.dist-info/RECORD,,