Mercurial > hg > svgui
diff 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 |
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp Thu Feb 02 16:10:19 2006 +0000 +++ b/layer/TimeValueLayer.cpp Thu Feb 02 17:31:08 2006 +0000 @@ -92,7 +92,7 @@ } else if (name == tr("Plot Type")) { if (min) *min = 0; - if (max) *max = 4; + if (max) *max = 5; deft = int(m_plotStyle); @@ -126,6 +126,7 @@ case 2: return tr("Connected Points"); case 3: return tr("Lines"); case 4: return tr("Curve"); + case 5: return tr("Segmentation"); } } return tr("<unknown>"); @@ -371,13 +372,17 @@ int y = getYForValue(p.value); if (w < 1) w = 1; + paint.setPen(m_colour); - if (m_plotStyle == PlotLines || - m_plotStyle == PlotCurve) { - paint.setPen(m_colour); + if (m_plotStyle == PlotSegmentation) { + int value = ((p.value - min) / (max - min)) * 255.999; + QColor colour = QColor::fromHsv(256 - value, value / 2 + 128, value); + paint.setBrush(QColor(colour.red(), colour.green(), colour.blue(), + 120)); + } else if (m_plotStyle == PlotLines || + m_plotStyle == PlotCurve) { paint.setBrush(Qt::NoBrush); } else { - paint.setPen(m_colour); paint.setBrush(brushColour); } @@ -403,12 +408,15 @@ if (m_plotStyle != PlotCurve && m_plotStyle != PlotLines) { paint.setPen(Qt::black);//!!! - paint.setBrush(Qt::black);//!!! + if (m_plotStyle != PlotSegmentation) { + paint.setBrush(Qt::black);//!!! + } } } if (m_plotStyle != PlotLines && - m_plotStyle != PlotCurve) { + m_plotStyle != PlotCurve && + m_plotStyle != PlotSegmentation) { paint.drawRect(x, y - 1, w, 2); } @@ -449,6 +457,30 @@ } } + if (m_plotStyle == PlotSegmentation) { + + SparseTimeValueModel::PointList::const_iterator j = i; + ++j; + + if (j != points.end()) { + + const SparseTimeValueModel::Point &q(*j); + int nx = getXForFrame(q.frame); + + if (nx == x) continue; + + if (nx < x + 5 && illuminateFrame != p.frame) { + paint.setPen(Qt::NoPen); + } + + paint.drawRect(x, -1, nx - x, m_view->height() + 1); + + } else { + + paint.drawLine(x, 0, x, m_view->height()); + } + } + /// if (p.label != "") { /// paint.drawText(x + 5, y - paint.fontMetrics().height() + paint.fontMetrics().ascent(), p.label); /// }