wolfhece 2.1.107__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
@@ -4001,10 +4001,17 @@ class WolfMapViewer(wx.Frame):
4001
4001
  '2006-2007': 'ORTHO_2006_2007',
4002
4002
  '2009-2010': 'ORTHO_2009_2010',
4003
4003
  '2012-2013': 'ORTHO_2012_2013',
4004
- '2015': 'ORTHO_2015', '2016': 'ORTHO_2016', '2017': 'ORTHO_2017',
4005
- '2018': 'ORTHO_2018', '2019': 'ORTHO_2019', '2020': 'ORTHO_2020',
4006
- '2021': 'ORTHO_2021', '2022 printemps': 'ORTHO_2022_PRINTEMPS', '2022 été': 'ORTHO_2022_ETE',
4004
+ '2015': 'ORTHO_2015',
4005
+ '2016': 'ORTHO_2016',
4006
+ '2017': 'ORTHO_2017',
4007
+ '2018': 'ORTHO_2018',
4008
+ '2019': 'ORTHO_2019',
4009
+ '2020': 'ORTHO_2020',
4010
+ '2021': 'ORTHO_2021',
4011
+ '2022 printemps': 'ORTHO_2022_PRINTEMPS',
4012
+ '2022 été': 'ORTHO_2022_ETE',
4007
4013
  '2023 été': 'ORTHO_2023_ETE',
4014
+ 'Last one': 'ORTHO_LAST',
4008
4015
  }}
4009
4016
  data_2021 = {'EAU': {'IDW': 'ZONES_INONDEES_IDW',
4010
4017
  'Emprise': 'ZONES_INONDEES',
@@ -4030,9 +4037,14 @@ class WolfMapViewer(wx.Frame):
4030
4037
  ToCheck=False, id='Orthos France')
4031
4038
 
4032
4039
  forelist = {'EAU': {'Aqualim': 'RES_LIMNI_DGARNE', 'Alea': 'ALEA_INOND', 'Lidaxes': 'LIDAXES'},
4033
- 'LIMITES': {'Secteurs Statistiques': 'LIMITES_QS_STATBEL'},
4034
- 'INSPIRE': {'Limites administratives': 'AU_wms'},
4035
- 'PLAN_REGLEMENT': {'Plan Percellaire': 'CADMAP_2021_PARCELLES'}}
4040
+ 'LIMITES': {'Secteurs Statistiques': 'LIMITES_QS_STATBEL',
4041
+ 'Limites administratives': 'LIMITES_ADMINISTRATIVES'},
4042
+ 'R3C': {'Limites Communes': 'Municipalities'},
4043
+ # 'INSPIRE': {'Limites administratives': 'AU_wms'},
4044
+ 'PLAN_REGLEMENT': {'Plan Parcellaire 2021': 'CADMAP_2021_PARCELLES',
4045
+ 'Plan Parcellaire 2022': 'CADMAP_2022_PARCELLES',
4046
+ 'Plan Parcellaire 2023': 'CADMAP_2023_PARCELLES',
4047
+ 'Plan Parcellaire 2024': 'CADMAP_2024_PARCELLES'}}
4036
4048
 
4037
4049
  for idx, (k, item) in enumerate(forelist.items()):
4038
4050
  for kdx, (m, subitem) in enumerate(item.items()):
@@ -4041,6 +4053,12 @@ class WolfMapViewer(wx.Frame):
4041
4053
  self, xmin, xmax, ymin, ymax, -99999, 1024),
4042
4054
  ToCheck=False, id=m)
4043
4055
 
4056
+ # self.add_object(which='wmsfore',
4057
+ # newobj=imagetexture('Cadastre Flandres', 'Plan Parcellaire 2024 (Flandres)', 'Adpf', '',
4058
+ # self, xmin, xmax, ymin, ymax, -99999, 1024, Vlaanderen=True),
4059
+ # ToCheck=False, id='Plan Parcellaire 2024 (Flandres)')
4060
+
4061
+
4044
4062
  def set_compare(self, ListArrays:list[WolfArray]=None, share_colormap:bool=True):
