annotate layer/SliceLayer.h @ 193:57c2350a8c40

* Add slice layers (so you can display a slice of a colour 3d plot as if it were a spectrum) * Make spectrum layer a subclass of slice layer
author Chris Cannam
date Fri, 26 Jan 2007 16:59:57 +0000
parents layer/SpectrumLayer.h@42118892f428
children 4a3bdde1ef13
rev   line source
Chris@133 1
Chris@133 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@133 3
Chris@133 4 /*
Chris@133 5 Sonic Visualiser
Chris@133 6 An audio file viewer and annotation editor.
Chris@133 7 Centre for Digital Music, Queen Mary, University of London.
Chris@182 8 This file copyright 2006 QMUL.
Chris@133 9
Chris@133 10 This program is free software; you can redistribute it and/or
Chris@133 11 modify it under the terms of the GNU General Public License as
Chris@133 12 published by the Free Software Foundation; either version 2 of the
Chris@133 13 License, or (at your option) any later version. See the file
Chris@133 14 COPYING included with this distribution for more information.
Chris@133 15 */
Chris@133 16
Chris@193 17 #ifndef _SLICE_LAYER_H_
Chris@193 18 #define _SLICE_LAYER_H_
Chris@133 19
Chris@133 20 #include "Layer.h"
Chris@133 21
Chris@153 22 #include "base/Window.h"
Chris@153 23
Chris@193 24 #include "data/model/DenseThreeDimensionalModel.h"
Chris@133 25
Chris@133 26 #include <QColor>
Chris@133 27
Chris@193 28 class SliceLayer : public Layer
Chris@133 29 {
Chris@133 30 Q_OBJECT
Chris@133 31
Chris@133 32 public:
Chris@193 33 SliceLayer();
Chris@193 34 ~SliceLayer();
Chris@133 35
Chris@193 36 // virtual void setModel(const Model *model);
Chris@193 37 // virtual const Model *getModel() const { return m_model; }
Chris@193 38 virtual const Model *getModel() const { return 0; }
Chris@193 39
Chris@193 40 void setSliceableModel(const Model *model);
Chris@193 41
Chris@133 42 virtual void paint(View *v, QPainter &paint, QRect rect) const;
Chris@133 43
Chris@153 44 virtual PropertyList getProperties() const;
Chris@153 45 virtual QString getPropertyLabel(const PropertyName &) const;
Chris@153 46 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@153 47 virtual QString getPropertyGroupName(const PropertyName &) const;
Chris@153 48 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@153 49 int *min, int *max) const;
Chris@153 50 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@153 51 int value) const;
Chris@167 52 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
Chris@153 53 virtual void setProperty(const PropertyName &, int value);
Chris@133 54 virtual void setProperties(const QXmlAttributes &);
Chris@133 55
Chris@133 56 virtual bool getValueExtents(float &min, float &max,
Chris@133 57 bool &logarithmic, QString &unit) const;
Chris@133 58
Chris@133 59 virtual bool isLayerScrollable(const View *v) const { return false; }
Chris@133 60
Chris@193 61 enum EnergyScale { LinearScale, MeterScale, dBScale };
Chris@153 62
Chris@193 63 enum SamplingMode { NearestSample, SampleMean, SamplePeak };
Chris@153 64
Chris@193 65 enum PlotStyle { PlotLines, PlotSteps, PlotBlocks };
Chris@153 66
Chris@193 67 enum BinScale { LinearBins, LogBins, InvertedLogBins };
Chris@153 68
Chris@153 69 void setBaseColour(QColor);
Chris@153 70 QColor getBaseColour() const { return m_colour; }
Chris@153 71
Chris@153 72 void setEnergyScale(EnergyScale);
Chris@153 73 EnergyScale getEnergyScale() const { return m_energyScale; }
Chris@153 74
Chris@193 75 void setSamplingMode(SamplingMode);
Chris@193 76 SamplingMode getSamplingMode() const { return m_samplingMode; }
Chris@153 77
Chris@193 78 void setPlotStyle(PlotStyle style);
Chris@193 79 PlotStyle getPlotStyle() const { return m_plotStyle; }
Chris@193 80
Chris@193 81 void setBinScale(BinScale scale);
Chris@193 82 BinScale getBinScale() const { return m_binScale; }
Chris@153 83
Chris@153 84 void setGain(float gain);
Chris@153 85 float getGain() const;
Chris@153 86
Chris@153 87 void setNormalize(bool n);
Chris@153 88 bool getNormalize() const;
Chris@153 89
Chris@153 90 virtual QString toXmlString(QString indent = "",
Chris@153 91 QString extraAttributes = "") const;
Chris@153 92
Chris@193 93 public slots:
Chris@193 94 void sliceableModelReplaced(const Model *, const Model *);
Chris@193 95 void modelAboutToBeDeleted(Model *);
Chris@133 96
Chris@133 97 protected:
Chris@193 98 const DenseThreeDimensionalModel *m_sliceableModel;
Chris@193 99 QColor m_colour;
Chris@193 100 EnergyScale m_energyScale;
Chris@193 101 SamplingMode m_samplingMode;
Chris@193 102 PlotStyle m_plotStyle;
Chris@193 103 BinScale m_binScale;
Chris@193 104 bool m_normalize;
Chris@193 105 bool m_bias;
Chris@193 106 float m_gain;
Chris@133 107 };
Chris@133 108
Chris@133 109 #endif