Mercurial > hg > svgui
diff layer/Colour3DPlotLayer.cpp @ 916:94e4952a6774 osx-retina
Start trying to introduce LayerGeometryProvider as proxyable interface for View methods that the Layer wants to use
author | Chris Cannam |
---|---|
date | Tue, 17 Mar 2015 15:05:25 +0000 |
parents | 4a578a360011 |
children | 0aac065f09f9 |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp Wed Mar 11 15:35:20 2015 +0000 +++ b/layer/Colour3DPlotLayer.cpp Tue Mar 17 15:05:25 2015 +0000 @@ -506,7 +506,7 @@ } void -Colour3DPlotLayer::setLayerDormant(const View *v, bool dormant) +Colour3DPlotLayer::setLayerDormant(const LayerGeometryProvider *v, bool dormant) { if (dormant) { @@ -530,7 +530,7 @@ } bool -Colour3DPlotLayer::isLayerScrollable(const View *v) const +Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider *v) const { if (m_normalizeVisibleArea) { return false; @@ -589,7 +589,7 @@ } bool -Colour3DPlotLayer::getYScaleValue(const View *, int, +Colour3DPlotLayer::getYScaleValue(const LayerGeometryProvider *, int, double &, QString &) const { return false;//!!! @@ -645,13 +645,13 @@ } double -Colour3DPlotLayer::getYForBin(View *v, double bin) const +Colour3DPlotLayer::getYForBin(LayerGeometryProvider *v, double bin) const { double y = bin; if (!m_model) return y; double mn = 0, mx = m_model->getHeight(); getDisplayExtents(mn, mx); - double h = v->height(); + double h = v->getPaintHeight(); if (m_binScale == LinearBinScale) { y = h - (((bin - mn) * h) / (mx - mn)); } else { @@ -663,19 +663,19 @@ } int -Colour3DPlotLayer::getIYForBin(View *v, int bin) const +Colour3DPlotLayer::getIYForBin(LayerGeometryProvider *v, int bin) const { return int(round(getYForBin(v, bin))); } double -Colour3DPlotLayer::getBinForY(View *v, double y) const +Colour3DPlotLayer::getBinForY(LayerGeometryProvider *v, double y) const { double bin = y; if (!m_model) return bin; double mn = 0, mx = m_model->getHeight(); getDisplayExtents(mn, mx); - double h = v->height(); + double h = v->getPaintHeight(); if (m_binScale == LinearBinScale) { bin = mn + ((h - y) * (mx - mn)) / h; } else { @@ -687,13 +687,13 @@ } int -Colour3DPlotLayer::getIBinForY(View *v, int y) const +Colour3DPlotLayer::getIBinForY(LayerGeometryProvider *v, int y) const { return int(floor(getBinForY(v, y))); } QString -Colour3DPlotLayer::getFeatureDescription(View *v, QPoint &pos) const +Colour3DPlotLayer::getFeatureDescription(LayerGeometryProvider *v, QPoint &pos) const { if (!m_model) return ""; @@ -724,8 +724,8 @@ if (symin < 0) symin = 0; if (symax > sh) symax = sh; - // double binHeight = double(v->height()) / (symax - symin); -// int sy = int((v->height() - y) / binHeight) + symin; + // double binHeight = double(v->getPaintHeight()) / (symax - symin); +// int sy = int((v->getPaintHeight() - y) / binHeight) + symin; int sy = getIBinForY(v, y); @@ -762,7 +762,7 @@ } int -Colour3DPlotLayer::getVerticalScaleWidth(View *, bool, QPainter &paint) const +Colour3DPlotLayer::getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &paint) const { if (!m_model) return 0; @@ -784,7 +784,7 @@ } void -Colour3DPlotLayer::paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const +Colour3DPlotLayer::paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const { if (!m_model) return; @@ -1246,7 +1246,7 @@ } bool -Colour3DPlotLayer::shouldPaintDenseIn(const View *v) const +Colour3DPlotLayer::shouldPaintDenseIn(const LayerGeometryProvider *v) const { if (!m_model || !v || !(v->getViewManager())) { return false; @@ -1255,7 +1255,7 @@ v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); if (m_opaque || m_smooth || - m_model->getHeight() >= v->height() || + m_model->getHeight() >= v->getPaintHeight() || ((m_model->getResolution() * srRatio) / v->getZoomLevel()) < 2) { return true; } @@ -1263,7 +1263,7 @@ } void -Colour3DPlotLayer::paint(View *v, QPainter &paint, QRect rect) const +Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const { /* if (m_model) { @@ -1278,13 +1278,13 @@ int completion = 0; if (!m_model || !m_model->isOK() || !m_model->isReady(&completion)) { if (completion > 0) { - paint.fillRect(0, 10, v->width() * completion / 100, + paint.fillRect(0, 10, v->getPaintWidth() * completion / 100, 10, QColor(120, 120, 120)); } return; } - if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->rect(); + if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->getPaintRect(); sv_frame_t modelStart = m_model->getStartFrame(); sv_frame_t modelEnd = m_model->getEndFrame(); @@ -1302,7 +1302,7 @@ int x0 = rect.left(); int x1 = rect.right() + 1; - int h = v->height(); + int h = v->getPaintHeight(); double srRatio = v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); @@ -1424,7 +1424,7 @@ } void -Colour3DPlotLayer::paintDense(View *v, QPainter &paint, QRect rect) const +Colour3DPlotLayer::paintDense(LayerGeometryProvider *v, QPainter &paint, QRect rect) const { Profiler profiler("Colour3DPlotLayer::paintDense", true); if (!m_cache) return; @@ -1440,7 +1440,7 @@ int x1 = rect.right() + 1; const int w = x1 - x0; // const so it can be used as array size below - int h = v->height(); // we always paint full height + int h = v->getPaintHeight(); // we always paint full height int sh = m_model->getHeight(); int symin = m_miny; @@ -1655,7 +1655,7 @@ } bool -Colour3DPlotLayer::snapToFeatureFrame(View *v, sv_frame_t &frame, +Colour3DPlotLayer::snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, int &resolution, SnapType snap) const {