Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1266:a34a2a25907c
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | 6e724c81f18f |
children | bc2cb82050a0 |
comparison
equal
deleted
inserted
replaced
1265:6e724c81f18f | 1266:a34a2a25907c |
---|---|
462 // applied by the colour scale object when mapping it | 462 // applied by the colour scale object when mapping it |
463 | 463 |
464 psx = sx; | 464 psx = sx; |
465 } | 465 } |
466 | 466 |
467 sv_frame_t fx = sx * modelResolution + modelStart; | 467 sv_frame_t fx = sx * modelResolution + modelStart; |
468 | 468 |
469 if (fx + modelResolution <= modelStart || fx > modelEnd) continue; | 469 if (fx + modelResolution <= modelStart || fx > modelEnd) continue; |
470 | 470 |
471 int rx0 = v->getXForFrame(int(double(fx) * rateRatio)); | 471 int rx0 = v->getXForFrame(int(double(fx) * rateRatio)); |
472 int rx1 = v->getXForFrame(int(double(fx + modelResolution + 1) * rateRatio)); | 472 int rx1 = v->getXForFrame(int(double(fx + modelResolution + 1) * rateRatio)); |
473 | 473 |
474 int rw = rx1 - rx0; | 474 int rw = rx1 - rx0; |
475 if (rw < 1) rw = 1; | 475 if (rw < 1) rw = 1; |
476 | 476 |
477 bool showLabel = (rw > 10 && | 477 bool showLabel = (rw > 10 && |
478 paint.fontMetrics().width("0.000000") < rw - 3 && | 478 paint.fontMetrics().width("0.000000") < rw - 3 && |
479 paint.fontMetrics().height() < (h / sh)); | 479 paint.fontMetrics().height() < (h / sh)); |
480 | 480 |
481 for (int sy = minbin; sy < minbin + nbins; ++sy) { | 481 for (int sy = minbin; sy < minbin + nbins; ++sy) { |
482 | 482 |
483 int ry0 = m_sources.verticalBinLayer->getIYForBin(v, sy); | 483 int ry0 = m_sources.verticalBinLayer->getIYForBin(v, sy); |
484 int ry1 = m_sources.verticalBinLayer->getIYForBin(v, sy + 1); | 484 int ry1 = m_sources.verticalBinLayer->getIYForBin(v, sy + 1); |
485 | 485 |
486 if (m_params.invertVertical) { | 486 if (m_params.invertVertical) { |
499 paint.setBrush(Qt::NoBrush); | 499 paint.setBrush(Qt::NoBrush); |
500 paint.drawLine(r.x(), r.y(), r.x(), r.y() + r.height() - 1); | 500 paint.drawLine(r.x(), r.y(), r.x(), r.y() + r.height() - 1); |
501 continue; | 501 continue; |
502 } | 502 } |
503 | 503 |
504 QColor pen(255, 255, 255, 80); | 504 QColor pen(255, 255, 255, 80); |
505 QColor brush(colour); | 505 QColor brush(colour); |
506 | 506 |
507 if (rw > 3 && r.height() > 3) { | 507 if (rw > 3 && r.height() > 3) { |
508 brush.setAlpha(160); | 508 brush.setAlpha(160); |
509 } | 509 } |
510 | 510 |
511 paint.setPen(Qt::NoPen); | 511 paint.setPen(Qt::NoPen); |
512 paint.setBrush(brush); | 512 paint.setBrush(brush); |
513 | 513 |
514 if (illuminate) { | 514 if (illuminate) { |
515 if (r.contains(illuminatePos)) { | 515 if (r.contains(illuminatePos)) { |
516 paint.setPen(v->getForeground()); | 516 paint.setPen(v->getForeground()); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 #ifdef DEBUG_COLOUR_PLOT_REPAINT | 520 #ifdef DEBUG_COLOUR_PLOT_REPAINT |
521 // SVDEBUG << "rect " << r.x() << "," << r.y() << " " | 521 // SVDEBUG << "rect " << r.x() << "," << r.y() << " " |
522 // << r.width() << "x" << r.height() << endl; | 522 // << r.width() << "x" << r.height() << endl; |
523 #endif | 523 #endif |
524 | 524 |
525 paint.drawRect(r); | 525 paint.drawRect(r); |
526 | 526 |
527 if (showLabel) { | 527 if (showLabel) { |
528 double value = model->getValueAt(sx, sy); | 528 double value = model->getValueAt(sx, sy); |
529 snprintf(labelbuf, buflen, "%06f", value); | 529 snprintf(labelbuf, buflen, "%06f", value); |
530 QString text(labelbuf); | 530 QString text(labelbuf); |
531 PaintAssistant::drawVisibleText | 531 PaintAssistant::drawVisibleText |
532 (v, | 532 (v, |
533 paint, | 533 paint, |
534 rx0 + 2, | 534 rx0 + 2, |
535 ry0 - h / sh - 1 + 2 + paint.fontMetrics().ascent(), | 535 ry0 - h / sh - 1 + 2 + paint.fontMetrics().ascent(), |
536 text, | 536 text, |
537 PaintAssistant::OutlinedText); | 537 PaintAssistant::OutlinedText); |
538 } | 538 } |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 return magRange; | 542 return magRange; |
543 } | 543 } |
544 | 544 |
596 // buffer is at the same resolution as the target in the cache, so | 596 // buffer is at the same resolution as the target in the cache, so |
597 // no extra scaling needed. | 597 // no extra scaling needed. |
598 | 598 |
599 const DenseThreeDimensionalModel *model = m_sources.source; | 599 const DenseThreeDimensionalModel *model = m_sources.source; |
600 if (!model || !model->isOK() || !model->isReady()) { | 600 if (!model || !model->isOK() || !model->isReady()) { |
601 throw std::logic_error("no source model provided, or model not ready"); | 601 throw std::logic_error("no source model provided, or model not ready"); |
602 } | 602 } |
603 | 603 |
604 int h = v->getPaintHeight(); | 604 int h = v->getPaintHeight(); |
605 | 605 |
606 clearDrawBuffer(repaintWidth, h); | 606 clearDrawBuffer(repaintWidth, h); |
737 // buffer is at bin resolution, i.e. buffer x == source column | 737 // buffer is at bin resolution, i.e. buffer x == source column |
738 // number. We use toolkit smooth scaling for interpolation. | 738 // number. We use toolkit smooth scaling for interpolation. |
739 | 739 |
740 const DenseThreeDimensionalModel *model = m_sources.source; | 740 const DenseThreeDimensionalModel *model = m_sources.source; |
741 if (!model || !model->isOK() || !model->isReady()) { | 741 if (!model || !model->isOK() || !model->isReady()) { |
742 throw std::logic_error("no source model provided, or model not ready"); | 742 throw std::logic_error("no source model provided, or model not ready"); |
743 } | 743 } |
744 | 744 |
745 // The draw buffer will contain a fragment at bin resolution. We | 745 // The draw buffer will contain a fragment at bin resolution. We |
746 // need to ensure that it starts and ends at points where a | 746 // need to ensure that it starts and ends at points where a |
747 // time-bin boundary occurs at an exact pixel boundary, and with a | 747 // time-bin boundary occurs at an exact pixel boundary, and with a |