From aa0c1de0bcf6b02e06d37124634fbd40a1e92756 2017-11-08 08:27:56 From: Alexandre Leroux Date: 2017-11-08 08:27:56 Subject: [PATCH] Implements spectrograms display (1) Implements the creation of the colormap that represents the spectrogram in QCustomPlot --- diff --git a/core/include/Data/DataSeries.h b/core/include/Data/DataSeries.h index c6d2ce3..c258397 100644 --- a/core/include/Data/DataSeries.h +++ b/core/include/Data/DataSeries.h @@ -383,6 +383,10 @@ public: return std::make_pair(minIt, maxIt); } + /// @return the y-axis associated to the data series + /// @todo pass getter as protected and use iterators to access the y-axis data + OptionalAxis yAxis() const { return m_YAxis; } + // /////// // // Mutexes // // /////// // @@ -438,9 +442,6 @@ protected: // necessary to call the sort method here ('other' is sorted) } - /// @return the y-axis associated to the data series - OptionalAxis yAxis() const { return m_YAxis; } - /// Assignment operator template DataSeries &operator=(DataSeries other) diff --git a/gui/src/Visualization/VisualizationGraphHelper.cpp b/gui/src/Visualization/VisualizationGraphHelper.cpp index 7bfce64..f8401f3 100644 --- a/gui/src/Visualization/VisualizationGraphHelper.cpp +++ b/gui/src/Visualization/VisualizationGraphHelper.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -68,6 +69,24 @@ struct PlottablesCreator +struct PlottablesCreator::value> > { + static PlottablesMap createPlottables(T &dataSeries, QCustomPlot &plot) + { + PlottablesMap result{}; + result.insert({0, new QCPColorMap{plot.xAxis, plot.yAxis}}); + + plot.replot(); + + return result; + } +}; + +/** * Struct used to update plottables, depending on the type of the data series from which to update * them * @tparam T the data series' type @@ -200,6 +219,9 @@ std::unique_ptr createHelper(std::shared_ptr dat if (auto scalarSeries = std::dynamic_pointer_cast(dataSeries)) { return std::make_unique >(*scalarSeries); } + else if (auto spectrogramSeries = std::dynamic_pointer_cast(dataSeries)) { + return std::make_unique >(*spectrogramSeries); + } else if (auto vectorSeries = std::dynamic_pointer_cast(dataSeries)) { return std::make_unique >(*vectorSeries); }