annotate layer/Colour3DPlotLayer.h @ 162:f32212631b9c

* Handle generator transforms (plugins whose channel count isn't dependent on number of audio inputs, as they have none) * Be less keen to suspend writing FFT data in spectrogram repaint -- only do it if we find we actually need to query the FFT data (i.e. we aren't repainting an area that hasn't been generated at all yet)
author Chris Cannam
date Tue, 10 Oct 2006 19:04:57 +0000
parents c1fb771b7646
children 42118892f428
rev   line source
Chris@58 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@59 4 Sonic Visualiser
Chris@59 5 An audio file viewer and annotation editor.
Chris@59 6 Centre for Digital Music, Queen Mary, University of London.
Chris@59 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@59 9 This program is free software; you can redistribute it and/or
Chris@59 10 modify it under the terms of the GNU General Public License as
Chris@59 11 published by the Free Software Foundation; either version 2 of the
Chris@59 12 License, or (at your option) any later version. See the file
Chris@59 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #ifndef _COLOUR_3D_PLOT_H_
Chris@0 17 #define _COLOUR_3D_PLOT_H_
Chris@0 18
Chris@128 19 #include "Layer.h"
Chris@0 20
Chris@128 21 #include "data/model/DenseThreeDimensionalModel.h"
Chris@0 22
Chris@0 23 class View;
Chris@0 24 class QPainter;
Chris@0 25 class QImage;
Chris@0 26
Chris@0 27 /**
Chris@0 28 * This is a view that displays dense 3-D data (time, some sort of
Chris@0 29 * binned y-axis range, value) as a colour plot with value mapped to
Chris@0 30 * colour range. Its source is a DenseThreeDimensionalModel.
Chris@0 31 *
Chris@0 32 * This was the original implementation for the spectrogram view, but
Chris@0 33 * it was replaced with a more efficient implementation that derived
Chris@0 34 * the spectrogram itself from a DenseTimeValueModel instead of using
Chris@0 35 * a three-dimensional model. This class is retained in case it
Chris@0 36 * becomes useful, but it will probably need some cleaning up if it's
Chris@0 37 * ever actually used.
Chris@0 38 */
Chris@0 39
Chris@0 40 class Colour3DPlotLayer : public Layer
Chris@0 41 {
Chris@0 42 Q_OBJECT
Chris@0 43
Chris@0 44 public:
Chris@44 45 Colour3DPlotLayer();
Chris@0 46 ~Colour3DPlotLayer();
Chris@0 47
Chris@156 48 virtual const ZoomConstraint *getZoomConstraint() const {
Chris@156 49 return m_model ? m_model->getZoomConstraint() : 0;
Chris@156 50 }
Chris@0 51 virtual const Model *getModel() const { return m_model; }
Chris@44 52 virtual void paint(View *v, QPainter &paint, QRect rect) const;
Chris@0 53
Chris@44 54 virtual int getVerticalScaleWidth(View *v, QPainter &) const;
Chris@44 55 virtual void paintVerticalScale(View *v, QPainter &paint, QRect rect) const;
Chris@25 56
Chris@44 57 virtual QString getFeatureDescription(View *v, QPoint &) const;
Chris@25 58
Chris@44 59 virtual bool snapToFeatureFrame(View *v, int &frame,
Chris@28 60 size_t &resolution,
Chris@28 61 SnapType snap) const;
Chris@24 62
Chris@44 63 virtual bool isLayerScrollable(const View *v) const;
Chris@25 64
Chris@0 65 void setModel(const DenseThreeDimensionalModel *model);
Chris@0 66
Chris@115 67 virtual int getCompletion(View *) const { return m_model->getCompletion(); }
Chris@24 68
Chris@101 69 virtual bool getValueExtents(float &, float &, bool &, QString &) const { return false; }
Chris@0 70
Chris@0 71 virtual PropertyList getProperties() const;
Chris@0 72 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@159 73 virtual QString getPropertyLabel(const PropertyName &) const;
Chris@159 74 virtual QString getPropertyGroupName(const PropertyName &) const;
Chris@0 75 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@159 76 int *min, int *max) const;
Chris@0 77 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@0 78 int value) const;
Chris@0 79 virtual void setProperty(const PropertyName &, int value);
Chris@0 80
Chris@125 81 void setProperties(const QXmlAttributes &) { }
Chris@11 82
Chris@159 83 //!!! harmonize with spectrogram
Chris@159 84 enum ColourScale { LinearScale, AbsoluteScale, MeterScale, dBScale };
Chris@159 85
Chris@159 86 void setColourScale(ColourScale);
Chris@159 87 ColourScale getColourScale() const { return m_colourScale; }
Chris@159 88
Chris@0 89 protected slots:
Chris@0 90 void cacheInvalid();
Chris@0 91 void cacheInvalid(size_t startFrame, size_t endFrame);
Chris@0 92
Chris@0 93 protected:
Chris@0 94 const DenseThreeDimensionalModel *m_model; // I do not own this
Chris@0 95
Chris@0 96 mutable QImage *m_cache;
Chris@98 97
Chris@159 98 ColourScale m_colourScale;
Chris@159 99
Chris@159 100 virtual int getColourScaleWidth(QPainter &) const;
Chris@98 101 virtual void paintDense(View *v, QPainter &paint, QRect rect) const;
Chris@0 102 };
Chris@0 103
Chris@0 104 #endif