comparison data/model/RegionModel.h @ 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 325112751f0e
comparison
equal deleted inserted replaced
441:288f45533041 442:04b7fd31e1c6
93 93
94 public: 94 public:
95 RegionModel(size_t sampleRate, size_t resolution, 95 RegionModel(size_t sampleRate, size_t resolution,
96 bool notifyOnAdd = true) : 96 bool notifyOnAdd = true) :
97 IntervalModel<RegionRec>(sampleRate, resolution, notifyOnAdd), 97 IntervalModel<RegionRec>(sampleRate, resolution, notifyOnAdd),
98 m_valueQuantization(0) 98 m_valueQuantization(0),
99 m_haveDistinctValues(false)
99 { 100 {
100 } 101 }
101 102
102 RegionModel(size_t sampleRate, size_t resolution, 103 RegionModel(size_t sampleRate, size_t resolution,
103 float valueMinimum, float valueMaximum, 104 float valueMinimum, float valueMaximum,
104 bool notifyOnAdd = true) : 105 bool notifyOnAdd = true) :
105 IntervalModel<RegionRec>(sampleRate, resolution, 106 IntervalModel<RegionRec>(sampleRate, resolution,
106 valueMinimum, valueMaximum, 107 valueMinimum, valueMaximum,
107 notifyOnAdd), 108 notifyOnAdd),
108 m_valueQuantization(0) 109 m_valueQuantization(0),
110 m_haveDistinctValues(false)
109 { 111 {
110 } 112 }
111 113
112 virtual ~RegionModel() 114 virtual ~RegionModel()
113 { 115 {
114 } 116 }
115 117
116 float getValueQuantization() const { return m_valueQuantization; } 118 float getValueQuantization() const { return m_valueQuantization; }
117 void setValueQuantization(float q) { m_valueQuantization = q; } 119 void setValueQuantization(float q) { m_valueQuantization = q; }
120
121 bool haveDistinctValues() const { return m_haveDistinctValues; }
118 122
119 QString getTypeName() const { return tr("Region"); } 123 QString getTypeName() const { return tr("Region"); }
120 124
121 virtual void toXml(QTextStream &out, 125 virtual void toXml(QTextStream &out,
122 QString indent = "", 126 QString indent = "",
195 { 199 {
196 if (column == 5) return SortAlphabetical; 200 if (column == 5) return SortAlphabetical;
197 return SortNumeric; 201 return SortNumeric;
198 } 202 }
199 203
204 virtual void addPoint(const Point &point)
205 {
206 if (point.value != 0.f) m_haveDistinctValues = true;
207 IntervalModel<RegionRec>::addPoint(point);
208 }
209
200 protected: 210 protected:
201 float m_valueQuantization; 211 float m_valueQuantization;
212 bool m_haveDistinctValues;
202 }; 213 };
203 214
204 #endif 215 #endif