wolfhece 2.1.121__py3-none-any.whl → 2.1.122__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.
@@ -745,15 +745,8 @@ class vectorproperties:
745
745
 
746
746
  text = props[('Legend','Text')]
747
747
 
748
- self.parent.set_legend_text(text)
749
-
750
748
  self.legendvisible = props[('Legend','Visible')]
751
749
 
752
- posx = props[('Legend','X')]
753
- posy = props[('Legend','Y')]
754
-
755
- self.parent.set_legend_position(posx,posy)
756
-
757
750
  self.legendlength = props[('Legend','Length')]
758
751
  self.legendheight = props[('Legend','Height')]
759
752
  self.legendpriority = props[('Legend','Priority')]
@@ -804,6 +797,13 @@ class vectorproperties:
804
797
  self.parent.move(dx,dy)
805
798
  self.parent.clear_cache()
806
799
 
800
+ # FIXME : Must be positionned here to avoid bug during update of move and rotate
801
+ # set_legend_position and set_legend_text will call update_props... It is not a good idea !!
802
+ posx = props[('Legend','X')]
803
+ posy = props[('Legend','Y')]
804
+ self.parent.set_legend_position(posx,posy)
805
+ self.parent.set_legend_text(text)
806
+
807
807
  self.load_unload_image()
808
808
 
809
809
  try:
@@ -974,8 +974,8 @@ if :\n \
974
974
  self.myprops[('Legend','Visible')] = self.legendvisible
975
975
  self.myprops[('Legend','Text')] = self.legendtext
976
976
  self.myprops[('Legend','Relative position')]=self.legendrelpos
977
- self.myprops[('Legend','X')] = self.legendx
978
- self.myprops[('Legend','Y')] = self.legendy
977
+ self.myprops[('Legend','X')] = str(self.legendx)
978
+ self.myprops[('Legend','Y')] = str(self.legendy)
979
979
  self.myprops[('Legend','Bold')] = self.legendbold
980
980
  self.myprops[('Legend','Italic')] = self.legenditalic
981
981
 
@@ -1163,19 +1163,19 @@ class vector:
1163
1163
  pass
1164
1164
  elif x.lower() == _('median'):
1165
1165
  # valeur mediane selon x et y
1166
- xy = self.asnparray()
1166
+ xy = self.xy
1167
1167
  self.myprop.legendx = np.median(xy[:,0])
1168
1168
  elif x.lower() == _('mean'):
1169
1169
  # valeur moyenne selon x et y
1170
- xy = self.asnparray()
1170
+ xy = self.xy
1171
1171
  self.myprop.legendx = np.mean(xy[:,0])
1172
1172
  elif x.lower() == _('min'):
1173
1173
  # valeur minimale selon x et y
1174
- xy = self.asnparray()
1174
+ xy = self.xy
1175
1175
  self.myprop.legendx = np.min(xy[:,0])
1176
1176
  elif x.lower() == _('max'):
1177
1177
  # valeur maximale selon x et y
1178
- xy = self.asnparray()
1178
+ xy = self.xy
1179
1179
  self.myprop.legendx = np.max(xy[:,0])
1180
1180
  elif x.lower() == _('first'):
1181
1181
  self.myprop.legendx = self.myvertices[0].x
@@ -1191,19 +1191,19 @@ class vector:
1191
1191
  pass
1192
1192
  elif y.lower() == _('median'):
1193
1193
  # valeur mediane selon x et y
1194
- xy = self.asnparray()
1194
+ xy = self.xy
1195
1195
  self.myprop.legendy = np.median(xy[:,1])
1196
1196
  elif y.lower() == _('mean'):
1197
1197
  # valeur moyenne selon x et y
1198
- xy = self.asnparray()
1198
+ xy = self.xy
1199
1199
  self.myprop.legendy = np.mean(xy[:,1])
1200
1200
  elif y.lower() == _('min'):
1201
1201
  # valeur minimale selon x et y
