GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gl-select.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2011-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_gl_select_h)
27 #define octave_gl_select_h 1
28 
29 #include <map>
30 #include <string>
31 
32 #include "gl-render.h"
33 #include "oct-opengl.h"
34 
35 namespace octave
36 {
37 
39  {
41  select_last = 0x02
42  };
43 
45  {
46  public:
48  : opengl_renderer (glfcns), size (5)
49  { }
50 
51  virtual ~opengl_selector (void) = default;
52 
53  graphics_object select (const graphics_object& ax, int x, int y,
54  int flags = 0);
55 
56  virtual void draw (const graphics_object& go, bool toplevel = true);
57 
58  protected:
59  virtual void draw_text (const text::properties& props);
60 
61  virtual void draw_image (const image::properties& props);
62 
63  virtual void setup_opengl_transformation (const axes::properties& props);
64 
65  virtual void init_marker (const std::string& m, double size, float width);
66 
67  virtual Matrix render_text (const std::string& txt,
68  double x, double y, double z,
69  int halign, int valign, double rotation = 0.0);
70 
71  private:
72  void apply_pick_matrix (void);
73 
74  void fake_text (double x, double y, double z, const Matrix& bbox,
75  bool use_scale = true);
76 
77  private:
78  // The mouse coordinate of the selection/picking point
79  int xp, yp;
80 
81  // The size (in pixels) of the picking window
82  int size;
83 
84  // The OpenGL name mapping
85  std::map<GLuint, graphics_object> object_map;
86  };
87 
88 }
89 
90 #endif
Definition: dMatrix.h:42
virtual void init_marker(const std::string &m, double size, float width)
Definition: gl-select.cc:71
graphics_object select(const graphics_object &ax, int x, int y, int flags=0)
Definition: gl-select.cc:80
virtual void draw_image(const image::properties &props)
Definition: gl-select.cc:221
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:205
void apply_pick_matrix(void)
Definition: gl-select.cc:36
virtual void draw(const graphics_object &go, bool toplevel=true)
Definition: gl-select.cc:151
virtual void setup_opengl_transformation(const axes::properties &props)
Definition: gl-select.cc:64
opengl_selector(opengl_functions &glfcns)
Definition: gl-select.h:47
virtual ~opengl_selector(void)=default
virtual void draw_text(const text::properties &props)
Definition: gl-select.cc:193
std::map< GLuint, graphics_object > object_map
Definition: gl-select.h:85
void fake_text(double x, double y, double z, const Matrix &bbox, bool use_scale=true)
Definition: gl-select.cc:164
F77_RET_T const F77_DBLE * x
T octave_idx_type m
Definition: mx-inlines.cc:773
select_flags
Definition: gl-select.h:39
@ select_last
Definition: gl-select.h:41
@ select_ignore_hittest
Definition: gl-select.h:40