# HG changeset patch # User Chris Cannam # Date 1138901468 0 # Node ID 94381052a6c904c40b1e54bff080896f2e081167 # Parent dcdb21b62dbb7749911368d07549cc4ee192b41a * 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 diff -r dcdb21b62dbb -r 94381052a6c9 layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Thu Feb 02 16:10:19 2006 +0000 +++ b/layer/Colour3DPlotLayer.cpp Thu Feb 02 17:31:08 2006 +0000 @@ -228,8 +228,8 @@ // int hue = 256 - spread; // QColor color = QColor::fromHsv(hue, spread/2 + 128, spread); int hue = 256 - value; - QColor color = QColor::fromHsv(hue, value/2 + 128, value); - m_cache->setColor(value, qRgba(color.red(), color.green(), color.blue(), 80)); + QColor colour = QColor::fromHsv(hue, value/2 + 128, value); + m_cache->setColor(value, qRgba(colour.red(), colour.green(), colour.blue(), 80)); // std::cerr << "Colour3DPlotLayer: Index " << value << ": hue " << hue << std::endl; } diff -r dcdb21b62dbb -r 94381052a6c9 layer/TimeValueLayer.cpp --- 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(""); @@ -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); /// } diff -r dcdb21b62dbb -r 94381052a6c9 layer/TimeValueLayer.h --- a/layer/TimeValueLayer.h Thu Feb 02 16:10:19 2006 +0000 +++ b/layer/TimeValueLayer.h Thu Feb 02 17:31:08 2006 +0000 @@ -56,7 +56,14 @@ void setBaseColour(QColor); QColor getBaseColour() const { return m_colour; } - enum PlotStyle { PlotPoints, PlotStems, PlotConnectedPoints, PlotLines, PlotCurve }; + enum PlotStyle { + PlotPoints, + PlotStems, + PlotConnectedPoints, + PlotLines, + PlotCurve, + PlotSegmentation + }; void setPlotStyle(PlotStyle style); PlotStyle getPlotStyle() const { return m_plotStyle; }