1202
- xy = self.asnparray()
1202
+ xy = self.xy
1203
1203
  self.myprop.legendy = np.min(xy[:,1])
1204
1204
  elif y.lower() == _('max'):
1205
1205
  # valeur maximale selon x et y
1206
- xy = self.asnparray()
1206
+ xy = self.xy
1207
1207
  self.myprop.legendy = np.max(xy[:,1])
1208
1208
  elif y.lower() == _('first'):
1209
1209
  self.myprop.legendy = self.myvertices[0].y
@@ -3344,7 +3344,7 @@ class zone:
3344
3344
  logging.error(_('No rotation center defined - Set it before rotating by this routine'))
3345
3345
  return self
3346
3346
 
3347
- angle = np.degree(np.arctan2(y-self._rotation_center[1], x-self._rotation_center[0]))
3347
+ angle = np.degrees(-np.arctan2(y-self._rotation_center[1], x-self._rotation_center[0]))
3348
3348
 
3349
3349
  if self._rotation_step is not None:
3350
3350
  angle = np.round(angle/self._rotation_step)*self._rotation_step
@@ -3888,6 +3888,41 @@ class zone:
3888
3888
 
3889
3889
  return mytri
3890
3890
 
3891
+ def create_tri_crosssection(self, ds:float = 1.) -> Triangulation:
3892
+ """ Create a triangulation like cross sections and support vectors """
3893
+
3894
+ supports = [curv for curv in self.myvectors if curv.myname.startswith('support')]
3895
+ others = [curv for curv in self.myvectors if curv not in supports]
3896
+
3897
+ if len(supports) ==0:
3898
+ logging.error(_('No support vector found'))
3899
+ return None
3900
+
3901
+ if len(others) == 0:
3902
+ logging.error(_('No cross section vector found'))
3903
+ return None
3904
+
3905
+ from .PyCrosssections import Interpolators, crosssections, profile
3906
+
3907
+ banks = Zones(plotted=False)
3908
+ onezone = zone(name='support')
3909
+ banks.add_zone(onezone, forceparent=True)
3910
+ onezone.myvectors = supports
3911
+
3912
+ cs = crosssections(plotted=False)
3913
+ for curprof in others:
3914
+ cs.add(curprof)
3915
+
3916
+ cs.verif_bed()
3917
+ cs.find_minmax(True)
3918
+ cs.init_cloud()
3919
+ cs.sort_along(supports[0].asshapely_ls(), 'poly', downfirst = False)
3920
+ # cs.set_zones(True)
3921
+
3922
+ interp = Interpolators(banks, cs, ds)
3923
+
3924
+ return interp
3925
+
3891
3926
  def create_constrainedDelaunay(self, nb=None) -> Triangulation:
