21 #ifndef _OF_REFERENCEFRAME_ 22 #define _OF_REFERENCEFRAME_ 29 #include <osg/LightSource> 30 #include <osgText/Text> 31 #include <osg/Referenced> 32 #include <osg/ref_ptr> 58 typedef std::vector<osg::ref_ptr<ReferenceFrame> >
ChildList;
101 ReferenceFrame(
const std::string &name ,
float r,
float g,
float b,
float a = 1.0 );
108 void setName(
const std::string &name );
115 inline const std::string& getName()
const {
return _name; }
124 virtual void setColor(
const osg::Vec4 &color );
136 virtual void setColor(
float r,
float g,
float b,
float a = 1.0 );
145 virtual const osg::Vec4& getColor()
const;
157 virtual void getColor(
float &r,
float &g,
float &b,
float &a )
const;
164 inline FrameTransform* getTransform()
const {
return _xform.get();}
176 virtual osg::Group* getGroup()
const;
187 inline void setPosition(
const double &x,
const double &y,
const double &z )
188 { _xform->setPosition(x, y, z); }
190 inline void setPosition(
const osg::Vec3d &pos )
191 { _xform->setPosition(pos); }
200 inline void getPosition(
double &x,
double &y,
double &z )
const 201 { _xform->getPosition(x, y, z); }
203 inline void getPosition( osg::Vec3d &pos )
const 204 { _xform->getPosition(pos); }
216 inline void setAttitude(
const double &rx,
const double &ry,
const double &rz,
const double &angle )
217 { _xform->setAttitude(rx, ry, rz, angle); }
219 inline void setAttitude(
const osg::Quat &att )
220 { _xform->setAttitude(att); }
230 inline void getAttitude(
double &rx,
double &ry,
double &rz,
double &angle)
const 232 _xform->getAttitude(rx, ry, rz, angle);
235 inline void getAttitude( osg::Quat &att )
const 236 { _xform->getAttitude(att); }
245 virtual const osg::BoundingSphere& getBound()
const;
262 virtual void showAxes(
unsigned int axes);
269 virtual void showAxesLabels(
unsigned int labels);
276 virtual void showNameLabel(
bool namelabel);
280 virtual void showContents(
bool showContents) {}
281 virtual bool getContentsShown()
const {
return true; }
292 void moveXAxis(osg::Vec3d base,
double len,
double headRatio = 0.3,
double bodyRadius = 0.0,
double headRadius = 0.0)
const;
303 void moveYAxis(osg::Vec3d base,
double len,
double headRatio = 0.3,
double bodyRadius = 0.0,
double headRadius = 0.0)
const;
314 void moveZAxis(osg::Vec3d base,
double len,
double headRatio = 0.3,
double bodyRadius = 0.0,
double headRadius = 0.0)
const;
323 inline void setXLabel(
const std::string &str) { _xLabel->setText(str); }
332 inline void setYLabel(
const std::string &str) { _yLabel->setText(str); }
341 inline void setZLabel(
const std::string &str) { _zLabel->setText(str); }
352 bool addChild(ReferenceFrame* frame);
363 bool removeChild( ReferenceFrame* frame );
372 void setLightSourceEnabled(
bool enable);
377 bool getLightSourceEnabled()
const;
384 osg::LightSource* getLightSource()
const;
391 inline int getNumChildren() {
return _children.size(); }
400 inline ReferenceFrame* getChild(
int i ) {
return _children[i].get(); }
408 void createFrameString( std::string& str, std::string prefix =
" " )
const;
416 virtual std::string frameInfo()
const;
425 void addParent( ReferenceFrame* frame );
432 void removeParent( ReferenceFrame* frame );
439 inline int getNumParents()
const {
return _parents.size(); }
448 inline ReferenceFrame* getParent(
int i ) {
return _parents[i]; }
455 void addTracker( FrameTracker* t );
462 void removeTracker( FrameTracker* t );
469 inline int getNumTrackers()
const {
return _trackers.size(); }
478 inline FrameTracker* getTracker(
int i ) {
return _trackers[i]; }
488 int getChildIndex(
const ReferenceFrame* frame )
const;
498 int getParentIndex(
const ReferenceFrame* frame )
const;
508 int getTrackerIndex(
const FrameTracker* t )
const;
511 virtual ~ReferenceFrame();
529 void _init(
const std::string &n,
const osg::Vec4& c );
538 #endif // !define _OF_REFERENCEFRAME_ osg::ref_ptr< osg::Geode > _axes
x,y,z axes together
Definition: ReferenceFrame.hpp:521
osg::BoundingSphere _bound
Frame's bounding sphere.
Definition: ReferenceFrame.hpp:524
osg::ref_ptr< osgText::Text > _zLabel
Z-Axes label.
Definition: ReferenceFrame.hpp:519
AxesType
Definition: ReferenceFrame.hpp:247
osg::ref_ptr< osgText::Text > _xLabel
X-Axes label.
Definition: ReferenceFrame.hpp:517
Definition: CoordinateAxes.hpp:29
std::vector< ReferenceFrame * > ParentList
Definition: ReferenceFrame.hpp:57
osg::ref_ptr< Vector > _xAxis
Vector of frame's x-axis.
Definition: ReferenceFrame.hpp:514
osg::ref_ptr< osgText::Text > _nameLabel
Name of reference frame that is displayed.
Definition: ReferenceFrame.hpp:520
std::vector< FrameTracker * > TrackerList
Definition: ReferenceFrame.hpp:59
std::vector< osg::ref_ptr< ReferenceFrame > > ChildList
Definition: ReferenceFrame.hpp:58
Definition: ReferenceFrame.hpp:54
osg::ref_ptr< osg::Geode > _labels
axes and name labels
Definition: ReferenceFrame.hpp:522
osg::ref_ptr< osgText::Text > _yLabel
Y-Axes label.
Definition: ReferenceFrame.hpp:518
std::string _name
Name of reference frame.
Definition: ReferenceFrame.hpp:513
osg::ref_ptr< Vector > _zAxis
Vector of frame's z-axis.
Definition: ReferenceFrame.hpp:516
osg::ref_ptr< FrameTransform > _xform
The transform that all contained objects will undergo.
Definition: ReferenceFrame.hpp:526
osg::ref_ptr< Vector > _yAxis
Vector of frame's y-axis.
Definition: ReferenceFrame.hpp:515