Mercurial > hg > svgui
diff layer/Colour3DPlotLayer.cpp @ 446:ae51d4b73860
* update changelog
* Put scale extents in vertical scale colour bar of colour 3d plot
author | Chris Cannam |
---|---|
date | Wed, 12 Nov 2008 16:08:47 +0000 |
parents | 4a14499fb184 |
children | 84ada1c89510 |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp Wed Nov 12 15:51:41 2008 +0000 +++ b/layer/Colour3DPlotLayer.cpp Wed Nov 12 16:08:47 2008 +0000 @@ -473,14 +473,43 @@ if (ch > 20 && m_cache) { paint.setPen(v->getForeground()); - paint.drawRect(4, 10, cw - 8, ch - 19); + paint.drawRect(4, 10, cw - 8, ch); - for (int y = 0; y < ch - 20; ++y) { - QRgb c = m_cache->color(((ch - 20 - y) * 255) / (ch - 20)); -// std::cerr << "y = " << y << ": rgb " << qRed(c) << "," << qGreen(c) << "," << qBlue(c) << std::endl; + for (int y = 0; y < ch; ++y) { + QRgb c = m_cache->color(((ch - y) * 255) / ch); paint.setPen(QColor(qRed(c), qGreen(c), qBlue(c))); paint.drawLine(5, 11 + y, cw - 5, 11 + y); } + + float min = m_model->getMinimumLevel(); + float max = m_model->getMaximumLevel(); + + QString minstr = QString("%1").arg(min); + QString maxstr = QString("%1").arg(max); + + paint.save(); + + QFont font = paint.font(); + font.setPixelSize(10); + paint.setFont(font); + + int msw = paint.fontMetrics().width(maxstr); + + QMatrix m; + m.translate(cw - 6, ch + 10); + m.rotate(-90); + + paint.setWorldMatrix(m); + + v->drawVisibleText(paint, 2, 0, minstr, View::OutlinedText); + + m.translate(ch - msw - 2, 0); + paint.setWorldMatrix(m); + + v->drawVisibleText(paint, 0, 0, maxstr, View::OutlinedText); + + paint.restore(); + } paint.setPen(v->getForeground());