0023457: Slow text rendering
[occt.git] / src / OpenGl / OpenGl_AspectText.hxx
CommitLineData
b311480e 1// Created on: 2011-07-13
2// Created by: Sergey ZERCHANINOV
a174a3c5 3// Copyright (c) 2011-2013 OPEN CASCADE SAS
b311480e 4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
2166f0fa
SK
20#ifndef OpenGl_AspectText_Header
21#define OpenGl_AspectText_Header
22
bf75be98 23#include <InterfaceGraphic_Graphic3d.hxx>
eeaaaefb 24#include <Font_FontAspect.hxx>
2166f0fa
SK
25#include <Aspect_TypeOfStyleText.hxx>
26#include <Aspect_TypeOfDisplayText.hxx>
27
a174a3c5 28#include <TCollection_AsciiString.hxx>
29
2166f0fa
SK
30#include <OpenGl_Element.hxx>
31
a174a3c5 32//! Text representation parameters
2166f0fa
SK
33class OpenGl_AspectText : public OpenGl_Element
34{
2166f0fa 35
5e27df78 36public:
37
38 OpenGl_AspectText();
39 virtual ~OpenGl_AspectText();
2166f0fa 40
a174a3c5 41 //! Copy parameters
42 void SetContext (const CALL_DEF_CONTEXTTEXT& theContext);
43
44 //! @return font family name
45 const TCollection_AsciiString& FontName() const
46 {
47 return myFont;
48 }
49
50 //! @return font family name
51 TCollection_AsciiString& ChangeFontName()
52 {
53 return myFont;
54 }
55
56 //! @return is zoomable flag
57 bool IsZoomable() const
58 {
59 return myZoomable;
60 }
61
62 //! @return rotation angle
63 float Angle() const
64 {
65 return myAngle;
66 }
67
68 //! @return font aspect (regular/bold/italic)
69 Font_FontAspect FontAspect() const
70 {
71 return myFontAspect;
72 }
73
74 //! @param theValue font aspect (regular/bold/italic)
75 void SetFontAspect (const Font_FontAspect theValue)
76 {
77 myFontAspect = theValue;
78 }
79
80 //! @return text color
81 const TEL_COLOUR& Color() const
82 {
83 return myColor;
84 }
85
86 //! @return text color
87 TEL_COLOUR& ChangeColor()
88 {
89 return myColor;
90 }
91
92 //! @return annotation style
93 Aspect_TypeOfStyleText StyleType() const
94 {
95 return myStyleType;
96 }
97
98 //! @return subtitle style (none/blend/decale/subtitle)
99 Aspect_TypeOfDisplayText DisplayType() const
100 {
101 return myDisplayType;
102 }
103
104 void SetDisplayType (const Aspect_TypeOfDisplayText theType)
105 {
106 myDisplayType = theType;
107 }
108
109 //! @return subtitle color
110 const TEL_COLOUR& SubtitleColor() const
111 {
112 return mySubtitleColor;
113 }
114
115 //! @return subtitle color
116 TEL_COLOUR& ChangeSubtitleColor()
117 {
118 return mySubtitleColor;
119 }
2166f0fa 120
5e27df78 121 virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
122 virtual void Release (const Handle(OpenGl_Context)& theContext);
2166f0fa 123
5e27df78 124protected:
2166f0fa 125
a174a3c5 126 TCollection_AsciiString myFont;
2166f0fa 127 TEL_COLOUR myColor;
a174a3c5 128 TEL_COLOUR mySubtitleColor;
129 float myAngle;
2166f0fa
SK
130 Aspect_TypeOfStyleText myStyleType;
131 Aspect_TypeOfDisplayText myDisplayType;
a174a3c5 132 Font_FontAspect myFontAspect;
133 bool myZoomable;
2166f0fa 134
5e27df78 135public:
136
1c35b92f 137 DEFINE_STANDARD_ALLOC
5e27df78 138
2166f0fa
SK
139};
140
a174a3c5 141#endif // OpenGl_AspectText_Header