Text.h

Go to the documentation of this file.
00001 
00002 //    Copyright 2004, SenseGraphics AB
00003 //
00004 //    This file is part of H3D API.
00005 //
00006 //    H3D API is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    H3D API is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with H3D API; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 //    A commercial license is also available. Please contact us at 
00021 //    www.sensegraphics.com for more information.
00022 //
00023 //
00027 //
00029 #ifndef __TEXT_H__
00030 #define __TEXT_H__
00031 
00032 #include "X3DGeometryNode.h"
00033 #include "X3DFontStyleNode.h"
00034 #include "MFFloat.h"
00035 #include "SFFloat.h"
00036 #include "MFString.h"
00037 
00038 namespace H3D {
00039 
00082   class H3DAPI_API Text : public X3DGeometryNode {
00083   protected:
00084     typedef TypedSFNode< X3DFontStyleNode > SFFontStyleNode;
00085 
00093     class H3DAPI_API SFBound: 
00094       public TypedField< X3DGeometryNode::SFBound,
00095       Types< SFFontStyleNode, MFFloat, SFFloat, MFString > >{
00096         protected:
00098       virtual void update();
00099     }; 
00100 
00108     class H3DAPI_API DisplayList : public X3DGeometryNode::DisplayList {
00111       virtual void callList( bool build_list );
00112     };
00113 
00114   public:
00115     
00117     Text( Inst< SFNode          > _metadata    = 0,
00118           Inst< SFBound         > _bound       = 0,
00119           Inst< DisplayList     > _displayList = 0,
00120           Inst< SFFontStyleNode > _fontStyle   = 0,
00121           Inst< MFFloat         > _length      = 0,
00122           Inst< SFFloat         > _maxExtent   = 0,
00123           Inst< MFString        > _string      = 0,
00124           Inst< SFBool          > _solid       = 0 );
00125 
00127     virtual void render();
00128 
00129 #ifdef USE_HAPTICS
00132     virtual void traverseSG( TraverseInfo &ti ); 
00133 #endif
00134 
00140     auto_ptr< SFFontStyleNode   >  fontStyle;
00141     
00157     auto_ptr< MFFloat  >  length;
00158 
00173     auto_ptr< SFFloat  >  maxExtent;
00174 
00180     auto_ptr< MFString >  stringF;
00181 
00189     auto_ptr< SFBool   >  solid;
00190 
00192     static H3DNodeDatabase database;
00193   protected:
00198     virtual void scaleToMaxExtent( const vector< string >&text, 
00199                                    X3DFontStyleNode *font );
00200     
00203     virtual void justifyMinor( const vector< string > &text,
00204                                X3DFontStyleNode *font );
00205 
00210     virtual void moveToNewLine( const string &text, X3DFontStyleNode *font );
00211 
00214     virtual void renderTextLine( const string& text,
00215                                  X3DFontStyleNode *font );
00216     
00219     virtual void justifyLine( const string& text,
00220                               X3DFontStyleNode *font );
00221   };
00222 }
00223 
00224 #endif

Generated on Thu Aug 24 12:38:34 2006 for H3D API by  doxygen 1.4.5