Hermes2D  2.0
order_view.h
1 // This file is part of Hermes2D.
2 //
3 // Copyright 2005-2008 Jakub Cerveny <jakub.cerveny@gmail.com>
4 // Copyright 2005-2008 Lenka Dubcova <dubcova@gmail.com>
5 // Copyright 2005-2008 Pavel Solin <solin@unr.edu>
6 //
7 // Hermes2D is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // Hermes2D is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
19 
20 // $Id: view.h 1086 2008-10-21 09:05:44Z jakub $
21 
22 #ifndef __H2D_ORDER_VIEW_H
23 #define __H2D_ORDER_VIEW_H
24 #include "view.h"
25 
26 namespace Hermes
27 {
28  namespace Hermes2D
29  {
30  namespace Views
31  {
32  // you can define NOGLUT to turn off all OpenGL stuff in Hermes2D
33 #ifndef NOGLUT
34 
35  static const int H2DV_MAX_VIEWABLE_ORDER = 10;
36 
41  class HERMES_API OrderView : public View
42  {
43  public:
44 
45  OrderView(const char* title = "OrderView", WinGeom* wg = NULL);
46  //#ifndef _MSC_VER
47  // OrderView(const char* title = "OrderView", WinGeom* wg = NULL);
48  //#endif
49  OrderView(char* title, WinGeom* wg = NULL);
50 
51  template<typename Scalar>
52  void show(const Space<Scalar>* space);
53  void set_b_orders(bool set);
54  protected:
55 
56  Orderizer ord;
57  bool b_orders;
58 
59  int num_boxes, order_min;
60  const char* box_names[H2DV_MAX_VIEWABLE_ORDER + 1];
61  char text_buffer[H2DV_MAX_VIEWABLE_ORDER*4];
62  float order_colors[H2DV_MAX_VIEWABLE_ORDER + 1][3];
63 
64  void init_order_palette(double3* vert);
65 
66  virtual void on_display();
67  virtual void on_key_down(unsigned char key, int x, int y);
68  virtual void scale_dispatch();
69  virtual int measure_scale_labels();
70  virtual const char* get_help_text() const;
71  };
72 #else
73  class HERMES_API OrderView : public View
74  {
75  public:
76 
77  OrderView(const char* title = "OrderView", WinGeom* wg = NULL) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
78  //#ifndef _MSC_VER
79  // OrderView(const char* title = "OrderView", WinGeom* wg = NULL);
80  //#endif
81  OrderView(char* title, WinGeom* wg = NULL) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
82 
83  template<typename Scalar>
84  void show(const Space<Scalar>* space) { throw Hermes::Exceptions::Exception("GLUT disabled."); }
85  };
86 #endif
87  }
88  }
89 }
90 #endif