changeset 700:7846175403f1

And tidy up
author Chris Cannam
date Wed, 04 Dec 2013 13:12:09 +0000
parents 1a1448f7beb2
children 084f65094203
files layer/TimeValueLayer.cpp
diffstat 1 files changed, 0 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Wed Dec 04 13:11:23 2013 +0000
+++ b/layer/TimeValueLayer.cpp	Wed Dec 04 13:12:09 2013 +0000
@@ -1230,134 +1230,6 @@
 {
     if (!m_model) return;
 
-/*
-    int h = v->height();
-
-    int n = 10;
-
-    float min, max;
-    bool logarithmic;
-    getScaleExtents(v, min, max, logarithmic);
-
-    if (m_plotStyle == PlotSegmentation) {
-        QString unit;
-        getValueExtents(min, max, logarithmic, unit);
-        if (logarithmic) {
-            LogRange::mapRange(min, max);
-        }
-    }
-
-    float val = min;
-    float inc = (max - val) / n;
-
-    char buffer[40];
-
-    int w = getVerticalScaleWidth(v, false, paint);
-
-    int tx = 5;
-
-    int boxx = 5, boxy = 5;
-    if (getScaleUnits() != "") {
-        boxy += paint.fontMetrics().height();
-    }
-    int boxw = 10, boxh = h - boxy - 5;
-
-    if (m_plotStyle == PlotSegmentation) {
-        tx += boxx + boxw;
-        paint.drawRect(boxx, boxy, boxw, boxh);
-    }
-
-    if (m_plotStyle == PlotSegmentation) {
-        paint.save();
-        for (int y = 0; y < boxh; ++y) {
-            float val = ((boxh - y) * (max - min)) / boxh + min;
-            if (logarithmic) {
-                paint.setPen(getColourForValue(v, LogRange::unmap(val)));
-            } else {
-                paint.setPen(getColourForValue(v, val));
-            }
-            paint.drawLine(boxx + 1, y + boxy + 1, boxx + boxw, y + boxy + 1);
-        }
-        paint.restore();
-    }
-    
-    float round = 1.f;
-    int dp = 0;
-    if (inc > 0) {
-        int prec = trunc(log10f(inc));
-        prec -= 1;
-        if (prec < 0) dp = -prec;
-        round = powf(10.f, prec);
-#ifdef DEBUG_TIME_VALUE_LAYER
-        cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl;
-#endif
-    }
-
-    int prevy = -1;
-                
-    for (int i = 0; i < n; ++i) {
-
-	int y, ty;
-        bool drawText = true;
-
-        float dispval = val;
-
-        if (m_plotStyle == PlotSegmentation) {
-            y = boxy + int(boxh - ((val - min) * boxh) / (max - min));
-            ty = y;
-        } else {
-            if (i == n-1 &&
-                v->height() < paint.fontMetrics().height() * (n*2)) {
-                if (getScaleUnits() != "") drawText = false;
-            }
-            dispval = lrintf(val / round) * round;
-#ifdef DEBUG_TIME_VALUE_LAYER
-            cerr << "val = " << val << ", dispval = " << dispval << endl;
-#endif
-            if (logarithmic) {
-                y = getYForValue(v, LogRange::unmap(dispval));
-            } else {
-                y = getYForValue(v, dispval);
-            }                
-            ty = y - paint.fontMetrics().height() +
-                     paint.fontMetrics().ascent() + 2;
-
-            if (prevy >= 0 && (prevy - y) < paint.fontMetrics().height()) {
-                val += inc;
-                continue;
-            }
-        }
-
-        if (logarithmic) {
-            double dv = LogRange::unmap(dispval);
-            int digits = trunc(log10f(dv));
-            int sf = dp + (digits > 0 ? digits : 0);
-            if (sf < 2) sf = 2;
-            sprintf(buffer, "%.*g", sf, dv);
-        } else {
-            sprintf(buffer, "%.*f", dp, dispval);
-        }            
-	QString label = QString(buffer);
-
-        if (m_plotStyle != PlotSegmentation) {
-            paint.drawLine(w - 5, y, w, y);
-        } else {
-            paint.drawLine(boxx + boxw - boxw/3, y, boxx + boxw, y);
-        }
-
-        if (drawText) {
-            if (m_plotStyle != PlotSegmentation) {
-                paint.drawText(tx + w - paint.fontMetrics().width(label) - 8,
-                               ty, label);
-            } else {
-                paint.drawText(tx, ty, label);
-            }
-        }
-
-        prevy = y;
-	val += inc;
-    }
-*/
     QString unit;
     float min, max;
     bool logarithmic;
@@ -1370,10 +1242,8 @@
         getValueExtents(min, max, logarithmic, unit);
 
         if (logarithmic) {
-
             LogRange::mapRange(min, max);
             LogColourScale().paintVertical(v, this, paint, 0, min, max);
-
         } else {
             LinearColourScale().paintVertical(v, this, paint, 0, min, max);
         }