Mercurial > hg > svgui
changeset 412:d332ad1ca66b
* Add segmentation plot type to region layer (plotting not implemented yet)
author | Chris Cannam |
---|---|
date | Fri, 19 Sep 2008 12:55:35 +0000 |
parents | 96e4d7b9e165 |
children | f71752646f97 |
files | layer/RegionLayer.cpp layer/RegionLayer.h |
diffstat | 2 files changed, 49 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/RegionLayer.cpp Thu Sep 18 16:08:14 2008 +0000 +++ b/layer/RegionLayer.cpp Fri Sep 19 12:55:35 2008 +0000 @@ -44,7 +44,8 @@ m_originalPoint(0, 0.0, 0, tr("New Point")), m_editingPoint(0, 0.0, 0, tr("New Point")), m_editingCommand(0), - m_verticalScale(AutoAlignScale) + m_verticalScale(AutoAlignScale), + m_plotStyle(PlotLines) { } @@ -68,6 +69,7 @@ PropertyList list = SingleColourLayer::getProperties(); list.push_back("Vertical Scale"); list.push_back("Scale Units"); + list.push_back("Plot Type"); return list; } @@ -76,6 +78,7 @@ { if (name == "Vertical Scale") return tr("Vertical Scale"); if (name == "Scale Units") return tr("Scale Units"); + if (name == "Plot Type") return tr("Plot Type"); return SingleColourLayer::getPropertyLabel(name); } @@ -84,6 +87,7 @@ { if (name == "Scale Units") return UnitsProperty; if (name == "Vertical Scale") return ValueProperty; + if (name == "Plot Type") return ValueProperty; return SingleColourLayer::getPropertyType(name); } @@ -102,7 +106,15 @@ { int val = 0; - if (name == "Vertical Scale") { + if (name == "Plot Type") { + + if (min) *min = 0; + if (max) *max = 1; + if (deflt) *deflt = 0; + + val = int(m_plotStyle); + + } else if (name == "Vertical Scale") { if (min) *min = 0; if (max) *max = 3; @@ -130,7 +142,15 @@ RegionLayer::getPropertyValueLabel(const PropertyName &name, int value) const { - if (name == "Vertical Scale") { + if (name == "Plot Type") { + + switch (value) { + default: + case 0: return tr("Lines"); + case 1: return tr("Segmentation"); + } + + } else if (name == "Vertical Scale") { switch (value) { default: case 0: return tr("Auto-Align"); @@ -144,7 +164,9 @@ void RegionLayer::setProperty(const PropertyName &name, int value) { - if (name == "Vertical Scale") { + if (name == "Plot Type") { + setPlotStyle(PlotStyle(value)); + } else if (name == "Vertical Scale") { setVerticalScale(VerticalScale(value)); } else if (name == "Scale Units") { if (m_model) { @@ -158,6 +180,14 @@ } void +RegionLayer::setPlotStyle(PlotStyle style) +{ + if (m_plotStyle == style) return; + m_plotStyle = style; + emit layerParametersChanged(); +} + +void RegionLayer::setVerticalScale(VerticalScale scale) { if (m_verticalScale == scale) return; @@ -958,8 +988,9 @@ QString indent, QString extraAttributes) const { SingleColourLayer::toXml(stream, indent, extraAttributes + - QString(" verticalScale=\"%1\"") - .arg(m_verticalScale)); + QString(" verticalScale=\"%1\" plotStyle=\"%2\"") + .arg(m_verticalScale) + .arg(m_plotStyle)); } void @@ -971,6 +1002,9 @@ VerticalScale scale = (VerticalScale) attributes.value("verticalScale").toInt(&ok); if (ok) setVerticalScale(scale); + PlotStyle style = (PlotStyle) + attributes.value("plotStyle").toInt(&ok); + if (ok) setPlotStyle(style); }
--- a/layer/RegionLayer.h Thu Sep 18 16:08:14 2008 +0000 +++ b/layer/RegionLayer.h Fri Sep 19 12:55:35 2008 +0000 @@ -84,6 +84,14 @@ void setVerticalScale(VerticalScale scale); VerticalScale getVerticalScale() const { return m_verticalScale; } + enum PlotStyle { + PlotLines, + PlotSegmentation + }; + + void setPlotStyle(PlotStyle style); + PlotStyle getPlotStyle() const { return m_plotStyle; } + virtual bool isLayerScrollable(const View *v) const; virtual bool isLayerEditable() const { return true; } @@ -115,6 +123,7 @@ RegionModel::Point m_editingPoint; RegionModel::EditCommand *m_editingCommand; VerticalScale m_verticalScale; + PlotStyle m_plotStyle; void finish(RegionModel::EditCommand *command) { Command *c = command->finish();