![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtProjectedTextModelInstance.h,v $ $Revision: 1.10 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtAttachableProjectedTextModelInstance_H_ 00014 #define DtAttachableProjectedTextModelInstance_H_ 00015 00016 #include <vrvOsg/vrvOsg.h> 00017 #include <vrvOsg/DtOsgModelInstance.h> 00018 00019 #include <osg/Group> 00020 #include <osg/Geode> 00021 #include <osg/Geometry> 00022 #include <osg/Switch> 00023 #include <osgText/Text> 00024 00025 namespace makVrv 00026 { 00027 class DtDe; 00028 class DtChannel; 00029 00033 class DT_DLL_VRVOSG DtProjectedTextModelInstance 00034 : public DtOsgModelInstance 00035 { 00036 public: 00038 DtProjectedTextModelInstance(DtDe& de, const std::string& uniqueName); 00039 00041 ~DtProjectedTextModelInstance(); 00042 00045 virtual void addToConnector( DtOsgSceneConnector* connector ); 00046 00049 virtual bool removeFromConnector( DtOsgSceneConnector* connector ); 00050 00051 virtual void setColor( const osg::Vec4& color ); 00052 virtual void setFontName( const std::string& fontName ); 00053 virtual void setFontSize( double size ); 00054 virtual void setText( const std::string& text ); 00055 00056 virtual void setPosition( int vtx, const DtVector& position ); 00057 00059 virtual void setVisible(bool visible) {} 00060 00061 protected: 00062 00063 DtChannel* findChannelWithLocation( const osg::Vec3d& location ) const; 00064 bool locationInChannel( DtChannel* channel, const osg::Vec3d& location ) const; 00065 void getChannelDimensions( DtChannel* channel, double& startX, double& startY, 00066 double& endX, double& endY ) const; 00067 00068 protected: 00069 00070 osg::ref_ptr<osgText::Text> myTextDrawable; 00071 osg::ref_ptr<osg::Geode> myTextGeode; 00072 00073 std::string myFontName; 00074 osg::Vec4 myColor; 00075 double mySize; 00076 00077 std::string myUniqueName; 00078 }; 00079 } 00080 00081 #endif 00082