1 -- Created by: NW,JPB,CAL
2 -- Copyright (c) 1991-1999 Matra Datavision
3 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 -- The content of this file is subject to the Open CASCADE Technology Public
6 -- License Version 6.5 (the "License"). You may not use the content of this file
7 -- except in compliance with the License. Please obtain a copy of the License
8 -- at http://www.opencascade.org and read it completely before using this file.
10 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 -- The Original Code and all software distributed under the License is
14 -- distributed on an "AS IS" basis, without warranty of any kind, and the
15 -- Initial Developer hereby disclaims all such warranties, including without
16 -- limitation, any warranties of merchantability, fitness for a particular
17 -- purpose or non-infringement. Please see the License for the specific terms
18 -- and conditions governing the rights and limitations under the License.
20 -- Modified FMN: 30-11-98 : S4069. Textes always visible.
22 class AspectText3d from Graphic3d inherits TShared
26 ---Purpose: Creates and updates a group of attributes for
27 -- text primitives. This group contains the colour,
28 -- font, expansion factor (height/width ratio), and
29 -- inter-character space.
31 -- NOTE: The font name is stored in the aspect instance
32 -- so it is safe to pass it as const char* to OpenGl package
33 -- without copying the string. However, the aspect should not
34 -- be deleted until the text drawn using this aspect is no longer
35 -- visible. The best practice is to keep the aspect in the object's drawer.
40 TypeOfStyleText from Aspect,
41 TypeOfDisplayText from Aspect,
42 AsciiString from TCollection,
47 AspectTextDefinitionError from Graphic3d
52 returns mutable AspectText3d from Graphic3d;
54 ---Purpose: Creates a context table for text primitives
55 -- defined with the following default values:
57 -- Colour : NOC_YELLOW
58 -- Font : NOF_ASCII_MONO
59 -- Expansion factor : 1.
60 -- Space between characters : 0.
61 -- The style : TOST_NORMAL
62 -- The display type : TODT_NORMAL
64 Create ( AColor : Color from Quantity;
65 AFont : CString from Standard;
66 AExpansionFactor : Real from Standard;
67 ASpace : Real from Standard;
68 AStyle : TypeOfStyleText from Aspect = Aspect_TOST_NORMAL;
69 ADisplayType : TypeOfDisplayText from Aspect = Aspect_TODT_NORMAL )
70 returns mutable AspectText3d from Graphic3d
72 ---Purpose: Creates a context table for text primitives
73 -- defined with the specified values.
74 -- AFont may be to take means from User(example "Courier New")
75 -- or Font described in OpenGl_FontName(example Graphic3d_NOF_ASCII_MONO)
76 -- or use default font("Courier")
78 raises AspectTextDefinitionError from Graphic3d;
79 -- if <AExpansionFactor> is a negative value
81 ---------------------------------------------------
82 -- Category: Methods to modify the class definition
83 ---------------------------------------------------
85 SetColor ( me : mutable;
86 AColor : Color from Quantity )
88 ---Purpose: Modifies the colour of <me>.
90 SetExpansionFactor ( me : mutable;
91 AFactor : Real from Standard )
92 ---Purpose: Modifies the expansion factor (height/width ratio)
93 -- If the factor is less than 1, the characters will
94 -- be higher than they are wide.
95 ---Category: Methods to modify the class definition
96 -- Warning: Raises AspectTextDefinitionError if <AFactor> is a
98 raises AspectTextDefinitionError from Graphic3d is static;
100 SetFont ( me : mutable;
101 AFont : CString from Standard )
104 ---Purpose: Modifies the font of <me>.
105 ---Category: Methods to modify the class definition
106 ---AFont may be to take means from User(example "Courier New")
107 ---or Font described in OpenGl_FontName(example Graphic3d_NOF_ASCII_MONO)
108 ---or use default font("Courier")
111 SetSpace ( me : mutable;
112 ASpace : Real from Standard )
115 ---Purpose: Modifies the space between the characters.
116 ---Category: Methods to modify the class definition
118 SetStyle ( me : mutable;
119 AStyle : TypeOfStyleText from Aspect )
122 ---Purpose: Modifies the style of the text.
123 -- TOST_NORMAL Default text. The text is displayed like any other graphic object.
124 -- This text can be hidden by another object that is nearest from the
126 -- TOST_ANNOTATION The text is always visible. The texte is displayed
127 -- over the other object according to the priority.
128 ---Category: Methods to modify the class definition
130 SetDisplayType ( me : mutable;
131 ADisplayType : TypeOfDisplayText from Aspect )
134 ---Purpose: Define the display type of the text.
136 -- TODT_NORMAL Default display. Text only.
137 -- TODT_SUBTITLE There is a subtitle under the text.
138 -- TODT_DEKALE The text is displayed with a 3D style.
139 -- TODT_BLEND The text is displayed in XOR.
140 ---Category: Methods to modify the class definition
142 SetColorSubTitle ( me : mutable;
143 AColor : Color from Quantity )
146 ---Purpose: Modifies the colour of the subtitle for the TODT_SUBTITLE TextDisplayType
147 --- and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
148 ---Category: Methods to modify the class definition
151 SetTextZoomable ( me : mutable;
152 AFlag : Boolean from Standard );
154 ---Purpose: Turns usage of text zoomable on/off
155 ---Category: Methods to modify the class definition
157 GetTextZoomable( me ) returns Boolean from Standard;
159 ---Purpose: Returns TRUE when the Text Zoomable is on.
161 SetTextAngle ( me : mutable;
162 AAngle : Real from Standard );
164 ---Purpose: Turns usage of text rotated
165 ---Category: Methods to modify the class definition
167 GetTextAngle( me ) returns Real from Standard;
169 ---Purpose: Returns Angle of degree
171 SetTextFontAspect ( me : mutable;
172 AFontAspect : FontAspect from Font );
174 ---Purpose: Turns usage of Aspect text
175 ---Category: Methods to modify the class definition
177 GetTextFontAspect( me ) returns FontAspect from Font;
179 ---Purpose: Returns text FontAspect
187 ----------------------------
188 -- Category: Inquire methods
189 ----------------------------
192 AColor : out Color from Quantity;
193 AFont : out CString from Standard;
194 AnExpansionFactor : out Real from Standard;
195 ASpace : out Real from Standard)
198 ---Purpose: Returns the current values of the group <me>.
199 ---Category: Inquire methods
204 AColor : out Color from Quantity;
205 AFont : out CString from Standard;
206 AnExpansionFactor : out Real from Standard;
207 ASpace : out Real from Standard;
208 AStyle : out TypeOfStyleText from Aspect;
209 ADisplayType : out TypeOfDisplayText from Aspect;
210 AColorSubTitle : out Color from Quantity
214 ---Purpose: Returns the current values of the group <me>.
215 ---Category: Inquire methods
218 AColor : out Color from Quantity;
219 AFont : out CString from Standard;
220 AnExpansionFactor : out Real from Standard;
221 ASpace : out Real from Standard;
222 AStyle : out TypeOfStyleText from Aspect;
223 ADisplayType : out TypeOfDisplayText from Aspect;
224 AColorSubTitle : out Color from Quantity;
225 ATextZoomable : out Boolean from Standard;
226 ATextAngle : out Real from Standard)
229 ---Purpose: Returns the current values of the group <me>.
230 ---Category: Inquire methods
233 AColor : out Color from Quantity;
234 AFont : out CString from Standard;
235 AnExpansionFactor : out Real from Standard;
236 ASpace : out Real from Standard;
237 AStyle : out TypeOfStyleText from Aspect;
238 ADisplayType : out TypeOfDisplayText from Aspect;
239 AColorSubTitle : out Color from Quantity;
240 ATextZoomable : out Boolean from Standard;
241 ATextAngle : out Real from Standard;
242 ATextFontAspect : out FontAspect from Font)
245 ---Purpose: Returns the current values of the group <me>.
246 ---Category: Inquire methods
253 -- Class : Graphic3d_AspectText3d
255 -- Purpose : Declaration of variables specific to a context for
258 -- Reminder : A text writing context is defined by:
262 -- - the space between characters
266 MyFont : AsciiString from TCollection;
269 MyColor : Color from Quantity;
272 MyFactor : Real from Standard;
274 -- the space between characters
275 MySpace : Real from Standard;
277 -- the style of the text
278 MyStyle : TypeOfStyleText from Aspect;
280 -- the display type of the text
281 MyDisplayType : TypeOfDisplayText from Aspect;
283 -- the colour of the sub-title and background for the dekale.
284 MyColorSubTitle : Color from Quantity;
286 -- the flag turning text zoomable on/off
287 MyTextZoomable : Boolean from Standard;
289 -- the variable turning angle of the text
290 MyTextAngle : Real from Standard;
292 -- the variable turning FontAspect of the text
293 MyTextFontAspect : FontAspect from Font;