~ubuntu-branches/ubuntu/trusty/3depict/trusty-proposed

« back to all changes in this revision

Viewing changes to src/backend/filters/ionColour.cpp

  • Committer: Package Import Robot
  • Author(s): D Haley
  • Date: 2013-07-20 18:31:32 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20130720183132-5ak932y2x6pwo4fs
Tags: 0.0.14-1
* Update to upstream, 0.0.14
* Enable mathgl2.x configure option
* Modify build-depends, libmgl-dev >= 2.1.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "common/colourmap.h"
23
23
 
24
24
 
 
25
 
25
26
const unsigned int MAX_NUM_COLOURS=256;
26
27
enum
27
28
{
70
71
                return (size_t)((float)(nObjects*IONDATA_SIZE));
71
72
}
72
73
 
73
 
DrawColourBarOverlay *IonColourFilter::makeColourBar() const
74
 
{
75
 
        //If we have ions, then we should draw a colour bar
76
 
        //Set up the colour bar. Place it in a draw stream type
77
 
        DrawColourBarOverlay *dc = new DrawColourBarOverlay;
78
 
 
79
 
        vector<float> r,g,b;
80
 
        r.resize(nColours);
81
 
        g.resize(nColours);
82
 
        b.resize(nColours);
83
 
 
84
 
        for (unsigned int ui=0;ui<nColours;ui++)
85
 
        {
86
 
                unsigned char rgb[3]; //RGB array
87
 
                float value;
88
 
                value = (float)(ui)*(mapBounds[1]-mapBounds[0])/(float)nColours + mapBounds[0];
89
 
                //Pick the desired colour map
90
 
                colourMapWrap(colourMap,rgb,value,mapBounds[0],mapBounds[1]);
91
 
                r[ui]=rgb[0]/255.0f;
92
 
                g[ui]=rgb[1]/255.0f;
93
 
                b[ui]=rgb[2]/255.0f;
94
 
        }
95
 
 
96
 
        dc->setColourVec(r,g,b);
97
 
 
98
 
        dc->setSize(0.08,0.6);
99
 
        dc->setPosition(0.1,0.1);
100
 
        dc->setMinMax(mapBounds[0],mapBounds[1]);
101
 
 
102
 
 
103
 
        return dc;
104
 
}
105
74
 
106
75
 
107
76
unsigned int IonColourFilter::refresh(const std::vector<const FilterStreamData *> &dataIn,
124
93
                {
125
94
                        DrawStreamData *d = new DrawStreamData;
126
95
                        d->parent=this;
127
 
                        d->drawables.push_back(makeColourBar());
 
96
                        d->drawables.push_back(makeColourBar(mapBounds[0],
 
97
                                        mapBounds[1],nColours,colourMap));
128
98
                        d->cached=0;
129
99
                        getOut.push_back(d);
130
100
                }
222
192
        if(foundIons && showColourBar)
223
193
        {
224
194
                DrawStreamData *d = new DrawStreamData;
225
 
                d->drawables.push_back(makeColourBar());
 
195
                d->drawables.push_back(makeColourBar(mapBounds[0],mapBounds[1],nColours,colourMap));
226
196
                d->parent=this;
227
197
                d->cached=0;
228
198
                getOut.push_back(d);