File: Colorbar.h

package info (click to toggle)
glgrib 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,861,496 kB
  • sloc: cpp: 20,811; ansic: 6,530; perl: 2,902; sh: 513; makefile: 147; python: 58; sql: 18
file content (47 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include "glGrib/Palette.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "glGrib/OpenGL.h"
#include "glGrib/Font.h"
#include "glGrib/String.h"
#include "glGrib/Options.h"
#include "glGrib/Program.h"

namespace glGrib
{

class Colorbar : public Object2D
{
public:
  Colorbar () : VAID (this) {}
  void setup (const OptionsColorbar &);
  void setupVertexAttributes () const;
  Colorbar & operator= (const Colorbar &);
  void render (const glm::mat4 &) const;
  const OptionsColorbar & getOptions () const { return d.opts; }
  void update (const Palette &);
  void reSize (const View &) override {}
  Object2D::side_t getSide () const override { return Object2D::LEFT; }
private:
  void createLabels (std::vector<float> &, std::vector<float> &, 
                     std::vector<std::string> &, const std::vector<float> &, const bool);
  void updateLinear (const float, const float, std::vector<float> &, 
                     std::vector <float> &, std::vector<std::string> &);
  void updateNonLinear (const float, const float, std::vector<float> &, 
                        std::vector <float> &, std::vector<std::string> &);
  struct
  {
    OptionsColorbar opts;
    OpenGLBufferPtr<unsigned int> elementbuffer;
    int nt;
    std::vector<int> rank2rgba;
    String2D<0,1> label;
    Palette palette;
  } d;
  OpenGLVertexArray<Colorbar> VAID;
};


}