| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 00018 00019 #ifndef __FONTLodTEXT_H__ 00020 #define __FONTLodTEXT_H__ 00021 00022 #include <vrs/container/array.h> 00023 #include <vrs/shape.h> 00024 00025 #include <vrs/text/vrs_textprerequisites.h> 00026 #include <vrs/text/basetext.h> 00027 #include <vrs/text/fontdefinition.h> 00028 00030 namespace VRS 00031 { 00032 namespace TEXT 00033 { 00034 typedef Array< SO<FontDefinition> > LodFontDefintions; 00035 typedef Array< float > LodDistances; 00036 00042 class VRS_CORE_API FontLodText : public AbstractText 00043 { 00044 public: 00046 enum LodMode { LM_NONE, LM_FIRST, LM_LAST, LM_DISTANCE, LM_SIZE }; 00047 VRS_SERIALIZABLE_CLASS_ENUM(LodMode); 00048 00053 FontLodText( SO<AbstractText> at ); 00055 virtual ~FontLodText(); 00056 00057 00058 //------- The abstract Text 00059 00061 virtual void setAbstractText( SO<AbstractText> at ); 00063 virtual SO<AbstractText> getAbstractText( ) const; 00064 00065 //------- The Lod FontDefinitions 00066 00068 virtual void setLodMode( FontLodText::LodMode ); 00070 virtual FontLodText::LodMode getLodMode( ) const; 00071 00072 00073 //------- The Lod FontDefinitions 00074 00078 virtual SO<FontDefinition> getLodFontDefinition( unsigned int lodLevel ) const; 00080 virtual unsigned int getNumLodLevels() const; 00082 virtual unsigned int getLodLevelByDistance( float distance ) const; 00086 virtual unsigned int getLodLevelBySize( float size ) const; 00095 virtual void addLodLevel( SO<FontDefinition> fd, float lodstart=-1.0 ); 00098 virtual void removeLodLevel( unsigned int level ); 00101 virtual void clearLodLevels( ); 00102 00103 00104 00105 //------- The text-contents 00106 00107 #ifdef VRS_HAS_WSTRING // Has Unicode support 00108 00109 virtual const std::wstring& getText() const; 00111 virtual void setText(const std::wstring& str); 00112 #else // Has no Unicode support 00113 00114 virtual const std::string& getText() const; 00115 #endif 00117 virtual void setText(const std::string& str); 00118 00119 00120 //------- FontDefinition 00121 00123 virtual SO<FontDefinition> getFontDefinition( ) const; 00125 virtual void setFontDefinition( SO<FontDefinition> ); 00126 00127 //------- Alignment and AbstractText::Direction 00128 00132 virtual AbstractText::HorizontalAlignment getHorizontalAlignment() const; 00136 virtual void setHorizontalAlignment(AbstractText::HorizontalAlignment tva); 00140 virtual AbstractText::VerticalAlignment getVerticalAlignment() const; 00144 virtual void setVerticalAlignment(AbstractText::VerticalAlignment tva); 00148 virtual AbstractText::HorizontalDirection getHorizontalDirection() const; 00152 virtual void setHorizontalDirection(AbstractText::HorizontalDirection thd); 00156 virtual AbstractText::VerticalDirection getVerticalDirection() const; 00160 virtual void setVerticalDirection(AbstractText::VerticalDirection thd); 00164 virtual AbstractText::Direction getDirection() const; 00168 virtual void setDirection(AbstractText::Direction td); 00169 00181 virtual void setAlignmentBounds( float rightBorder, float bottomBorder ); 00185 virtual void setRightAlignmentBound(float rightBorder); 00189 virtual void setBottomAlignmentBound(float bottomBorder); 00193 virtual float getRightAlignmentBound() const; 00197 virtual float getBottomAlignmentBound() const; 00198 00199 00200 //------- Line Spacing 00201 00205 virtual float getLineSpacing() const; 00209 virtual void setLineSpacing(float LineSpacing); 00210 00211 00212 //------- Text Color 00213 00215 virtual void setColor( const Color& color, bool use = true ); 00217 virtual Color getColor() const; 00219 virtual bool useColor() const; 00220 00221 //------- Text Offset, Scaling and Axis 00222 00224 virtual Matrix getMatrix() const; 00226 virtual void setMatrix( const Matrix& m ); 00227 00228 00229 //------- Shape rendering 00230 00232 virtual Bounds boundingBox() const; 00234 virtual Bounds getLocalBounds() const; 00235 00236 VRS_TYPEINFO(FontLodText, Shape); 00237 VRS_SERIALIZABLE(FontLodText); 00238 private: 00240 FontLodText( ); 00241 00243 SO<AbstractText> m_AbstractText; 00244 00246 LodMode m_LodMode; 00247 00249 SO<LodFontDefintions> m_LodFontDefintions; 00251 SO<LodDistances> m_LodDistances; 00252 }; 00253 } 00254 } 00255 00256 #endif