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