00001 /* 00002 Copyright (C) 2001, 2002 Peter Amstutz 00003 Copyright (C) 2002 Reed Hedges 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 */ 00020 00021 #ifndef _VIEWPOINT_HH_ 00022 #define _VIEWPOINT_HH_ 00023 00024 #if defined(_WIN32) && defined(_MSC_VER) 00025 # ifdef A3DL_EXPORTS 00026 # define A3DL_API __declspec(dllexport) 00027 # else 00028 # define A3DL_API __declspec(dllimport) 00029 # endif 00030 #else 00031 # define A3DL_API 00032 #endif 00033 00034 #include <vos/corelibs/vos/vos.hh> 00035 #include <vos/metaobjects/property/property.hh> 00036 00037 namespace A3DL 00038 { 00039 class A3DL_API Viewpoint : public virtual MetaObject 00040 { 00041 protected: 00042 PropertyAccessControl* propac; 00043 public: 00044 Viewpoint(MetaObject* superobject); 00045 virtual ~Viewpoint(); 00046 00047 void setPropertyAccessControl(PropertyAccessControl* pac); 00048 00049 PropertyAccessControl* getPropertyAccessControl(); 00050 00051 /** Set position of this viewpoint. 00052 @param x X translation, relative to origin of parent object 00053 @param y Y translation, relative to origin of parent object 00054 @param z Z translation, relative to origin of parent object 00055 @throws NoSuchObjectError if "position" subobject does not exist, or is not a property. 00056 */ 00057 virtual void setPosition(double x, double y, double z) throw(NoSuchObjectError); 00058 00059 /** Get position of this viewpoint. 00060 @param x X translation, relative to origin of parent object 00061 @param y Y translation, relative to origin of parent object 00062 @param z Z translation, relative to origin of parent object 00063 @throws NoSuchObjectError if "position" subobject does not exist, or is not a property. 00064 */ 00065 virtual void getPosition(double& x, double& y, double& z) throw(NoSuchObjectError); 00066 00067 00068 /** The orientation of this viewpoint in angle-axis 00069 representation. See A3DL::Object3D::setOrientation() for 00070 details */ 00071 virtual void setOrientation(double x, double y, double z, double r) throw(NoSuchObjectError); 00072 00073 00074 /** The orientation of this viewpoint in angle-axis 00075 representation. See A3DL::Object3D::getOrientation() for 00076 details */ 00077 virtual void getOrientation(double& x, double& y, double& z, double& r) throw(NoSuchObjectError); 00078 00079 /** Set viewpoint field of view. 00080 @param angle View angle in radians. PI > angle > 0 00081 @throws NoSuchObjectError if "viewpoint:fov" subobject does not exist, or is not a property. 00082 */ 00083 virtual void setFOV(double angle) throw(NoSuchObjectError); 00084 00085 /** Get viewpoint field of view. 00086 @return the viewpoint field of view 00087 @throws NoSuchObjectError if "viewpoint:fov" subobject does not exist, or is not a property. 00088 */ 00089 virtual double getFOV() throw(NoSuchObjectError); 00090 00091 /** Set the viewpoint's title. 00092 @param text Title in plain text. 00093 */ 00094 virtual void setTitle(const string& text) throw(NoSuchObjectError); 00095 00096 /** Get the viewpoint's title. */ 00097 virtual string getTitle() throw(NoSuchObjectError); 00098 00099 00100 /** Initialize subproperties: 00101 * position=(0,0,0), orientaiont=(0,0,0), viewpoint:fov and viewpoint:title 00102 * are unset. 00103 * @param access Access control object for subproperties. Default is 00104 * none. 00105 * @warning sets <i>No</i> access control by default! 00106 */ 00107 virtual void initialize(PropertyAccessControl* access) throw(NoSuchObjectError); 00108 00109 virtual void initialize() { 00110 initialize(NULL); 00111 } 00112 00113 virtual const string getType(); 00114 static void registerExtenders(); 00115 static MetaObject* new_Viewpoint(MetaObject* superobject, const string& type); 00116 }; 00117 } 00118 00119 #endif