##// END OF EJS Templates
Spectrograms implementation (5)...
Alexandre Leroux -
r942:aa9146db2d67
parent child
Show More
@@ -76,7 +76,11 public:
76 76
77 77 private:
78 78 Properties m_Properties{};
79 std::vector<double> m_XAxisData{};
79 80 std::vector<double> m_YAxisData{};
81 std::vector<double> m_ValuesData{};
82 std::vector<int> m_ValuesIndexes{};
83 double m_FillValue{std::numeric_limits<double>::quiet_NaN()};
80 84 };
81 85
82 86 /**
@@ -1,8 +1,10
1 1 #include "AmdaResultParserHelper.h"
2 2
3 3 #include <Common/DateUtils.h>
4 #include <Common/SortUtils.h>
4 5
5 6 #include <Data/ScalarSeries.h>
7 #include <Data/SpectrogramSeries.h>
6 8 #include <Data/Unit.h>
7 9 #include <Data/VectorSeries.h>
8 10
@@ -269,12 +271,28 bool SpectrogramParserHelper::checkProperties()
269 271 minBands.begin(), minBands.end(), maxBands.begin(), std::back_inserter(m_YAxisData),
270 272 [](const auto &minValue, const auto &maxValue) { return (minValue + maxValue) / 2.; });
271 273
274 // Generates values indexes, i.e. the order in which each value will be retrieved (in ascending
275 // order of the associated bands)
276 m_ValuesIndexes = SortUtils::sortPermutation(m_YAxisData, std::less<double>());
277
278 // Sorts y-axis data accoding to the ascending order
279 m_YAxisData = SortUtils::sort(m_YAxisData, 1, m_ValuesIndexes);
280
281 // Sets fill value
282 m_FillValue = m_Properties.value(FILL_VALUE_PROPERTY).value<double>();
283
284 /// @todo: handle min/max samplings?
285
272 286 return true;
273 287 }
274 288
275 289 std::shared_ptr<IDataSeries> SpectrogramParserHelper::createSeries()
276 290 {
277 /// @todo ALX
291 return std::make_shared<SpectrogramSeries>(
292 std::move(m_XAxisData), std::move(m_YAxisData), std::move(m_ValuesData),
293 Unit{"t", true}, // x-axis unit is always a time unit
294 m_Properties.value(Y_AXIS_UNIT_PROPERTY).value<Unit>(),
295 m_Properties.value(VALUES_UNIT_PROPERTY).value<Unit>());
278 296 }
279 297
280 298 void SpectrogramParserHelper::readPropertyLine(const QString &line)
@@ -329,7 +347,7 void SpectrogramParserHelper::readPropertyLine(const QString &line)
329 347
330 348 void SpectrogramParserHelper::readResultLine(const QString &line)
331 349 {
332 /// @todo ALX
350 tryReadResult(m_XAxisData, m_ValuesData, line, m_ValuesIndexes, m_FillValue);
333 351 }
334 352
335 353 // ////////////////// //
General Comments 0
You need to be logged in to leave comments. Login now