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/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 = 108
8
+ self.patch = 109
9
9
 
10
10
  def __str__(self):
11
11
 
@@ -23,6 +23,7 @@ from ..PyWMS import getWalonmap
23
23
  from ..PyTranslate import _
24
24
  from ..color_constants import Colors
25
25
  from ..PyParams import Wolf_Param
26
+ from ..matplotlib_fig import Matplotlib_Figure as mplfig
26
27
 
27
28
  """
28
29
  Importation et visualisation de données LAS et LAZ
@@ -620,6 +621,27 @@ class xyz_laz_grids():
620
621
 
621
622
  return fig,ax
622
623
 
624
+ def plot_laz_wx(self, xy:Union[LineString, list[list[float], list[float]]], length_buffer=5., show=True):
625
+ """
626
+ Dessin des points LAZ sur un graphique Matplotlib
627
+ """
628
+
629
+ (up_s, up_z, up_color), (down_s, down_z, down_color) = self.scan_around(xy, length_buffer)
630
+
631
+ figmpl = mplfig()
632
+ figmpl.presets()
633
+ fig = figmpl.fig
634
+ ax = figmpl.cur_ax
635
+
636
+ logging.info(_('Plotting'))
637
+ ax.scatter(up_s, up_z, c=up_color ,marker='.')
638
+ ax.scatter(down_s, down_z,c=down_color,marker='+')
639
+
640
+ if show:
641
+ figmpl.Show()
642
+
643
+ return figmpl
644
+
623
645
  def create_from_laz(self, dir_laz:str, shape:str, ds:float = 50, force_format = np.float64):
624
646
 
625
647
  try:
@@ -1053,6 +1053,7 @@ class Matplotlib_Figure(wx.Frame):
1053
1053
  self.ax_dict:dict[str,Axes] = {} # dict of axes
1054
1054
  self.ax:list[Axes] = [] # list of axes -- always flatten
1055
1055
  self.shown_props = None # shown properties
1056
+ self._shiftdown = False
1056
1057
 
1057
1058
  self.apply_layout(layout) # apply the layout
1058
1059
  pass
@@ -1192,6 +1193,7 @@ class Matplotlib_Figure(wx.Frame):
1192
1193
  self._canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar)
1193
1194
  self._canvas.mpl_connect('button_press_event', self.OnClickCanvas)
1194
1195
  self._canvas.mpl_connect('key_press_event', self.OnKeyCanvas)
1196
+ self._canvas.mpl_connect('key_release_event', self.OnKeyRelease)
1195
1197
 
1196
1198
  # Toolbar - Matplotlib
1197
1199
  # --------------------
@@ -1280,6 +1282,9 @@ class Matplotlib_Figure(wx.Frame):
1280
1282
  self._add_row = wx.Button(win, -1, 'Add rows')
1281
1283
  self._add_row.Bind(wx.EVT_BUTTON, self.add_row_to_grid)
1282
1284
 
1285
+ self._new_line = wx.Button(win, -1, 'New line')
1286
+ self._new_line.Bind(wx.EVT_BUTTON, self.onnew_line)
1287
+
1283
1288
  self._add_line = wx.Button(win, -1, 'Add line')
1284
1289
  self._add_line.Bind(wx.EVT_BUTTON, self.onadd_line)
1285
1290
 
@@ -1287,10 +1292,19 @@ class Matplotlib_Figure(wx.Frame):
1287
1292
  self._del_line.Bind(wx.EVT_BUTTON, self.ondel_line)
1288
1293
 
1289
1294
  self._sizer_xls.Add(self._xls, 1, wx.EXPAND)
1290
- self._sizer_xls.Add(self._update_xy, 0, wx.EXPAND)
1291
- self._sizer_xls.Add(self._add_row, 0, wx.EXPAND)
1292
- self._sizer_xls.Add(self._add_line, 0, wx.EXPAND)
1293
- self._sizer_xls.Add(self._del_line, 0, wx.EXPAND)
1295
+
1296
+ self._sizer_update_add = wx.BoxSizer(wx.HORIZONTAL)
1297
+ self._sizer_add_remove = wx.BoxSizer(wx.HORIZONTAL)
1298
+
1299
+ self._sizer_xls.Add(self._sizer_update_add, 0, wx.EXPAND)
1300
+ self._sizer_xls.Add(self._sizer_add_remove, 0, wx.EXPAND)
1301
+
1302
+ self._sizer_update_add.Add(self._update_xy, 1, wx.EXPAND)
1303
+ self._sizer_update_add.Add(self._add_row, 1, wx.EXPAND)
1304
+
1305
+ self._sizer_add_remove.Add(self._new_line, 1, wx.EXPAND)
1306
+ self._sizer_add_remove.Add(self._add_line, 1, wx.EXPAND)
1307
+ self._sizer_add_remove.Add(self._del_line, 1, wx.EXPAND)
1294
1308
 
1295
1309
  # Properties sizer
1296
1310
  # ---------------
@@ -1519,6 +1533,12 @@ class Matplotlib_Figure(wx.Frame):
1519
1533
 
1520
1534
  if event.key == 'escape':
1521
1535
  self._axes_properties[int(self._ax_current.GetSelection())].reset_selection()
1536
+ elif event.key == 'shift':
1537
+ self._shiftdown = True
1538
+
1539
+ def OnKeyRelease(self, event:KeyEvent):
1540
+ if event.key == 'shift':
1541
+ self._shiftdown = False
1522
1542
 
1523
1543
  def OnClickCanvas(self, event:MouseEvent):
1524
1544
 
@@ -1533,21 +1553,33 @@ class Matplotlib_Figure(wx.Frame):
1533
1553
  idx= ax.get_figure().axes.index(event.inaxes)
1534
1554
  x, y = event.xdata, event.ydata
1535
1555
 
1536
- dist_min = 1e6
1537
- line_min = None
1556
+ if rclick and not self._shiftdown:
1538
1557
 
1539
- for line in ax.get_lines():
1540
- xy = line.get_xydata()
1541
- dist = np.linalg.norm(xy - np.array([x,y]), axis=1)
1542
- idx_min = np.argmin(dist)
1543
- if dist[idx_min] < dist_min:
1544
- dist_min = dist[idx_min]
1545
- line_min = line
1558
+ dist_min = 1e6
1559
+ line_min = None
1546
1560
 
1547
- self._ax_current.SetSelection(idx)
1548
- self._fill_lines_ax(idx = ax.get_lines().index(line_min))
1549
- self._axes_properties[idx].select_line(ax.get_lines().index(line_min))
1550
- self.fill_grid_with_xy(line_min)
1561
+ for line in ax.get_lines():
1562
+ xy = line.get_xydata()
1563
+ if xy.shape[0] == 0:
1564
+ continue
1565
+
1566
+ dist = np.linalg.norm(xy - np.array([x,y]), axis=1)
1567
+ idx_min = np.argmin(dist)
1568
+ if dist[idx_min] < dist_min:
1569
+ dist_min = dist[idx_min]
1570
+ line_min = line
1571
+
1572
+ self._ax_current.SetSelection(idx)
1573
+ self._fill_lines_ax(idx = ax.get_lines().index(line_min))
1574
+ self._axes_properties[idx].select_line(ax.get_lines().index(line_min))
1575
+ self.fill_grid_with_xy(line_min)
1576
+
1577
+ if rclick and self._shiftdown:
1578
+ xy = self.cur_line.get_xydata()
1579
+ xy = np.vstack((xy, [x,y]))
1580
+ self.cur_line.set_data(xy[:,0], xy[:,1])
1581
+ self.fill_grid_with_xy(self.cur_line)
1582
+ self._canvas.draw()
1551
1583
 
1552
1584
  self.show_curline_properties()
1553
1585
 
@@ -1609,6 +1641,17 @@ class Matplotlib_Figure(wx.Frame):
1609
1641
  xy = self._get_xy_from_grid(self._xls)
1610
1642
  self.add_line(xy, self.cur_ax)
1611
1643
 
1644
+ def onnew_line(self, event):
1645
+ """ Add a plot to the current ax """
1646
+
1647
+ curline = self.cur_line
1648
+ if curline is not None:
1649
+ xy = curline.get_xydata()
1650
+ xy = np.asarray([[xy[0,0],xy[0,1]]])
1651
+ else:
1652
+ xy = np.asarray([[0,0]])
1653
+ self.add_line(xy, self.cur_ax)
1654
+
1612
1655
  def _get_xy_from_grid(self, grid:CpGrid, colx:int= 0, coly:int= 1):
1613
1656
  """ Get the xy from a grid """
1614
1657
 
@@ -1637,23 +1680,29 @@ class Matplotlib_Figure(wx.Frame):
1637
1680
  cur_ax_prop:Matplotlib_ax_properties = self._axes_properties[idx_ax]
1638
1681
  cur_ax_prop._lines.append(Matplolib_line_properties(ax.get_lines()[-1], cur_ax_prop))
1639
1682
  cur_ax_prop._lines[-1].add_props_to_sizer(self._collaps_pane.GetPane(), self._sizer_grid_props)
1683
+
1684
+ self._fill_lines_ax(len(ax.get_lines())-1)
1685
+
1640
1686
  self.update_layout()
1687
+ self._canvas.SetFocus()
1641
1688
 
1642
1689
  def ondel_line(self, event):
1643
1690
  """ Remove a plot from the current ax """
1644
1691
 
1692
+ if self._line_current.GetSelection() == -1:
1693
+ return
1694
+
1645
1695
  dlg = wx.MessageDialog(self, _('Do you want to remove the selected line?\n\nSuch action is irrevocable !\n\nPlease consider to set "Visible" to "False" to hide data'), _('Remove line'), wx.YES_NO | wx.ICON_QUESTION | wx.NO_DEFAULT)
1646
1696
 
1647
1697
  ret = dlg.ShowModal()
1648
1698
  if ret == wx.ID_NO:
1649
1699
  return
1650
1700
 
1651
- if self._line_current.GetSelection() == -1:
1652
- return
1653
-
1654
1701
  idx = self._line_current.GetSelection()
1655
1702
  self.del_line(idx)
1656
1703
 
1704
+ self._fill_lines_ax()
1705
+
1657
1706
  def del_line(self, idx:int):
1658
1707
  """ Delete a line """
1659
1708
 
wolfhece/pybridges.py CHANGED
@@ -48,10 +48,18 @@ class stored_values_coords(Enum):
48
48
  X = (0, 'CoordX')
49
49
  Y = (1, 'CoordY')
50
50
 
51
- class zones_in_file(Enum):
51
+ class zones_in_file_fr_vec(Enum):
52
52
  PARTS = '3 zones'
53
53
  RIVER = 'entier'
54
- SECTION = 'section'
54
+
55
+ class zones_in_file(Enum):
56
+ PARTS = _('bridge_position')
57
+ RIVER = _('river')
58
+ DECK = _('deck')
59
+ ROOF = _('roof')
60
+ PIER = _('pier')
61
+ CROSS_SECTIONS = _('crosssections')
62
+ EXTRACTION = _('extraction')
55
63
 
56
64
  class operators(Enum):
57
65
  MEDIAN = 'median'
@@ -66,6 +74,16 @@ class parts_values(Enum):
66
74
  UPSTREAM = _('upstream')
67
75
  DOWNSTREAM = _('downstream')
68
76
 
77
+ class rivers_values(Enum):
78
+ RIVERBED = _('riverbed')
79
+ LEFTBANK = _('leftbank')
80
+ RIGHTBANK = _('rightbank')
81
+
82
+ class cs_values(Enum):
83
+ UPSTREAM = _('upstream')
84
+ MIDDLE = _('middle')
85
+ DOWNSTREAM = _('downstream')
86
+
69
87
  class Bridge(Zones):
70
88
  """
71
89
  Bridge class
@@ -105,108 +123,230 @@ class Bridge(Zones):
105
123
 
106
124
  """
107
125
 
126
+ @classmethod
127
+ def new_bridge(cls, name:str):
128
+ """
129
+ Create a new bridge with name
130
+ """
131
+ new_bridge = cls()
132
+ new_bridge.myname = name
133
+
134
+ position = zone(name = zones_in_file.PARTS.value, parent= new_bridge)
135
+ new_bridge.add_zone(position)
136
+
137
+ new_bridge.centralpart = vector(name = parts_values.CENTRAL.value)
138
+ position.add_vector(new_bridge.centralpart, forceparent=True)
139
+
140
+ new_bridge.upstream = vector(name = parts_values.UPSTREAM.value)
141
+ position.add_vector(new_bridge.upstream, forceparent=True)
142
+
143
+ new_bridge.downstream = vector(name = parts_values.DOWNSTREAM.value)
144
+ position.add_vector(new_bridge.downstream, forceparent=True)
145
+
146
+ river = zone(name = zones_in_file.RIVER.value, parent= new_bridge)
147
+ new_bridge.add_zone(river)
148
+
149
+ new_bridge.leftbank = vector(name = rivers_values.LEFTBANK.value)
150
+ new_bridge.riverbed = vector(name = rivers_values.RIVERBED.value)
151
+ new_bridge.rightbank = vector(name = rivers_values.RIGHTBANK.value)
152
+
153
+ river.add_vector(new_bridge.leftbank, forceparent=True)
154
+ river.add_vector(new_bridge.riverbed, forceparent=True)
155
+ river.add_vector(new_bridge.rightbank, forceparent=True)
156
+
157
+ new_bridge.add_zone(zone(name = zones_in_file.DECK.value, parent= new_bridge))
158
+ new_bridge.add_zone(zone(name = zones_in_file.ROOF.value, parent= new_bridge))
159
+ new_bridge.add_zone(zone(name = zones_in_file.PIER.value, parent= new_bridge))
160
+ new_bridge.add_zone(zone(name = zones_in_file.CROSS_SECTIONS.value, parent= new_bridge))
161
+ new_bridge.add_zone(zone(name = zones_in_file.EXTRACTION.value, parent= new_bridge))
162
+
163
+ return new_bridge
164
+
108
165
  def __init__(self, myfile='', ds:float=5., ox: float = 0, oy: float = 0, tx: float = 0, ty: float = 0, parent=None, is2D=True, wx_exists:bool = False):
109
166
  super().__init__(myfile, ox, oy, tx, ty, parent, is2D, wx_exists)
110
167
  self.init_ui()
111
168
 
112
- self.myname = splitext(basename(myfile))[0]
169
+ self.centralpart = None
170
+ self.upstream = None
171
+ self.downstream = None
113
172
 
114
- # recherche de la zone du fichier contenant les 3 parties de l'ouvrage
115
- curzone = self.get_zone(zones_in_file.PARTS.value)
116
- if curzone is None:
117
- curzone = self.get_zone(0)
118
- curzone.myname = zones_in_file.PARTS.value # on force le nom de la zone pour éviter de refaire le test ailleurs
119
- if curzone is None:
120
- raise Warning(_('Bad file : {}'.format(myfile)))
173
+ self.riverbed = None
174
+ self.leftbank = None
175
+ self.rightbank = None
121
176
 
122
- # attribution des vecteurs pour les différentes parties de l'ouvrage
177
+ self.polygons_zone = None
123
178
 
124
- self.centralpart = curzone.get_vector('tablier') # 4 vertices from Upstream Left to Dowstream Left passing by Upstream Right and Downstream Right
125
- if self.centralpart is None:
126
- self.centralpart = curzone.get_vector('seuil') # 4 vertices from Upstream Left to Dowstream Left passing by Upstream Right and Downstream Right
179
+ if myfile != '':
180
+ self.myname = splitext(basename(myfile))[0]
181
+ extension = splitext(basename(myfile))[1]
127
182
 
128
- self.upstream = curzone.get_vector('amont') # 4 vertices from Upstream Left Deck to Upstream Right Deck passing by Upstream Left Bank and Upstream Right Bank
129
- self.downstream = curzone.get_vector('aval') # 4 vertices from Downstream Left Deck Left to Downstream Right Deck passing by Downstream Left Bank and Downstream Right Bank
130
183
 
131
- xydeck = self.centralpart.asnparray()
184
+ if extension == '.vec':
132
185
 
133
- # point central de l'ouvrage
134
- self.centerx = np.mean(xydeck[:,0]) # X coordinate of the deck
135
- self.centery = np.mean(xydeck[:,1]) # X coordinate of the deck
136
- self.curvi = 0 # s curvilinear coordinate of the deck along a support polyline
186
+ # recherche de la zone du fichier contenant les 3 parties de l'ouvrage
187
+ curzone = self.get_zone(zones_in_file_fr_vec.PARTS.value)
188
+ if curzone is None:
189
+ curzone = self.get_zone(0)
190
+ curzone.myname = zones_in_file_fr_vec.PARTS.value # on force le nom de la zone pour éviter de refaire le test ailleurs
191
+ if curzone is None:
192
+ raise Warning(_('Bad file : {}'.format(myfile)))
137
193
 
138
- """
139
- Si certaines parties ne sont pas attribuées, il peut s'agir d'une mauvaise appellation.
140
- Dans ce cas, on attribue sur base de la position dans la zone
141
- """
142
- assert curzone.nbvectors==3, _('Bad number of parts')
143
-
144
- if self.centralpart is None:
145
- self.centralpart = curzone.get_vector(0)
146
- if self.upstream is None:
147
- self.upstream = curzone.get_vector(1)
148
- if self.downstream is None:
149
- self.downstream = curzone.get_vector(2)
150
-
151
- if self.centralpart is None:
152
- raise Warning(_('Bad file : {}'.format(myfile)))
153
- if self.upstream is None:
154
- raise Warning(_('Bad file : {}'.format(myfile)))
155
- if self.downstream is None:
156
- raise Warning(_('Bad file : {}'.format(myfile)))
157
-
158
- curzone = self.get_zone(zones_in_file.RIVER.value)
159
- if curzone is None:
160
- curzone = self.get_zone(1)
161
- curzone.myname = zones_in_file.RIVER.value # on force le nom de la zone pour éviter de refaire le test ailleurs
162
- if curzone is None:
163
- raise Warning(_('Bad file : {}'.format(myfile)))
164
-
165
- self.riverbed = curzone.get_vector('parallèle') # vertices from upstream to downstream
166
- if self.riverbed is None:
167
- self.riverbed = curzone.get_vector(1)
168
- if self.riverbed is None:
169
- raise Warning(_('Bad file : {}'.format(myfile)))
170
-
171
- self.riverbed.reverse()
172
-
173
- self.leftbank = curzone.get_vector(2) # vertices from upstream to downstream
174
- if self.leftbank is None:
175
- raise Warning(_('Bad file : {}'.format(myfile)))
176
-
177
- self.leftbank.reverse()
178
-
179
- self.rightbank = curzone.get_vector(0) # vertices from upstream to downstream
180
- if self.rightbank is None:
181
- raise Warning(_('Bad file : {}'.format(myfile)))
182
-
183
- self.rightbank.reverse()
184
-
185
- curzone.myvectors = [self.leftbank, self.riverbed, self.rightbank] #inverse order to be up -> down
186
-
187
- #création des polygones de rivière
188
- curzone.create_polygon_from_parallel(ds)
189
- self.polygons_zone:zone
190
- self.polygons_zone = self.get_zone(-1)
191
- self.polygons_curvi = {}
192
- for curvert in self.polygons_zone.myvectors:
193
- self.polygons_curvi[curvert.myname] = curvert.myvertices[0].z
194
+ # attribution des vecteurs pour les différentes parties de l'ouvrage
195
+
196
+ self.centralpart = curzone.get_vector('tablier') # 4 vertices from Upstream Left to Dowstream Left passing by Upstream Right and Downstream Right
197
+ if self.centralpart is None:
198
+ self.centralpart = curzone.get_vector('seuil') # 4 vertices from Upstream Left to Dowstream Left passing by Upstream Right and Downstream Right
199
+
200
+ self.upstream = curzone.get_vector('amont') # 4 vertices from Upstream Left Deck to Upstream Right Deck passing by Upstream Left Bank and Upstream Right Bank
201
+ self.downstream = curzone.get_vector('aval') # 4 vertices from Downstream Left Deck Left to Downstream Right Deck passing by Downstream Left Bank and Downstream Right Bank
202
+
203
+ xydeck = self.centralpart.asnparray()
204
+
205
+ # point central de l'ouvrage
206
+ self.centerx = np.mean(xydeck[:,0]) # X coordinate of the deck
207
+ self.centery = np.mean(xydeck[:,1]) # X coordinate of the deck
208
+ self.curvi = 0 # s curvilinear coordinate of the deck along a support polyline
209
+
210
+ """
211
+ Si certaines parties ne sont pas attribuées, il peut s'agir d'une mauvaise appellation.
212
+ Dans ce cas, on attribue sur base de la position dans la zone
213
+ """
214
+ assert curzone.nbvectors==3, _('Bad number of parts')
215
+
216
+ if self.centralpart is None:
217
+ self.centralpart = curzone.get_vector(0)
218
+ if self.upstream is None:
219
+ self.upstream = curzone.get_vector(1)
220
+ if self.downstream is None:
221
+ self.downstream = curzone.get_vector(2)
222
+
223
+ if self.centralpart is None:
224
+ raise Warning(_('Bad file : {}'.format(myfile)))
225
+ if self.upstream is None:
226
+ raise Warning(_('Bad file : {}'.format(myfile)))
227
+ if self.downstream is None:
228
+ raise Warning(_('Bad file : {}'.format(myfile)))
229
+
230
+ curzone = self.get_zone(zones_in_file_fr_vec.RIVER.value)
231
+ if curzone is None:
232
+ curzone = self.get_zone(1)
233
+ curzone.myname = zones_in_file_fr_vec.RIVER.value # on force le nom de la zone pour éviter de refaire le test ailleurs
234
+ if curzone is None:
235
+ raise Warning(_('Bad file : {}'.format(myfile)))
194
236
 
195
- for vec in self.polygons_zone.myvectors:
196
- vec.myprop.used=False # cache les polygones pour ne pas surcharger l'affichage éventuel
237
+ self.riverbed = curzone.get_vector('parallèle') # vertices from upstream to downstream
238
+ if self.riverbed is None:
239
+ self.riverbed = curzone.get_vector(1)
240
+ if self.riverbed is None:
241
+ raise Warning(_('Bad file : {}'.format(myfile)))
242
+
243
+ self.riverbed.reverse()
244
+
245
+ self.leftbank = curzone.get_vector(2) # vertices from upstream to downstream
246
+ if self.leftbank is None:
247
+ raise Warning(_('Bad file : {}'.format(myfile)))
248
+
249
+ self.leftbank.reverse()
250
+
251
+ self.rightbank = curzone.get_vector(0) # vertices from upstream to downstream
252
+ if self.rightbank is None:
253
+ raise Warning(_('Bad file : {}'.format(myfile)))
254
+
255
+ self.rightbank.reverse()
256
+
257
+ elif extension == '.vecz':
258
+
259
+ zone_names = [curzone.myname for curzone in self.myzones]
260
+
261
+ # test if all zones are present
262
+ for curkey in zones_in_file:
263
+ if curkey.value not in zone_names:
264
+ logging.warning(_('Zone {} not found in file {}'.format(curkey.value, myfile)))
265
+
266
+
267
+ if zones_in_file.PARTS.value in zone_names:
268
+ # recherche de la zone du fichier contenant les 3 parties de l'ouvrage
269
+ curzone = self.get_zone(zones_in_file.PARTS.value)
270
+
271
+ vec_names = [curvec.myname for curvec in curzone.myvectors]
272
+ for curkey in parts_values:
273
+ if curkey.value not in vec_names:
274
+ logging.error(_('Vector {} not found in zone {}'.format(curkey.value, zones_in_file.PARTS.value)))
275
+
276
+ # attribution des vecteurs pour les différentes parties de l'ouvrage
277
+ self.centralpart = curzone.get_vector(parts_values.CENTRAL.value) # 4 vertices from Upstream Left to Dowstream Left passing by Upstream Right and Downstream Right
278
+ self.upstream = curzone.get_vector(parts_values.UPSTREAM.value) # 4 vertices from Upstream Left Deck to Upstream Right Deck passing by Upstream Left Bank and Upstream Right Bank
279
+ self.downstream = curzone.get_vector(parts_values.DOWNSTREAM.value) # 4 vertices from Downstream Left Deck Left to Downstream Right Deck passing by Downstream Left Bank and Downstream Right Bank
280
+
281
+ xydeck = self.centralpart.asnparray()
282
+
283
+ # point central de l'ouvrage
284
+ self.centerx = np.mean(xydeck[:,0]) # X coordinate of the deck
285
+ self.centery = np.mean(xydeck[:,1]) # X coordinate of the deck
286
+ self.curvi = 0 # s curvilinear coordinate of the deck along a support polyline
287
+
288
+ if self.centralpart is None:
289
+ raise Warning(_('Bad file : {}'.format(myfile)))
290
+ if self.upstream is None:
291
+ raise Warning(_('Bad file : {}'.format(myfile)))
292
+ if self.downstream is None:
293
+ raise Warning(_('Bad file : {}'.format(myfile)))
294
+
295
+ if zones_in_file.RIVER.value in zone_names:
296
+ curzone = self.get_zone(zones_in_file.RIVER.value)
297
+
298
+ self.riverbed = curzone.get_vector(rivers_values.RIVERBED.value) # vertices from upstream to downstream
299
+ self.leftbank = curzone.get_vector(rivers_values.LEFTBANK.value) # vertices from upstream to downstream
300
+ self.rightbank = curzone.get_vector(rivers_values.RIGHTBANK.value) # vertices from upstream to downstream
301
+
302
+ if self.riverbed is None:
303
+ raise Warning(_('Bad file : {}'.format(myfile)))
304
+ if self.leftbank is None:
305
+ raise Warning(_('Bad file : {}'.format(myfile)))
306
+ if self.rightbank is None:
307
+ raise Warning(_('Bad file : {}'.format(myfile)))
308
+
309
+ self.create_polygon_river(ds)
310
+ self.force_plot()
311
+
312
+ self.colorize()
313
+
314
+ def force_plot(self):
197
315
 
198
316
  vecs = [self.centralpart, self.upstream, self.downstream, self.riverbed, self.leftbank, self.rightbank]
199
317
  vec: vector
200
318
  for vec in vecs:
201
- vec.myprop.used=True
319
+ if vec is not None:
320
+ vec.myprop.used=True
202
321
 
203
- self.colorize()
322
+ def create_polygon_river(self, ds:float=5.):
323
+ """ Create river polygons """
324
+
325
+ if self.leftbank is not None and self.riverbed is not None and self.rightbank is not None:
326
+
327
+ self.polygons_zone = zone(name= "polygons_river")
328
+ self.add_zone(self.polygons_zone, forceparent=True)
329
+ self.polygons_zone.myvectors = [self.leftbank, self.riverbed, self.rightbank] #inverse order to be up -> down
330
+
331
+ #création des polygones de rivière
332
+ self.polygons_zone.create_polygon_from_parallel(ds)
333
+
334
+ self.polygons_zone = self.get_zone(-1)
335
+ self.polygons_curvi = {}
336
+ for curvert in self.polygons_zone.myvectors:
337
+ self.polygons_curvi[curvert.myname] = curvert.myvertices[0].z
338
+
339
+ for vec in self.polygons_zone.myvectors:
340
+ vec.myprop.used=False # cache les polygones pour ne pas surcharger l'affichage éventuel
204
341
 
205
342
  def colorize(self):
206
343
  """Colorisation des polygones pour l'interface graphique"""
207
- self.centralpart.myprop.color = getIfromRGB((0,255,0))
208
- self.upstream.myprop.color = getIfromRGB((255,0,0))
209
- self.downstream.myprop.color = getIfromRGB((0,0,255))
344
+
345
+ if self.centralpart is not None and self.upstream is not None and self.downstream is not None:
346
+
347
+ self.centralpart.myprop.color = getIfromRGB((0,255,0))
348
+ self.upstream.myprop.color = getIfromRGB((255,0,0))
349
+ self.downstream.myprop.color = getIfromRGB((0,0,255))
210
350
 
211
351
  def get_distance(self, x:float, y:float):
212
352
  """
@@ -260,7 +400,7 @@ class Bridge(Zones):
260
400
  ATTENTION : si linked_arrays est un dictionnaire, alors un niveau supérieur est ajouté sur base des clés de ce dictionnaire, dans ce cas, self.linked est un dict et non une liste
261
401
 
262
402
  """
263
- curzone = self.get_zone(zones_in_file.PARTS.value)
403
+ curzone = self.get_zone(zones_in_file_fr_vec.PARTS.value)
264
404
 
265
405
  if isinstance(linked_arrays, dict):
266
406
 
@@ -1314,8 +1454,8 @@ class Weir(Bridge):
1314
1454
 
1315
1455
  def colorize(self):
1316
1456
  self.centralpart.myprop.color = getIfromRGB((102,102,255))
1317
- self.upstream.myprop.color = getIfromRGB((255,0,127))
1318
- self.downstream.myprop.color = getIfromRGB((102,0,204))
1457
+ self.upstream.myprop.color = getIfromRGB((255,0,127))
1458
+ self.downstream.myprop.color = getIfromRGB((102,0,204))
1319
1459
 
1320
1460
  class Weirs(Bridges):
1321
1461
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: wolfhece
3
- Version: 2.1.108
3
+ Version: 2.1.109
4
4
  Author-email: Pierre Archambeau <pierre.archambeau@uliege.be>
5
5
  License: Copyright (c) 2024 University of Liege. All rights reserved.
6
6
  Project-URL: Homepage, https://uee.uliege.be/hece
@@ -7,7 +7,7 @@ wolfhece/ManageParams.py,sha256=EeuUI5Vvh9ixCvYf8YShMC1s1Yacc7OxOCN7q81gqiQ,517
7
7
  wolfhece/Model1D.py,sha256=SI4oNF_J3MdjiWZoizS8kuRXLMVyymX9dYfYJNVCQVI,476989
8
8
  wolfhece/PyConfig.py,sha256=Bb1T8qjgKMChadJYDrHO9uo6CwItiAXScZpYkDXqZF8,11387
