wolfhece 2.1.108__py3-none-any.whl → 2.1.110__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
@@ -116,6 +116,12 @@ except ImportError as e:
116
116
  print(e)
117
117
  raise ImportError("Error importing pyshields, pyviews, PyConfig, GraphProfile, pybridges, tools_mpl, wolf_tiles, lagrangian.particle_system_ui, opengl.py3d, pyGui1D. Please check your installation.")
118
118
 
119
+ try:
120
+ from .apps.curvedigitizer import Digitizer
121
+ except ImportError as e:
122
+ print(e)
123
+ raise ImportError("Error importing apps.curvedigitizer. Please check your installation.")
124
+
119
125
  ID_SELECTCS = 1000
120
126
  ID_SORTALONG = 1001
121
127
  ID_LOCMINMAX = 1002
@@ -1363,6 +1369,7 @@ class WolfMapViewer(wx.Frame):
1363
1369
  self.menu_contour_from_arrays = self.tools_menu.Append(wx.ID_ANY, _("Create contour from checked arrays..."), _("Create contour"))
1364
1370
  self.menu_calculator = self.tools_menu.Append(wx.ID_ANY, _("Calculator..."), _("Calculator"))
1365
1371
  self.menu_views = self.tools_menu.Append(wx.ID_ANY, _("Memory views..."), _("Memory views"))
1372
+ self.menu_digitizer = self.tools_menu.Append(wx.ID_ANY, _("Image digitizer..."), _("Image Digitizer"))
1366
1373
  self.calculator = None
1367
1374
  self.memory_views = None
1368
1375
  self._memory_views_gui = None
@@ -1708,6 +1715,8 @@ class WolfMapViewer(wx.Frame):
1708
1715
 
1709
1716
  self._menuinteractptri = self.trianglesmenu.Append(wx.ID_ANY, _("Interpolate on active triangulation..."), _("InterpolateTri"))
1710
1717
  self._menucomparetri = self.trianglesmenu.Append(wx.ID_ANY, _("Compare triangles to array..."), _("Comparison"))
1718
+ self._menumovetri = self.trianglesmenu.Append(wx.ID_ANY, _("Move triangles..."), _("Move triangles"))
1719
+ self._menurotatetri = self.trianglesmenu.Append(wx.ID_ANY, _("Rotate triangles..."), _("Rotate triangles"))
1711
1720
 
1712
1721
 
1713
1722
  def create_cloud_menu(self):
@@ -3143,6 +3152,20 @@ class WolfMapViewer(wx.Frame):
3143
3152
 
3144
3153
  self.active_array.compare_tri(self.active_tri)
3145
3154
 
3155
+ def move_triangles(self):
3156
+ """ Move the active triangles """
3157
+ if self.active_tri is None:
3158
+ logging.warning(_('No active triangles -- Please activate triangles first'))
3159
+ return
3160
+ self.start_action('move triangles', 'Move the current triangulation -- Please select 2 points to define the translation vector')
3161
+
3162
+ def rotate_triangles(self):
3163
+ """ Rotate the active triangles """
3164
+ if self.active_tri is None:
3165
+ logging.warning(_('No active triangles -- Please activate triangles first'))
3166
+ return
3167
+ self.start_action('rotate triangles', 'Rotate the current triangulation -- Please select 1 point for the center')
3168
+
3146
3169
  def copy_canvasogl(self, mpl:bool= True, ds:float= 0., figsizes= [10.,10.], palette:wolfpalette = None):
