comparison layer/Colour3DPlotLayer.cpp @ 456:035d62c4cddf

* Permit viewing (though not editing) colour 3d plot layer data in the spreadsheet data viewer dialog * Add somewhat simplistic RDF export for layers * Fix display of peak frequencies in spectrum layer * Fix (I hope) sizing of plugin parameter dialog
author Chris Cannam
date Tue, 02 Dec 2008 17:17:25 +0000
parents 84ada1c89510
children e75f15c9ea11
comparison
equal deleted inserted replaced
455:747a58d45d56 456:035d62c4cddf
551 symax = sh; 551 symax = sh;
552 } 552 }
553 if (symin < 0) symin = 0; 553 if (symin < 0) symin = 0;
554 if (symax > sh) symax = sh; 554 if (symax > sh) symax = sh;
555 555
556 float binHeight = float(v->height()) / (symax - symin);
557
558 paint.save();
559
560 QFont tf = paint.font();
561 if (paint.fontMetrics().height() >= binHeight) {
562 tf.setPixelSize(binHeight > 4 ? binHeight - 2 : 2);
563 paint.setFont(tf);
564 }
565
556 int count = v->height() / paint.fontMetrics().height(); 566 int count = v->height() / paint.fontMetrics().height();
557 int step = (symax - symin) / count; 567 int step = (symax - symin) / count;
558 if (step == 0) step = 1; 568 if (step == 0) step = 1;
559
560 float binHeight = float(v->height()) / (symax - symin);
561 569
562 for (size_t i = symin; i < symax; ++i) { 570 for (size_t i = symin; i < symax; ++i) {
563 571
564 size_t idx = i; 572 size_t idx = i;
565 if (m_invertVertical) idx = m_model->getHeight() - idx - 1; 573 if (m_invertVertical) idx = m_model->getHeight() - idx - 1;
576 int cy = int(y0 - (step * binHeight)/2); 584 int cy = int(y0 - (step * binHeight)/2);
577 int ty = cy + paint.fontMetrics().ascent()/2; 585 int ty = cy + paint.fontMetrics().ascent()/2;
578 586
579 paint.drawText(cw + 5, ty, text); 587 paint.drawText(cw + 5, ty, text);
580 } 588 }
589
590 paint.restore();
581 } 591 }
582 592
583 void 593 void
584 Colour3DPlotLayer::getColumn(size_t col, 594 Colour3DPlotLayer::getColumn(size_t col,
585 DenseThreeDimensionalModel::Column &values) const 595 DenseThreeDimensionalModel::Column &values) const