9
9
  wolfhece/PyCrosssections.py,sha256=FnmM9DWY_SAF2EDH9Gu2PojXNtSTRF4-aYQuAAJXBh4,112771
10
- wolfhece/PyDraw.py,sha256=BEMvFAefHqTJx_IPvuowrfS4l-WJyfNKwoqJtvr8-4s,483898
10
+ wolfhece/PyDraw.py,sha256=qlb1ClUTY9yDtPfXTyT6TnbGqhaLiXL3wd3Ri9AePOc,488365
11
11
  wolfhece/PyGui.py,sha256=Ceaby7kyTFf-eZQy4b6sI_b6y2ssN37bSGWBqOcb5VM,144145
12
12
  wolfhece/PyGuiHydrology.py,sha256=f60E8K9eGTnRq5RDF6yvt-ahf2AYegwQ9t25zZ2Mk1A,14946
13
13
  wolfhece/PyHydrographs.py,sha256=jwtSNMMACwarxrtN1UeQYth99UNrhwPx1IGgUwcooHA,3774
@@ -15,8 +15,8 @@ wolfhece/PyPalette.py,sha256=81n1P-olOe4wElTLv-miSDhqvJU_RHcxgfpHt794dSw,31436
15
15
  wolfhece/PyParams.py,sha256=GRp1zZDUJIjs8PtjwScDdov-E9orr1JWOntDazN5AOw,98577
