Mercurial > hg > svgui
diff layer/Colour3DPlotLayer.cpp @ 130:10eec0da9efe last-cc-copyright
* Move the current DenseThreeDimensionalModel to EditableDenseThreeDimensionalModel
(wow!), and make DTDM an abstract base
* Move FFTFuzzyAdapter to FFTModel as a new subclass of DTDM
author | Chris Cannam |
---|---|
date | Mon, 31 Jul 2006 17:05:18 +0000 |
parents | 33929e0c3c6b |
children | c1fb771b7646 |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp Mon Jul 31 16:15:45 2006 +0000 +++ b/layer/Colour3DPlotLayer.cpp Mon Jul 31 17:05:18 2006 +0000 @@ -90,11 +90,11 @@ int y = pos.y(); size_t modelStart = m_model->getStartFrame(); - size_t modelWindow = m_model->getWindowSize(); + size_t modelResolution = m_model->getResolution(); - int sx0 = modelWindow * - int((v->getFrameForX(x) - long(modelStart)) / long(modelWindow)); - int sx1 = sx0 + modelWindow; + int sx0 = modelResolution * + int((v->getFrameForX(x) - long(modelStart)) / long(modelResolution)); + int sx1 = sx0 + modelResolution; float binHeight = float(v->height()) / m_model->getYBinCount(); int sy = (v->height() - y) / binHeight; @@ -198,9 +198,9 @@ size_t modelStart = m_model->getStartFrame(); size_t modelEnd = m_model->getEndFrame(); - size_t modelWindow = m_model->getWindowSize(); + size_t modelResolution = m_model->getResolution(); - size_t cacheWidth = (modelEnd - modelStart) / modelWindow + 1; + size_t cacheWidth = (modelEnd - modelStart) / modelResolution + 1; size_t cacheHeight = m_model->getYBinCount(); if (m_cache && @@ -231,7 +231,7 @@ m_cache->fill(min); - for (size_t f = modelStart; f <= modelEnd; f += modelWindow) { + for (size_t f = modelStart; f <= modelEnd; f += modelResolution) { values.clear(); m_model->getBinValues(f, values); @@ -245,7 +245,7 @@ if (pixel < 0) pixel = 0; if (pixel > 255) pixel = 255; - m_cache->setPixel(f / modelWindow, y, pixel); + m_cache->setPixel(f / modelResolution, y, pixel); } } } @@ -271,14 +271,14 @@ //direction. This one is only really appropriate for models with //far fewer bins in both directions. - int sx0 = int((v->getFrameForX(x0) - long(modelStart)) / long(modelWindow)); - int sx1 = int((v->getFrameForX(x1) - long(modelStart)) / long(modelWindow)); + int sx0 = int((v->getFrameForX(x0) - long(modelStart)) / long(modelResolution)); + int sx1 = int((v->getFrameForX(x1) - long(modelStart)) / long(modelResolution)); int sw = sx1 - sx0; int sh = m_model->getYBinCount(); #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT std::cerr << "Colour3DPlotLayer::paint: w " << w << ", h " << h << ", sx0 " << sx0 << ", sx1 " << sx1 << ", sw " << sw << ", sh " << sh << std::endl; - std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", window size " << m_model->getWindowSize() << std::endl; + std::cerr << "Colour3DPlotLayer: sample rate is " << m_model->getSampleRate() << ", resolution " << m_model->getResolution() << std::endl; #endif QPoint illuminatePos; @@ -287,13 +287,13 @@ for (int sx = sx0 - 1; sx <= sx1; ++sx) { - int fx = sx * int(modelWindow); + int fx = sx * int(modelResolution); - if (fx + modelWindow < int(modelStart) || + if (fx + modelResolution < int(modelStart) || fx > int(modelEnd)) continue; int rx0 = v->getXForFrame(fx + int(modelStart)); - int rx1 = v->getXForFrame(fx + int(modelStart) + int(modelWindow)); + int rx1 = v->getXForFrame(fx + int(modelStart) + int(modelResolution)); int w = rx1 - rx0; if (w < 1) w = 1; @@ -356,7 +356,7 @@ size_t modelStart = m_model->getStartFrame(); size_t modelEnd = m_model->getEndFrame(); - size_t modelWindow = m_model->getWindowSize(); + size_t modelResolution = m_model->getResolution(); int x0 = rect.left(); int x1 = rect.right() + 1; @@ -377,8 +377,8 @@ continue; } - float sx0 = (float(xf) - modelStart) / modelWindow; - float sx1 = (float(v->getFrameForX(x+1)) - modelStart) / modelWindow; + float sx0 = (float(xf) - modelStart) / modelResolution; + float sx1 = (float(v->getFrameForX(x+1)) - modelStart) / modelResolution; int sx0i = int(sx0 + 0.001); int sx1i = int(sx1); @@ -432,7 +432,7 @@ return Layer::snapToFeatureFrame(v, frame, resolution, snap); } - resolution = m_model->getWindowSize(); + resolution = m_model->getResolution(); int left = (frame / resolution) * resolution; int right = left + resolution;