3892
3927
  """
3893
3928
  Création d'une triangulation Delaunay contrainte sur base des vecteurs
@@ -3933,7 +3968,7 @@ class zone:
3933
3968
  # redécoupage des polylines
3934
3969
  s = np.linspace(0.,1.,num=nb,endpoint=True)
3935
3970
 
3936
- newls = [LineString([curls.interpolate(curs,True) for curs in s]) for curls in myls]
3971
+ newls = [LineString([curls.interpolate(curs,True) for curs in s]) for curls in myls if curls.length>0.]
3937
3972
 
3938
3973
  # Récupération des coordonnées des points
3939
3974
  xyz = [np.asarray(curls.coords[:]) for curls in newls]
@@ -4536,7 +4571,7 @@ class zone:
4536
4571
  sublsr.reverse()
4537
4572
 
4538
4573
  sublsc=veccenter.substring(ptc1,ptc2,is3D=False, adim=False)
4539
- sublscr = sublsc.copy()
4574
+ sublscr = sublsc.deepcopy()
4540
4575
  sublscr.reverse()
4541
4576
 
4542
4577
  upl = [wolfvertex(pt[i].x, pt[i].y) for pt in ptl.values()]
@@ -5156,8 +5191,8 @@ class zone:
5156
5191
  locvec.show_properties()
5157
5192
  self.myprops = locvec.myprop.myprops
5158
5193
 
5159
- self.myprops[('Legend','X')] = 99999.
5160
- self.myprops[('Legend','Y')] = 99999.
5194
+ self.myprops[('Legend','X')] = str(99999.)
5195
+ self.myprops[('Legend','Y')] = str(99999.)
5161
5196
  self.myprops[('Legend','Text')] = _('Not used')
5162
5197
 
5163
5198
  if self._rotation_center is None:
@@ -6134,7 +6169,8 @@ class Zones(wx.Frame, Element_To_Draw):
6134
6169
  self.xls=CpGrid(self,-1,wx.WANTS_CHARS)
6135
6170
  self.xls.CreateGrid(10,6)
6136
6171
 
6137
- self.addrows = wx.Button(self,label=_('Add rows to grid'))
6172
+ sizer_add_update = BoxSizer(orient=wx.HORIZONTAL)
6173
+ self.addrows = wx.Button(self,label=_('Add rows'))
6138
6174
  self.addrows.SetToolTip(_("Add rows to the grid --> Useful for manually adding some points to a vector"))
6139
6175
  self.addrows.Bind(wx.EVT_BUTTON,self.Onaddrows)
6140
6176
 
@@ -6142,6 +6178,9 @@ class Zones(wx.Frame, Element_To_Draw):
6142
6178
  self.updatevertices.SetToolTip(_("Transfer the coordinates from the editor to the memory and update the plot"))
6143
6179
  self.updatevertices.Bind(wx.EVT_BUTTON,self.Onupdatevertices)
6144
6180
 
6181
+ sizer_add_update.Add(self.addrows,1, wx.EXPAND)
6182
+ sizer_add_update.Add(self.updatevertices,3, wx.EXPAND)
6183
+
6145
6184
  self.capturevertices = wx.Button(self,label=_('Add'))
6146
6185
  self.capturevertices.SetToolTip(_("Capture new points from mouse clicks \n\n Keyboard 'Return' to stop the action ! "))
6147
6186
  self.capturevertices.Bind(wx.EVT_BUTTON,self.Oncapture)
@@ -6158,6 +6197,7 @@ class Zones(wx.Frame, Element_To_Draw):
6158
6197
  self.createapar.SetToolTip(_("Create a single parallel to the currently activated vector as a new vector in the same zone"))
6159
6198
  self.createapar.Bind(wx.EVT_BUTTON,self.OnAddPar)
6160
6199
 
6200
+ sizer_reverse_split = BoxSizer(orient=wx.HORIZONTAL)
6161
6201
  self.reverseorder = wx.Button(self,label=_('Reverse points order'))
6162
6202
  self.reverseorder.SetToolTip(_("Reverse the order/sens of the currently activated vector -- Overwrite the data"))
6163
6203
  self.reverseorder.Bind(wx.EVT_BUTTON,self.OnReverse)
@@ -6206,35 +6246,51 @@ class Zones(wx.Frame, Element_To_Draw):
6206
6246
  self.binfrom3.SetToolTip(_("Create a bin/rectangular channel based on 3 vectors in the currently active zone \n Some parameters will be prompted to the user (lateral height, ...) and if a triangular mesh must be created --> Blender"))
6207
6247
  self.binfrom3.Bind(wx.EVT_BUTTON,self.Oncreatebin)
6208
6248
 
6209
- self.trifromall = wx.Button(self,label=_('Create triangulation'))
6249
+ sizer_triangulation = wx.BoxSizer(wx.HORIZONTAL)
6250
+ self.trifromall = wx.Button(self,label=_('Triangulation'))
6210
6251
  self.trifromall.SetToolTip(_("Create a triangular mesh based on all vectors within the currently active zone.\nUse the vertices as they are after subdividing the vectors into a specified number of points.\nAdd the resulting mesh to the GUI.\nThis can be useful in certain interpolation methods."))
6211
6252
  self.trifromall.Bind(wx.EVT_BUTTON,self.Oncreatemultibin)
6212
6253
 
6213
- self.trifromall_proj = wx.Button(self,label=_('Create triangulation (projection)'))
6254
+ self.trifromall_proj = wx.Button(self,label=_('Triang. (projection)'))
6214
6255
  self.trifromall_proj.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone.\nGenerate vertices by projecting the central polyline, or the nearest one if there is an even number of polylines, onto the other polylines.\nAdd the resulting mesh to the GUI.\nThis can be useful in certain interpolation methods."))
6215
6256
  self.trifromall_proj.Bind(wx.EVT_BUTTON,self.Oncreatemultibin_project)
6216
6257
 
6217
- self.constrainedDelaunay = wx.Button(self,label=_('Constrained Delaunay'))
6258
+ sizer_triangulation.Add(self.trifromall, 1, wx.EXPAND)
6259
+ sizer_triangulation.Add(self.trifromall_proj, 1, wx.EXPAND)
6260
+
6261
+ sizer_delaunay = wx.BoxSizer(wx.HORIZONTAL)
6262
+ self.constrainedDelaunay = wx.Button(self,label=_('Constr. Delaunay'))
6218
6263
  self.constrainedDelaunay.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone."))
6219
6264
  self.constrainedDelaunay.Bind(wx.EVT_BUTTON,self.OnconstrainedDelaunay)
6220
6265
 
6221
- self.polyfrompar = wx.Button(self,label=_('Create polygons from parallels'))
6266
+ self.tri_cs = wx.Button(self,label=_('Triang. (cross-section)'))
6267
+ self.tri_cs.SetToolTip(_("Create a triangular mesh based on all vectors in the currently active zone.\nSupport vectors must have 'support' in their name.\nOthers must cross the supports."))
6268
+ self.tri_cs.Bind(wx.EVT_BUTTON,self.Oncreatetricrosssection)
6269
+
6270
+ sizer_delaunay.Add(self.constrainedDelaunay, 1, wx.EXPAND)
6271
+ sizer_delaunay.Add(self.tri_cs, 1, wx.EXPAND)
6272
+
6273
+ sizer_polygons = wx.BoxSizer(wx.HORIZONTAL)
6274
+ self.polyfrompar = wx.Button(self,label=_('Polygons from paral.'))
6222
6275
  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")))
6223
6276
  self.polyfrompar.Bind(wx.EVT_BUTTON,self.Oncreatepolygons)
6224
6277
 
6225
- self.slidingpoly = wx.Button(self,label=_('Create sliding polygons'))
6278
+ self.slidingpoly = wx.Button(self,label=_('Sliding polygons'))
6226
6279
  self.slidingpoly.SetToolTip(_("Create sliding polygons in a new zone"))
6227
6280
  self.slidingpoly.Bind(wx.EVT_BUTTON,self.Oncreateslidingpoly)
6228
6281
 
6282
+ sizer_polygons.Add(self.polyfrompar, 1, wx.EXPAND)
6283
+ sizer_polygons.Add(self.slidingpoly, 1, wx.EXPAND)
6284
+
6229
6285
  # Added
6230
6286
  self.getxyfromsz = wx.Button(self, label = _('Update from sz (2 points)'))
6231
6287
  self.getxyfromsz.SetToolTip(_("Populate the X an Y columns based on: \n - Given sz coordinates, \n - 2 Points \n - The X and Y coordinates of the initial point (s = 0) and, \n - The X and Y coordinates of a second point (for the direction)"))
6232
6288
  self.getxyfromsz.Bind(wx.EVT_BUTTON, self.get_xy_from_sz)
6233
6289
 
6234
6290
  boxright.Add(self.xls,1,wx.EXPAND)
6235
- boxright.Add(self.addrows,0,wx.EXPAND)
6291
+ boxright.Add(sizer_add_update,0,wx.EXPAND)
6236
6292
 
6237
- boxright.Add(self.updatevertices,0,wx.EXPAND)
6293
+ # boxright.Add(self.updatevertices,0,wx.EXPAND)
6238
6294
 
6239
6295
  subboxadd = BoxSizer(orient=wx.HORIZONTAL)
6240
6296
  subboxadd.Add(self.capturevertices,1,wx.EXPAND)
@@ -6247,8 +6303,11 @@ class Zones(wx.Frame, Element_To_Draw):
6247
6303
  boxright.Add(subboxmod,0,wx.EXPAND)
6248
6304
 
6249
6305
  boxright.Add(self.createapar,0,wx.EXPAND)
6250
- boxright.Add(self.reverseorder,0,wx.EXPAND)
6251
- boxright.Add(self.splitvertices,0,wx.EXPAND)
6306
+
6307
+ sizer_reverse_split.Add(self.reverseorder,1,wx.EXPAND)
6308
+ sizer_reverse_split.Add(self.splitvertices,1,wx.EXPAND)
6309
+ boxright.Add(sizer_reverse_split,0,wx.EXPAND)
6310
+ # boxright.Add(self.splitvertices,0,wx.EXPAND)
6252
6311
 
6253
6312
  # boxright.Add(self.zoomonactive,0,wx.EXPAND)
6254
6313
  boxright.Add(boxzoom,0,wx.EXPAND)
@@ -6263,16 +6322,16 @@ class Zones(wx.Frame, Element_To_Draw):
6263
6322
  boxright.Add(self.interpxyz,0,wx.EXPAND)
6264
6323
  boxright.Add(self.sascending,0,wx.EXPAND)
6265
6324
 
6266
- self.butgetval = wx.Button(self,label=_('Get values (self or active array)'))
6325
+ self.butgetval = wx.Button(self,label=_('Get values'))
6267
6326
  self.butgetval.SetToolTip(_("Get values of the attached/active array (not working with 2D results) on each vertex of the active vector and update the editor"))
6268
6327
  self.butgetval.Bind(wx.EVT_BUTTON,self.Ongetvalues)
6269
6328
  boxright.Add(self.butgetval,0,wx.EXPAND)
6270
6329
 
6271
- self.butgetvallinked = wx.Button(self,label=_('Get values (all arrays)'))
6330
+ self.butgetvallinked = wx.Button(self,label=_('Get values (all)'))
6272
6331
  self.butgetvallinked.SetToolTip(_("Get values of all the visible arrays and 2D results on each vertex of the active vector \n\n Create a new zone containing the results"))
6273
6332
  self.butgetvallinked.Bind(wx.EVT_BUTTON,self.Ongetvalueslinked)
6274
6333
 
6275
- self.butgetrefvallinked = wx.Button(self,label=_('Get values (all arrays and remeshing)'))
6334
+ self.butgetrefvallinked = wx.Button(self,label=_('Get values (all and remeshing)'))
6276
6335
  self.butgetrefvallinked.SetToolTip(_("Get values of all the visible arrays and 2D results on each vertex of the active vector \n and more is the step size of the array is more precise \n\n Create a new zone containing the results"))
6277
6336
  self.butgetrefvallinked.Bind(wx.EVT_BUTTON,self.Ongetvalueslinkedandref)
6278
6337
 
@@ -6289,8 +6348,13 @@ class Zones(wx.Frame, Element_To_Draw):
6289
6348
  self._move_rotate_sizer.Add(self.butmove, 1, wx.EXPAND)
6290
6349
  self._move_rotate_sizer.Add(self.butrotate, 1, wx.EXPAND)
6291
6350
 
6292
- boxright.Add(self.butgetvallinked,0,wx.EXPAND)
6293
- boxright.Add(self.butgetrefvallinked,0,wx.EXPAND)
6351
+ sizer_budget = wx.BoxSizer(wx.HORIZONTAL)
6352
+ sizer_budget.Add(self.butgetvallinked,1,wx.EXPAND)
6353
+ sizer_budget.Add(self.butgetrefvallinked,1,wx.EXPAND)
6354
+ boxright.Add(sizer_budget,0,wx.EXPAND)
6355
+ # boxright.Add(self.butgetrefvallinked,0,wx.EXPAND)
6356
+
6357
+
6294
6358
  boxright.Add(self._move_rotate_sizer, 0, wx.EXPAND)
6295
6359
 
6296
6360
  self.treelist = TreeListCtrl(self,style=TL_CHECKBOX|wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_EDIT_LABELS)
@@ -6308,9 +6372,13 @@ class Zones(wx.Frame, Element_To_Draw):
6308
6372
  self.labelactzone.Wrap( -1 )
6309
6373
  self.labelactzone.SetToolTip(_('Name of the active zone'))
6310
6374
 
6375
+ sizer_addzonevector=wx.BoxSizer(wx.HORIZONTAL)
6311
6376
  self.addzone = wx.Button(self,label=_('Add zone'))
6312
6377
  self.addvector = wx.Button(self,label=_('Add vector'))
6313
6378
 
6379
+ sizer_addzonevector.Add(self.addzone,1,wx.EXPAND)
6380
+ sizer_addzonevector.Add(self.addvector,1,wx.EXPAND)
6381
+
6314
6382
  self.duplicatezone = wx.Button(self,label=_('Duplicate zone'))
6315
6383
  self.duplicatevector = wx.Button(self,label=_('Duplicate vector'))
6316
6384
 
@@ -6359,8 +6427,8 @@ class Zones(wx.Frame, Element_To_Draw):
6359
6427
 
6360
6428
  boxadd.Add(self.labelactvect,1,wx.EXPAND)
6361
6429
  boxadd.Add(self.labelactzone,1,wx.EXPAND)
6362
- boxadd.Add(self.addzone,1,wx.EXPAND)
6363
- boxadd.Add(self.addvector,1,wx.EXPAND)
6430
+ boxadd.Add(sizer_addzonevector,1,wx.EXPAND)
6431
+ # boxadd.Add(self.addvector,1,wx.EXPAND)
6364
6432
 
6365
6433
  boxduplicate = wx.BoxSizer(wx.HORIZONTAL)
6366
6434
  boxduplicate.Add(self.duplicatezone,1,wx.EXPAND)
@@ -6390,11 +6458,13 @@ class Zones(wx.Frame, Element_To_Draw):
6390
6458
  boxtri = wx.BoxSizer(wx.VERTICAL)
6391
6459
  boxtri.Add(self.saveimages,1,wx.EXPAND)
6392
6460
  boxtri.Add(self.binfrom3,1,wx.EXPAND)
6393
- boxtri.Add(self.trifromall,1,wx.EXPAND)
6394
- boxtri.Add(self.trifromall_proj,1,wx.EXPAND)
6395
- boxtri.Add(self.constrainedDelaunay,1,wx.EXPAND)
6396
- boxtri.Add(self.polyfrompar,1,wx.EXPAND)
6397
- boxtri.Add(self.slidingpoly,1,wx.EXPAND)
6461
+ boxtri.Add(sizer_triangulation,1,wx.EXPAND)
6462
+ # boxtri.Add(self.trifromall,1,wx.EXPAND)
6463
+ # boxtri.Add(self.trifromall_proj,1,wx.EXPAND)
6464
+ boxtri.Add(sizer_delaunay,1,wx.EXPAND)
6465
+ boxtri.Add(sizer_polygons,1,wx.EXPAND)
6466
+ # boxtri.Add(self.polyfrompar,1,wx.EXPAND)
6467
+ # boxtri.Add(self.slidingpoly,1,wx.EXPAND)
6398
6468
 
6399
6469
  boxleft.Add(self.treelist,1,wx.EXPAND)
6400
6470
  boxleft.Add(boxadd,0,wx.EXPAND)
@@ -6446,7 +6516,7 @@ class Zones(wx.Frame, Element_To_Draw):
6446
6516
  return
6447
6517
 
6448
6518
  # Getting the 2 first XY coordinates
6449
- X =[]
6519
+ X = []
6450
6520
  Y = []
6451
6521
 
6452
6522
  z_row = 1 #Starting from the second row because the first one is the initial point
@@ -6481,6 +6551,8 @@ class Zones(wx.Frame, Element_To_Draw):
6481
6551
  xy1 = np.array([X[0], Y[0]])
6482
6552
  xy2 = np.array([X[1], Y[1]])
6483
6553
 
6554
+ # xy2 /= np.linalg.norm(xy2 - xy1)
6555
+
6484
6556
  # Collection of sz coordinates
6485
6557
  row = 0
6486
6558
 
@@ -7127,6 +7199,33 @@ class Zones(wx.Frame, Element_To_Draw):
7127
7199
  self.mapviewer.add_object('triangulation',newobj=mytri)
7128
7200
  self.mapviewer.Refresh()
7129
7201
 
7202
+ def Oncreatetricrosssection(self, event:wx.MouseEvent):
7203
+ """ Create a tringulation like cross-sections and support vectors """
7204
+ if self.wx_exists:
7205
+
7206
+ if self.get_mapviewer() is None:
7207
+ logging.warning(_('No mapviewer found'))
7208
+ return
7209
+
7210
+ if self.active_zone is None:
7211
+ logging.warning(_('No active zone found'))
7212
+ return
7213
+
7214
+ # dlg for ds value
7215
+ dlg = wx.NumberEntryDialog(None,_('What is the desired size [cm] ?'),'ds','ds size',50,1,10000)
7216
+ ret = dlg.ShowModal()
7217
+ if ret == wx.ID_CANCEL:
7218
+ dlg.Destroy()
7219
+ return
7220
+
7221
+ ds = float(dlg.GetValue())/100.
7222
+ dlg.Destroy()
7223
+
7224
+ myzone = self.active_zone
7225
+
7226
+ mapviewer = self.get_mapviewer()
7227
+ mapviewer.set_interp_cs(myzone.create_tri_crosssection(ds), True)
7228
+
7130
7229
  def OnconstrainedDelaunay(self, event:wx.MouseEvent):
7131
7230
  """
