changeset 442:04b7fd31e1c6

* Add segmentation plot type to region layer (plotting not implemented yet)
author Chris Cannam
date Fri, 19 Sep 2008 12:55:35 +0000
parents 288f45533041
children 381ec750eeee
files data/model/RegionModel.h
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data/model/RegionModel.h	Thu Sep 18 16:08:14 2008 +0000
+++ b/data/model/RegionModel.h	Fri Sep 19 12:55:35 2008 +0000
@@ -95,7 +95,8 @@
     RegionModel(size_t sampleRate, size_t resolution,
                 bool notifyOnAdd = true) :
 	IntervalModel<RegionRec>(sampleRate, resolution, notifyOnAdd),
-	m_valueQuantization(0)
+	m_valueQuantization(0),
+        m_haveDistinctValues(false)
     {
     }
 
@@ -105,7 +106,8 @@
 	IntervalModel<RegionRec>(sampleRate, resolution,
                             valueMinimum, valueMaximum,
                             notifyOnAdd),
-	m_valueQuantization(0)
+	m_valueQuantization(0),
+        m_haveDistinctValues(false)
     {
     }
 
@@ -116,6 +118,8 @@
     float getValueQuantization() const { return m_valueQuantization; }
     void setValueQuantization(float q) { m_valueQuantization = q; }
 
+    bool haveDistinctValues() const { return m_haveDistinctValues; }
+
     QString getTypeName() const { return tr("Region"); }
 
     virtual void toXml(QTextStream &out,
@@ -197,8 +201,15 @@
         return SortNumeric;
     }
 
+    virtual void addPoint(const Point &point)
+    {
+        if (point.value != 0.f) m_haveDistinctValues = true;
+        IntervalModel<RegionRec>::addPoint(point);
+    }
+    
 protected:
     float m_valueQuantization;
+    bool m_haveDistinctValues;
 };
 
 #endif