diff options
author | deva <deva> | 2010-01-03 14:00:36 +0000 |
---|---|---|
committer | deva <deva> | 2010-01-03 14:00:36 +0000 |
commit | 84bd1150e93658aea36db19cebdb6012f2f40a60 (patch) | |
tree | ec9db2a6b9d17243c4a3c736aeedacd831910ac3 /dgedit/samplesorter.cc | |
parent | 061e35d178350808bc4c2369c6d3c92fcb3b69d2 (diff) |
Some work on sample sorter
Diffstat (limited to 'dgedit/samplesorter.cc')
-rw-r--r-- | dgedit/samplesorter.cc | 22 |
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(); |