3147
3170
  """
3148
3171
  Generate image based on UI context and copy to the Clipboard
@@ -5064,7 +5087,7 @@ class WolfMapViewer(wx.Frame):
5064
5087
  value = dlg.GetValue()/100.
5065
5088
  dlg.Destroy()
5066
5089
 
5067
- fig,ax = self.mylazgrid.plot_laz(self.active_vector.asshapely_ls(), length_buffer=value, show=False)
5090
+ fig = self.mylazgrid.plot_laz_wx(self.active_vector.asshapely_ls(), length_buffer=value, show=True)
5068
5091
 
5069
5092
  if self.active_array is not None:
5070
5093
  copy_vec = vector()
@@ -5073,9 +5096,12 @@ class WolfMapViewer(wx.Frame):
5073
5096
  copy_vec.get_values_on_vertices(self.active_array)
5074
5097
  s,z = copy_vec.get_sz()
5075
5098
  notmasked = np.where(z != -99999.)
5076
- ax.plot(s[notmasked], z[notmasked], c='black', linewidth=2.0)
5077
5099
 
5078
- fig.show()
5100
+ fig.plot(s,z, c='black', linewidth=2.0)
5101
+
5102
+ # ax.plot(s[notmasked], z[notmasked], c='black', linewidth=2.0)
5103
+
5104
+ # fig.show()
5079
5105
 
5080
5106
  def clip_laz_gridded(self):
5081
5107
  """ Clip laz grid on current zoom """
@@ -6267,6 +6293,14 @@ class WolfMapViewer(wx.Frame):
6267
6293
  autoscale = False
6268
6294
  self.compare_tri2array()
6269
6295
 
6296
+ elif itemlabel == _("Move triangles..."):
6297
+ autoscale = False
6298
+ self.move_triangles()
6299
+
6300
+ elif itemlabel == _("Rotate triangles..."):
6301
+ autoscale = False
6302
+ self.rotate_triangles()
6303
+
6270
6304
  elif itemlabel == _("Create contour from checked arrays..."):
6271
6305
  autoscale = False
6272
6306
 
@@ -6282,6 +6316,11 @@ class WolfMapViewer(wx.Frame):
6282
6316
  else:
6283
6317
  self.calculator.Show()
6284
6318
 
6319
+ elif itemlabel == _('Image digitizer...'):
6320
+ autoscale = False
6321
+
6322
+ new_digitizer = Digitizer()
6323
+
6285
6324
  elif itemlabel == _("Memory views..."):
6286
6325
  autoscale = False
6287
6326
 
@@ -6501,11 +6540,11 @@ class WolfMapViewer(wx.Frame):
6501
6540
  self.select_active_array_from_laz(self.active_array)
6502
6541
 
6503
6542
  elif itemlabel == _('Plot LAZ around active vector'):
6504
-
6543
+ autoscale = False
6505
6544
  self.plot_laz_around_active_vec()
6506
6545
 
6507
6546
  elif itemlabel == _('Plot LAZ around temporary vector'):
6508
-
6547
+ autoscale = False
6509
6548
  self.active_vector = vector()
6510
6549
  self.active_vector.add_vertex(wolfvertex(0.,0.))
6511
6550
  self.mimicme()
@@ -6515,9 +6554,11 @@ class WolfMapViewer(wx.Frame):
6515
6554
  elif itemlabel == _('Change colors - Classification'):
6516
6555
 
6517
6556
  if self.mylazgrid is not None:
6557
+ autoscale = False
6518
6558
  self.mylazgrid.colors.interactive_update_colors()
6519
6559
 
6520
6560
  elif itemlabel == _('Multiviewer'):
6561
+ autoscale = False
6521
6562
  dlg = wx.NumberEntryDialog(self, _("Additional viewers"), _("How many?"), _("How many additional viewers?"),1, 0, 5)
6522
6563
  ret = dlg.ShowModal()
6523
6564
 
@@ -9037,6 +9078,54 @@ class WolfMapViewer(wx.Frame):
9037
9078
 
9038
9079
  self.rightdown = (x, y)
9039
9080
 
9081
+ elif self.action == 'move triangles':
9082
+
9083
+ if self.active_tri is None:
9084
+ logging.warning(_('No triangles selected -- Please select a triangulation first !'))
9085
+ return
9086
+
9087
+ if self.active_tri._start_move is None:
9088
+ self.active_tri._start_move = (x, y)
9089
+ return
9090
+
9091
+ delta_x = x - self.active_tri._start_move[0]
9092
+ delta_y = y - self.active_tri._start_move[1]
9093
+
9094
+ if shiftdown:
9095
+ delta_y = 0.
9096
+
9097
+ if alt:
9098
+ delta_x = 0.
9099
+
9100
+ self.active_tri.move(delta_x, delta_y)
9101
+ self.active_tri.reset_plot()
9102
+ self.active_tri._start_move = None
9103
+ self.active_tri.clear_cache()
9104
+ self.end_action(_('End move triangulation'))
9105
+
9106
+ elif self.action == 'rotate triangles':
9107
+
9108
+ if self.active_tri is None:
9109
+ logging.warning(_('No vector selected -- Please select a triangulation first !'))
9110
+ return
9111
+
9112
+ if self.active_tri._rotation_center is None:
9113
+ self.active_tri._rotation_center = (x,y)
9114
+ return
9115
+
9116
+ if shiftdown:
9117
+ if ctrl:
9118
+ self.active_tri._rotation_step = None
9119
+ else:
9120
+ # Set the rotation step
9121
+ self.active_tri._rotation_step = np.degrees(np.arctan2(y - self.active_tri._rotation_center[1], x - self.active_tri._rotation_center[0]))
9122
+
9123
+ self.active_tri.rotate_xy(x, y)
9124
+ self.active_tri._rotation_center = None
9125
+ self.active_tri.clear_cache()
9126
+ self.active_tri.reset_plot()
9127
+ self.end_action(_('End rotate triangulation'))
9128
+
9040
9129
  elif 'pick landmap' in self.action:
9041
9130
  # Pick a landmap if loaded
9042
9131
 
@@ -9251,6 +9340,84 @@ class WolfMapViewer(wx.Frame):
9251
9340
  self.active_vector.find_minmax()
9252
9341
  self.active_zone.find_minmax()
9253
9342
 
9343
+ elif self.action == 'move vector':
9344
+
9345
+ if self.active_vector is None:
9346
+ logging.warning(_('No vector selected -- Please select a vector first !'))
9347
+ return
9348
+
9349
+ if self.active_vector._start_move is None:
9350
+ self.active_vector._start_move = (x, y)
9351
+ return
9352
+
9353
+ delta_x = x - self.active_vector._start_move[0]
9354
+ delta_y = y - self.active_vector._start_move[1]
9355
+
9356
+ if shiftdown:
9357
+ delta_y = 0.
9358
+
9359
+ if alt:
9360
+ delta_x = 0.
9361
+
9362
+ self.active_vector.move(delta_x, delta_y)
9363
+ self.active_vector.clear_cache()
9364
+ self.end_action(_('End move vector'))
9365
+
9366
+ elif self.action == 'rotate vector':
9367
+
9368
+ if self.active_vector is None:
9369
+ logging.warning(_('No vector selected -- Please select a vector first !'))
9370
+ return
9371
+
9372
+ if self.active_vector._rotation_center is None:
9373
+ self.active_vector._rotation_center = (x,y)
9374
+ return
9375
+
9376
+ if shiftdown:
9377
+ if ctrl:
9378
+ self.active_vector._rotation_step = None
9379
+ else:
9380
+ # Set the rotation step
9381
+ self.active_vector._rotation_step = np.degrees(np.arctan2(y - self.active_vector._rotation_center[1], x - self.active_vector._rotation_center[0]))
9382
+
9383
+ self.active_vector.rotate_xy(x, y)
9384
+ self.active_vector.clear_cache()
9385
+ self.end_action(_('End rotate vector'))
9386
+
9387
+ elif self.action == 'move zone':
9388
+
9389
+ if self.active_zone is None:
9390
+ logging.warning(_('No zone selected -- Please select a zone first !'))
9391
+ return
9392
+
9393
+ if self.active_zone._start_move is None:
9394
+ self.active_zone._start_move = (x, y)
9395
+ return
9396
+
9397
+ if shiftdown:
9398
+ delta_y = 0.
9399
+
9400
+ if alt:
9401
+ delta_x = 0.
9402
+
9403
+ self.active_zone.move(x - self.active_zone._start_move[0], y - self.active_zone._start_move[1])
9404
+ self.active_zone.clear_cache()
9405
+ self.end_action(_('End move zone'))
9406
+
9407
+ elif self.action == 'rotate zone':
9408
+
9409
+ if self.active_zone is None:
9410
+ logging.warning(_('No zone selected -- Please select a zone first !'))
9411
+ return
9412
+
9413
+ if self.active_zone._rotation_center is None:
9414
+ self.active_zone._rotation_center = (x,y)
9415
+ return
9416
+
9417
+ self.active_zone.rotate_xy(x, y)
9418
+ self.active_zone.clear_cache()
9419
+ self.end_action(_('End rotate zone'))
9420
+
9254
9421
  elif self.action == 'dynamic parallel':
9255
9422
  # Create a dynamic parallel line
9256
9423
  if ctrl:
@@ -9891,6 +10058,68 @@ class WolfMapViewer(wx.Frame):
9891
10058
  if self.action == 'dynamic parallel':
9892
10059
  self.active_zone.parallel_active(self.dynapar_dist)
9893
10060
 
10061
+ if self.action == 'move vector':
10062
+ if self.active_vector is not None:
10063
+ if self.active_vector._start_move is not None:
10064
+
10065
+ delta_x = x - self.active_vector._start_move[0]
10066
+ delta_y = y - self.active_vector._start_move[1]
10067
+
10068
+ if shiftdown:
10069
+ delta_y = 0.
10070
+
10071
+ if altdown:
10072
+ delta_x = 0.
10073
+
10074
+ self.active_vector.move(delta_x, delta_y)
10075
+
10076
+ if self.action == 'move triangles':
10077
+ if self.active_tri is not None:
10078
+ if self.active_tri._start_move is not None:
10079
+
10080
+ delta_x = x - self.active_tri._start_move[0]
10081
+ delta_y = y - self.active_tri._start_move[1]
10082
+
10083
+ if shiftdown:
10084
+ delta_y = 0.
10085
+
10086
+ if altdown:
10087
+ delta_x = 0.
10088
+
10089
+ self.active_tri.move(delta_x, delta_y)
10090
+
10091
+ self.active_tri.reset_plot()
10092
+
10093
+ if self.action == 'rotate vector':
10094
+ if self.active_vector is not None:
10095
+ if self.active_vector._rotation_center is not None:
10096
+ self.active_vector.rotate_xy(x, y)
10097
+
10098
+ if self.action == 'rotate triangles':
10099
+ if self.active_tri is not None:
10100
+ if self.active_tri._rotation_center is not None:
10101
+ self.active_tri.rotate_xy(x, y)
10102
+ self.active_tri.reset_plot()
10103
+
10104
+ if self.action == 'move zone':
10105
+ if self.active_zone is not None:
10106
+ if self.active_zone._start_move is not None:
10107
+ delta_x = x - self.active_zone._start_move[0]
10108
+ delta_y = y - self.active_zone._start_move[1]
10109
+
10110
+ if shiftdown:
10111
+ delta_y = 0.
10112
+
10113
+ if altdown:
10114
+ delta_x = 0.
10115
+
10116
+ self.active_zone.move(delta_x, delta_y)
10117
+
10118
+ if self.action == 'rotate zone':
10119
+ if self.active_zone is not None:
10120
+ if self.active_zone._rotation_center is not None:
10121
+ self.active_zone.rotate_xy(x, y)
10122
+
9894
10123
  self.Paint()
9895
10124
 
9896
10125
  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: