Auto status change to "Under Review"
@@ -15,11 +15,6 struct SqpDateTime { | |||||
15 | { |
|
15 | { | |
16 | return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); |
|
16 | return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); | |
17 | } |
|
17 | } | |
18 |
|
||||
19 | bool intersect(const SqpDateTime &dateTime) |
|
|||
20 | { |
|
|||
21 | return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); |
|
|||
22 | } |
|
|||
23 | }; |
|
18 | }; | |
24 |
|
19 | |||
25 | // Required for using shared_ptr in signals/slots |
|
20 | // Required for using shared_ptr in signals/slots |
@@ -34,7 +34,6 public: | |||||
34 | IDataSeries *dataSeries() const noexcept; |
|
34 | IDataSeries *dataSeries() const noexcept; | |
35 |
|
35 | |||
36 | bool contains(const SqpDateTime &dateTime); |
|
36 | bool contains(const SqpDateTime &dateTime); | |
37 | bool intersect(const SqpDateTime &dateTime); |
|
|||
38 | void setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept; |
|
37 | void setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept; | |
39 |
|
38 | |||
40 | public slots: |
|
39 | public slots: |
@@ -80,15 +80,10 bool Variable::contains(const SqpDateTime &dateTime) | |||||
80 | // provider if necessary. |
|
80 | // provider if necessary. | |
81 | qCInfo(LOG_Variable()) << "NEW DATE NEEDED"; |
|
81 | qCInfo(LOG_Variable()) << "NEW DATE NEEDED"; | |
82 |
|
82 | |||
83 |
|
|
83 | impl->m_DateTime = dateTime; | |
84 |
|
84 | |||
85 | return false; |
|
85 | return false; | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | return true; |
|
88 | return true; | |
89 | } |
|
89 | } | |
90 |
|
||||
91 | bool Variable::intersect(const SqpDateTime &dateTime) |
|
|||
92 | { |
|
|||
93 | return impl->m_DateTime.intersect(dateTime); |
|
|||
94 | } |
|
@@ -111,38 +111,13 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||||
111 |
|
111 | |||
112 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); |
|
112 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); | |
113 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { |
|
113 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { | |
114 |
|
||||
115 | auto variable = it->first; |
|
114 | auto variable = it->first; | |
116 | qCInfo(LOG_VisualizationGraphWidget()) |
|
115 | auto tolerance = 0.1 * (t2.upper - t2.lower); | |
117 | << tr("TORM: VisualizationGraphWidget::onRangeChanged") |
|
116 | auto dateTime = SqpDateTime{t2.lower - tolerance, t2.upper + tolerance}; | |
118 | << variable->dataSeries()->xAxisData()->size(); |
|
|||
119 | auto dateTime = SqpDateTime{t2.lower, t2.upper}; |
|
|||
120 |
|
117 | |||
|
118 | qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged") | |||
|
119 | << variable->dataSeries()->xAxisData()->size(); | |||
121 | if (!variable->contains(dateTime)) { |
|
120 | if (!variable->contains(dateTime)) { | |
122 |
|
||||
123 | if (variable->intersect(dateTime)) { |
|
|||
124 | auto variableDateTime = variable->dateTime(); |
|
|||
125 | if (variableDateTime.m_TStart < dateTime.m_TStart) { |
|
|||
126 | dateTime.m_TStart = variableDateTime.m_TStart; |
|
|||
127 | // add 20% tolerance for left (start) side |
|
|||
128 | auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
|||
129 | dateTime.m_TStart -= tolerance; |
|
|||
130 | } |
|
|||
131 |
|
||||
132 | if (variableDateTime.m_TEnd > dateTime.m_TEnd) { |
|
|||
133 | dateTime.m_TEnd = variableDateTime.m_TEnd; |
|
|||
134 | // add 20% tolerance for right (end) side |
|
|||
135 | auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
|||
136 | dateTime.m_TEnd += tolerance; |
|
|||
137 | } |
|
|||
138 | } |
|
|||
139 | else { |
|
|||
140 | // add 10% tolerance for each side |
|
|||
141 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
|||
142 | dateTime.m_TStart -= tolerance; |
|
|||
143 | dateTime.m_TEnd += tolerance; |
|
|||
144 | } |
|
|||
145 | // CHangement detected, we need to |
|
|||
146 | sqpApp->variableController().requestDataLoading(variable, dateTime); |
|
121 | sqpApp->variableController().requestDataLoading(variable, dateTime); | |
147 | } |
|
122 | } | |
148 | } |
|
123 | } |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now