0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- manual
[occt.git] / src / Graphic3d / Graphic3d_AspectText3d.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16// 30/11/98 ; FMN : S3819. Textes always visible.
7fd59977 17//-Version
81bba717 18//-Design Declaration of variables specific to the context
19// of trace of texts 3d
81bba717 20//-Warning A context of trace of text is defined by :
21// - the font used
22// - the color
23// - the scale
24// - the space between characters
7fd59977 25//-References
7fd59977 26//-Language C++ 2.0
7fd59977 27//-Declarations
7fd59977 28// for the class
7fd59977 29
aff395a3 30#include <Font_NameOfFont.hxx>
42cf5bc1 31#include <Graphic3d_AspectText3d.hxx>
32#include <Graphic3d_AspectTextDefinitionError.hxx>
33#include <OSD_Environment.hxx>
34#include <Quantity_Color.hxx>
35#include <Standard_Type.hxx>
36#include <TCollection_AsciiString.hxx>
7fd59977 37
38//-Aliases
7fd59977 39//-Global data definitions
7fd59977 40// -- la font utilisee
41// MyFont : NameOfFont;
7fd59977 42// -- la couleur
43// MyColor : Color;
7fd59977 44// -- l'echelle
45// MyFactor : Standard_Real;
7fd59977 46// -- l'espace entre caracteres
47// MySpace : Standard_Real;
7fd59977 48// -- le style
49// MyStyle : TypeOfStyleText;
7fd59977 50// -- le display type
51// MyDisplayType : TypeOfDisplayText;
7fd59977 52// -- la couleur du sous-titrage et pour le fond en mode decalage.
53// MyColorSubTitle : Color;
7fd59977 54//-Constructors
7fd59977 55//-Destructors
7fd59977 56//-Methods, in order
7fd59977 57Graphic3d_AspectText3d::Graphic3d_AspectText3d ():
aff395a3 58MyFont (Font_NOF_ASCII_MONO), MyColor (Quantity_NOC_YELLOW), MyFactor (1.0), MySpace (0.0), MyStyle (Aspect_TOST_NORMAL), MyDisplayType (Aspect_TODT_NORMAL), MyColorSubTitle (Quantity_NOC_WHITE) {
7fd59977 59 MyTextZoomable = Standard_False;
60 MyTextAngle = 0.0;
eeaaaefb 61 MyTextFontAspect = Font_FA_Regular;
7fd59977 62}
63
64Graphic3d_AspectText3d::Graphic3d_AspectText3d (
65 const Quantity_Color& AColor,
66 const Standard_CString AFont,
67 const Standard_Real AFactor,
68 const Standard_Real ASpace,
69 const Aspect_TypeOfStyleText AStyle,
70 const Aspect_TypeOfDisplayText ADisplayType):
71MyFont(AFont), MyColor (AColor), MyFactor (AFactor), MySpace (ASpace), MyStyle (AStyle), MyDisplayType(ADisplayType), MyColorSubTitle (Quantity_NOC_WHITE) {
72 MyTextZoomable = Standard_False;
73 MyTextAngle = 0.0;
eeaaaefb 74 MyTextFontAspect = Font_FA_Regular;
7fd59977 75 if(MyFont.Length() == 0)
aff395a3 76 MyFont.AssignCat(Font_NOF_ASCII_MONO);
7fd59977 77
78 if (AFactor <= 0.0)
79 Graphic3d_AspectTextDefinitionError::Raise
80 ("Bad value for TextScaleFactor");
81
82}
83
84void Graphic3d_AspectText3d::SetColor (const Quantity_Color& AColor) {
85
86 MyColor = AColor;
87
88}
89
90void Graphic3d_AspectText3d::SetExpansionFactor (const Standard_Real AFactor) {
91
92 if (AFactor <= 0.0)
93 Graphic3d_AspectTextDefinitionError::Raise
94 ("Bad value for TextScaleFactor");
95
96 MyFactor = AFactor;
97
98}
99
100void Graphic3d_AspectText3d::SetFont (const Standard_CString AFont) {
101
102
103 TCollection_AsciiString aTemp("");
104 if( !strlen(AFont))
aff395a3 105 aTemp.AssignCat(Font_NOF_ASCII_MONO);
7fd59977 106 else
107 aTemp.AssignCat(AFont);
108 MyFont = aTemp;
109}
110
111void Graphic3d_AspectText3d::SetSpace (const Standard_Real ASpace) {
112
113 MySpace = ASpace;
114
115}
116
117void Graphic3d_AspectText3d::SetStyle(const Aspect_TypeOfStyleText AStyle) {
118
119 MyStyle = AStyle;
120
121}
122
123void Graphic3d_AspectText3d::SetDisplayType(const Aspect_TypeOfDisplayText ADisplayType) {
124
125 MyDisplayType = ADisplayType;
126
127}
128
129void Graphic3d_AspectText3d::SetColorSubTitle (const Quantity_Color& AColor) {
130
131 MyColorSubTitle = AColor;
132
133
134}
135
136
137void Graphic3d_AspectText3d::SetTextZoomable(const Standard_Boolean AFlag)
138{
139
140 MyTextZoomable = AFlag;
141
142}
143
144Standard_Boolean Graphic3d_AspectText3d::GetTextZoomable() const
145{
146 return MyTextZoomable;
147}
148
149void Graphic3d_AspectText3d::SetTextAngle(const Standard_Real AAngle)
150{
151 MyTextAngle = AAngle;
152}
153
154Standard_Real Graphic3d_AspectText3d::GetTextAngle() const
155{
156 return MyTextAngle;
157}
158
eeaaaefb 159void Graphic3d_AspectText3d::SetTextFontAspect(const Font_FontAspect AFontAspect)
7fd59977 160{
161 MyTextFontAspect = AFontAspect;
162}
163
eeaaaefb 164Font_FontAspect Graphic3d_AspectText3d::GetTextFontAspect() const
7fd59977 165{
166 return MyTextFontAspect;
167}
168
169
170
171void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace) const {
172
173 AColor = MyColor;
174 AFont = MyFont.ToCString();
175 AFactor = MyFactor;
176 ASpace = MySpace;
177
178}
179void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle,Aspect_TypeOfDisplayText& ADisplayType,Quantity_Color& AColorSubTitle) const {
180
181 AColor = MyColor;
182 AFont = MyFont.ToCString();
183 AFactor = MyFactor;
184 ASpace = MySpace;
185 AStyle = MyStyle;
186 ADisplayType = MyDisplayType;
187 AColorSubTitle = MyColorSubTitle;
188
189}
190void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace, Aspect_TypeOfStyleText& AStyle,Aspect_TypeOfDisplayText& ADisplayType,Quantity_Color& AColorSubTitle, Standard_Boolean& ATextZoomable,Standard_Real& ATextAngle ) const {
191
192 AColor = MyColor;
193 AFont = MyFont.ToCString();
194 AFactor = MyFactor;
195 ASpace = MySpace;
196 AStyle = MyStyle;
197 ADisplayType = MyDisplayType;
198 AColorSubTitle = MyColorSubTitle;
199
200 ATextZoomable = MyTextZoomable;
201 ATextAngle = MyTextAngle;
202
203}
204
205void Graphic3d_AspectText3d::Values ( Quantity_Color& AColor,
206 Standard_CString& AFont,
207 Standard_Real& AFactor,
208 Standard_Real& ASpace,
209 Aspect_TypeOfStyleText& AStyle,
210 Aspect_TypeOfDisplayText& ADisplayType,
211 Quantity_Color& AColorSubTitle,
212 Standard_Boolean& ATextZoomable,
213 Standard_Real& ATextAngle,
eeaaaefb 214 Font_FontAspect& ATextFontAspect ) const
7fd59977 215{
216
217 AColor = MyColor;
218 AFont = MyFont.ToCString();
219 AFactor = MyFactor;
220 ASpace = MySpace;
221 AStyle = MyStyle;
222 ADisplayType = MyDisplayType;
223 AColorSubTitle = MyColorSubTitle;
224
225 ATextZoomable = MyTextZoomable;
226 ATextAngle = MyTextAngle;
227 ATextFontAspect = MyTextFontAspect;
228
229}
230
30f0ad28 231void Graphic3d_AspectText3d::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram)
232{
233 MyShaderProgram = theProgram;
234}
7fd59977 235
30f0ad28 236const Handle(Graphic3d_ShaderProgram)& Graphic3d_AspectText3d::ShaderProgram() const
237{
238 return MyShaderProgram;
239}