annotate layer/Colour3DPlotLayer.h @ 25:dcdb21b62dbb

* Refactor sparse models. Previously the 1D and time-value models duplicated a lot of code; now there is a base class (SparseModel) templated on the stored point type, and the subclasses define point types with the necessary characteristics. * Add NoteModel, a new SparseModel subclass. * Reorganise local feature description display. Instead of asking the layer to draw its own, just query it for a textual description and draw that in Pane. Greatly simplifies this part of the layer code. * Add local feature descriptions to colour 3D plot and waveform layers. * Add pitch in MIDI-pitch-and-cents to spectrogram layer. * Give AudioGenerator its own mutex to shorten lock times in CallbackPlaySource. * Minor adjustments to layers menu &c
author Chris Cannam
date Thu, 02 Feb 2006 16:10:19 +0000
parents 6b794a2af3d9
children 202d1dca67d2
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 A waveform viewer and audio annotation editor.
Chris@5 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@0 6
Chris@0 7 This is experimental software. Not for distribution.
Chris@0 8 */
Chris@0 9
Chris@0 10 #ifndef _COLOUR_3D_PLOT_H_
Chris@0 11 #define _COLOUR_3D_PLOT_H_
Chris@0 12
Chris@0 13 #include "base/Layer.h"
Chris@0 14
Chris@0 15 #include "model/DenseThreeDimensionalModel.h"
Chris@0 16
Chris@0 17 class View;
Chris@0 18 class QPainter;
Chris@0 19 class QImage;
Chris@0 20
Chris@0 21 /**
Chris@0 22 * This is a view that displays dense 3-D data (time, some sort of
Chris@0 23 * binned y-axis range, value) as a colour plot with value mapped to
Chris@0 24 * colour range. Its source is a DenseThreeDimensionalModel.
Chris@0 25 *
Chris@0 26 * This was the original implementation for the spectrogram view, but
Chris@0 27 * it was replaced with a more efficient implementation that derived
Chris@0 28 * the spectrogram itself from a DenseTimeValueModel instead of using
Chris@0 29 * a three-dimensional model. This class is retained in case it
Chris@0 30 * becomes useful, but it will probably need some cleaning up if it's
Chris@0 31 * ever actually used.
Chris@0 32 */
Chris@0 33
Chris@0 34 class Colour3DPlotLayer : public Layer
Chris@0 35 {
Chris@0 36 Q_OBJECT
Chris@0 37
Chris@0 38 public:
Chris@0 39 Colour3DPlotLayer(View *w);
Chris@0 40 ~Colour3DPlotLayer();
Chris@0 41
Chris@0 42 virtual const ZoomConstraint *getZoomConstraint() const { return m_model; }
Chris@0 43 virtual const Model *getModel() const { return m_model; }
Chris@0 44 virtual void paint(QPainter &paint, QRect rect) const;
Chris@0 45
Chris@25 46 virtual int getVerticalScaleWidth(QPainter &) const;
Chris@25 47 virtual void paintVerticalScale(QPainter &paint, QRect rect) const;
Chris@25 48
Chris@25 49 virtual QString getFeatureDescription(QPoint &) const;
Chris@25 50
Chris@24 51 virtual int getNearestFeatureFrame(int frame,
Chris@24 52 size_t &resolution,
Chris@24 53 bool snapRight = true) const;
Chris@24 54
Chris@25 55 virtual bool isLayerScrollable() const;
Chris@25 56
Chris@0 57 void setModel(const DenseThreeDimensionalModel *model);
Chris@0 58
Chris@24 59 virtual int getCompletion() const { return m_model->getCompletion(); }
Chris@24 60
Chris@0 61
Chris@0 62 /*
Chris@0 63 virtual PropertyList getProperties() const;
Chris@0 64 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@0 65 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@0 66 int *min, int *max) const;
Chris@0 67 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@0 68 int value) const;
Chris@0 69 virtual void setProperty(const PropertyName &, int value);
Chris@0 70 */
Chris@0 71
Chris@11 72 void setProperties(const QXmlAttributes &attributes) { }
Chris@11 73
Chris@0 74 protected slots:
Chris@0 75 void cacheInvalid();
Chris@0 76 void cacheInvalid(size_t startFrame, size_t endFrame);
Chris@0 77
Chris@0 78 protected:
Chris@0 79 const DenseThreeDimensionalModel *m_model; // I do not own this
Chris@0 80
Chris@0 81 mutable QImage *m_cache;
Chris@0 82 };
Chris@0 83
Chris@0 84 #endif