Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 26:94381052a6c9
* Add natty segmentation display to time-value layer. Need to do the same
for time-instants layer.
* Make sure dense 3D model bin names are saved and restored properly.
* Fix to chromagram normalization
author | Chris Cannam |
---|---|
date | Thu, 02 Feb 2006 17:31:08 +0000 |
parents | dcdb21b62dbb |
children | 38fe0ea9e46e |
comparison
equal
deleted
inserted
replaced
25:dcdb21b62dbb | 26:94381052a6c9 |
---|---|
90 else if (m_colour == QColor(255, 150, 50)) deft = 5; | 90 else if (m_colour == QColor(255, 150, 50)) deft = 5; |
91 | 91 |
92 } else if (name == tr("Plot Type")) { | 92 } else if (name == tr("Plot Type")) { |
93 | 93 |
94 if (min) *min = 0; | 94 if (min) *min = 0; |
95 if (max) *max = 4; | 95 if (max) *max = 5; |
96 | 96 |
97 deft = int(m_plotStyle); | 97 deft = int(m_plotStyle); |
98 | 98 |
99 } else { | 99 } else { |
100 | 100 |
124 case 0: return tr("Points"); | 124 case 0: return tr("Points"); |
125 case 1: return tr("Stems"); | 125 case 1: return tr("Stems"); |
126 case 2: return tr("Connected Points"); | 126 case 2: return tr("Connected Points"); |
127 case 3: return tr("Lines"); | 127 case 3: return tr("Lines"); |
128 case 4: return tr("Curve"); | 128 case 4: return tr("Curve"); |
129 case 5: return tr("Segmentation"); | |
129 } | 130 } |
130 } | 131 } |
131 return tr("<unknown>"); | 132 return tr("<unknown>"); |
132 } | 133 } |
133 | 134 |
369 | 370 |
370 int x = getXForFrame(p.frame); | 371 int x = getXForFrame(p.frame); |
371 int y = getYForValue(p.value); | 372 int y = getYForValue(p.value); |
372 | 373 |
373 if (w < 1) w = 1; | 374 if (w < 1) w = 1; |
374 | 375 paint.setPen(m_colour); |
375 if (m_plotStyle == PlotLines || | 376 |
376 m_plotStyle == PlotCurve) { | 377 if (m_plotStyle == PlotSegmentation) { |
377 paint.setPen(m_colour); | 378 int value = ((p.value - min) / (max - min)) * 255.999; |
379 QColor colour = QColor::fromHsv(256 - value, value / 2 + 128, value); | |
380 paint.setBrush(QColor(colour.red(), colour.green(), colour.blue(), | |
381 120)); | |
382 } else if (m_plotStyle == PlotLines || | |
383 m_plotStyle == PlotCurve) { | |
378 paint.setBrush(Qt::NoBrush); | 384 paint.setBrush(Qt::NoBrush); |
379 } else { | 385 } else { |
380 paint.setPen(m_colour); | |
381 paint.setBrush(brushColour); | 386 paint.setBrush(brushColour); |
382 } | 387 } |
383 | 388 |
384 if (m_plotStyle == PlotStems) { | 389 if (m_plotStyle == PlotStems) { |
385 paint.setPen(brushColour); | 390 paint.setPen(brushColour); |
401 //or curve mode | 406 //or curve mode |
402 | 407 |
403 if (m_plotStyle != PlotCurve && | 408 if (m_plotStyle != PlotCurve && |
404 m_plotStyle != PlotLines) { | 409 m_plotStyle != PlotLines) { |
405 paint.setPen(Qt::black);//!!! | 410 paint.setPen(Qt::black);//!!! |
406 paint.setBrush(Qt::black);//!!! | 411 if (m_plotStyle != PlotSegmentation) { |
412 paint.setBrush(Qt::black);//!!! | |
413 } | |
407 } | 414 } |
408 } | 415 } |
409 | 416 |
410 if (m_plotStyle != PlotLines && | 417 if (m_plotStyle != PlotLines && |
411 m_plotStyle != PlotCurve) { | 418 m_plotStyle != PlotCurve && |
419 m_plotStyle != PlotSegmentation) { | |
412 paint.drawRect(x, y - 1, w, 2); | 420 paint.drawRect(x, y - 1, w, 2); |
413 } | 421 } |
414 | 422 |
415 if (m_plotStyle == PlotConnectedPoints || | 423 if (m_plotStyle == PlotConnectedPoints || |
416 m_plotStyle == PlotLines || | 424 m_plotStyle == PlotLines || |
444 path.cubicTo(x + w, y, nx, ny, nx + w/2, ny); | 452 path.cubicTo(x + w, y, nx, ny, nx + w/2, ny); |
445 } else { | 453 } else { |
446 path.lineTo(nx + w/2, ny); | 454 path.lineTo(nx + w/2, ny); |
447 } | 455 } |
448 } | 456 } |
457 } | |
458 } | |
459 | |
460 if (m_plotStyle == PlotSegmentation) { | |
461 | |
462 SparseTimeValueModel::PointList::const_iterator j = i; | |
463 ++j; | |
464 | |
465 if (j != points.end()) { | |
466 | |
467 const SparseTimeValueModel::Point &q(*j); | |
468 int nx = getXForFrame(q.frame); | |
469 | |
470 if (nx == x) continue; | |
471 | |
472 if (nx < x + 5 && illuminateFrame != p.frame) { | |
473 paint.setPen(Qt::NoPen); | |
474 } | |
475 | |
476 paint.drawRect(x, -1, nx - x, m_view->height() + 1); | |
477 | |
478 } else { | |
479 | |
480 paint.drawLine(x, 0, x, m_view->height()); | |
449 } | 481 } |
450 } | 482 } |
451 | 483 |
452 /// if (p.label != "") { | 484 /// if (p.label != "") { |
453 /// paint.drawText(x + 5, y - paint.fontMetrics().height() + paint.fontMetrics().ascent(), p.label); | 485 /// paint.drawText(x + 5, y - paint.fontMetrics().height() + paint.fontMetrics().ascent(), p.label); |