7132
7231
  Create a constrained Delaunay triangulation from the active zone
@@ -7486,6 +7585,12 @@ class Zones(wx.Frame, Element_To_Draw):
7486
7585
  """
7487
7586
  Ajout d'un vecteur à la zone courante
7488
7587
  """
7588
+
7589
+ if self.active_zone is None:
7590
+ logging.warning(_('No active zone - Can not add a vector to None !'))
7591
+ logging.warning(_('Please activate a zone first'))
7592
+ return
7593
+
7489
7594
  if self.wx_exists:
7490
7595
  curname=None
7491
7596
  dlg=wx.TextEntryDialog(None,_('Choose a name for the new vector'),value='New_Vector')
@@ -7516,6 +7621,12 @@ class Zones(wx.Frame, Element_To_Draw):
7516
7621
  """
7517
7622
  Duplication du vecteur actif
7518
7623
  """
7624
+
7625
+ if self.active_vector is None:
7626
+ logging.warning(_('No active vector - Can not duplicate None !'))
7627
+ logging.warning(_('Please activate a vector first'))
7628
+ return
7629
+
7519
7630
  if self.wx_exists:
7520
7631
  if self.verify_activevec():
7521
7632
  return
@@ -7530,6 +7641,12 @@ class Zones(wx.Frame, Element_To_Draw):
7530
7641
  """
7531
7642
  Suppression de la zone courante
7532
7643
  """
