lbajardsilogic@0: lbajardsilogic@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ lbajardsilogic@0: lbajardsilogic@0: /* lbajardsilogic@0: Sonic Visualiser lbajardsilogic@0: An audio file viewer and annotation editor. lbajardsilogic@0: Centre for Digital Music, Queen Mary, University of London. lbajardsilogic@0: This file copyright 2006 QMUL. lbajardsilogic@0: lbajardsilogic@0: This program is free software; you can redistribute it and/or lbajardsilogic@0: modify it under the terms of the GNU General Public License as lbajardsilogic@0: published by the Free Software Foundation; either version 2 of the lbajardsilogic@0: License, or (at your option) any later version. See the file lbajardsilogic@0: COPYING included with this distribution for more information. lbajardsilogic@0: */ lbajardsilogic@0: lbajardsilogic@0: #ifndef _SLICE_LAYER_H_ lbajardsilogic@0: #define _SLICE_LAYER_H_ lbajardsilogic@0: lbajardsilogic@0: #include "Layer.h" lbajardsilogic@0: lbajardsilogic@0: #include "base/Window.h" lbajardsilogic@0: lbajardsilogic@0: #include "data/model/DenseThreeDimensionalModel.h" lbajardsilogic@0: lbajardsilogic@0: #include lbajardsilogic@0: lbajardsilogic@0: class SliceLayer : public Layer lbajardsilogic@0: { lbajardsilogic@0: Q_OBJECT lbajardsilogic@0: lbajardsilogic@0: public: lbajardsilogic@0: SliceLayer(); lbajardsilogic@0: ~SliceLayer(); lbajardsilogic@0: lbajardsilogic@0: // virtual void setModel(const Model *model); lbajardsilogic@0: // virtual const Model *getModel() const { return m_model; } lbajardsilogic@0: virtual const Model *getModel() const { return 0; } lbajardsilogic@0: lbajardsilogic@0: void setSliceableModel(const Model *model); lbajardsilogic@0: lbajardsilogic@0: virtual void paint(View *v, QPainter &paint, QRect rect) const; lbajardsilogic@0: lbajardsilogic@0: virtual QString getFeatureDescription(View *v, QPoint &) const; lbajardsilogic@0: lbajardsilogic@0: virtual int getVerticalScaleWidth(View *v, QPainter &) const; lbajardsilogic@0: virtual void paintVerticalScale(View *v, QPainter &paint, QRect rect) const; lbajardsilogic@0: lbajardsilogic@0: virtual PropertyList getProperties() const; lbajardsilogic@0: virtual QString getPropertyLabel(const PropertyName &) const; lbajardsilogic@0: virtual PropertyType getPropertyType(const PropertyName &) const; lbajardsilogic@0: virtual QString getPropertyGroupName(const PropertyName &) const; lbajardsilogic@0: virtual int getPropertyRangeAndValue(const PropertyName &, lbajardsilogic@0: int *min, int *max, int *deflt) const; lbajardsilogic@0: virtual QString getPropertyValueLabel(const PropertyName &, lbajardsilogic@0: int value) const; lbajardsilogic@0: virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const; lbajardsilogic@0: virtual void setProperty(const PropertyName &, int value); lbajardsilogic@0: virtual void setProperties(const QXmlAttributes &); lbajardsilogic@0: lbajardsilogic@0: virtual bool getValueExtents(float &min, float &max, lbajardsilogic@0: bool &logarithmic, QString &unit) const; lbajardsilogic@0: lbajardsilogic@0: virtual bool hasTimeXAxis() const { return false; } lbajardsilogic@0: lbajardsilogic@0: virtual bool isLayerScrollable(const View *) const { return false; } lbajardsilogic@0: lbajardsilogic@0: enum EnergyScale { LinearScale, MeterScale, dBScale }; lbajardsilogic@0: lbajardsilogic@0: enum SamplingMode { NearestSample, SampleMean, SamplePeak }; lbajardsilogic@0: lbajardsilogic@0: enum PlotStyle { PlotLines, PlotSteps, PlotBlocks, PlotFilledBlocks }; lbajardsilogic@0: lbajardsilogic@0: enum BinScale { LinearBins, LogBins, InvertedLogBins }; lbajardsilogic@0: benoitrigolleau@61: virtual void setBaseColour(QColor); benoitrigolleau@61: virtual QColor getBaseColour() const { return m_colour; } lbajardsilogic@0: lbajardsilogic@0: void setFillColourMap(int); lbajardsilogic@0: int getFillColourMap() const { return m_colourMap; } lbajardsilogic@0: lbajardsilogic@0: void setEnergyScale(EnergyScale); lbajardsilogic@0: EnergyScale getEnergyScale() const { return m_energyScale; } lbajardsilogic@0: lbajardsilogic@0: void setSamplingMode(SamplingMode); lbajardsilogic@0: SamplingMode getSamplingMode() const { return m_samplingMode; } lbajardsilogic@0: lbajardsilogic@0: void setPlotStyle(PlotStyle style); lbajardsilogic@0: PlotStyle getPlotStyle() const { return m_plotStyle; } lbajardsilogic@0: lbajardsilogic@0: void setBinScale(BinScale scale); lbajardsilogic@0: BinScale getBinScale() const { return m_binScale; } lbajardsilogic@0: lbajardsilogic@0: void setGain(float gain); lbajardsilogic@0: float getGain() const; lbajardsilogic@0: lbajardsilogic@0: void setNormalize(bool n); lbajardsilogic@0: bool getNormalize() const; lbajardsilogic@0: lbajardsilogic@0: virtual QString toXmlString(QString indent = "", lbajardsilogic@0: QString extraAttributes = "") const; lbajardsilogic@0: lbajardsilogic@0: public slots: lbajardsilogic@0: void sliceableModelReplaced(const Model *, const Model *); lbajardsilogic@0: void modelAboutToBeDeleted(Model *); lbajardsilogic@0: lbajardsilogic@0: protected: lbajardsilogic@0: float getXForBin(int bin, int totalBins, float w) const; lbajardsilogic@0: int getBinForX(float x, int totalBins, float w) const; lbajardsilogic@0: lbajardsilogic@0: virtual QString getFeatureDescription(View *v, QPoint &, lbajardsilogic@0: bool includeBinDescription, lbajardsilogic@0: int &minbin, int &maxbin, lbajardsilogic@0: int &range) const; lbajardsilogic@0: lbajardsilogic@0: const DenseThreeDimensionalModel *m_sliceableModel; lbajardsilogic@0: QColor m_colour; lbajardsilogic@0: int m_colourMap; lbajardsilogic@0: EnergyScale m_energyScale; lbajardsilogic@0: SamplingMode m_samplingMode; lbajardsilogic@0: PlotStyle m_plotStyle; lbajardsilogic@0: BinScale m_binScale; lbajardsilogic@0: bool m_normalize; lbajardsilogic@0: bool m_bias; lbajardsilogic@0: float m_gain; lbajardsilogic@0: mutable std::vector m_scalePoints; lbajardsilogic@0: mutable std::map m_xorigins; lbajardsilogic@0: mutable size_t m_currentf0; lbajardsilogic@0: mutable size_t m_currentf1; lbajardsilogic@0: mutable std::vector m_values; lbajardsilogic@0: }; lbajardsilogic@0: lbajardsilogic@0: #endif