comparison 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
comparison
equal deleted inserted replaced
445:4a14499fb184 446:ae51d4b73860
471 471
472 int ch = h - 20; 472 int ch = h - 20;
473 if (ch > 20 && m_cache) { 473 if (ch > 20 && m_cache) {
474 474
475 paint.setPen(v->getForeground()); 475 paint.setPen(v->getForeground());
476 paint.drawRect(4, 10, cw - 8, ch - 19); 476 paint.drawRect(4, 10, cw - 8, ch);
477 477
478 for (int y = 0; y < ch - 20; ++y) { 478 for (int y = 0; y < ch; ++y) {
479 QRgb c = m_cache->color(((ch - 20 - y) * 255) / (ch - 20)); 479 QRgb c = m_cache->color(((ch - y) * 255) / ch);
480 // std::cerr << "y = " << y << ": rgb " << qRed(c) << "," << qGreen(c) << "," << qBlue(c) << std::endl;
481 paint.setPen(QColor(qRed(c), qGreen(c), qBlue(c))); 480 paint.setPen(QColor(qRed(c), qGreen(c), qBlue(c)));
482 paint.drawLine(5, 11 + y, cw - 5, 11 + y); 481 paint.drawLine(5, 11 + y, cw - 5, 11 + y);
483 } 482 }
483
484 float min = m_model->getMinimumLevel();
485 float max = m_model->getMaximumLevel();
486
487 QString minstr = QString("%1").arg(min);
488 QString maxstr = QString("%1").arg(max);
489
490 paint.save();
491
492 QFont font = paint.font();
493 font.setPixelSize(10);
494 paint.setFont(font);
495
496 int msw = paint.fontMetrics().width(maxstr);
497
498 QMatrix m;
499 m.translate(cw - 6, ch + 10);
500 m.rotate(-90);
501
502 paint.setWorldMatrix(m);
503
504 v->drawVisibleText(paint, 2, 0, minstr, View::OutlinedText);
505
506 m.translate(ch - msw - 2, 0);
507 paint.setWorldMatrix(m);
508
509 v->drawVisibleText(paint, 0, 0, maxstr, View::OutlinedText);
510
511 paint.restore();
512
484 } 513 }
485 514
486 paint.setPen(v->getForeground()); 515 paint.setPen(v->getForeground());
487 516
488 int sh = m_model->getHeight(); 517 int sh = m_model->getHeight();