Chris@1554: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1554: Chris@1554: /* Chris@1554: Sonic Visualiser Chris@1554: An audio file viewer and annotation editor. Chris@1554: Centre for Digital Music, Queen Mary, University of London. Chris@1554: Chris@1554: This program is free software; you can redistribute it and/or Chris@1554: modify it under the terms of the GNU General Public License as Chris@1554: published by the Free Software Foundation; either version 2 of the Chris@1554: License, or (at your option) any later version. See the file Chris@1554: COPYING included with this distribution for more information. Chris@1554: */ Chris@1554: Chris@1554: #ifndef COLOUR_3D_PLOT_EXPORTER_H Chris@1554: #define COLOUR_3D_PLOT_EXPORTER_H Chris@1554: Chris@1554: #include "Colour3DPlotRenderer.h" Chris@1554: Chris@1554: class Colour3DPlotExporter : public Model Chris@1554: { Chris@1554: Q_OBJECT Chris@1554: Chris@1554: public: Chris@1554: struct Sources { Chris@1554: // These must all outlive this class, or else discardSources() Chris@1554: // must be called Chris@1554: const VerticalBinLayer *verticalBinLayer; // always Chris@1554: ModelId source; // always; a DenseThreeDimensionalModel Chris@1554: ModelId fft; // optionally; an FFTModel; used for phase/peak-freq modes Chris@1554: const LayerGeometryProvider *provider; // optionally Chris@1554: }; Chris@1554: Chris@1554: struct Parameters { Chris@1554: Parameters() : Chris@1554: binDisplay(BinDisplay::AllBins) { } Chris@1554: Chris@1554: /** Selection of bins to include in the export. */ Chris@1554: BinDisplay binDisplay; Chris@1554: }; Chris@1554: Chris@1556: Colour3DPlotExporter(Sources sources, Parameters parameters); Chris@1556: ~Colour3DPlotExporter(); Chris@1554: Chris@1556: void discardSources(); Chris@1554: Chris@1554: QString toDelimitedDataString(QString, DataExportOptions, Chris@1554: sv_frame_t, sv_frame_t) const override; Chris@1554: Chris@1556: Chris@1556: // Further Model methods that we just delegate Chris@1556: Chris@1556: bool isOK() const override { Chris@1556: if (auto model = ModelById::get(m_sources.source)) { Chris@1556: return model->isOK(); Chris@1556: } Chris@1556: return false; Chris@1556: } Chris@1556: Chris@1556: sv_frame_t getStartFrame() const override { Chris@1556: if (auto model = ModelById::get(m_sources.source)) { Chris@1556: return model->getStartFrame(); Chris@1556: } Chris@1556: return 0; Chris@1556: } Chris@1556: Chris@1556: sv_frame_t getTrueEndFrame() const override { Chris@1556: if (auto model = ModelById::get(m_sources.source)) { Chris@1556: return model->getTrueEndFrame(); Chris@1556: } Chris@1556: return 0; Chris@1556: } Chris@1556: Chris@1556: sv_samplerate_t getSampleRate() const override { Chris@1556: if (auto model = ModelById::get(m_sources.source)) { Chris@1556: return model->getSampleRate(); Chris@1556: } Chris@1556: return 0; Chris@1556: } Chris@1556: Chris@1556: QString getTypeName() const override { Chris@1556: if (auto model = ModelById::get(m_sources.source)) { Chris@1556: return model->getTypeName(); Chris@1556: } Chris@1556: return "(exporter)"; // internal fallback, no translation needed Chris@1556: } Chris@1556: Chris@1556: int getCompletion() const override { Chris@1556: if (auto model = ModelById::get(m_sources.source)) { Chris@1556: return model->getCompletion(); Chris@1556: } Chris@1556: return 0; Chris@1556: } Chris@1556: Chris@1554: private: Chris@1554: Sources m_sources; Chris@1554: Parameters m_params; Chris@1554: }; Chris@1554: Chris@1554: #endif