wolfhece 2.1.108__py3-none-any.whl → 2.1.109__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
@@ -5064,7 +5064,7 @@ class WolfMapViewer(wx.Frame):
5064
5064
  value = dlg.GetValue()/100.
5065
5065
  dlg.Destroy()
5066
5066
 
5067
- fig,ax = self.mylazgrid.plot_laz(self.active_vector.asshapely_ls(), length_buffer=value, show=False)
5067
+ fig = self.mylazgrid.plot_laz_wx(self.active_vector.asshapely_ls(), length_buffer=value, show=True)
5068
5068
 
5069
5069
  if self.active_array is not None:
5070
5070
  copy_vec = vector()
@@ -5073,9 +5073,12 @@ class WolfMapViewer(wx.Frame):
5073
5073
  copy_vec.get_values_on_vertices(self.active_array)
5074
5074
  s,z = copy_vec.get_sz()
5075
5075
  notmasked = np.where(z != -99999.)
5076
- ax.plot(s[notmasked], z[notmasked], c='black', linewidth=2.0)
5077
5076
 
5078
- fig.show()
5077
+ fig.plot(s,z, c='black', linewidth=2.0)
5078
+
5079
+ # ax.plot(s[notmasked], z[notmasked], c='black', linewidth=2.0)
5080
+
5081
+ # fig.show()
5079
5082
 
5080
5083
  def clip_laz_gridded(self):
5081
5084
  """ Clip laz grid on current zoom """
@@ -6501,11 +6504,11 @@ class WolfMapViewer(wx.Frame):
6501
6504
  self.select_active_array_from_laz(self.active_array)
6502
6505
 
6503
6506
  elif itemlabel == _('Plot LAZ around active vector'):
6504
-
6507
+ autoscale = False
6505
6508
  self.plot_laz_around_active_vec()
6506
6509
 
6507
6510
  elif itemlabel == _('Plot LAZ around temporary vector'):
6508
-
6511
+ autoscale = False
6509
6512
  self.active_vector = vector()
6510
6513
  self.active_vector.add_vertex(wolfvertex(0.,0.))
6511
6514
  self.mimicme()
@@ -6515,9 +6518,11 @@ class WolfMapViewer(wx.Frame):
6515
6518
  elif itemlabel == _('Change colors - Classification'):
6516
6519
 
6517
6520
  if self.mylazgrid is not None:
6521
+ autoscale = False
6518
6522
  self.mylazgrid.colors.interactive_update_colors()
6519
6523
 
6520
6524
  elif itemlabel == _('Multiviewer'):
6525
+ autoscale = False
6521
6526
  dlg = wx.NumberEntryDialog(self, _("Additional viewers"), _("How many?"), _("How many additional viewers?"),1, 0, 5)
6522
6527
  ret = dlg.ShowModal()
6523
6528
 
@@ -9251,6 +9256,84 @@ class WolfMapViewer(wx.Frame):
9251
9256
  self.active_vector.find_minmax()
9252
9257
  self.active_zone.find_minmax()
9253
9258
 
9259
+ elif self.action == 'move vector':
9260
+
9261
+ if self.active_vector is None:
9262
+ logging.warning(_('No vector selected -- Please select a vector first !'))
9263
+ return
9264
+
9265
+ if self.active_vector._start_move is None:
9266
+ self.active_vector._start_move = (x, y)
9267
+ return
9268
+
9269
+ delta_x = x - self.active_vector._start_move[0]
9270
+ delta_y = y - self.active_vector._start_move[1]
9271
+
9272
+ if shiftdown:
9273
+ delta_y = 0.
9274
+
9275
+ if alt:
9276
+ delta_x = 0.
9277
+
9278
+ self.active_vector.move(delta_x, delta_y)
9279
+ self.active_vector.clear_cache()
9280
+ self.end_action(_('End move vector'))
9281
+
9282
+ elif self.action == 'rotate vector':
9283
+
9284
+ if self.active_vector is None:
9285
+ logging.warning(_('No vector selected -- Please select a vector first !'))
9286
+ return
9287
+
9288
+ if self.active_vector._rotation_center is None:
9289
+ self.active_vector._rotation_center = (x,y)
9290
+ return
9291
+
9292
+ if shiftdown:
9293
+ if ctrl:
9294
+ self.active_vector._rotation_step = None
9295
+ else:
9296
+ # Set the rotation step
9297
+ self.active_vector._rotation_step = np.degrees(np.arctan2(y - self.active_vector._rotation_center[1], x - self.active_vector._rotation_center[0]))
9298
+
9299
+ self.active_vector.rotate_xy(x, y)
9300
+ self.active_vector.clear_cache()
9301
+ self.end_action(_('End rotate vector'))
9302
+
9303
+ elif self.action == 'move zone':
9304
+
9305
+ if self.active_zone is None:
9306
+ logging.warning(_('No zone selected -- Please select a zone first !'))
9307
+ return
9308
+
9309
+ if self.active_zone._start_move is None:
9310
+ self.active_zone._start_move = (x, y)
9311
+ return
9312
+
9313
+ if shiftdown:
9314
+ delta_y = 0.
9315
+
9316
+ if alt:
9317
+ delta_x = 0.
9318
+
9319
+ self.active_zone.move(x - self.active_zone._start_move[0], y - self.active_zone._start_move[1])
9320
+ self.active_zone.clear_cache()
9321
+ self.end_action(_('End move zone'))
9322
+
9323
+ elif self.action == 'rotate zone':
9324
+
9325
+ if self.active_zone is None:
9326
+ logging.warning(_('No zone selected -- Please select a zone first !'))
9327
+ return
9328
+
9329
+ if self.active_zone._rotation_center is None:
9330
+ self.active_zone._rotation_center = (x,y)
9331
+ return
9332
+
9333
+ self.active_zone.rotate_xy(x, y)
9334
+ self.active_zone.clear_cache()
9335
+ self.end_action(_('End rotate zone'))
9336
+
9254
9337
  elif self.action == 'dynamic parallel':
