Graphite  Version 3
An experimental 3D geometry processing program
scene_graph_tools_manager.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 
38 #ifndef H_OGF_SCENE_GRAPH_TOOLS_SCENE_GRAPH_TOOLS_MGR_H
39 #define H_OGF_SCENE_GRAPH_TOOS_SCENE_GRAPH_TOOLS_MGR_H
40 
41 #include <OGF/scene_graph_gfx/common/common.h>
45 
46 #include <map>
47 
53 namespace OGF {
54 
55  class RenderingContext;
56 
57 
61  gom_class SCENE_GRAPH_GFX_API SceneGraphToolsManager : public Node {
62  public:
63 
69 
74 
80  return instance_;
81  }
82 
88  return scene_graph_;
89  }
90 
91 
92  gom_slots:
98  void focus(const mat4& value);
99 
105  void current_object(const std::string& value);
106 
112  void tool(const std::string& value);
113 
119  void grab(const RayPick& value);
120 
126  void drag(const RayPick& value);
127 
133  void release(const RayPick& value);
134 
139  Tool* current() const;
140 
147 
148  gom_signals:
153  void status_message(const std::string& value);
154 
161  void tool_icon_changed(const std::string& value);
162 
163  gom_slots:
169  void update_tool_icon(const std::string& value);
170 
175  const mat4& get_focus() const {
176  return focus_;
177  }
178 
183  Node* renderer() const {
184  ogf_assert(renderer_ != nullptr);
185  return renderer_;
186  }
187 
192  void set_rendering_context( OGF::RenderingContext* rendering_context );
193 
194 
200 
205  void status(const std::string& value) {
206  status_message(value);
207  }
208 
209  protected:
217  const std::string& grob_class_name
218  );
219 
223  void create_gui();
224 
225  private:
226  SceneGraph* scene_graph_;
227  Node* renderer_;
228  ToolsManager* current_tools_manager_;
229  RenderingContext* rendering_context_;
230  typedef std::map<std::string, ToolsManager_var> ToolsMap;
231  ToolsMap tools_;
232  mat4 focus_;
233  static SceneGraphToolsManager* instance_;
234  };
235 }
236 
237 #endif
A composite object in the GOM system.
Definition: node.h:58
Helper class for OpenGL context management.
Manages the tools for the entire SceneGraph.
SceneGraphToolsManager(Node *renderer)
SceneGraphToolsManager constructor.
ToolsManager * current_tools_manager() const
Gets the current ToolsManager.
void tool(const std::string &value)
Changes the current tool.
void grab(const RayPick &value)
Called when a mouse button is pressed.
RenderingContext * rendering_context()
Gets the RenderingContext.
~SceneGraphToolsManager() override
SceneGraphToolsManager destructor.
void drag(const RayPick &value)
Called when the mouse is dragged with a button pressed.
Tool * current() const
Gets the current Tool.
void status(const std::string &value)
Triggers the status_message() signal.
void create_gui()
Creates the GUI for the tools.
void current_object(const std::string &value)
Notify this SceneGraphToolsManager that the current object changed.
void release(const RayPick &value)
Called when a mouse button is released.
static SceneGraphToolsManager * instance()
Gets the instance.
ToolsManager * resolve_tools_manager(const std::string &grob_class_name)
Finds a ToolManager by Grob class name.
SceneGraph * scene_graph()
Gets the SceneGraph.
const mat4 & get_focus() const
Gets the focus matrix.
void tool_icon_changed(const std::string &value)
A signal that is triggered each time the current tool changes, to update the tool icon in the status ...
void set_rendering_context(OGF::RenderingContext *rendering_context)
Sets the RenderingContext.
Node * renderer() const
Gets the renderer.
Represents the list of objects loaded in Graphite.
Definition: scene_graph.h:62
Base class for the tools.
Definition: tool.h:61
Manages the Tool objects associated with a given Grob class.
Definition: tools_manager.h:62
Global Graphite namespace.
Definition: common.h:76
the class that represents the scene graph.
Represents the information related with a picking event.
Definition: ray_picker.h:64
Base classes for the tools.
A class to manage the Tool objects associated with a given Grob class.