00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot de> * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 ***************************************************************************/ 00024 #ifndef __ABSTRACTGROUND_H 00025 #define __ABSTRACTGROUND_H 00026 00027 #include <list> 00028 #include "abstractobstacle.h" 00029 #include <selforg/position.h> 00030 00031 namespace lpzrobots { 00032 00033 class Primitive; 00034 00035 // abstract class for any playground 00036 class AbstractGround : public AbstractObstacle { 00037 00038 public: 00039 00040 AbstractGround(const OdeHandle& odeHandle, const OsgHandle& osgHandle, 00041 bool createGround, double groundLength, double groundWidth, double wallThickness); 00042 00043 virtual ~AbstractGround(); 00044 00045 00046 virtual void setPose(const osg::Matrix& pose); 00047 00048 virtual void createGround(bool create); 00049 00050 virtual Primitive* getMainPrimitive() const; 00051 00052 virtual void changeGeometry(double length, double width, double height, double factorxy); 00053 00054 /// prints the contour of the boxes into the file 00055 virtual void printContours(FILE* f); 00056 00057 /** 00058 * assigns the texture to the object 00059 */ 00060 virtual void setGroundTexture(const std::string& filename); 00061 00062 /** 00063 * sets the ground color 00064 * should be called before setPosition() 00065 * @param color values in RGBA 00066 */ 00067 virtual void setGroundColor(const Color& color); 00068 00069 /** 00070 * sets the substance of the ground. 00071 * @param substance description of the substance 00072 */ 00073 virtual void setGroundSubstance(const Substance& substance); 00074 00075 00076 /** 00077 * returns the corner points of the groundplane 00078 * @return list of the cornerpoints 00079 */ 00080 virtual std::list<Position> getCornerPointsXY(); 00081 00082 /// size in x dimension 00083 virtual double getGroundLength(){ return groundLength; } 00084 /// size in y dimension 00085 virtual double getGroundWidth(){ return groundWidth; } 00086 00087 virtual double getGroundThickness(){ return groundThickness; } 00088 00089 virtual void setGroundThickness(double thickness); 00090 00091 protected: 00092 00093 Primitive* groundPlane; // the groundplane 00094 bool creategroundPlane; 00095 double groundLength; 00096 double groundWidth; 00097 double wallThickness; 00098 double groundThickness; 00099 Substance groundSubstance; 00100 std::string wallTextureFileName; 00101 Color groundColor; 00102 std::string groundTextureFileName; 00103 00104 virtual void createGround(); 00105 00106 }; 00107 00108 } 00109 00110 #endif