7644
+
7645
+ if self.active_zone is None:
7646
+ logging.warning(_('No active zone - Can not delete None !'))
7647
+ logging.warning(_('Please activate a zone first'))
7648
+ return
7649
+
7533
7650
  if self.wx_exists:
7534
7651
  curname=self.active_zone.myname
7535
7652
  r = wx.MessageDialog(
@@ -7836,8 +7953,8 @@ class Zones(wx.Frame, Element_To_Draw):
7836
7953
 
7837
7954
  self._myprops = locvec.myprop.myprops
7838
7955
 
7839
- self._myprops[('Legend','X')] = 99999.
7840
- self._myprops[('Legend','Y')] = 99999.
7956
+ self._myprops[('Legend','X')] = str(99999.)
7957
+ self._myprops[('Legend','Y')] = str(99999.)
7841
7958
  self._myprops[('Legend','Text')] = _('Not used')
7842
7959
 
7843
7960
  if self._rotation_center is not None:
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 = 121
8
+ self.patch = 122
9
9
 
10
10
  def __str__(self):
11
11
 
@@ -553,7 +553,7 @@ class xyz_laz_grids():
553
553
  return np.asarray([])
554
554
  else:
555
555
  ret = np.concatenate(ret)
556
- logging.info(_('Data found -- {} points'.format(ret.shape[0])))
556
+ logging.info(_('Data found -- {:_} points'.format(ret.shape[0])))
557
557
  return ret
558
558
 
559
559
  def find_files_in_bounds(self, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]]):
