/[escript]/trunk/cusplibrary/cusp/opengl/spy/matrix_data_panel.h
ViewVC logotype

Contents of /trunk/cusplibrary/cusp/opengl/spy/matrix_data_panel.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5148 - (show annotations)
Mon Sep 15 01:25:23 2014 UTC (6 years, 1 month ago) by caltinay
File MIME type: text/plain
File size: 2623 byte(s)
Merging ripley diagonal storage + CUDA support into trunk.
Options file version has been incremented due to new options
'cuda' and 'nvccflags'.

1 /*
2 * Copyright 2008-2013 Steven Dalton
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 /**
17 * @file matrix_data_panel.hpp
18 * The definition file for the matrix_data_panel class.
19 */
20
21 /*
22 * David Gleich
23 * 22 November 2006
24 * Copyright, Stanford University
25 */
26
27 #pragma once
28
29 #include <string>
30 #include <sstream>
31
32 #include <cusp/opengl/spy/glut_window.h>
33
34 namespace cusp
35 {
36 namespace opengl
37 {
38 namespace spy
39 {
40
41 /**
42 * The matrix_data_panel class manages the display of the data window
43 * showing additional information about the current cursor position
44 * of the matrix.
45 */
46 class matrix_data_panel
47 : public glut_window<matrix_data_panel>
48 {
49 private:
50 typedef glut_window<matrix_data_panel> super;
51
52 public:
53 matrix_data_panel(int parent_glut_id,
54 int w, int h, int x, int y);
55
56 // this is the function called when the matrix canvas updates
57 // the cursor
58 // void position(int x, int y);
59
60 // this draws the window
61 void display();
62 void reshape(int w, int h);
63
64 void update(int in_row, int in_col, float in_val,
65 const std::string& in_rlabel = "",
66 const std::string& in_clabel = "")
67 {
68 row = in_row; col = in_col;
69 val = in_val;
70 rlabel = in_rlabel; clabel = in_clabel;
71
72 int old_glut_win = glutGetWindow();
73 glutSetWindow(super::get_glut_window_id());
74 glutPostRedisplay();
75 glutSetWindow(old_glut_win);
76 }
77
78 void set_background_color(float r, float g, float b)
79 { background_color[0]=r; background_color[1]=g; background_color[2]=b; }
80
81 void set_border_color(float r, float g, float b)
82 { border_color[0]=r; border_color[1]=g; border_color[2]=b; }
83
84 void set_text_color(float r, float g, float b)
85 { text_color[0]=r; text_color[1]=g; text_color[2]=b; }
86
87 private:
88 int parent_glut_id;
89 int width, height;
90
91 int row, col;
92 float val;
93
94 std::string rlabel, clabel;
95 float background_color[3];
96 float border_color[3];
97 float text_color[3];
98 };
99
100 } // end spy
101 } // end opengl
102 } // end cusp
103
104 #include <cusp/opengl/spy/detail/matrix_data_panel.inl>
105

  ViewVC Help
Powered by ViewVC 1.1.26