4045
4063
  """
4046
4064
  Comparison of 2 arrays
@@ -5046,7 +5064,7 @@ class WolfMapViewer(wx.Frame):
5046
5064
  value = dlg.GetValue()/100.
5047
5065
  dlg.Destroy()
5048
5066
 
5049
- 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)
5050
5068
 
5051
5069
  if self.active_array is not None:
5052
5070
  copy_vec = vector()
@@ -5055,9 +5073,12 @@ class WolfMapViewer(wx.Frame):
5055
5073
  copy_vec.get_values_on_vertices(self.active_array)
5056
5074
  s,z = copy_vec.get_sz()
5057
5075
  notmasked = np.where(z != -99999.)
5058
- ax.plot(s[notmasked], z[notmasked], c='black', linewidth=2.0)
5059
5076
 
5060
- 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()
5061
5082
 
5062
5083
  def clip_laz_gridded(self):
5063
5084
  """ Clip laz grid on current zoom """
@@ -6483,11 +6504,11 @@ class WolfMapViewer(wx.Frame):
6483
6504
  self.select_active_array_from_laz(self.active_array)
6484
6505
 
6485
6506
  elif itemlabel == _('Plot LAZ around active vector'):
6486
-
6507
+ autoscale = False
6487
6508
  self.plot_laz_around_active_vec()
6488
6509
 
6489
6510
  elif itemlabel == _('Plot LAZ around temporary vector'):
6490
-
6511
+ autoscale = False
6491
6512
  self.active_vector = vector()
6492
6513
  self.active_vector.add_vertex(wolfvertex(0.,0.))
6493
6514
  self.mimicme()
@@ -6497,9 +6518,11 @@ class WolfMapViewer(wx.Frame):
6497
6518
  elif itemlabel == _('Change colors - Classification'):
6498
6519
 
6499
6520
  if self.mylazgrid is not None:
6521
+ autoscale = False
6500
6522
  self.mylazgrid.colors.interactive_update_colors()
6501
6523
 
6502
6524
  elif itemlabel == _('Multiviewer'):
6525
+ autoscale = False
6503
6526
  dlg = wx.NumberEntryDialog(self, _("Additional viewers"), _("How many?"), _("How many additional viewers?"),1, 0, 5)
6504
6527
  ret = dlg.ShowModal()
6505
6528
 
@@ -6713,7 +6736,7 @@ class WolfMapViewer(wx.Frame):
6713
6736
  autoscale = False
6714
6737
 
6715
6738
  from .scenario.config_manager import Config_Manager_2D_GPU
6716
- newmanager = Config_Manager_2D_GPU(mapviewer=self)
6739
+ newmanager = Config_Manager_2D_GPU(mapviewer=self, create_ui_if_wx=True)
6717
6740
 
6718
6741
  elif itemlabel == _('Create acceptability manager...'):
6719
6742
  autoscale = False
@@ -8846,7 +8869,11 @@ class WolfMapViewer(wx.Frame):
8846
8869
  curobj = self.getobj_from_id(nameitem)
8847
8870
  myobj = self.treelist.GetItemData(myitem)
8848
8871
 
8849
- assert curobj is myobj, 'curobj is not myobj'
8872
+ if curobj is not myobj:
8873
+ logging.error(_('Bad association between object and tree item'))
8874
+ logging.error(_('Do you have 2 objects with the same id ?'))
8875
+ logging.error(_('It could be the case if you have drag/drop an object in the viewer...'))
8876
+ logging.error(_('I will continue but it is not normal...'))
8850
8877
 
8851
8878
  self.treelist.SetToolTip(self.treelist.GetItemText(myitem))
8852
8879
 
@@ -9229,6 +9256,84 @@ class WolfMapViewer(wx.Frame):
9229
9256
  self.active_vector.find_minmax()
9230
9257
  self.active_zone.find_minmax()
9231
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
+
9232
9337
  elif self.action == 'dynamic parallel':
9233
9338
  # Create a dynamic parallel line
9234
9339
  if ctrl:
@@ -9869,6 +9974,45 @@ class WolfMapViewer(wx.Frame):
9869
9974
  if self.action == 'dynamic parallel':
9870
9975
  self.active_zone.parallel_active(self.dynapar_dist)
9871
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
+
9872
10016
  self.Paint()
9873
10017
 
9874
10018
  self._last_mouse_pos = (x,y,pos)
@@ -10504,7 +10648,14 @@ class WolfMapViewer(wx.Frame):
10504
10648
 
10505
10649
  newarray.nullify_border(width=1)
10506
10650
 
10507
- self.add_object('array', newobj = newarray, id = self.active_array.idx + '_crop')
10651
+ #keys for arrays
10652
+ keys = self.get_list_keys(draw_type.ARRAYS, checked_state=False)
10653
+ new_key = self.active_array.idx + '_crop'
10654
+
10655
+ while new_key in keys:
10656
+ new_key += '_'
10657
+
10658
+ self.add_object('array', newobj = newarray, id = new_key)
10508
10659
 
10509
10660
  self.Refresh()
10510
10661
 
wolfhece/PyGui.py CHANGED
@@ -3751,4 +3751,4 @@ class Wolf2DGPUModel(GenMapManager):
3751
3751
  """ Append text to the information zone """
3752
3752
 
3753
3753
  if self.wx_exists:
3754
- self._txt_info.AppendText(text)
3754
+ self._txt_info.AppendText(text)
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: