00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 #ifndef VRS_TEXT_H_
00137 #define VRS_TEXT_H_
00138
00139 #include <vrs/text/vrs_textprerequisites.h>
00140 #include <vrs/shape.h>
00141 #include <vrs/vector.h>
00142 #include <vrs/color.h>
00143 #include <vrs/text/deprecated/font.h>
00144
00145 #include <string>
00146
00147 namespace VRS {
00148
00153 class VRS_CORE_API Text : public Shape {
00154
00155 public:
00156 enum TextPlane { XY_PLANE, XZ_PLANE, YZ_PLANE };
00157 VRS_SERIALIZABLE_CLASS_ENUM(TextPlane);
00159
00160 enum AlignmentH { LEFT, CENTER_H, RIGHT };
00161 enum AlignmentV { BOTTOM, CENTER_V, TOP };
00162 VRS_SERIALIZABLE_CLASS_ENUM(AlignmentH);
00163 VRS_SERIALIZABLE_CLASS_ENUM(AlignmentV);
00164
00165 Text(
00166 Font* font,
00167 const std::string& text = std::string(),
00168 const Vector& position = Vector(0,0,0),
00169 const Vector& scaling = Vector (1,1,1),
00170 TextPlane textplane = Text::XY_PLANE,
00171 AlignmentH alignmentH = Text::LEFT,
00172 AlignmentV alignmentV = Text::BOTTOM,
00173 double haloedSize = 0.0,
00174 const Color& haloedColor = Color::white,
00175 bool useModulateForTexturing = false
00176 );
00178
00179 #ifdef VRS_HAS_WSTRING
00180 Text(
00181 Font* font,
00182 const std::wstring& text,
00183 const Vector& position = Vector(0,0,0),
00184 const Vector& scaling = Vector (1,1,1),
00185 TextPlane textplane = Text::XY_PLANE,
00186 AlignmentH alignmentH = Text::LEFT,
00187 AlignmentV alignmentV = Text::BOTTOM,
00188 double haloeSize = 0.0,
00189 const Color& haloeColor = Color::white,
00190 bool useModulateForTexturing = false
00191 );
00193 #endif // VRS_HAS_WSTRING
00194
00195 Text(const Text& text);
00196
00197 void setFont(Font* newFont);
00199 Font* getFont() const;
00200
00201 #ifdef VRS_HAS_WSTRING
00202 void setUnicodeText(const std::wstring& newText);
00204 std::wstring getUnicodeText() const;
00206 #else // VRS_HAS_WSTRING
00207 void setUnicodeText(const std::string& newText);
00209 std::string getUnicodeText() const;
00211 #endif // VRS_HAS_WSTRING
00212
00213 void setText(const std::string& newText);
00215 std::string getText() const;
00217
00222 double getLength() const;
00224
00233 double getHeight() const;
00235
00244 Bounds getPixelBoundingBox() const;
00246
00251 void setPosition(const Vector& newPosition);
00253 const Vector& getPosition() const;
00254
00255 void setScaling(const Vector& newScaling);
00261 const Vector& getScaling() const;
00262
00263 void setFixedSize(double inches);
00265
00282 void disableFixedSize();
00284
00285 double getHaloeSize() const;
00287 void setHaloeSize( double haloedSize);
00289
00301 const Color& getHaloeColor() const;
00303 void setHaloeColor(const Color& color);
00305
00306
00307 TextPlane getTextPlane() const;
00309 void setTextPlane(TextPlane textplane);
00311
00312 AlignmentH getAlignmentH() const;
00314
00316 void setAlignmentH(AlignmentH newAlignment);
00318
00321 AlignmentV getAlignmentV() const;
00323
00325 void setAlignmentV(AlignmentV newAlignment);
00327
00330 bool useModulateForTexturing() const;
00331 void setUseModulateForTexturing(bool useModulateForTexturing);
00335 virtual Bounds boundingBox() const;
00336 virtual void modified();
00337
00338 VRS_TYPEINFO(Text, Shape);
00339 VRS_SERIALIZABLE(Text);
00340
00341 protected:
00342 Text();
00344
00345 private:
00346 SO<Font> font_;
00347
00348 #ifdef VRS_HAS_WSTRING
00349 std::wstring text_;
00351 #else // VRS_HAS_WSTRING
00352 std::string text_;
00354 #endif // VRS_HAS_WSTRING
00355
00356 Vector position_;
00358
00359 Vector scaling_;
00361
00362 double inches_;
00363 bool fixedSize_;
00364
00365 int horizontal_;
00366 int vertical_;
00367
00368 double haloeSize_;
00369 Color haloeColor_;
00370 int textplane_;
00371
00372 double length_;
00373 double leftBound_;
00374 double rightBound_;
00375 bool updateLength_;
00376 double height_;
00377 double lowerBound_;
00378 double upperBound_;
00379 bool updateHeight_;
00380 Bounds bbox_;
00381 bool updateBBox_;
00382
00383 bool useModulateForTexturing_;
00384
00385 friend class TextPainterGL;
00386 };
00387
00388 }
00389
00390 #endif // VRS_TEXT_H_