GNU Octave  8.1.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-2023 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 
36 
38  {
40  select_last = 0x02
41  };
42 
44 {
45 public:
47  : opengl_renderer (glfcns), size (5)
48  { }
49 
50  virtual ~opengl_selector (void) = default;
51 
52  graphics_object select (const graphics_object& ax, int x, int y,
53  int flags = 0);
54 
55  virtual void draw (const graphics_object& go, bool toplevel = true);
56 
57 protected:
58  virtual void draw_text (const text::properties& props);
59 
60  virtual void draw_image (const image::properties& props);
61 
62  virtual void setup_opengl_transformation (const axes::properties& props);
63 
64  virtual void init_marker (const std::string& m, double size, float width);
65 
66  virtual Matrix render_text (const std::string& txt,
67  double x, double y, double z,
68  int halign, int valign, double rotation = 0.0);
69 
70 private:
71  void apply_pick_matrix (void);
72 
73  void fake_text (double x, double y, double z, const Matrix& bbox,
74  bool use_scale = true);
75 
76 private:
77  // The mouse coordinate of the selection/picking point
78  int xp, yp;
79 
80  // The size (in pixels) of the picking window
81  int size;
82 
83  // The OpenGL name mapping
84  std::map<GLuint, graphics_object> object_map;
85 };
86 
88 
89 #endif
OCTAVE_END_NAMESPACE(octave)
Definition: dMatrix.h:42
virtual ~opengl_selector(void)=default
virtual void draw_image(const image::properties &props)
Definition: gl-select.cc:220
virtual void draw(const graphics_object &go, bool toplevel=true)
Definition: gl-select.cc:150
virtual void setup_opengl_transformation(const axes::properties &props)
Definition: gl-select.cc:63
opengl_selector(opengl_functions &glfcns)
Definition: gl-select.h:46
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:204
graphics_object select(const graphics_object &ax, int x, int y, int flags=0)
Definition: gl-select.cc:79
std::map< GLuint, graphics_object > object_map
Definition: gl-select.h:84
void apply_pick_matrix(void)
Definition: gl-select.cc:35
virtual void draw_text(const text::properties &props)
Definition: gl-select.cc:192
virtual void init_marker(const std::string &m, double size, float width)
Definition: gl-select.cc:70
void fake_text(double x, double y, double z, const Matrix &bbox, bool use_scale=true)
Definition: gl-select.cc:163
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
select_flags
Definition: gl-select.h:38
@ select_ignore_hittest
Definition: gl-select.h:39
@ select_last
Definition: gl-select.h:40
F77_RET_T const F77_DBLE * x
T octave_idx_type m
Definition: mx-inlines.cc:773
T::properties & properties(graphics_object obj)