An error occurred while loading the file. Please try again.
-
Guillaume Perréal authoreda50a3f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding: utf-8 -*-
from tools import timer
from View.Plot.APlot import APlot
from PyQt5.QtCore import (
QCoreApplication
)
_translate = QCoreApplication.translate
class PlotDKP(APlot):
def __init__(self, canvas=None, data=None, toolbar=None):
super(PlotDKP, self).__init__(
canvas=canvas,
data=data,
toolbar=toolbar
)
@timer
def draw(self, highlight=None):
self.canvas.axes.cla()
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
if self.data is None:
return
if len(self.data) == 0:
return
self.canvas.axes.set_ylabel(
_translate("MainWindow_reach", "Draft (m)"),
color='green', fontsize=11
)
self.canvas.axes.set_xlabel(
_translate("MainWindow_reach", "KP (m)"),
color='green', fontsize=11
)
kp = self.data.reach.reach.get_kp()
z_min = self.data.reach.reach.get_z_min()
self.canvas.axes.set_xlim(
left = min(kp), right = max(kp)
)
self.line_kp_zmin = self.canvas.axes.plot(
kp, z_min,
color='grey', lw=1.
)
kp = self.data.get_kp()
elevation = self.data.get_elevation()
self.line_kp_elevation = self.canvas.axes.plot(
kp, elevation,
color='b', marker='+', lw=1.
)
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
if self.toolbar is not None:
self.toolbar.update()
# self._init = True
@timer
def update(self, ind=None):
if self._init == False:
self.draw()
return