0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / Graphic3d / Graphic3d_AspectText3d.hxx
1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _Graphic3d_AspectText3d_HeaderFile
17 #define _Graphic3d_AspectText3d_HeaderFile
18
19 #include <Graphic3d_Aspects.hxx>
20
21 //! Creates and updates a group of attributes for text primitives.
22 class Graphic3d_AspectText3d : public Graphic3d_Aspects
23 {
24   DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Graphic3d_Aspects)
25 public:
26
27   //! Creates a context table for text primitives defined with the following default values:
28   //! Color            : Quantity_NOC_YELLOW
29   //! Font             : Font_NOF_ASCII_MONO
30   //! The style        : Aspect_TOST_NORMAL
31   //! The display type : Aspect_TODT_NORMAL
32   Standard_EXPORT Graphic3d_AspectText3d();
33
34   //! Creates a context table for text primitives defined with the specified values.
35   //! @param theColor [in] text color
36   //! @param theFont  [in] font family name or alias like Font_NOF_ASCII_MONO
37   //! @param theExpansionFactor [in] deprecated parameter, has no effect
38   //! @param theSpace [in] deprecated parameter, has no effect
39   //! @param theStyle [in] font style
40   //! @param theDisplayType [in] display mode
41   Standard_EXPORT Graphic3d_AspectText3d (const Quantity_Color& theColor,
42                                           Standard_CString theFont,
43                                           Standard_Real theExpansionFactor,
44                                           Standard_Real theSpace,
45                                           Aspect_TypeOfStyleText theStyle = Aspect_TOST_NORMAL,
46                                           Aspect_TypeOfDisplayText theDisplayType = Aspect_TODT_NORMAL);
47
48   //! Return the text color.
49   const Quantity_Color& Color() const { return myInteriorColor.GetRGB(); }
50
51   //! Return the text color.
52   const Quantity_ColorRGBA& ColorRGBA() const { return myInteriorColor; }
53
54   //! Modifies the color.
55   void SetColor (const Quantity_Color& theColor) { myInteriorColor.SetRGB (theColor); }
56
57   //! Modifies the color.
58   void SetColor (const Quantity_ColorRGBA& theColor) { myInteriorColor = theColor; }
59
60   //! Return the font.
61   const TCollection_AsciiString& Font() const
62   {
63     if (myTextFont.IsNull())
64     {
65       static const TCollection_AsciiString anEmpty;
66       return anEmpty;
67     }
68     return myTextFont->String();
69   }
70
71   //! Modifies the font.
72   void SetFont (const TCollection_AsciiString& theFont)
73   {
74     if (!theFont.IsEmpty())
75     {
76       myTextFont = new TCollection_HAsciiString (theFont);
77     }
78     else
79     {
80       myTextFont.Nullify();
81     }
82   }
83
84   //! Modifies the font.
85   void SetFont (const Standard_CString theFont)
86   {
87     SetFont (TCollection_AsciiString (theFont));
88   }
89
90   //! Return the text style.
91   Aspect_TypeOfStyleText Style() const { return myTextStyle; }
92
93   //! Modifies the style of the text.
94   void SetStyle (Aspect_TypeOfStyleText theStyle) { myTextStyle = theStyle; }
95
96   //! Return display type.
97   Aspect_TypeOfDisplayText DisplayType() const { return myTextDisplayType; }
98
99   //! Define the display type of the text.
100   void SetDisplayType (Aspect_TypeOfDisplayText theDisplayType) { myTextDisplayType = theDisplayType; }
101
102   //! Returns TRUE when the Text Zoomable is on.
103   bool GetTextZoomable() const { return myIsTextZoomable; }
104
105   //! Returns Angle of degree
106   Standard_ShortReal GetTextAngle() const { return myTextAngle; }
107
108   //! Turns usage of text rotated
109   void SetTextAngle (const Standard_Real theAngle) { myTextAngle = (Standard_ShortReal )theAngle; }
110
111   //! Returns text FontAspect
112   Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; }
113
114 };
115
116 DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, Graphic3d_Aspects)
117
118 #endif // _Graphic3d_AspectText3d_HeaderFile