Mercurial > hg > svgui
comparison layer/LinearNumericalScale.cpp @ 1259:4d7e566092a7 scale-ticks
Rework log scale calculation, update to changed interface
author | Chris Cannam |
---|---|
date | Thu, 04 May 2017 15:37:43 +0100 |
parents | 0cc6ab236b0d |
children | cdaeff1858af |
comparison
equal
deleted
inserted
replaced
1258:0cc6ab236b0d | 1259:4d7e566092a7 |
---|---|
45 | 45 |
46 int w = getWidth(v, paint) + x0; | 46 int w = getWidth(v, paint) + x0; |
47 | 47 |
48 int prevy = -1; | 48 int prevy = -1; |
49 | 49 |
50 for (int i = 0; i < int(ticks.ticks.size()); ++i) { | 50 for (int i = 0; i < int(ticks.size()); ++i) { |
51 | 51 |
52 int y, ty; | 52 int y, ty; |
53 bool drawText = true; | 53 bool drawText = true; |
54 | 54 |
55 if (i == n-1 && | 55 if (i == n-1 && |
56 v->getPaintHeight() < paint.fontMetrics().height() * (n*2)) { | 56 v->getPaintHeight() < paint.fontMetrics().height() * (n*2)) { |
57 if (layer->getScaleUnits() != "") drawText = false; | 57 if (layer->getScaleUnits() != "") drawText = false; |
58 } | 58 } |
59 | 59 |
60 double val = ticks.ticks[i].value; | 60 double val = ticks[i].value; |
61 QString label = QString::fromStdString(ticks.ticks[i].label); | 61 QString label = QString::fromStdString(ticks[i].label); |
62 | 62 |
63 y = layer->getYForValue(v, val); | 63 y = layer->getYForValue(v, val); |
64 | 64 |
65 ty = y - paint.fontMetrics().height() + paint.fontMetrics().ascent() + 2; | 65 ty = y - paint.fontMetrics().height() + paint.fontMetrics().ascent() + 2; |
66 | 66 |