@@ -565,7 +565,7 @@ class xyz_laz_grids():
565
565
  logging.info(_('No data found'))
566
566
  return []
567
567
  else:
568
- logging.info(_('Data found -- {} files'.format(len(ret))))
568
+ logging.info(_('Data found -- {:_} files'.format(len(ret))))
569
569
  return ret
570
570
 
571
571
  def copy_files_in_bounds(self, bounds:Union[tuple[tuple[float,float],tuple[float,float]], list[list[float, float],list[float, float]]], dirout:str):
@@ -578,7 +578,7 @@ class xyz_laz_grids():
578
578
  files = self.find_files_in_bounds(bounds)
579
579
 
580
580
  for curdir, curfiles in files:
581
- locdir = dirout / Path(curdir).parent.name
581
+ locdir = out / Path(curdir).name
582
582
  locdir.mkdir(exist_ok=True)
583
583
  for curfile in curfiles:
584
584
  shutil.copy(curfile, locdir / Path(curfile).name)
@@ -762,6 +762,7 @@ class Wolf_LAZ_Data(Element_To_Draw):
762
762
  self._data:np.ndarray = None # Numpy data array -- to be plotted
763
763
  self._colors:np.ndarray = None # NumPy array of colors for each point --> see viewer attributes for details
764
764
  self.classification = Classification_LAZ() # Classification of LAZ data --> defining colors if codification is used
