wolfhece 2.0.44__py3-none-any.whl → 2.0.45__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/GraphProfile.py CHANGED
@@ -48,6 +48,7 @@ class ProfilePanel(wx.Panel):
48
48
  self.ax_hsw= None
49
49
 
50
50
  self.add_ax()
51
+ # self.Layout()
51
52
 
52
53
  if self.wx_exists:
53
54
  # impossible to initialize wx.Panel if wx.App is not running
@@ -57,12 +58,14 @@ class ProfilePanel(wx.Panel):
57
58
  self.canvas.ClearBackground()
58
59
 
59
60
  #Sizers
60
- self.sizerfig = wx.BoxSizer(wx.VERTICAL)
61
61
  self.sizer = wx.BoxSizer(wx.VERTICAL)
62
+ self.sizerfig = wx.BoxSizer(wx.HORIZONTAL)
63
+
62
64
 
63
65
  self.sizerfig.Add(self.canvas, 1, wx.EXPAND) #wx.EXPAND expands the given object proportions in case the windows is resized.
64
66
  self.sizer.Add(self.sizerfig, 7, wx.EXPAND)
65
67
 
68
+
66
69
  self.SetSizer(self.sizer)
67
70
 
68
71
  def add_ax(self): #Just in case a 3D projection is implemented
@@ -90,6 +93,8 @@ class ProfilePanel(wx.Panel):
90
93
  """
91
94
  return self.figure, self.ax_cs_real, self.ax_cs_anam, self.ax_img, self.ax_dis, self.ax_hsw
92
95
 
96
+
97
+
93
98
  # class for plotting all figures at once
94
99
  class PlotCSAll(ProfilePanel):
95
100
  """
@@ -128,6 +133,7 @@ class PlotCSAll(ProfilePanel):
128
133
 
129
134
  self.reset_models()
130
135
  self.init_UI()
136
+ # self.Layout()
131
137
 
132
138
  def init_UI(self):
133
139
  """
@@ -406,6 +412,7 @@ class PlotCSAll(ProfilePanel):
406
412
  self.toolbar = NavigationToolbar(self.canvas) #Ajout d'une barre d'outils pour la figure courante
407
413
  self.toolbar.Realize()
408
414
  self.sizer.Add(self.toolbar,0.9, wx.ALIGN_CENTER)
415
+ self.SetAutoLayout(True)
409
416
 
410
417
  # Functions
411
418
  def set_cs(self, my_profile:profile=None, vec: list[vector] = [], Manning=0.04, plot=True) -> None:
@@ -418,9 +425,9 @@ class PlotCSAll(ProfilePanel):
418
425
  return # Nothing to do
419
426
 
420
427
  if self.mycs is not None:
421
- self.mycs.uncolor_active_profile()
428
+ self.mycs.uncolor_active_profile(plot_opengl= False)
422
429
 
423
- my_profile.color_active_profile()
430
+ my_profile.color_active_profile(plot_opengl= False)
424
431
 
425
432
  #Initialisation and reinitialisation of the plot parameters
426
433
  self.mycs = my_profile
@@ -536,31 +543,34 @@ class PlotCSAll(ProfilePanel):
536
543
 
537
544
  ax3 = self.ax_img
538
545
  fig = self.figure
539
- self.mapviewer.set_active_profile(self.mycs) #We set the active profile in wolfhece.pydraw
546
+ # self.mapviewer.set_active_profile(self.mycs) #We set the active profile in wolfhece.pydraw
540
547
  self.mapviewer.set_active_vector(self.mycs) #To avoid visual confusions, we set the profile as the active vector in wolfhece.pydraw
541
- self.mycs.color_active_profile() #we thicken and color the profile in red.
548
+ self.mycs.color_active_profile(plot_opengl= True) #we thicken and color the profile in red.
542
549
  size = 200
543
550
  self.mapviewer.zoomon_active_profile(size=size) #We zoom on the profile in the gui.
544
551
  self.mapviewer.Paint() #We take the visual information in the GUI necessary for a screen shot.
545
552
  self.mapviewer.display_canvasogl(fig= fig, ax = ax3) #We return a clear screen shot of the wolfpy GUI as a matplolib graph (ax).
546
553
  else:
547
- self.mycs.color_active_profile()
554
+ self.mycs.color_active_profile(plot_opengl= False)
548
555
 
549
556
  bounds = self.mycs.get_bounds(100.)
550
557
 
551
558
  """
