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