annotate data/model/EditableDenseThreeDimensionalModel.h @ 316:3a6725f285d6

* Make RemoteFile far more pervasive, and use it for local files as well so that we can handle both transparently. Make it shallow copy with reference counting, so it can be used by value without having to worry about the cache file lifetime. Use RemoteFile for MainWindow file-open functions, etc
author Chris Cannam
date Thu, 18 Oct 2007 15:31:20 +0000
parents 70a232b1f12a
children 7a4bd2c8585c
rev   line source
Chris@152 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@152 2
Chris@152 3 /*
Chris@152 4 Sonic Visualiser
Chris@152 5 An audio file viewer and annotation editor.
Chris@152 6 Centre for Digital Music, Queen Mary, University of London.
Chris@202 7 This file copyright 2006 Chris Cannam and QMUL.
Chris@152 8
Chris@152 9 This program is free software; you can redistribute it and/or
Chris@152 10 modify it under the terms of the GNU General Public License as
Chris@152 11 published by the Free Software Foundation; either version 2 of the
Chris@152 12 License, or (at your option) any later version. See the file
Chris@152 13 COPYING included with this distribution for more information.
Chris@152 14 */
Chris@152 15
Chris@152 16 #ifndef _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_
Chris@152 17 #define _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_
Chris@152 18
Chris@152 19 #include "DenseThreeDimensionalModel.h"
Chris@152 20
Chris@152 21 class EditableDenseThreeDimensionalModel : public DenseThreeDimensionalModel
Chris@152 22 {
Chris@152 23 Q_OBJECT
Chris@152 24
Chris@152 25 public:
Chris@152 26 EditableDenseThreeDimensionalModel(size_t sampleRate,
Chris@152 27 size_t resolution,
Chris@152 28 size_t yBinCount,
Chris@152 29 bool notifyOnAdd = true);
Chris@152 30
Chris@152 31 virtual bool isOK() const;
Chris@152 32
Chris@152 33 virtual size_t getSampleRate() const;
Chris@152 34 virtual size_t getStartFrame() const;
Chris@152 35 virtual size_t getEndFrame() const;
Chris@152 36
Chris@152 37 virtual Model *clone() const;
Chris@152 38
Chris@152 39
Chris@152 40 /**
Chris@152 41 * Return the number of sample frames covered by each set of bins.
Chris@152 42 */
Chris@152 43 virtual size_t getResolution() const;
Chris@152 44
Chris@152 45 /**
Chris@152 46 * Set the number of sample frames covered by each set of bins.
Chris@152 47 */
Chris@152 48 virtual void setResolution(size_t sz);
Chris@152 49
Chris@152 50 /**
Chris@182 51 * Return the number of columns.
Chris@182 52 */
Chris@182 53 virtual size_t getWidth() const;
Chris@182 54
Chris@182 55 /**
Chris@152 56 * Return the number of bins in each set of bins.
Chris@152 57 */
Chris@182 58 virtual size_t getHeight() const;
Chris@152 59
Chris@152 60 /**
Chris@152 61 * Set the number of bins in each set of bins.
Chris@152 62 */
Chris@182 63 virtual void setHeight(size_t sz);
Chris@152 64
Chris@152 65 /**
Chris@152 66 * Return the minimum value of the value in each bin.
Chris@152 67 */
Chris@152 68 virtual float getMinimumLevel() const;
Chris@152 69
Chris@152 70 /**
Chris@152 71 * Set the minimum value of the value in a bin.
Chris@152 72 */
Chris@152 73 virtual void setMinimumLevel(float sz);
Chris@152 74
Chris@152 75 /**
Chris@152 76 * Return the maximum value of the value in each bin.
Chris@152 77 */
Chris@152 78 virtual float getMaximumLevel() const;
Chris@152 79
Chris@152 80 /**
Chris@152 81 * Set the maximum value of the value in a bin.
Chris@152 82 */
Chris@152 83 virtual void setMaximumLevel(float sz);
Chris@152 84
Chris@182 85 /**
Chris@182 86 * Return true if there are data available for the given column.
Chris@182 87 */
Chris@182 88 virtual bool isColumnAvailable(size_t x) const { return x < getWidth(); }
Chris@152 89
Chris@152 90 /**
Chris@182 91 * Get the set of bin values at the given column.
Chris@152 92 */
Chris@182 93 virtual void getColumn(size_t x, Column &) const;
Chris@152 94
Chris@152 95 /**
Chris@182 96 * Get a single value, from the n'th bin of the given column.
Chris@152 97 */
Chris@182 98 virtual float getValueAt(size_t x, size_t n) const;
Chris@152 99
Chris@152 100 /**
Chris@182 101 * Set the entire set of bin values at the given column.
Chris@152 102 */
Chris@182 103 virtual void setColumn(size_t x, const Column &values);
Chris@152 104
Chris@152 105 virtual QString getBinName(size_t n) const;
Chris@152 106 virtual void setBinName(size_t n, QString);
Chris@152 107 virtual void setBinNames(std::vector<QString> names);
Chris@152 108
Chris@152 109 virtual void setCompletion(int completion);
Chris@152 110 virtual int getCompletion() const { return m_completion; }
Chris@152 111
Chris@152 112 virtual void toXml(QTextStream &out,
Chris@152 113 QString indent = "",
Chris@152 114 QString extraAttributes = "") const;
Chris@152 115
Chris@152 116 protected:
Chris@182 117 typedef std::vector<Column> ValueMatrix;
Chris@152 118 ValueMatrix m_data;
Chris@152 119
Chris@152 120 std::vector<QString> m_binNames;
Chris@152 121
Chris@152 122 size_t m_sampleRate;
Chris@152 123 size_t m_resolution;
Chris@152 124 size_t m_yBinCount;
Chris@152 125 float m_minimum;
Chris@152 126 float m_maximum;
Chris@256 127 bool m_haveExtents;
Chris@152 128 bool m_notifyOnAdd;
Chris@152 129 long m_sinceLastNotifyMin;
Chris@152 130 long m_sinceLastNotifyMax;
Chris@152 131 int m_completion;
Chris@152 132
Chris@152 133 mutable QMutex m_mutex;
Chris@152 134 };
Chris@152 135
Chris@152 136 #endif