##// END OF EJS Templates
Updates data series creation according to the value type (vector or scalar)
Alexandre Leroux -
r532:522bb785789b
parent child
Show More
@@ -2,6 +2,7
2 2
3 3 #include <Common/DateUtils.h>
4 4 #include <Data/ScalarSeries.h>
5 #include <Data/VectorSeries.h>
5 6
6 7 #include <QDateTime>
7 8 #include <QFile>
@@ -188,7 +189,28 std::shared_ptr<IDataSeries> AmdaResultParser::readTxt(const QString &filePath,
188 189 stream.seek(0); // returns to the beginning of the file
189 190 auto results = readResults(stream, valueType);
190 191
192 // Creates data series
193 switch (valueType) {
194 case ValueType::SCALAR:
195 Q_ASSERT(results.second.size() == 1);
196 return std::make_shared<ScalarSeries>(
197 std::move(results.first), std::move(results.second.takeFirst()), xAxisUnit, Unit{});
198 case ValueType::VECTOR: {
199 Q_ASSERT(results.second.size() == 3);
200 auto xValues = results.second.takeFirst();
201 auto yValues = results.second.takeFirst();
202 auto zValues = results.second.takeFirst();
203 return std::make_shared<VectorSeries>(std::move(results.first), std::move(xValues),
204 std::move(yValues), std::move(zValues), xAxisUnit,
205 Unit{});
206 }
207 case ValueType::UNKNOWN:
208 // Invalid case
209 break;
210 }
191 211
192 return std::make_shared<ScalarSeries>(std::move(results.first), std::move(results.second),
193 xAxisUnit, Unit{});
212 // Invalid cases
213 qCCritical(LOG_AmdaResultParser())
214 << QObject::tr("Can't create data series: unsupported value type");
215 return nullptr;
194 216 }
General Comments 0
You need to be logged in to leave comments. Login now