Graphite  Version 3
An experimental 3D geometry processing program
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 #ifndef H_OGF_SCENE_GRAPH_TOOLS_TOOLS_MANAGER_H
38 #define H_OGF_SCENE_GRAPH_TOOLS_TOOLS_MANAGER_H
39 
40 #include <OGF/scene_graph_gfx/common/common.h>
42 #include <OGF/gom/types/node.h>
43 #include <map>
44 
51 namespace OGF {
52 
53  class Grob;
54  class RenderingContext;
55  class SceneGraphToolsManager;
56 
61  gom_attribute(abstract, "true")
62  gom_class SCENE_GRAPH_GFX_API ToolsManager : public Node {
63  public:
74  const std::string& grob_class_name,
75  RenderingContext* context
76  );
77 
81  ~ToolsManager() override;
82 
91  void activate(Grob* grob);
92 
101  void deactivate();
102 
112  void set_grob(Grob* grob);
113 
118  const std::string& grob_class_name() {
119  return grob_class_name_;
120  }
121 
126  Grob* object() const {
127  return grob_;
128  }
129 
135 
141  rendering_context_ = rc;
142  }
143 
148  void grab(const RayPick& ray);
149 
154  void drag(const RayPick& ray);
155 
160  void release(const RayPick& ray);
161 
167  return manager_;
168  }
169 
175  return current_tool_;
176  }
177 
185  void status(const std::string& value);
186 
187  gom_slots:
188 
194  void set_tool(const std::string& value);
195 
201  void configure_tool(const std::string& value);
202 
203  public:
213  Tool* resolve_tool(const std::string& tool_class_name);
214 
215  private:
216  SceneGraphToolsManager* manager_;
217  std::string grob_class_name_;
218  mutable RenderingContext* rendering_context_;
219  Grob* grob_;
220  Tool* current_tool_;
221 
222  typedef std::map<std::string, Tool_var> ToolMap;
223  ToolMap tools_;
224  };
225 
230 }
231 
232 #endif
A smart pointer with reference-counted copy semantics.
Definition: smart_pointer.h:76
Base class for all 3D Graphite objects.
Definition: grob.h:68
A composite object in the GOM system.
Definition: node.h:58
Helper class for OpenGL context management.
Manages the tools for the entire SceneGraph.
Base class for the tools.
Definition: tool.h:61
Manages the Tool objects associated with a given Grob class.
Definition: tools_manager.h:62
void grab(const RayPick &ray)
Routes a mouse pick event to the current tool.
const std::string & grob_class_name()
Gets the Grob class name associated with this ToolsManager.
void set_grob(Grob *grob)
Sets the current Grob.
SceneGraphToolsManager * manager() const
Gets the SceneGraphToolsManager.
void activate(Grob *grob)
Notifies this ToolsManager that the current Grob of the SceneGraph changed.
ToolsManager(SceneGraphToolsManager *mgr, const std::string &grob_class_name, RenderingContext *context)
ToolsManager constructor.
~ToolsManager() override
ToolsManager destructor.
void set_rendering_context(RenderingContext *rc)
Sets the RenderingContext.
void configure_tool(const std::string &value)
Open a dialog to edit the properties of a Tool.
RenderingContext * rendering_context() const
Gets the RenderingContext.
Tool * current_tool()
Gets the current Tool.
Tool * resolve_tool(const std::string &tool_class_name)
Finds a Tool by its class name.
void drag(const RayPick &ray)
Routes a mouse drag event to the current tool.
void release(const RayPick &ray)
Routes a mouse release event to the current tool.
Grob * object() const
Gets the current Grob.
void deactivate()
Notifies this ToolsManager that the current Grob of the SceneGraph is no longer of the class that it ...
void status(const std::string &value)
Displays a status message.
Global Graphite namespace.
Definition: common.h:76
SmartPointer< ToolsManager > ToolsManager_var
An automatic reference-counted pointer to a ToolsManager.
The base class for all composite objects in the GOM system.
Represents the information related with a picking event.
Definition: ray_picker.h:64
Base classes for the tools.