Auto status change to "Under Review"
@@ -15,6 +15,11 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 | } | |||
18 | }; |
|
23 | }; | |
19 |
|
24 | |||
20 | // Required for using shared_ptr in signals/slots |
|
25 | // Required for using shared_ptr in signals/slots |
@@ -34,6 +34,7 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); | |||
37 | void setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept; |
|
38 | void setDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept; | |
38 |
|
39 | |||
39 | public slots: |
|
40 | public slots: |
@@ -80,10 +80,15 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 | impl->m_DateTime = dateTime; |
|
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,13 +111,38 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 | auto variable = it->first; |
|
|||
115 | auto tolerance = 0.1 * (t2.upper - t2.lower); |
|
|||
116 | auto dateTime = SqpDateTime{t2.lower - tolerance, t2.upper + tolerance}; |
|
|||
117 |
|
114 | |||
118 | qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged") |
|
115 | auto variable = it->first; | |
|
116 | qCInfo(LOG_VisualizationGraphWidget()) | |||
|
117 | << tr("TORM: VisualizationGraphWidget::onRangeChanged") | |||
119 |
|
|
118 | << variable->dataSeries()->xAxisData()->size(); | |
|
119 | auto dateTime = SqpDateTime{t2.lower, t2.upper}; | |||
|
120 | ||||
120 | if (!variable->contains(dateTime)) { |
|
121 | 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 | |||
121 | sqpApp->variableController().requestDataLoading(variable, dateTime); |
|
146 | sqpApp->variableController().requestDataLoading(variable, dateTime); | |
122 | } |
|
147 | } | |
123 | } |
|
148 | } |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now