559
+ FIXME find a way to better iterate over the different orthophotos
552
560
  orthos = {'IMAGERIE': {'1971': 'ORTHO_1971', '1994-2000': 'ORTHO_1994_2000',
553
561
  '2006-2007': 'ORTHO_2006_2007',
554
562
  '2009-2010': 'ORTHO_2009_2010',
555
563
  '2012-2013': 'ORTHO_2012_2013',
556
564
  '2015': 'ORTHO_2015', '2016': 'ORTHO_2016', '2017': 'ORTHO_2017',
557
565
  '2018': 'ORTHO_2018', '2019': 'ORTHO_2019', '2020': 'ORTHO_2020',
558
- '2021': 'ORTHO_2021'}}
566
+ '2021': 'ORTHO_2021', '2022 printemps': 'ORTHO_2022_PRINTEMPS', '2022 été': 'ORTHO_2022_ETE',
567
+ '2023 été': 'ORTHO_2023_ETE'}}
559
568
  """
560
569
 
561
570
  try:
562
- mybytes = getWalonmap(cat='IMAGERIE/ORTHO_2021',xl = bounds[0][0], yl = bounds[0][1], xr = bounds[1][0], yr = bounds[1][1], w=500, h=500, tofile=False)
571
+ mybytes = getWalonmap(cat='IMAGERIE/ORTHO_2022_PRINTEMPS',xl = bounds[0][0], yl = bounds[0][1], xr = bounds[1][0], yr = bounds[1][1], w=500, h=500, tofile=False)
563
572
  image = Image.open(mybytes)
573
+ self.ax_img.clear()
564
574
  self.ax_img.imshow(image, origin='upper', extent=(bounds[0][0],bounds[1][0],bounds[0][1],bounds[1][1]))
565
575
  self.ax_img.plot([self.mycs.myvertices[0].x, self.mycs.myvertices[-1].x], [self.mycs.myvertices[0].y, self.mycs.myvertices[-1].y], c='red', linewidth=3)
566
576
  except:
@@ -1099,7 +1109,7 @@ class PlotCSAll(ProfilePanel):
1099
1109
  if self.mycs.up is None:
1100
1110
  return
1101
1111
 
1102
- self.mycs.uncolor_active_profile()
1112
+ self.mycs.uncolor_active_profile(plot_opengl= False)
1103
1113
  self.set_cs(self.mycs.up)
1104
1114
  self.plot_cs()
1105
1115
 
@@ -1110,7 +1120,7 @@ class PlotCSAll(ProfilePanel):
1110
1120
  if self.mycs.down is None:
1111
1121
  return
1112
1122
 
1113
- self.mycs.uncolor_active_profile()
1123
+ self.mycs.uncolor_active_profile(plot_opengl= False)
1114
1124
  self.set_cs(self.mycs.down)
1115
1125
  self.plot_cs()
1116
1126
 
@@ -1126,6 +1136,7 @@ class PlotCSAll(ProfilePanel):
1126
1136
  """
1127
1137
  This method displays on the profile and on the discharge graphs, the hydraulic characteristics in the numerical simulations.
1128
1138
  Also, it triggers a new window containing a table (grid) of the displayed values.
1139
+ FIXME add a plot method for 2D and 1D results.
1129
1140
  """
1130
1141
  # Data from numerical simulations
1131
1142
 
@@ -1678,13 +1689,15 @@ class ProfileWithoutGUI():
1678
1689
  Useful for scripts commands (an example is provide in )
1679
1690
  """
1680
1691
  def __init__(self, fcrossection ='', fsupport= '', format='') :
1681
- self.app=wx.App()
1682
1692
 
1693
+ self.cross = crosssections(fcrossection, format) #Crossection data
1694
+ self.myvec = Zones(fsupport) #Vector data
1695
+
1696
+ self.app=wx.App()
1683
1697
  self.curprofile : profile
1684
1698
  self.plotter = ProfileNotebook()
1685
1699
  self.plotter.add('Figure 1') # .figure.add_subplot()
1686
- self.cross = crosssections(fcrossection, format) #Crossection data
1687
- self.myvec = Zones(fsupport) #Vector data
1700
+
1688
1701
 
1689
1702
  if fsupport != '':
1690
1703
  self.cross.sort_along(self.myvec.myzones[0].myvectors[0].asshapely_ls(),'vesdre')