42cf5bc1 |
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 | |
bf5f0ca2 |
19 | #include <Graphic3d_Aspects.hxx> |
42cf5bc1 |
20 | |
bf5f0ca2 |
21 | //! Creates and updates a group of attributes for text primitives. |
22 | class Graphic3d_AspectText3d : public Graphic3d_Aspects |
42cf5bc1 |
23 | { |
bf5f0ca2 |
24 | DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Graphic3d_Aspects) |
42cf5bc1 |
25 | public: |
26 | |
bf5f0ca2 |
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 |
42cf5bc1 |
32 | Standard_EXPORT Graphic3d_AspectText3d(); |
b6472664 |
33 | |
bf5f0ca2 |
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); |
b6472664 |
47 | |
48 | //! Return the text color. |
bf5f0ca2 |
49 | const Quantity_Color& Color() const { return myInteriorColor.GetRGB(); } |
b6472664 |
50 | |
51 | //! Return the text color. |
bf5f0ca2 |
52 | const Quantity_ColorRGBA& ColorRGBA() const { return myInteriorColor; } |
b6472664 |
53 | |
54 | //! Modifies the color. |
bf5f0ca2 |
55 | void SetColor (const Quantity_Color& theColor) { myInteriorColor.SetRGB (theColor); } |
b6472664 |
56 | |
85719f0e |
57 | //! Modifies the color. |
bf5f0ca2 |
58 | void SetColor (const Quantity_ColorRGBA& theColor) { myInteriorColor = theColor; } |
85719f0e |
59 | |
bf5f0ca2 |
60 | //! Return the font. |
61 | const TCollection_AsciiString& Font() const |
b6472664 |
62 | { |
bf5f0ca2 |
63 | if (myTextFont.IsNull()) |
b6472664 |
64 | { |
bf5f0ca2 |
65 | static const TCollection_AsciiString anEmpty; |
66 | return anEmpty; |
b6472664 |
67 | } |
bf5f0ca2 |
68 | return myTextFont->String(); |
b6472664 |
69 | } |
70 | |
b6472664 |
71 | //! Modifies the font. |
72 | void SetFont (const TCollection_AsciiString& theFont) |
73 | { |
bf5f0ca2 |
74 | if (!theFont.IsEmpty()) |
75 | { |
76 | myTextFont = new TCollection_HAsciiString (theFont); |
77 | } |
78 | else |
79 | { |
80 | myTextFont.Nullify(); |
81 | } |
b6472664 |
82 | } |
83 | |
84 | //! Modifies the font. |
85 | void SetFont (const Standard_CString theFont) |
86 | { |
87 | SetFont (TCollection_AsciiString (theFont)); |
88 | } |
89 | |
b6472664 |
90 | //! Return the text style. |
bf5f0ca2 |
91 | Aspect_TypeOfStyleText Style() const { return myTextStyle; } |
b6472664 |
92 | |
42cf5bc1 |
93 | //! Modifies the style of the text. |
bf5f0ca2 |
94 | void SetStyle (Aspect_TypeOfStyleText theStyle) { myTextStyle = theStyle; } |
b6472664 |
95 | |
96 | //! Return display type. |
bf5f0ca2 |
97 | Aspect_TypeOfDisplayText DisplayType() const { return myTextDisplayType; } |
b6472664 |
98 | |
42cf5bc1 |
99 | //! Define the display type of the text. |
bf5f0ca2 |
100 | void SetDisplayType (Aspect_TypeOfDisplayText theDisplayType) { myTextDisplayType = theDisplayType; } |
85719f0e |
101 | |
b6472664 |
102 | //! Returns TRUE when the Text Zoomable is on. |
bf5f0ca2 |
103 | bool GetTextZoomable() const { return myIsTextZoomable; } |
42cf5bc1 |
104 | |
b6472664 |
105 | //! Returns Angle of degree |
bf5f0ca2 |
106 | Standard_ShortReal GetTextAngle() const { return myTextAngle; } |
42cf5bc1 |
107 | |
b6472664 |
108 | //! Turns usage of text rotated |
bf5f0ca2 |
109 | void SetTextAngle (const Standard_Real theAngle) { myTextAngle = (Standard_ShortReal )theAngle; } |
42cf5bc1 |
110 | |
b6472664 |
111 | //! Returns text FontAspect |
112 | Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; } |
42cf5bc1 |
113 | |
b6472664 |
114 | }; |
42cf5bc1 |
115 | |
bf5f0ca2 |
116 | DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, Graphic3d_Aspects) |
42cf5bc1 |
117 | |
118 | #endif // _Graphic3d_AspectText3d_HeaderFile |