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