0022149: Strings with Japanese characters can not be displayed in 3D viewer
[occt.git] / src / Graphic3d / Graphic3d_Group_10.cxx
1 // File:      Graphic3d_Group_10.cxx (Text)
2 // Created:   Fevrier 1992
3 // Author:    NW,JPB,CAL
4 // Copyright: OPEN CASCADE 1992
5
6 //-Version      
7
8 //-Design       Declaration des variables specifiques aux groupes
9 //              de primitives
10
11 //-Warning      Un groupe est defini dans une structure
12 //              Il s'agit de la plus petite entite editable
13
14 //-References   
15
16 //-Language     C++ 2.0
17
18 //-Declarations
19
20 // for the class
21 #include <Graphic3d_Group.jxx>
22 #include <Graphic3d_Group.pxx>
23
24 #include <TCollection_AsciiString.hxx>
25
26 //-Methods, in order
27
28 void Graphic3d_Group::Text (
29                        const Standard_CString AText,
30                        const Graphic3d_Vertex& APoint,
31                        const Standard_Real AHeight,
32                        const Quantity_PlaneAngle AAngle,
33                        const Graphic3d_TextPath ATp,
34                        const Graphic3d_HorizontalTextAlignment AHta,
35                        const Graphic3d_VerticalTextAlignment AVta,
36                        const Standard_Boolean EvalMinMax
37                       )
38 {
39   if (IsDeleted ()) return;
40
41   MyIsEmpty = Standard_False;
42
43   // Min-Max Update
44   if (EvalMinMax) {
45     Standard_Real X, Y, Z;
46     APoint.Coord (X, Y, Z);
47     if (X < MyBounds.XMin) MyBounds.XMin        = Standard_ShortReal (X);
48     if (Y < MyBounds.YMin) MyBounds.YMin        = Standard_ShortReal (Y);
49     if (Z < MyBounds.ZMin) MyBounds.ZMin        = Standard_ShortReal (Z);
50     if (X > MyBounds.XMax) MyBounds.XMax        = Standard_ShortReal (X);
51     if (Y > MyBounds.YMax) MyBounds.YMax        = Standard_ShortReal (Y);
52     if (Z > MyBounds.ZMax) MyBounds.ZMax        = Standard_ShortReal (Z);
53   }
54
55   MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
56
57   Update ();
58 }
59
60 void Graphic3d_Group::Text (
61                        const Standard_CString AText, 
62                        const Graphic3d_Vertex& APoint, 
63                        const Standard_Real AHeight, 
64                        const Standard_Boolean EvalMinMax
65                       )
66 {
67   if (IsDeleted ()) return;
68
69   MyIsEmpty = Standard_False;
70
71   // Min-Max Update
72   if (EvalMinMax) {
73     Standard_Real X, Y, Z;
74     APoint.Coord (X, Y, Z);
75     if (X < MyBounds.XMin) MyBounds.XMin        = Standard_ShortReal (X);
76     if (Y < MyBounds.YMin) MyBounds.YMin        = Standard_ShortReal (Y);
77     if (Z < MyBounds.ZMin) MyBounds.ZMin        = Standard_ShortReal (Z);
78     if (X > MyBounds.XMax) MyBounds.XMax        = Standard_ShortReal (X);
79     if (Y > MyBounds.YMax) MyBounds.YMax        = Standard_ShortReal (Y);
80     if (Z > MyBounds.ZMax) MyBounds.ZMax        = Standard_ShortReal (Z);
81   }
82
83   MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
84
85   Update ();
86 }
87
88 void Graphic3d_Group::Text (
89                        const TCollection_ExtendedString& AText, 
90                        const Graphic3d_Vertex& APoint, 
91                        const Standard_Real AHeight, 
92                        const Quantity_PlaneAngle AAngle, 
93                        const Graphic3d_TextPath ATp, 
94                        const Graphic3d_HorizontalTextAlignment AHta, 
95                        const Graphic3d_VerticalTextAlignment AVta, 
96                        const Standard_Boolean EvalMinMax
97                       )
98 {
99   if (IsDeleted ()) return;
100
101   MyIsEmpty     = Standard_False;
102
103   // Min-Max Update
104   if (EvalMinMax) {
105     Standard_Real X, Y, Z;
106     APoint.Coord (X, Y, Z);
107     if (X < MyBounds.XMin) MyBounds.XMin        = Standard_ShortReal (X);
108     if (Y < MyBounds.YMin) MyBounds.YMin        = Standard_ShortReal (Y);
109     if (Z < MyBounds.ZMin) MyBounds.ZMin        = Standard_ShortReal (Z);
110     if (X > MyBounds.XMax) MyBounds.XMax        = Standard_ShortReal (X);
111     if (Y > MyBounds.YMax) MyBounds.YMax        = Standard_ShortReal (Y);
112     if (Z > MyBounds.ZMax) MyBounds.ZMax        = Standard_ShortReal (Z);
113   }
114
115   MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
116
117   Update ();
118 }
119
120 void Graphic3d_Group::Text (
121                        const TCollection_ExtendedString& AText, 
122                        const Graphic3d_Vertex& APoint, 
123                        const Standard_Real AHeight, 
124                        const Standard_Boolean EvalMinMax
125                       )
126 {
127   if (IsDeleted ()) return;
128
129   MyIsEmpty = Standard_False;
130
131   // Min-Max Update
132   if (EvalMinMax) {
133     Standard_Real X, Y, Z;
134     APoint.Coord (X, Y, Z);
135     if (X < MyBounds.XMin) MyBounds.XMin        = Standard_ShortReal (X);
136     if (Y < MyBounds.YMin) MyBounds.YMin        = Standard_ShortReal (Y);
137     if (Z < MyBounds.ZMin) MyBounds.ZMin        = Standard_ShortReal (Z);
138     if (X > MyBounds.XMax) MyBounds.XMax        = Standard_ShortReal (X);
139     if (Y > MyBounds.YMax) MyBounds.YMax        = Standard_ShortReal (Y);
140     if (Z > MyBounds.ZMax) MyBounds.ZMax        = Standard_ShortReal (Z);
141   }
142
143   MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
144
145   Update ();
146 }