00001
00002
00003
00004
00005
00006
00007 #ifndef _SG_PLACEMENT_HXX
00008 #define _SG_PLACEMENT_HXX 1
00009
00010 #ifndef __cplusplus
00011 # error This library requires C++
00012 #endif
00013
00014 #include <osg/ref_ptr>
00015 #include <osg/Node>
00016 #include <osg/Switch>
00017 #include <osg/PositionAttitudeTransform>
00018
00019 #include <simgear/math/SGMath.hxx>
00020
00021
00022 #ifdef min
00023 #undef min
00024 #endif
00025 #ifdef max
00026 #undef max
00027 #endif
00028
00029
00031
00033
00037 class SGModelPlacement
00038 {
00039 public:
00040
00041 SGModelPlacement ();
00042 virtual ~SGModelPlacement ();
00043
00044 virtual void init( osg::Node* model );
00045
00046 virtual void update();
00047
00048 virtual osg::Node* getSceneGraph () { return _selector.get(); }
00049
00050 virtual bool getVisible () const;
00051 virtual void setVisible (bool visible);
00052
00053 virtual double getLongitudeDeg () const { return _position.getLongitudeDeg(); }
00054 virtual double getLatitudeDeg () const { return _position.getLatitudeDeg(); }
00055 virtual double getElevationFt () const { return _position.getElevationFt(); }
00056
00057 virtual void setLongitudeDeg (double lon_deg);
00058 virtual void setLatitudeDeg (double lat_deg);
00059 virtual void setElevationFt (double elev_ft);
00060 virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
00061 void setPosition(const SGGeod& position);
00062 const SGGeod& getPosition() const { return _position; }
00063
00064 virtual double getRollDeg () const { return _roll_deg; }
00065 virtual double getPitchDeg () const { return _pitch_deg; }
00066 virtual double getHeadingDeg () const { return _heading_deg; }
00067
00068 virtual void setRollDeg (double roll_deg);
00069 virtual void setPitchDeg (double pitch_deg);
00070 virtual void setHeadingDeg (double heading_deg);
00071 virtual void setOrientation (double roll_deg, double pitch_deg,
00072 double heading_deg);
00073 void setOrientation(const SGQuatd& orientation);
00074
00075 void setReferenceTime(const double& referenceTime);
00076 void setBodyLinearVelocity(const SGVec3d& velocity);
00077 void setBodyAngularVelocity(const SGVec3d& velocity);
00078
00079 private:
00080
00081 SGGeod _position;
00082
00083
00084 double _roll_deg;
00085 double _pitch_deg;
00086 double _heading_deg;
00087
00088 osg::ref_ptr<osg::Switch> _selector;
00089 osg::ref_ptr<osg::PositionAttitudeTransform> _transform;
00090 };
00091
00092 #endif // _SG_PLACEMENT_HXX