1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Graphic3d_AspectText3d_HeaderFile
17 #define _Graphic3d_AspectText3d_HeaderFile
19 #include <Graphic3d_Aspects.hxx>
21 //! Creates and updates a group of attributes for text primitives.
22 class Graphic3d_AspectText3d : public Graphic3d_Aspects
24 DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectText3d, Graphic3d_Aspects)
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();
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);
48 //! Return the text color.
49 const Quantity_Color& Color() const { return myInteriorColor.GetRGB(); }
51 //! Return the text color.
52 const Quantity_ColorRGBA& ColorRGBA() const { return myInteriorColor; }
54 //! Modifies the color.
55 void SetColor (const Quantity_Color& theColor) { myInteriorColor.SetRGB (theColor); }
57 //! Modifies the color.
58 void SetColor (const Quantity_ColorRGBA& theColor) { myInteriorColor = theColor; }
61 const TCollection_AsciiString& Font() const
63 if (myTextFont.IsNull())
65 static const TCollection_AsciiString anEmpty;
68 return myTextFont->String();
71 //! Modifies the font.
72 void SetFont (const TCollection_AsciiString& theFont)
74 if (!theFont.IsEmpty())
76 myTextFont = new TCollection_HAsciiString (theFont);
84 //! Modifies the font.
85 void SetFont (const Standard_CString theFont)
87 SetFont (TCollection_AsciiString (theFont));
90 //! Return the text style.
91 Aspect_TypeOfStyleText Style() const { return myTextStyle; }
93 //! Modifies the style of the text.
94 void SetStyle (Aspect_TypeOfStyleText theStyle) { myTextStyle = theStyle; }
96 //! Return display type.
97 Aspect_TypeOfDisplayText DisplayType() const { return myTextDisplayType; }
99 //! Define the display type of the text.
100 void SetDisplayType (Aspect_TypeOfDisplayText theDisplayType) { myTextDisplayType = theDisplayType; }
102 //! Returns TRUE when the Text Zoomable is on.
103 bool GetTextZoomable() const { return myIsTextZoomable; }
105 //! Returns Angle of degree
106 Standard_ShortReal GetTextAngle() const { return myTextAngle; }
108 //! Turns usage of text rotated
109 void SetTextAngle (const Standard_Real theAngle) { myTextAngle = (Standard_ShortReal )theAngle; }
111 //! Returns text FontAspect
112 Font_FontAspect GetTextFontAspect() const { return myTextFontAspect; }
116 DEFINE_STANDARD_HANDLE(Graphic3d_AspectText3d, Graphic3d_Aspects)
118 #endif // _Graphic3d_AspectText3d_HeaderFile