Robotics Library  0.7.0
Scene.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef RL_SG_SCENE_H
28 #define RL_SG_SCENE_H
29 
30 #include <string>
31 #include <vector>
32 #include <Inventor/actions/SoCallbackAction.h>
33 #include <Inventor/VRMLnodes/SoVRMLGroup.h>
34 
35 namespace rl
36 {
40  namespace sg
41  {
42  class Model;
43 
44  class Scene
45  {
46  public:
47  typedef ::std::vector<Model*>::iterator Iterator;
48 
49  Scene();
50 
51  virtual ~Scene();
52 
53  virtual void add(Model* model);
54 
55  Iterator begin();
56 
57  virtual Model* create() = 0;
58 
59  Iterator end();
60 
61  Model* getModel(const ::std::size_t& i) const;
62 
63  virtual ::std::string getName() const;
64 
65  ::std::size_t getNumModels() const;
66 
67  void load(const ::std::string& filename, const bool& doBoundingBoxPoints = false, const bool& doPoints = false);
68 
69  virtual void remove(Model* model);
70 
71  virtual void setName(const ::std::string& name);
72 
73  protected:
75 
76  ::std::vector<Model*> models;
77 
78  private:
79  static void triangleCallback(void* userData, ::SoCallbackAction* action, const ::SoPrimitiveVertex* v1, const ::SoPrimitiveVertex* v2, const ::SoPrimitiveVertex* v3);
80 
81  ::std::string name;
82  };
83  }
84 }
85 
86 #endif // RL_SG_SCENE_H
rl::sg::Scene::create
virtual Model * create()=0
rl::sg::Scene::add
virtual void add(Model *model)
Definition: Scene.cpp:68
rl::sg::Scene::isScalingSupported
bool isScalingSupported
Definition: Scene.h:74
rl::sg::Scene::load
void load(const ::std::string &filename, const bool &doBoundingBoxPoints=false, const bool &doPoints=false)
Definition: Scene.cpp:104
rl::sg::Scene::setName
virtual void setName(const ::std::string &name)
Definition: Scene.cpp:326
rl::sg::Scene::getModel
Model * getModel(const ::std::size_t &i) const
Definition: Scene.cpp:86
rl::sg::Scene::Scene
Scene()
Definition: Scene.cpp:56
rl::sg::Scene::remove
virtual void remove(Model *model)
Definition: Scene.cpp:315
rl::sg::Model
Definition: Model.h:43
rl::sg::Scene::getName
virtual ::std::string getName() const
Definition: Scene.cpp:92
rl::sg::Scene::Iterator
::std::vector< Model * >::iterator Iterator
Definition: Scene.h:47
rl::sg::Scene::end
Iterator end()
Definition: Scene.cpp:80
rl::sg::Scene::~Scene
virtual ~Scene()
Definition: Scene.cpp:63
rl::sg::Scene::begin
Iterator begin()
Definition: Scene.cpp:74
rl::sg::Scene::models
::std::vector< Model * > models
Definition: Scene.h:76
rl::sg::Scene::getNumModels
::std::size_t getNumModels() const
Definition: Scene.cpp:98
rl::sg::Scene::triangleCallback
static void triangleCallback(void *userData, ::SoCallbackAction *action, const ::SoPrimitiveVertex *v1, const ::SoPrimitiveVertex *v2, const ::SoPrimitiveVertex *v3)
Definition: Scene.cpp:332
rl::sg::Scene
Definition: Scene.h:45
rl::sg::Scene::name
::std::string name
Definition: Scene.h:81
rl
Robotics Library.
Definition: AnalogInput.cpp:30