summaryrefslogtreecommitdiff
path: root/dgedit/samplesorter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dgedit/samplesorter.cc')
-rw-r--r--dgedit/samplesorter.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/dgedit/samplesorter.cc b/dgedit/samplesorter.cc
index 7be869b..e93754c 100644
--- a/dgedit/samplesorter.cc
+++ b/dgedit/samplesorter.cc
@@ -34,6 +34,8 @@
#define MAXFLOAT (3.40282347e+38F)
#endif
+#define NUM_LEVELS 6
+
SampleSorter::SampleSorter()
{
data = NULL;
@@ -79,6 +81,26 @@ Selections SampleSorter::selections()
return s;
}
+QVector<int> SampleSorter::levels()
+{
+ QVector<int> lvls;
+ int idx = 0;
+ float next = min;
+
+ QMap<float, Selection>::iterator i = sorted.begin();
+ while(i != sorted.end()) {
+ if(i.key() >= next) {
+ lvls.push_back(idx);
+ next += (max - min) / NUM_LEVELS;
+ }
+ i++;
+ idx++;
+ }
+
+ return lvls;
+}
+
+
void SampleSorter::resort()
{
sorted.clear();