00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2006 Chris Cannam and QMUL. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _DENSE_THREE_DIMENSIONAL_MODEL_H_ 00017 #define _DENSE_THREE_DIMENSIONAL_MODEL_H_ 00018 00019 #include "Model.h" 00020 #include "base/ZoomConstraint.h" 00021 00022 #include <QMutex> 00023 #include <vector> 00024 00025 class DenseThreeDimensionalModel : public Model 00026 { 00027 Q_OBJECT 00028 00029 public: 00033 virtual size_t getResolution() const = 0; 00034 00038 virtual size_t getWidth() const = 0; 00039 00043 virtual size_t getHeight() const = 0; 00044 00048 virtual float getMinimumLevel() const = 0; 00049 00053 virtual float getMaximumLevel() const = 0; 00054 00062 virtual bool isColumnAvailable(size_t column) const = 0; 00063 00064 typedef std::vector<float> Column; 00065 00069 virtual void getColumn(size_t column, Column &result) const = 0; 00070 00074 virtual float getValueAt(size_t column, size_t n) const = 0; 00075 00080 virtual QString getBinName(size_t n) const = 0; 00081 00086 bool isLocalPeak(size_t x, size_t y) { 00087 float value = getValueAt(x, y); 00088 if (y > 0 && value < getValueAt(x, y - 1)) return false; 00089 if (y < getHeight() - 1 && value < getValueAt(x, y + 1)) return false; 00090 return true; 00091 } 00092 00097 bool isOverThreshold(size_t x, size_t y, float threshold) { 00098 return getValueAt(x, y) > threshold; 00099 } 00100 00101 QString getTypeName() const { return tr("Dense 3-D"); } 00102 00103 virtual int getCompletion() const = 0; 00104 00105 protected: 00106 DenseThreeDimensionalModel() { } 00107 }; 00108 00109 #endif
1.5.1