##// END OF EJS Templates
Updates model after an event has been created through the colored zone
Updates model after an event has been created through the colored zone

File last commit:

r1029:2928e8449245
r1286:073d4af7c849
Show More
SpectrogramSeries.cpp
50 lines | 2.1 KiB | text/x-c | CppLexer
/ core / src / Data / SpectrogramSeries.cpp
Alexandre Leroux
Creates SpectrogramSeries...
r869 #include <Data/SpectrogramSeries.h>
SpectrogramSeries::SpectrogramSeries(std::vector<double> xAxisData, std::vector<double> yAxisData,
std::vector<double> valuesData, const Unit &xAxisUnit,
Alexandre Leroux
Updates spectrogram to hold time resolution...
r1029 const Unit &yAxisUnit, const Unit &valuesUnit,
double resolution)
Alexandre Leroux
Creates SpectrogramSeries...
r869 : SpectrogramSeries{
Alexandre Leroux
Updates spectrogram to hold time resolution...
r1029 std::make_shared<ArrayData<1> >(std::move(xAxisData)),
xAxisUnit,
std::make_shared<ArrayData<2> >(std::move(valuesData), yAxisData.size()),
valuesUnit,
OptionalAxis{std::make_shared<ArrayData<1> >(std::move(yAxisData)), yAxisUnit},
resolution}
Alexandre Leroux
Creates SpectrogramSeries...
r869 {
}
SpectrogramSeries::SpectrogramSeries(std::shared_ptr<ArrayData<1> > xAxisData,
const Unit &xAxisUnit,
std::shared_ptr<ArrayData<2> > valuesData,
Alexandre Leroux
Updates spectrogram to hold time resolution...
r1029 const Unit &valuesUnit, OptionalAxis yAxis, double resolution)
Alexandre Leroux
Creates SpectrogramSeries...
r869 : DataSeries{std::move(xAxisData), xAxisUnit, std::move(valuesData), valuesUnit,
Alexandre Leroux
Updates spectrogram to hold time resolution...
r1029 std::move(yAxis)},
m_XResolution{resolution}
Alexandre Leroux
Creates SpectrogramSeries...
r869 {
}
std::unique_ptr<IDataSeries> SpectrogramSeries::clone() const
{
return std::make_unique<SpectrogramSeries>(*this);
}
std::shared_ptr<IDataSeries> SpectrogramSeries::subDataSeries(const SqpRange &range)
{
auto subXAxisData = std::vector<double>();
auto subValuesData = QVector<double>(); // Uses QVector to append easily values to it
this->lockRead();
auto bounds = xAxisRange(range.m_TStart, range.m_TEnd);
for (auto it = bounds.first; it != bounds.second; ++it) {
subXAxisData.push_back(it->x());
subValuesData.append(it->values());
}
auto yAxis = this->yAxis();
this->unlock();
return std::make_shared<SpectrogramSeries>(
std::make_shared<ArrayData<1> >(std::move(subXAxisData)), this->xAxisUnit(),
std::make_shared<ArrayData<2> >(subValuesData.toStdVector(), yAxis.size()),
this->valuesUnit(), std::move(yAxis));
}