1 // placement.hxx - manage the placment of a 3D model.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain, and comes with no warranty.
7 #ifndef _SG_PLACEMENT_HXX
8 #define _SG_PLACEMENT_HXX 1
11 # error This library requires C++
14 #include <osg/ref_ptr>
18 #include <simgear/props/props.hxx>
20 #include "placementtrans.hxx"
22 // Don't pull in the headers, since we don't need them here.
26 // Has anyone done anything *really* stupid, like making min and max macros?
35 ////////////////////////////////////////////////////////////////////////
37 ////////////////////////////////////////////////////////////////////////
40 * A wrapper for a model with a definite placement.
42 class SGModelPlacement
47 virtual ~SGModelPlacement ();
49 virtual void init( osg::Node* model );
51 virtual void update();
53 virtual osg::Node* getSceneGraph () { return _selector.get(); }
55 virtual SGLocation * getSGLocation () { return _location; }
57 virtual bool getVisible () const;
58 virtual void setVisible (bool visible);
60 virtual double getLongitudeDeg () const { return _lon_deg; }
61 virtual double getLatitudeDeg () const { return _lat_deg; }
62 virtual double getElevationFt () const { return _elev_ft; }
64 virtual void setLongitudeDeg (double lon_deg);
65 virtual void setLatitudeDeg (double lat_deg);
66 virtual void setElevationFt (double elev_ft);
67 virtual void setPosition (double lon_deg, double lat_deg, double elev_ft);
68 void setPosition(const SGGeod& position);
70 virtual double getRollDeg () const { return _roll_deg; }
71 virtual double getPitchDeg () const { return _pitch_deg; }
72 virtual double getHeadingDeg () const { return _heading_deg; }
74 virtual void setRollDeg (double roll_deg);
75 virtual void setPitchDeg (double pitch_deg);
76 virtual void setHeadingDeg (double heading_deg);
77 virtual void setOrientation (double roll_deg, double pitch_deg,
79 void setOrientation(const SGQuatd& orientation);
81 SGPlacementTransform * getTransform(void)
82 { return _position.get(); }
96 osg::ref_ptr<osg::Switch> _selector;
97 osg::ref_ptr<SGPlacementTransform> _position;
100 SGLocation * _location;
103 #endif // _SG_PLACEMENT_HXX