Mercurial > hg > svcore
diff data/model/Dense3DModelPeakCache.h @ 1365:3382d914e110
Merge from branch 3.0-integration
author | Chris Cannam |
---|---|
date | Fri, 13 Jan 2017 10:29:44 +0000 |
parents | df59bf0b4236 |
children | c01cbe41aeb5 |
line wrap: on
line diff
--- a/data/model/Dense3DModelPeakCache.h Mon Nov 21 16:32:58 2016 +0000 +++ b/data/model/Dense3DModelPeakCache.h Fri Jan 13 10:29:44 2017 +0000 @@ -13,19 +13,18 @@ COPYING included with this distribution for more information. */ -#ifndef _DENSE_3D_MODEL_PEAK_CACHE_H_ -#define _DENSE_3D_MODEL_PEAK_CACHE_H_ +#ifndef DENSE_3D_MODEL_PEAK_CACHE_H +#define DENSE_3D_MODEL_PEAK_CACHE_H #include "DenseThreeDimensionalModel.h" #include "EditableDenseThreeDimensionalModel.h" -#include "base/ResizeableBitset.h" class Dense3DModelPeakCache : public DenseThreeDimensionalModel { Q_OBJECT public: - Dense3DModelPeakCache(DenseThreeDimensionalModel *source, + Dense3DModelPeakCache(const DenseThreeDimensionalModel *source, int columnsPerPeak); ~Dense3DModelPeakCache(); @@ -46,11 +45,20 @@ } virtual int getResolution() const { - return m_source->getResolution() * m_resolution; + return m_source->getResolution() * m_columnsPerPeak; } + virtual int getColumnsPerPeak() const { + return m_columnsPerPeak; + } + virtual int getWidth() const { - return m_source->getWidth() / m_resolution + 1; + int sourceWidth = m_source->getWidth(); + if ((sourceWidth % m_columnsPerPeak) == 0) { + return sourceWidth / m_columnsPerPeak; + } else { + return sourceWidth / m_columnsPerPeak + 1; + } } virtual int getHeight() const { @@ -65,11 +73,15 @@ return m_source->getMaximumLevel(); } - virtual bool isColumnAvailable(int column) const; + /** + * Retrieve the peaks column at peak-cache column number col. This + * will consist of the peak values in the underlying model from + * columns (col * getColumnsPerPeak()) to ((col+1) * + * getColumnsPerPeak() - 1) inclusive. + */ + virtual Column getColumn(int col) const; - virtual Column getColumn(int column) const; - - virtual float getValueAt(int column, int n) const; + virtual float getValueAt(int col, int n) const; virtual QString getBinName(int n) const { return m_source->getBinName(n); @@ -90,10 +102,11 @@ void sourceModelAboutToBeDeleted(); private: - DenseThreeDimensionalModel *m_source; + const DenseThreeDimensionalModel *m_source; mutable EditableDenseThreeDimensionalModel *m_cache; - mutable ResizeableBitset m_coverage; - int m_resolution; + mutable std::vector<bool> m_coverage; // must be bool, for space efficiency + // (vector of bool uses 1-bit elements) + int m_columnsPerPeak; bool haveColumn(int column) const; void fillColumn(int column) const;