Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tmpprimitive.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __TMPPRIMITIVE_H
25 #define __TMPPRIMITIVE_H
26 
27 #include "tmpobject.h"
28 #include <ode_robots/osgprimitive.h>
29 
30 namespace lpzrobots {
31 
32  class Primitive;
33  class Joint;
34 
35  /**
36  holding a temporary primitive
37  */
38  class TmpPrimitive : public TmpObject {
39  public:
40  /** creates a new item from the given primitives and initializes it.
41  The lifetime is set when adding it to globalData
42  */
43  TmpPrimitive(Primitive* p, char mode, double mass, const Pose& pose,
44  const Color& color);
45 
46  /// provided for convenience to supply color as name and alpha independently
47  TmpPrimitive(Primitive* p, char mode, double mass, const Pose& pose,
48  const std::string& colorname, float alpha = 1.0);
49 
50  virtual void init(const OdeHandle& odeHandle, const OsgHandle& osgHandle);
51  virtual void deleteObject();
52  virtual void update();
53 
54  private:
55  Primitive* item;
56  char mode;
57  double mass;
58  Pose pose;
59  Color color;
60  std::string colorname;
61  bool useColorName;
62  float alpha;
63  bool initialized;
64  };
65 
66  /**
67  holding a temporary graphical item
68  */
69  class TmpDisplayItem : public TmpObject {
70  public:
71  /** creates a new item from the given primitives and initializes it.
72  The lifetime is set when adding it to globalData
73  */
74  TmpDisplayItem(OSGPrimitive* p, const Pose& pose, const Color& color,
76 
77  /// provided for convenience to supply color as name and alpha independently
78  TmpDisplayItem(OSGPrimitive* p, const Pose& pose,
79  const std::string& colorname, float alpha = 1.0,
81 
82  virtual void init(const OdeHandle& odeHandle, const OsgHandle& osgHandle);
83 
84  virtual void deleteObject();
85  virtual void update() {} // nothing to be done here, because they do not move
86 
87  private:
88  OSGPrimitive* item;
89  Pose pose;
90  Color color;
91  std::string colorname;
92  bool useColorName;
93  float alpha;
94  OSGPrimitive::Quality quality;
95  bool initialized;
96  };
97 
98  /**
99  holding a temporary joint
100  */
101  class TmpJoint : public TmpObject {
102  public:
103  /** creates a new tmporary object from the given joint and initializes it.
104  The lifetime is set when adding it to globalData
105  */
106  TmpJoint(Joint* p, const Color& color, bool withVisual = true, double visualSize = 0.2,
107  bool ignoreColl = true);
108 
109  /// provided for convenience to supply color as name and alpha independently
110  TmpJoint(Joint* p, const std::string& colorname, float alpha = 1.0,
111  bool withVisual = true, double visualSize = 0.2, bool ignoreColl = true);
112 
113  virtual void init(const OdeHandle& odeHandle, const OsgHandle& osgHandle);
114 
115  virtual void deleteObject();
116  virtual void update();
117 
118  private:
119  Joint* joint;
120  Color color;
121  std::string colorname;
122  bool useColorName;
123  float alpha;
124  bool withVisual;
125  double visualSize;
126  bool ignoreColl;
127  bool initialized;
128  };
129 
130 }
131 
132 #endif
virtual void init(const OdeHandle &odeHandle, const OsgHandle &osgHandle)
Definition: tmpprimitive.cpp:132
virtual void update()
update graphics here
Definition: tmpprimitive.cpp:69
Data structure for accessing the ODE.
Definition: odehandle.h:44
TmpJoint(Joint *p, const Color &color, bool withVisual=true, double visualSize=0.2, bool ignoreColl=true)
creates a new tmporary object from the given joint and initializes it.
Definition: tmpprimitive.cpp:113
virtual void update()
update graphics here
Definition: tmpprimitive.h:85
virtual void update()
update graphics here
Definition: tmpprimitive.cpp:148
TmpDisplayItem(OSGPrimitive *p, const Pose &pose, const Color &color, OSGPrimitive::Quality quality=OSGPrimitive::Middle)
creates a new item from the given primitives and initializes it.
Definition: tmpprimitive.cpp:76
virtual void deleteObject()
deletes the object
Definition: tmpprimitive.cpp:143
Interface class for graphic primitives like spheres, boxes, and meshes, which can be drawn by OSG...
Definition: osgprimitive.h:62
holding a temporary primitive
Definition: tmpprimitive.h:38
virtual void init(const OdeHandle &odeHandle, const OsgHandle &osgHandle)
Definition: tmpprimitive.cpp:96
Definition: joint.h:41
virtual void deleteObject()
deletes the object
Definition: tmpprimitive.cpp:64
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
osg::Matrix Pose
Definition: pose.h:35
virtual void init(const OdeHandle &odeHandle, const OsgHandle &osgHandle)
Definition: tmpprimitive.cpp:53
holding a temporary joint
Definition: tmpprimitive.h:101
virtual void deleteObject()
deletes the object
Definition: tmpprimitive.cpp:107
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
this is the base-class for objects that exist temporarily like some indicator of manipulation or a me...
Definition: tmpobject.h:37
Definition: color.h:32
Quality
Definition: osgprimitive.h:64
TmpPrimitive(Primitive *p, char mode, double mass, const Pose &pose, const Color &color)
creates a new item from the given primitives and initializes it.
Definition: tmpprimitive.cpp:34
holding a temporary graphical item
Definition: tmpprimitive.h:69
Definition: osgprimitive.h:64