summaryrefslogtreecommitdiff
path: root/src/Graphic3d/Graphic3d_AspectText3d.cxx
blob: 2e86220fd59816a07f3a6a082ca32038e242e2d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242

// File   Graphic3d_AspectText3d.cxx
// Created  Mars 1992
// Author NW,JPB,CAL
//    30/11/98 ; FMN : S3819. Textes always visible.   

//-Copyright  MatraDatavision 1991,1992

//-Version  

//-Design Declaration of variables specific to the context
//    of trace of texts 3d

//-Warning  A context of trace of text is defined by :
//    - the font used
//    - the color
//    - the scale
//    - the space between characters

//-References 

//-Language C++ 2.0

//-Declarations

// for the class
#include <Graphic3d_AspectText3d.ixx>

#include <TCollection_AsciiString.hxx>
#include <OSD_Environment.hxx>

#include <Graphic3d_NameOfFont.hxx>

//-Aliases

//-Global data definitions

//  -- la font utilisee
//  MyFont    : NameOfFont;

//  -- la couleur
//  MyColor   : Color;

//  -- l'echelle
//  MyFactor  : Standard_Real;

//  -- l'espace entre caracteres
//  MySpace   : Standard_Real;

//  -- le style
//  MyStyle   : TypeOfStyleText;

//  -- le display type
//  MyDisplayType : TypeOfDisplayText;

//  -- la couleur du sous-titrage et pour le fond en mode decalage.
//  MyColorSubTitle : Color;

//-Constructors

//-Destructors

//-Methods, in order



Graphic3d_AspectText3d::Graphic3d_AspectText3d ():
MyFont (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) {
  MyTextZoomable = Standard_False;
  MyTextAngle = 0.0;
  MyTextFontAspect = OSD_FA_Regular;
}

Graphic3d_AspectText3d::Graphic3d_AspectText3d (
  const Quantity_Color& AColor, 
  const Standard_CString AFont, 
  const Standard_Real AFactor, 
  const Standard_Real ASpace,
  const Aspect_TypeOfStyleText AStyle,
  const Aspect_TypeOfDisplayText ADisplayType):
MyFont(AFont), MyColor (AColor), MyFactor (AFactor), MySpace (ASpace), MyStyle (AStyle), MyDisplayType(ADisplayType), MyColorSubTitle   (Quantity_NOC_WHITE) {
  MyTextZoomable = Standard_False;
  MyTextAngle = 0.0;
  MyTextFontAspect = OSD_FA_Regular;
  if(MyFont.Length() == 0)
    MyFont.AssignCat(Graphic3d_NOF_ASCII_MONO);

  if (AFactor <= 0.0)
    Graphic3d_AspectTextDefinitionError::Raise
    ("Bad value for TextScaleFactor");

}

void Graphic3d_AspectText3d::SetColor (const Quantity_Color& AColor) {

  MyColor = AColor;

}

void Graphic3d_AspectText3d::SetExpansionFactor (const Standard_Real AFactor) {

  if (AFactor <= 0.0)
    Graphic3d_AspectTextDefinitionError::Raise
    ("Bad value for TextScaleFactor");

  MyFactor = AFactor;

}

void Graphic3d_AspectText3d::SetFont (const Standard_CString AFont) {


  TCollection_AsciiString aTemp("");
  if( !strlen(AFont))
    aTemp.AssignCat(Graphic3d_NOF_ASCII_MONO);
  else
    aTemp.AssignCat(AFont);
  MyFont = aTemp;  
}

void Graphic3d_AspectText3d::SetSpace (const Standard_Real ASpace) {

  MySpace = ASpace;

}

void Graphic3d_AspectText3d::SetStyle(const Aspect_TypeOfStyleText AStyle) {

  MyStyle = AStyle;

}

void Graphic3d_AspectText3d::SetDisplayType(const Aspect_TypeOfDisplayText ADisplayType) {

  MyDisplayType = ADisplayType;

}

void Graphic3d_AspectText3d::SetColorSubTitle (const Quantity_Color& AColor) {

  MyColorSubTitle = AColor;


}


void Graphic3d_AspectText3d::SetTextZoomable(const Standard_Boolean AFlag) 
{

  MyTextZoomable = AFlag;

}

Standard_Boolean Graphic3d_AspectText3d::GetTextZoomable() const
{
  return MyTextZoomable;
}

void Graphic3d_AspectText3d::SetTextAngle(const Standard_Real AAngle) 
{
  MyTextAngle = AAngle;
}

Standard_Real Graphic3d_AspectText3d::GetTextAngle() const
{
  return MyTextAngle;
}

void Graphic3d_AspectText3d::SetTextFontAspect(const OSD_FontAspect AFontAspect) 
{
  MyTextFontAspect = AFontAspect;
}

OSD_FontAspect Graphic3d_AspectText3d::GetTextFontAspect() const
{
  return MyTextFontAspect;
}



void Graphic3d_AspectText3d::Values (Quantity_Color& AColor, Standard_CString& AFont, Standard_Real& AFactor, Standard_Real& ASpace) const {

  AColor    = MyColor;
  AFont     = MyFont.ToCString();
  AFactor   = MyFactor;
  ASpace    = MySpace;

}
void 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 {

  AColor          = MyColor;
  AFont           = MyFont.ToCString();
  AFactor         = MyFactor;
  ASpace          = MySpace;
  AStyle          = MyStyle;
  ADisplayType    = MyDisplayType;
  AColorSubTitle  = MyColorSubTitle;

}
void 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 {

  AColor          = MyColor;
  AFont           = MyFont.ToCString();
  AFactor         = MyFactor;
  ASpace          = MySpace;
  AStyle          = MyStyle;
  ADisplayType    = MyDisplayType;
  AColorSubTitle  = MyColorSubTitle;

  ATextZoomable   = MyTextZoomable;  
  ATextAngle      = MyTextAngle;  

}

void 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,
                                      OSD_FontAspect& ATextFontAspect ) const 
{

  AColor          = MyColor;
  AFont           = MyFont.ToCString();
  AFactor         = MyFactor;
  ASpace          = MySpace;
  AStyle          = MyStyle;
  ADisplayType    = MyDisplayType;
  AColorSubTitle  = MyColorSubTitle;

  ATextZoomable   = MyTextZoomable;  
  ATextAngle      = MyTextAngle;  
  ATextFontAspect = MyTextFontAspect;

}