16
16
  wolfhece/PyPictures.py,sha256=m1kY0saW6Y9Q0bDCo47lW6XxDkBrbQG-Fd8uVn8G5ic,2514
17
17
  wolfhece/PyTranslate.py,sha256=4appkmNeHHZLFmUtaA_k5_5QL-5ymxnbVN4R2OblmtE,622
18
- wolfhece/PyVertex.py,sha256=0TATf_Se6E7_P-kR1_DMEzRw_zy8-5cGFnc3yAod7yQ,44754
19
- wolfhece/PyVertexvectors.py,sha256=KH1IDGVsTCFserTEudu3UUxRqzOKpPzBk-LV7vMBHOM,259661
18
+ wolfhece/PyVertex.py,sha256=qFf8UPvkbwumRRfjpBcgZmqpHtcEtIEoUh30rWFF-lQ,45205
19
+ wolfhece/PyVertexvectors.py,sha256=d84gTrFXonYblgaQMJ9N0GcKWOPd85kJPlV_N9FpwuQ,280672
20
20
  wolfhece/PyWMS.py,sha256=WmOzHP02wVcB5RGJAlENL_NzF9rYfvLxslRFyxaEt1Q,6615
21
21
  wolfhece/RatingCurve.py,sha256=bUjIrQjvIjkD4V-z8bZmA6pe1ILtYNM0-3fT6YUY1RU,22498
22
22
  wolfhece/RatingCurveData.py,sha256=5UvnIm89BwqjnEbLCcY3CA8WoFd_xHJbooNy62fX5iY,57660
@@ -37,12 +37,12 @@ wolfhece/import_ascfiles.py,sha256=6Zl8qBR9c6VtyziookQ8YE9KC0GtW_J9WFt5ubyGp-s,4
37
37
  wolfhece/ins.py,sha256=uUeLMS1n3GPnfJhxl0Z2l-UXpmPUgthuwct282OOEzk,36184
38
38
  wolfhece/irm_qdf.py,sha256=KyrIk0Gu50Q702EWxRpwKTWI2KGjtHA1l8CL-Y469O0,26394
39
39
  wolfhece/ismember.py,sha256=fkLvaH9fhx-p0QrlEzqa6ySO-ios3ysjAgXVXzLgSpY,2482
40
- wolfhece/matplotlib_fig.py,sha256=JM3wmURaBCWXu-pRKzmjCBm05MPYtFqdUdkU3njiLfY,67812
40
+ wolfhece/matplotlib_fig.py,sha256=SRAAOBz8Y2B9Xc9jA6ZLbVaSw_6oAIBR_We_jdvwvIw,69511
41
41
  wolfhece/multiprojects.py,sha256=Sd6Bl6YP33jlR79A6rvSLu23vq8sqbFYL8lWuVPkEpE,21549
42
42
  wolfhece/picc.py,sha256=0X_pzhSBoVxgtTfJ37pkOQO3Vbr9yurPaD1nVeurx8k,8531
43
43
  wolfhece/pidcontroller.py,sha256=PHYenOdzfyPK2pXAhyRolCxMSMRd2AFza0eVMafpPHk,5205
44
44
  wolfhece/pyGui1D.py,sha256=9g7OS3YiKsqy--6y0cBD7x2gaqTTYFXWkxImpgnTA20,121937
45
- wolfhece/pybridges.py,sha256=EU_r6yRYDf5zKmwwXEBsGYvTKFbSfE3iTxPwusKR-1I,57398
45
+ wolfhece/pybridges.py,sha256=pNdtk42QiY4I2XPZJux5VsY3PLEPHPegefziu6n3tO4,64298
46
46
  wolfhece/pydike.py,sha256=hPBQsmSTW4QAp1wcOzb-TL3L7eet2WT1sJx2q-WNQ-Q,2241
47
47
  wolfhece/pylogging.py,sha256=4TI8hgBB65z-zpvU5Rfa2jkPXPhJaqXjHVPwbcdzTNc,4528
48
48
  wolfhece/pypolygons_scen.py,sha256=vMfAKXKrW6vKR7l9Fl2hEt-jihLwIiMur7qNTNfwRg4,46101
@@ -80,7 +80,7 @@ wolfhece/apps/curvedigitizer.py,sha256=Yps4bcayzbsz0AoVc_dkSk35dEhhn_esIBy1Ziefg
80
80
  wolfhece/apps/hydrometry.py,sha256=lhhJsFeb4zGL4bNQTs0co85OQ_6ssL1Oy0OUJCzhfYE,656
81
81
  wolfhece/apps/isocurrent.py,sha256=dagmGR8ja9QQ1gwz_8fU-N052hIw-W0mWGVkzLu6C7I,4247
82
82
  wolfhece/apps/splashscreen.py,sha256=SrustmIQeXnsiD-92OzjdGhBi-S7c_j-cSvuX4T6rtg,2929
83
- wolfhece/apps/version.py,sha256=B3V4f-GzEEtG_8tFb-c1Mvk7yh9C0Gr4C-hl8heRIVY,389
83
+ wolfhece/apps/version.py,sha256=8TeUFKF4fnleDiIjOTuhQTBUInamT8Zh5Q7qRDvk2x4,389
84
84
  wolfhece/apps/wolf.py,sha256=j_CgvsL8rwixbVvVD5Z0s7m7cHZ86gmFLojKGuetMls,729
85
85
  wolfhece/apps/wolf2D.py,sha256=4z_OPQ3IgaLtjexjMKX9ppvqEYyjFLt1hcfFABy3-jU,703
86
86
  wolfhece/apps/wolf_logo.bmp,sha256=ruJ4MA51CpGO_AYUp_dB4SWKHelvhOvd7Q8NrVOjDJk,3126
@@ -154,7 +154,7 @@ wolfhece/lagrangian/particles.py,sha256=S52_-3rzgVhift6l4Gznvsf_RTggzvNaD1dPvQUr
154
154
  wolfhece/lagrangian/velocity_field.py,sha256=oGVjNm98gEpawreFIrC1lDyC5bEhkk2CsyYAlF1Kq50,10574
155
155
  wolfhece/lazviewer/__init__.py,sha256=lz60EpQOBZ-zjvYzff6Y11jzAmC7mjOaxRYAfoqizQs,473
156
156
  wolfhece/lazviewer/_add_path.py,sha256=GDwPnzHuGRXGriDNcu1SQ6HetFDGIApeAQZEzYArGvI,605
157
- wolfhece/lazviewer/laz_viewer.py,sha256=XQ7vL8NU-igBEFQHSIQjFbKQYnt4sbZ-J6YLmzaxt3s,43426
157
+ wolfhece/lazviewer/laz_viewer.py,sha256=RENRGgW5BYaM97i6a0D5tgqtTswt3bJ7h5LPNqj5QQA,44124
158
158
  wolfhece/lazviewer/libs/Qt5Core.dll,sha256=sTJ_ctYFY9KHMNytF-lzH_078zIvnKTjN-71FDkOWPw,4924928
159
159
  wolfhece/lazviewer/libs/Qt5Gui.dll,sha256=07BeaOeYByraGkKYeDiSDYLawHM8tyd55pVJlKbZ4Y0,5436416
160
160
  wolfhece/lazviewer/libs/Qt5Network.dll,sha256=U-9FiLE9LUKru8r8EQxTnwwlMpwS8JzUtenhkKTCox0,1038336
@@ -293,8 +293,8 @@ wolfhece/ui/wolf_multiselection_collapsiblepane.py,sha256=8PlMYrb_8jI8h9F0_EagpM
293
293
  wolfhece/ui/wolf_times_selection_comparison_models.py,sha256=ORy7fz4dcp691qKzaOZHrRLZ0uXNhL-LIHxmpDGL6BI,5007
294
294
  wolfhece/wintab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
295
295
  wolfhece/wintab/wintab.py,sha256=8A-JNONV6ujgsgG3lM5Uw-pVgglPATwKs86oBzzljoc,7179
296
- wolfhece-2.1.108.dist-info/METADATA,sha256=UQSqXkwBsCIxXDUyovyKX-Ild-APC1qGfLJeGmw_llU,2618
297
- wolfhece-2.1.108.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
298
- wolfhece-2.1.108.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
299
- wolfhece-2.1.108.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
300
- wolfhece-2.1.108.dist-info/RECORD,,
296
+ wolfhece-2.1.109.dist-info/METADATA,sha256=WNTPztYbROy00T05fggMqd3xndJna-m0pRa9RANfpws,2618
297
+ wolfhece-2.1.109.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
298
+ wolfhece-2.1.109.dist-info/entry_points.txt,sha256=ZZ-aSfbpdcmo-wo84lRFzBN7LaSnD1XRGSaAKVX-Gpc,522
299
+ wolfhece-2.1.109.dist-info/top_level.txt,sha256=EfqZXMVCn7eILUzx9xsEu2oBbSo9liWPFWjIHik0iCI,9
300
+ wolfhece-2.1.109.dist-info/RECORD,,