765
+ self.classification.init_2023() # Default classification for LAZ data
765
766
 
766
767
  self._associated_color:int = Colors_Lazviewer.CODE_2023.value # Associated color type for LAZ data
767
768
 
@@ -1204,7 +1205,8 @@ class Wolf_LAZ_Data(Element_To_Draw):
1204
1205
 
1205
1206
  def from_file(self, fn:str):
1206
1207
  """ Create data from LAZ file """
1207
- self.data = read_laz(fn)
1208
+ laz = read_laz(fn)
1209
+ self.data = np.column_stack((laz.x, laz.y, laz.z, laz.classification)).astype(np.float32)
1208
1210
  self.bounds = [[np.min(self.data[:,0]), np.max(self.data[:,0])],[np.min(self.data[:,1]), np.max(self.data[:,1])]]
1209
1211
 
1210
1212
  def descimate(self, step:int):
wolfhece/pybridges.py CHANGED
@@ -340,7 +340,12 @@ class Bridge(Zones):
340
340
 
341
341
  if self.leftbank is not None and self.riverbed is not None and self.rightbank is not None:
342
342
 
343
- self.polygons_zone = zone(name= "polygons_river")
343
+ keys_zones = [curzone.myname for curzone in self.myzones]
344
+ if "_river_auto" in keys_zones:
345
+ logging.warning(_('Polygons already created'))
346
+ return
347
+
348
+ self.polygons_zone = zone(name= "_river_auto")
344
349
  self.add_zone(self.polygons_zone, forceparent=True)
345
350
  self.polygons_zone.myvectors = [self.leftbank, self.riverbed, self.rightbank] #inverse order to be up -> down
346
351