comparison layer/TimeValueLayer.cpp @ 34:c43f2c4f66f2

* As previous commit
author Chris Cannam
date Fri, 17 Feb 2006 18:11:08 +0000
parents 202d1dca67d2
children 1bdf285c4eac
comparison
equal deleted inserted replaced
33:651e4e868bcc 34:c43f2c4f66f2
418 const SparseTimeValueModel::Point &p(*i); 418 const SparseTimeValueModel::Point &p(*i);
419 419
420 int x = getXForFrame(p.frame); 420 int x = getXForFrame(p.frame);
421 int y = getYForValue(p.value); 421 int y = getYForValue(p.value);
422 422
423 bool haveNext = false;
424 int nx = getXForFrame(m_model->getEndFrame());
425 int ny = y;
426
427 SparseTimeValueModel::PointList::const_iterator j = i;
428 ++j;
429
430 if (j != points.end()) {
431 const SparseTimeValueModel::Point &q(*j);
432 nx = getXForFrame(q.frame);
433 ny = getYForValue(q.value);
434 haveNext = true;
435 }
436
437 int labelY = y;
438
423 if (w < 1) w = 1; 439 if (w < 1) w = 1;
424 paint.setPen(m_colour); 440 paint.setPen(m_colour);
425 441
426 if (m_plotStyle == PlotSegmentation) { 442 if (m_plotStyle == PlotSegmentation) {
427 int value = ((p.value - min) / (max - min)) * 255.999; 443 int value = ((p.value - min) / (max - min)) * 255.999;
428 QColor colour = QColor::fromHsv(256 - value, value / 2 + 128, value); 444 QColor colour = QColor::fromHsv(256 - value, value / 2 + 128, value);
429 paint.setBrush(QColor(colour.red(), colour.green(), colour.blue(), 445 paint.setBrush(QColor(colour.red(), colour.green(), colour.blue(),
430 120)); 446 120));
447 labelY = m_view->height();
431 } else if (m_plotStyle == PlotLines || 448 } else if (m_plotStyle == PlotLines ||
432 m_plotStyle == PlotCurve) { 449 m_plotStyle == PlotCurve) {
433 paint.setBrush(Qt::NoBrush); 450 paint.setBrush(Qt::NoBrush);
434 } else { 451 } else {
435 paint.setBrush(brushColour); 452 paint.setBrush(brushColour);
471 488
472 if (m_plotStyle == PlotConnectedPoints || 489 if (m_plotStyle == PlotConnectedPoints ||
473 m_plotStyle == PlotLines || 490 m_plotStyle == PlotLines ||
474 m_plotStyle == PlotCurve) { 491 m_plotStyle == PlotCurve) {
475 492
476 SparseTimeValueModel::PointList::const_iterator j = i; 493 if (haveNext) {
477 ++j;
478
479 if (j != points.end()) {
480
481 const SparseTimeValueModel::Point &q(*j);
482 int nx = getXForFrame(q.frame);
483 int ny = getYForValue(q.value);
484 494
485 if (m_plotStyle == PlotConnectedPoints) { 495 if (m_plotStyle == PlotConnectedPoints) {
486 496
487 paint.setPen(brushColour); 497 paint.setPen(brushColour);
488 paint.drawLine(x + w, y, nx, ny); 498 paint.drawLine(x + w, y, nx, ny);
489 499
490 } else if (m_plotStyle == PlotLines) { 500 } else if (m_plotStyle == PlotLines) {
491 501
506 } 516 }
507 } 517 }
508 518
509 if (m_plotStyle == PlotSegmentation) { 519 if (m_plotStyle == PlotSegmentation) {
510 520
511 SparseTimeValueModel::PointList::const_iterator j = i;
512 ++j;
513
514 int nx;
515
516 if (j != points.end()) {
517 const SparseTimeValueModel::Point &q(*j);
518 nx = getXForFrame(q.frame);
519 } else {
520 nx = getXForFrame(m_model->getEndFrame());
521 }
522
523 if (nx <= x) continue; 521 if (nx <= x) continue;
524 522
525 if (illuminateFrame != p.frame && 523 if (illuminateFrame != p.frame &&
526 (nx < x + 5 || x >= m_view->width() - 1)) { 524 (nx < x + 5 || x >= m_view->width() - 1)) {
527 paint.setPen(Qt::NoPen); 525 paint.setPen(Qt::NoPen);