Mercurial > hg > svgui
changeset 1071:65b183494331 spectrogram-minor-refactor
Start stubbing Colour3DPlotRenderer
author | Chris Cannam |
---|---|
date | Thu, 23 Jun 2016 17:07:21 +0100 |
parents | 27163db978d8 |
children | 76b50b48e1e4 |
files | layer/Colour3DPlotRenderer.cpp layer/Colour3DPlotRenderer.h layer/ColourMapper.cpp layer/ColourMapper.h layer/ColourScale.cpp layer/ColourScale.h svgui.pro |
diffstat | 7 files changed, 118 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layer/Colour3DPlotRenderer.cpp Thu Jun 23 17:07:21 2016 +0100 @@ -0,0 +1,17 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2006-2016 Chris Cannam and QMUL. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "Colour3DPlotRenderer.h" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layer/Colour3DPlotRenderer.h Thu Jun 23 17:07:21 2016 +0100 @@ -0,0 +1,72 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + This file copyright 2006-2016 Chris Cannam and QMUL. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef COLOUR_3D_PLOT_RENDERER_H +#define COLOUR_3D_PLOT_RENDERER_H + +#include "ColourScale.h" + +#include "base/ColumnOp.h" + +class DenseThreeDimensionalModel; +class Dense3DModelPeakCache; +class FFTModel; + +class Colour3DPlotRenderer +{ +public: + enum BinDisplay { + AllBins, + PeakBins, + PeakFrequencies + }; + + enum BinScale { + LinearBinScale, + LogBinScale + }; + + struct Parameters { + + Parameters() : + source(0), peaks(0), fft(0), + colourScale(ColourScale::Parameters()), + normalization(ColumnOp::NoNormalization), + binDisplay(AllBins), binScale(LinearBinScale), + alwaysOpaque(false), interpolate(false), invertVertical(false) { } + + DenseThreeDimensionalModel *source; // always + Dense3DModelPeakCache *peaks; // optionally + FFTModel *fft; // optionally + + ColourScale colourScale; // complete ColourScale object by value + ColumnOp::Normalization normalization; + BinDisplay binDisplay; + BinScale binScale; + bool alwaysOpaque; + bool interpolate; + bool invertVertical; + }; + + Colour3DPlotRenderer(Parameters parameters) : + m_params(parameters) + { } + +private: + Parameters m_params; +}; + +#endif +
--- a/layer/ColourMapper.cpp Thu Jun 23 14:51:10 2016 +0100 +++ b/layer/ColourMapper.cpp Thu Jun 23 17:07:21 2016 +0100 @@ -60,7 +60,6 @@ } ColourMapper::ColourMapper(int map, double min, double max) : - QObject(), m_map(map), m_min(min), m_max(max) @@ -85,25 +84,25 @@ QString ColourMapper::getColourMapName(int n) { - if (n >= getColourMapCount()) return tr("<unknown>"); + if (n >= getColourMapCount()) return QObject::tr("<unknown>"); StandardMap map = (StandardMap)n; switch (map) { - case Green: return tr("Green"); - case WhiteOnBlack: return tr("White on Black"); - case BlackOnWhite: return tr("Black on White"); - case Cherry: return tr("Cherry"); - case Wasp: return tr("Wasp"); - case Ice: return tr("Ice"); - case Sunset: return tr("Sunset"); - case FruitSalad: return tr("Fruit Salad"); - case Banded: return tr("Banded"); - case Highlight: return tr("Highlight"); - case Printer: return tr("Printer"); - case HighGain: return tr("High Gain"); + case Green: return QObject::tr("Green"); + case WhiteOnBlack: return QObject::tr("White on Black"); + case BlackOnWhite: return QObject::tr("Black on White"); + case Cherry: return QObject::tr("Cherry"); + case Wasp: return QObject::tr("Wasp"); + case Ice: return QObject::tr("Ice"); + case Sunset: return QObject::tr("Sunset"); + case FruitSalad: return QObject::tr("Fruit Salad"); + case Banded: return QObject::tr("Banded"); + case Highlight: return QObject::tr("Highlight"); + case Printer: return QObject::tr("Printer"); + case HighGain: return QObject::tr("High Gain"); } - return tr("<unknown>"); + return QObject::tr("<unknown>"); } QColor
--- a/layer/ColourMapper.h Thu Jun 23 14:51:10 2016 +0100 +++ b/layer/ColourMapper.h Thu Jun 23 17:07:21 2016 +0100 @@ -23,14 +23,14 @@ /** * A class for mapping intensity values onto various colour maps. */ - -class ColourMapper : public QObject +class ColourMapper { - Q_OBJECT - public: ColourMapper(int map, double minValue, double maxValue); - virtual ~ColourMapper(); + ~ColourMapper(); + + ColourMapper(const ColourMapper &) = default; + ColourMapper &operator=(const ColourMapper &) = default; enum StandardMap { Green,
--- a/layer/ColourScale.cpp Thu Jun 23 14:51:10 2016 +0100 +++ b/layer/ColourScale.cpp Thu Jun 23 17:07:21 2016 +0100 @@ -56,6 +56,10 @@ } } +ColourScale::~ColourScale() +{ +} + int ColourScale::getPixel(double value) {
--- a/layer/ColourScale.h Thu Jun 23 14:51:10 2016 +0100 +++ b/layer/ColourScale.h Thu Jun 23 17:07:21 2016 +0100 @@ -68,7 +68,11 @@ * are ignored for PhaseColourScale. */ ColourScale(Parameters parameters); + ~ColourScale(); + ColourScale(const ColourScale &) = default; + ColourScale &operator=(const ColourScale &) = default; + /** * Return a pixel number (in the range 0-255 inclusive) * corresponding to the given value. The pixel 0 is used only for
--- a/svgui.pro Thu Jun 23 14:51:10 2016 +0100 +++ b/svgui.pro Thu Jun 23 17:07:21 2016 +0100 @@ -39,6 +39,7 @@ MOC_DIR = o HEADERS += layer/Colour3DPlotLayer.h \ + layer/Colour3DPlotRenderer.h \ layer/ColourDatabase.h \ layer/ColourMapper.h \ layer/ColourScale.h \ @@ -69,6 +70,7 @@ layer/VerticalScaleLayer.h \ layer/WaveformLayer.h SOURCES += layer/Colour3DPlotLayer.cpp \ + layer/Colour3DPlotRenderer.cpp \ layer/ColourDatabase.cpp \ layer/ColourMapper.cpp \ layer/ColourScale.cpp \