00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <vos/corelibs/vos/vos.hh>
00025 #include "avatar3d.hh"
00026
00027
00028 Avatar3D::Avatar3D(MetaObject* super) : MetaObject(super), Avatar(super) {
00029 }
00030
00031 Avatar3D::~Avatar3D() {
00032 }
00033
00034 void Avatar3D::registerExtenders() {
00035 LocalSite::addLocalObjectExtension(typeid(Avatar3D).name(), &Avatar3D::new_Avatar3D);
00036 LocalSite::addLocalObjectExtension("misc:avatar.3d", &Avatar3D::new_Avatar3D);
00037 RemoteSite::addRemoteObjectExtension(typeid(Avatar3D).name(), &Avatar3D::new_Avatar3D);
00038 RemoteSite::addRemoteObjectExtension("misc:avatar.3d", &Avatar3D::new_Avatar3D);
00039 }
00040
00041 const string Avatar3D::getType() {
00042 return "misc:avatar.3d";
00043 }
00044
00045 MetaObject* Avatar3D::new_Avatar3D(MetaObject* super, const string& type) {
00046 return new Avatar3D(super);
00047 }
00048
00049 void Avatar3D::setPointerPosition(double x, double y, double z, PropertyAccessControl* ac) {
00050 if(!ac)
00051 ac = defaultAccessControl;
00052 vector<double> v(3);
00053 v[0] = x;
00054 v[1] = y;
00055 v[2] = z;
00056 Property::setFloatVectorProperty(*this, "misc:pointer-position", v, ac);
00057 }
00058
00059 void Avatar3D::setNullPointerPosition(PropertyAccessControl* ac) {
00060 if(!ac)
00061 ac = defaultAccessControl;
00062 Property::setProperty(*this, "misc:pointer-position", "", "text/x-vector-float", ac);
00063 }
00064
00065 void Avatar3D::getPointerPosition(double& x, double& y, double& z) {
00066 vector<double> v = Property::getFloatVectorProperty(*this, "misc:pointer-position");
00067 if(v.size() >= 3) {
00068 x = v[0];
00069 y = v[1];
00070 z = v[2];
00071 } else {
00072 throw range_error("misc:pointer-position property has less than 3 elements.");
00073 }
00074 }
00075
00076