23 #ifndef __H2D_SCALAR_VIEW_H
24 #define __H2D_SCALAR_VIEW_H
57 void show_linearizer_data(
double eps = HERMES_EPS_NORMAL,
int item = H2D_FN_VAL_0);
59 inline void show_mesh(
bool show =
true) { show_edges = show; refresh(); }
60 inline void show_bounding_box(
bool show =
true) { show_aabb = show; refresh(); }
61 void show_contours(
double step,
double orig = 0.0);
62 inline void hide_contours() { contours =
false; refresh(); }
63 void set_3d_mode(
bool enable =
true);
64 void set_vertical_scaling(
double sc);
65 void set_min_max_range(
double min,
double max);
67 virtual void reset_view(
bool force_reset);
83 VertexNodeInfo(
int id,
float x,
float y) : x(x), y(y), id(id), selected(false) {};
88 bool allow_node_selection;
95 void init_vertex_nodes(
const Mesh* mesh);
96 VertexNodeInfo* find_nearest_node_in_range(
float x,
float y,
float radius);
98 void draw_vertex_nodes();
100 void create_nodes_widgets();
109 ElementInfo(
int id,
float x,
float y,
float width,
float height) : x(x), y(y), width(width), height(height), id(id) {};
117 void init_element_info(
const Mesh* mesh);
118 void create_element_info_widgets();
119 void draw_element_infos_2d();
122 #define H2DV_GL_MAX_EDGE_BUFFER 128
130 GLVertex2(
float x,
float y,
float coord) : x(x), y(y), coord(coord) {};
131 static const size_t H2D_OFFSETOF_COORD = 2*
sizeof(float);
146 void prepare_gl_geometry();
147 void draw_values_2d();
148 void draw_edges_2d();
150 void draw_normals_3d();
155 float edges_color[3];
157 typedef void (*DrawSingleEdgeCallback)(
int inx_vert_a,
int inx_vert_b,
ScalarView* viewer,
void* param);
159 void calculate_mesh_aabb(
double* x_min,
double* x_max,
double* y_min,
double* y_max);
161 static void draw_gl_edge(
int inx_vert_a,
int inx_vert_b,
ScalarView* viewer,
void* param);
162 void draw_edges(DrawSingleEdgeCallback draw_single_edge,
void* param,
bool boundary_only);
177 bool pmode, mode3d, panning;
178 double xrot, yrot, xtrans, ytrans, ztrans;
179 double xzscale, yscale, xctr, yctr, zctr;
182 double value_irange, value_range_avg;
198 double calculate_ztrans_to_fit_view();
199 virtual void update_layout();
201 void draw_tri_contours(double3* vert, int3* tri);
202 void calculate_normals(double3* verts,
int num_verts, int3* tris,
int num_tris);
203 void init_lighting();
204 void update_mesh_info();
206 virtual void on_display();
207 virtual void on_key_down(
unsigned char key,
int x,
int y);
208 virtual void on_mouse_move(
int x,
int y);
209 virtual void on_right_mouse_down(
int x,
int y);
210 virtual void on_middle_mouse_down(
int x,
int y);
211 virtual void on_middle_mouse_up(
int x,
int y);
212 virtual const char* get_help_text()
const;
213 virtual void on_close();
219 void init() {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
221 ScalarView(
const char* title =
"ScalarView", WinGeom* wg = NULL) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
223 ScalarView(
char* title, WinGeom* wg = NULL) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
225 void show(MeshFunction<double>* sln,
double eps = HERMES_EPS_NORMAL,
int item = H2D_FN_VAL_0,
226 MeshFunction<double>* xdisp = NULL, MeshFunction<double>* ydisp = NULL,
double dmult = 1.0) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
228 void show_linearizer_data(
double eps = HERMES_EPS_NORMAL,
int item = H2D_FN_VAL_0) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
230 inline void show_mesh(
bool show =
true) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
231 inline void show_bounding_box(
bool show =
true) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
232 void show_contours(
double step,
double orig = 0.0) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
233 inline void hide_contours() {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
234 inline void set_3d_mode(
bool enable =
true) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
235 void set_vertical_scaling(
double sc) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }
236 void set_min_max_range(
double min,
double max) {
throw Hermes::Exceptions::Exception(
"GLUT disabled."); }