GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
gl-select.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2015 Michael Goffioul
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifndef __QtHandles_gl_selector__
24 #define __QtHandles_gl_selector__ 1
25 
26 #include "gl-render.h"
27 
28 #include <map>
29 
31 {
33  select_last = 0x02
34 };
35 
37 {
38 public:
39  opengl_selector (void) : size (5) { }
40 
41  virtual ~opengl_selector (void) { }
42 
43  graphics_object select (const graphics_object& ax, int x, int y,
44  int flags = 0);
45 
46  virtual void draw (const graphics_object& go, bool toplevel = true);
47 
48 protected:
49  virtual void draw_text (const text::properties& props);
50 
51  virtual void draw_image (const image::properties& props);
52 
53  virtual void setup_opengl_transformation (const axes::properties& props);
54 
55  virtual void init_marker (const std::string& m, double size, float width);
56 
57  virtual Matrix render_text (const std::string& txt,
58  double x, double y, double z,
59  int halign, int valign, double rotation = 0.0);
60 
61 private:
62  void apply_pick_matrix (void);
63 
64  void fake_text (double x, double y, double z, const Matrix& bbox,
65  bool use_scale = true);
66 
67 private:
68  // The mouse coordinate of the selection/picking point
69  int xp, yp;
70 
71  // The size (in pixels) of the picking window
72  int size;
73 
74  // The OpenGL name mapping
75  std::map<GLuint, graphics_object> object_map;
76 };
77 
78 #endif // __QtHandles_gl_selector__
select_flags
Definition: gl-select.h:30
virtual ~opengl_selector(void)
Definition: gl-select.h:41
virtual Matrix render_text(const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
Definition: gl-select.cc:186
virtual void draw_image(const image::properties &props)
Definition: gl-select.cc:206
opengl_selector(void)
Definition: gl-select.h:39
void fake_text(double x, double y, double z, const Matrix &bbox, bool use_scale=true)
Definition: gl-select.cc:145
virtual void draw(const graphics_object &go, bool toplevel=true)
Definition: gl-select.cc:134
virtual void draw_text(const text::properties &props)
Definition: gl-select.cc:174
virtual void setup_opengl_transformation(const axes::properties &props)
Definition: gl-select.cc:47
void apply_pick_matrix(void)
Definition: gl-select.cc:32
Definition: dMatrix.h:35
std::map< GLuint, graphics_object > object_map
Definition: gl-select.h:75
virtual void init_marker(const std::string &m, double size, float width)
Definition: gl-select.cc:54
F77_RET_T const double * x
graphics_object select(const graphics_object &ax, int x, int y, int flags=0)
Definition: gl-select.cc:63