Parallel Coordinate System with Time Series Data
Graphics2D.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QtWidgets/QWidget>
4 #include <QtOpenGL>
5 #include "qtcsv/stringdata.h"
6 #include "qtcsv/reader.h"
7 #include "qtcsv/writer.h"
8 #include "qstring.h"
9 #include "Shader.h"
10 #include <string>
11 #include <iostream>
12 #include <filesystem>
13 #include <unordered_map>
14 #include "Calendar.h"
15 
16 #include "Graphics2D.h"
17 
18 using namespace std;
19 namespace fs = filesystem;
20 namespace std {
21 
22  template <>
23  struct hash<Calendar>
24  {
25  std::size_t operator()(const Calendar& d) const
26  {
27  using std::size_t;
28  using std::hash;
29 
30  // Compute individual hash values for first,
31  // second and third and combine them using XOR
32  // and bit shifting:
33 
34  return (hash<int>()(d.getYear()) << 1)
35  ^ (hash<int>()(d.getMonth()) << 1)
36  ^ (hash<int>()(d.getDay()) << 1);
37  }
38  };
39 }
40 class Graphics2D : public QOpenGLWidget, protected QOpenGLFunctions
41 {
42  Q_OBJECT
43 
44 public:
45  Graphics2D(QWidget *parent = 0);
46  ~Graphics2D();
47 
48 protected:
49  void initializeData(string filespath);
50  void testData();
51  void initializeGL() Q_DECL_OVERRIDE;
52  void resizeGL(int w, int h) Q_DECL_OVERRIDE;
53  void paintGL() Q_DECL_OVERRIDE;
54 
55 
56  GLfloat vertices[18];
57  GLfloat colors[18];
58  GLfloat lines[6];
59 
60 private:
61  QOpenGLShaderProgram program;
62  QOpenGLVertexArrayObject vao;
63  QOpenGLBuffer vbo[2];
64  unordered_map<Calendar, vector<vector<string>>> data;
65 
66 };
A Calendar from which you can access the whole data.
Definition: Calendar.h:83
Definition: Graphics2D.h:41
Definition: Calendar.h:53
std::size_t operator()(const Calendar &d) const
Definition: Graphics2D.h:25