9255
9338
  # Create a dynamic parallel line
9256
9339
  if ctrl:
@@ -9891,6 +9974,45 @@ class WolfMapViewer(wx.Frame):
9891
9974
  if self.action == 'dynamic parallel':
9892
9975
  self.active_zone.parallel_active(self.dynapar_dist)
9893
9976
 
9977
+ if self.action == 'move vector':
9978
+ if self.active_vector is not None:
9979
+ if self.active_vector._start_move is not None:
9980
+
9981
+ delta_x = x - self.active_vector._start_move[0]
9982
+ delta_y = y - self.active_vector._start_move[1]
9983
+
9984
+ if shiftdown:
9985
+ delta_y = 0.
9986
+
9987
+ if altdown:
9988
+ delta_x = 0.
9989
+
9990
+ self.active_vector.move(delta_x, delta_y)
9991
+
9992
+ if self.action == 'rotate vector':
9993
+ if self.active_vector is not None:
9994
+ if self.active_vector._rotation_center is not None:
9995
+ self.active_vector.rotate_xy(x, y)
9996
+
9997
+ if self.action == 'move zone':
9998
+ if self.active_zone is not None:
9999
+ if self.active_zone._start_move is not None:
10000
+ delta_x = x - self.active_zone._start_move[0]
10001
+ delta_y = y - self.active_zone._start_move[1]
10002
+
10003
+ if shiftdown:
10004
+ delta_y = 0.
10005
+
10006
+ if altdown:
10007
+ delta_x = 0.
10008
+
10009
+ self.active_zone.move(delta_x, delta_y)
10010
+
10011
+ if self.action == 'rotate zone':
10012
+ if self.active_zone is not None:
10013
+ if self.active_zone._rotation_center is not None:
10014
+ self.active_zone.rotate_xy(x, y)
10015
+
9894
10016
  self.Paint()
9895
10017
 
9896
10018
  self._last_mouse_pos = (x,y,pos)
wolfhece/PyVertex.py CHANGED
@@ -113,6 +113,22 @@ class wolfvertex:
113
113
  self.in_use = True
114
114
  self.values = None
115
115
 
116
+ def rotate(self, angle:float, center:tuple):
117
+ """ Rotate the vertex
118
+
119
+ :param angle: angle in radians (positive for counterclockwise)
120
+ :param center: center of the rotation (x, y)
121
+ """
122
+
123
+ x = self.x - center[0]
124
+ y = self.y - center[1]
125
+
126
+ x1 = x * math.cos(angle) - y * math.sin(angle)
127
+ y1 = x * math.sin(angle) + y * math.cos(angle)
128
+
129
+ self.x = x1 + center[0]
130
+ self.y = y1 + center[1]
131
+
116
132
  def as_shapelypoint(self):
117
133
  """ Return a shapely Point """
118
134
 
@@ -725,7 +741,7 @@ class cloud_vertices(Element_To_Draw):
725
741
  logging.info(_('Number of entities : ')+str(len(msp)))
726
742
  logging.info(_('Number of layers : ')+str(len(doc.layers)))
727
743
  logging.info(_('Treating entities... '))
728
-
744
+
729
745
  # Bouclage sur les éléments du DXF
730
746
  k=0
731
747
  for e in msp: