mirror of https://gitlab.com/pamhyr/pamhyr2
debug colors
parent
239ee905e7
commit
82c386806a
|
|
@ -48,3 +48,6 @@ class PlotRKZ(PlotRKC):
|
||||||
|
|
||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def draw_hs(self):
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -81,14 +81,13 @@ class PlotRKC(PamhyrPlot):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.draw_data(highlight)
|
self.draw_data(highlight)
|
||||||
self.draw_current()
|
#self.draw_current()
|
||||||
|
|
||||||
self.idle()
|
self.idle()
|
||||||
self._init = True
|
self._init = True
|
||||||
|
|
||||||
def draw_data(self, highlight):
|
def draw_data(self, highlight):
|
||||||
reach = self._current_reach
|
reach = self._current_reach
|
||||||
|
|
||||||
rk = reach.reach.get_rk()
|
rk = reach.reach.get_rk()
|
||||||
z_min = reach.reach.get_z_min()
|
z_min = reach.reach.get_z_min()
|
||||||
z_max = reach.reach.get_z_max()
|
z_max = reach.reach.get_z_max()
|
||||||
|
|
@ -115,8 +114,14 @@ class PlotRKC(PamhyrPlot):
|
||||||
picker=10
|
picker=10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.draw_hs()
|
||||||
# Draw HS
|
# Draw HS
|
||||||
|
|
||||||
|
def draw_hs(self):
|
||||||
|
reach = self._current_reach
|
||||||
|
rk = reach.reach.get_rk()
|
||||||
|
z_min = reach.reach.get_z_min()
|
||||||
|
z_max = reach.reach.get_z_max()
|
||||||
lhs = filter(
|
lhs = filter(
|
||||||
lambda hs: hs._input_reach is reach,
|
lambda hs: hs._input_reach is reach,
|
||||||
filter(
|
filter(
|
||||||
|
|
@ -130,9 +135,12 @@ class PlotRKC(PamhyrPlot):
|
||||||
vymax = []
|
vymax = []
|
||||||
self.anotate_lst = []
|
self.anotate_lst = []
|
||||||
hs_color = []
|
hs_color = []
|
||||||
for hs in lhs:
|
index = self.parent.tableView.selectedIndexes()
|
||||||
if hs.enabled:
|
for i, hs in enumerate(lhs):
|
||||||
hs_color.append("black")
|
if i == index[0].row():
|
||||||
|
hs_color.append("blue")
|
||||||
|
elif hs.enabled:
|
||||||
|
hs_color.append("red")
|
||||||
else:
|
else:
|
||||||
hs_color.append("darkgrey")
|
hs_color.append("darkgrey")
|
||||||
x = hs.input_rk
|
x = hs.input_rk
|
||||||
|
|
@ -161,7 +169,7 @@ class PlotRKC(PamhyrPlot):
|
||||||
def color_highlight(self, highlight):
|
def color_highlight(self, highlight):
|
||||||
|
|
||||||
reach = self._current_reach
|
reach = self._current_reach
|
||||||
colors = [self.color_plot] * reach.reach.number_profiles
|
colors = [self.color_plot_river_bottom] * reach.reach.number_profiles
|
||||||
|
|
||||||
if highlight is not None:
|
if highlight is not None:
|
||||||
rk = reach.reach.get_rk()
|
rk = reach.reach.get_rk()
|
||||||
|
|
@ -169,24 +177,9 @@ class PlotRKC(PamhyrPlot):
|
||||||
if (rk[i] >= highlight[0] and rk[i] <= highlight[1])]
|
if (rk[i] >= highlight[0] and rk[i] <= highlight[1])]
|
||||||
if len(rows) > 0:
|
if len(rows) > 0:
|
||||||
for row in rows:
|
for row in rows:
|
||||||
colors[row] = self.color_plot_current
|
colors[row] = "blue"
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
def draw_current(self):
|
|
||||||
if self._current_profile is None:
|
|
||||||
self.profile = None
|
|
||||||
else:
|
|
||||||
rk = [self._current_profile.rk,
|
|
||||||
self._current_profile.rk]
|
|
||||||
min_max = [self._current_profile.z_min(),
|
|
||||||
self._current_profile.z_max()]
|
|
||||||
|
|
||||||
self.profile = self.canvas.axes.plot(
|
|
||||||
rk, min_max,
|
|
||||||
color=self.color_plot_current,
|
|
||||||
lw=1.
|
|
||||||
)
|
|
||||||
|
|
||||||
def set_reach(self, reach):
|
def set_reach(self, reach):
|
||||||
self._current_reach = reach
|
self._current_reach = reach
|
||||||
self._current_profile = None
|
self._current_profile = None
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class PlotXY(PamhyrPlot):
|
||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
if event.mouseevent.inaxes != self.canvas.axes:
|
if event.mouseevent.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.mouseevent.button.value not in [1, 3]:
|
if event.mouseevent.button not in [1, 3]:
|
||||||
return
|
return
|
||||||
|
|
||||||
closest = self._closest_section(event)
|
closest = self._closest_section(event)
|
||||||
|
|
@ -70,9 +70,9 @@ class PlotXY(PamhyrPlot):
|
||||||
index = tableView.selectedIndexes()
|
index = tableView.selectedIndexes()
|
||||||
rk = self.data.get_rk()
|
rk = self.data.get_rk()
|
||||||
if self.parent._table is not None:
|
if self.parent._table is not None:
|
||||||
if event.mouseevent.button.value == 1:
|
if event.mouseevent.button == 1:
|
||||||
table.setData(index[3], rk[closest[0]])
|
table.setData(index[3], rk[closest[0]])
|
||||||
if event.mouseevent.button.value == 3:
|
if event.mouseevent.button == 3:
|
||||||
table.setData(index[4], rk[closest[0]])
|
table.setData(index[4], rk[closest[0]])
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
@ -141,7 +141,7 @@ class PlotXY(PamhyrPlot):
|
||||||
if self._highlight_data is not None:
|
if self._highlight_data is not None:
|
||||||
rk_min, rk_max = self._highlight_data
|
rk_min, rk_max = self._highlight_data
|
||||||
|
|
||||||
colors = [self.color_plot for row in range(len(self._data))]
|
colors = [self.color_plot_river_bottom for row in range(len(self._data))]
|
||||||
for i, rk in enumerate(self.data.get_rk_complete_profiles()):
|
for i, rk in enumerate(self.data.get_rk_complete_profiles()):
|
||||||
if rk_min <= rk <= rk_max:
|
if rk_min <= rk <= rk_max:
|
||||||
colors[i] = self.color_plot_current
|
colors[i] = self.color_plot_current
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,8 @@ class PlotXY(PamhyrPlot):
|
||||||
reach.geometry.get_y()):
|
reach.geometry.get_y()):
|
||||||
self.line_xy.append(np.column_stack(xy))
|
self.line_xy.append(np.column_stack(xy))
|
||||||
|
|
||||||
self._colors, self._style = self.color_hightlight()
|
self._colors = "grey"
|
||||||
|
self._style = "-"
|
||||||
self.line_xy_collection = collections.LineCollection(
|
self.line_xy_collection = collections.LineCollection(
|
||||||
self.line_xy,
|
self.line_xy,
|
||||||
colors=self._colors,
|
colors=self._colors,
|
||||||
|
|
@ -175,22 +176,22 @@ class PlotXY(PamhyrPlot):
|
||||||
)
|
)
|
||||||
self.canvas.axes.add_collection(self.line_xy_collection)
|
self.canvas.axes.add_collection(self.line_xy_collection)
|
||||||
|
|
||||||
def color_hightlight(self):
|
#def color_hightlight(self):
|
||||||
reach = self.results.river.reach(self._current_reach_id)
|
#reach = self.results.river.reach(self._current_reach_id)
|
||||||
rows = [self._current_profile_id]
|
#rows = [self._current_profile_id]
|
||||||
colors = [self.color_plot
|
#colors = [self.color_plot
|
||||||
for row in range(reach.geometry.number_profiles)]
|
#for row in range(reach.geometry.number_profiles)]
|
||||||
style = ["-" for row in range(reach.geometry.number_profiles)]
|
#style = ["-" for row in range(reach.geometry.number_profiles)]
|
||||||
if len(rows) > 0:
|
#if len(rows) > 0:
|
||||||
for row in rows:
|
#for row in rows:
|
||||||
colors[row] = self.color_plot_current
|
#colors[row] = self.color_plot_current
|
||||||
if rows[0] > 0:
|
#if rows[0] > 0:
|
||||||
colors[rows[0]-1] = self.color_plot_previous
|
#colors[rows[0]-1] = self.color_plot_previous
|
||||||
style[rows[0]-1] = "--"
|
#style[rows[0]-1] = "--"
|
||||||
if rows[-1] < reach.geometry.number_profiles-1:
|
#if rows[-1] < reach.geometry.number_profiles-1:
|
||||||
colors[rows[-1]+1] = self.color_plot_next
|
#colors[rows[-1]+1] = self.color_plot_next
|
||||||
style[rows[-1]+1] = "--"
|
#style[rows[-1]+1] = "--"
|
||||||
return colors, style
|
#return colors, style
|
||||||
|
|
||||||
def draw_guide_lines(self, reach):
|
def draw_guide_lines(self, reach):
|
||||||
x_complete = reach.geometry.get_guidelines_x()
|
x_complete = reach.geometry.get_guidelines_x()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue