1 -- Created by: NW,JPB,CAL
2 -- Copyright (c) 1991-1999 Matra Datavision
3 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 -- This file is part of Open CASCADE Technology software library.
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.
13 -- Alternatively, this file may be used under the terms of Open CASCADE
14 -- commercial license or contractual agreement.
16 -- Modified FMN: 30-11-98 : S4069. Textes always visible.
18 class AspectText3d from Graphic3d inherits TShared
22 ---Purpose: Creates and updates a group of attributes for
23 -- text primitives. This group contains the colour,
24 -- font, expansion factor (height/width ratio), and
25 -- inter-character space.
27 -- NOTE: The font name is stored in the aspect instance
28 -- so it is safe to pass it as const char* to OpenGl package
29 -- without copying the string. However, the aspect should not
30 -- be deleted until the text drawn using this aspect is no longer
31 -- visible. The best practice is to keep the aspect in the object's drawer.
36 TypeOfStyleText from Aspect,
37 TypeOfDisplayText from Aspect,
38 AsciiString from TCollection,
40 ShaderProgram from Graphic3d
44 AspectTextDefinitionError from Graphic3d
49 returns AspectText3d from Graphic3d;
51 ---Purpose: Creates a context table for text primitives
52 -- defined with the following default values:
54 -- Colour : NOC_YELLOW
55 -- Font : NOF_ASCII_MONO
56 -- Expansion factor : 1.
57 -- Space between characters : 0.
58 -- The style : TOST_NORMAL
59 -- The display type : TODT_NORMAL
61 Create ( AColor : Color from Quantity;
62 AFont : CString from Standard;
63 AExpansionFactor : Real from Standard;
64 ASpace : Real from Standard;
65 AStyle : TypeOfStyleText from Aspect = Aspect_TOST_NORMAL;
66 ADisplayType : TypeOfDisplayText from Aspect = Aspect_TODT_NORMAL )
67 returns AspectText3d from Graphic3d
69 ---Purpose: Creates a context table for text primitives
70 -- defined with the specified values.
71 -- AFont may be to take means from User(example "Courier New")
72 -- or Font name defined in Font_NameOfFont(example Font_NOF_ASCII_MONO)
73 -- or use default font("Courier")
75 raises AspectTextDefinitionError from Graphic3d;
76 -- if <AExpansionFactor> is a negative value
78 ---------------------------------------------------
79 -- Category: Methods to modify the class definition
80 ---------------------------------------------------
82 SetColor ( me : mutable;
83 AColor : Color from Quantity )
85 ---Purpose: Modifies the colour of <me>.
87 SetExpansionFactor ( me : mutable;
88 AFactor : Real from Standard )
89 ---Purpose: Modifies the expansion factor (height/width ratio)
90 -- If the factor is less than 1, the characters will
91 -- be higher than they are wide.
92 ---Category: Methods to modify the class definition
93 -- Warning: Raises AspectTextDefinitionError if <AFactor> is a
95 raises AspectTextDefinitionError from Graphic3d is static;
97 SetFont ( me : mutable;
98 AFont : CString from Standard )
101 ---Purpose: Modifies the font of <me>.
102 ---Category: Methods to modify the class definition
103 ---AFont may be to take means from User(example "Courier New")
104 ---or Font name defined in Font_NameOfFont(example Font_NOF_ASCII_MONO)
105 ---or use default font("Courier")
108 SetSpace ( me : mutable;
109 ASpace : Real from Standard )
112 ---Purpose: Modifies the space between the characters.
113 ---Category: Methods to modify the class definition
115 SetStyle ( me : mutable;
116 AStyle : TypeOfStyleText from Aspect )
119 ---Purpose: Modifies the style of the text.
120 -- TOST_NORMAL Default text. The text is displayed like any other graphic object.
121 -- This text can be hidden by another object that is nearest from the
123 -- TOST_ANNOTATION The text is always visible. The texte is displayed
124 -- over the other object according to the priority.
125 ---Category: Methods to modify the class definition
127 SetDisplayType ( me : mutable;
128 ADisplayType : TypeOfDisplayText from Aspect )
131 ---Purpose: Define the display type of the text.
133 -- TODT_NORMAL Default display. Text only.
134 -- TODT_SUBTITLE There is a subtitle under the text.
135 -- TODT_DEKALE The text is displayed with a 3D style.
136 -- TODT_BLEND The text is displayed in XOR.
137 -- TODT_DIMENSION Dimension line under text will be invisible.
138 ---Category: Methods to modify the class definition
140 SetColorSubTitle ( me : mutable;
141 AColor : Color from Quantity )
144 ---Purpose: Modifies the colour of the subtitle for the TODT_SUBTITLE TextDisplayType
145 --- and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
146 ---Category: Methods to modify the class definition
149 SetTextZoomable ( me : mutable;
150 AFlag : Boolean from Standard );
152 ---Purpose: Turns usage of text zoomable on/off
153 ---Category: Methods to modify the class definition
155 GetTextZoomable( me ) returns Boolean from Standard;
157 ---Purpose: Returns TRUE when the Text Zoomable is on.
159 SetTextAngle ( me : mutable;
160 AAngle : Real from Standard );
162 ---Purpose: Turns usage of text rotated
163 ---Category: Methods to modify the class definition
165 GetTextAngle( me ) returns Real from Standard;
167 ---Purpose: Returns Angle of degree
169 SetTextFontAspect ( me : mutable;
170 AFontAspect : FontAspect from Font );
172 ---Purpose: Turns usage of Aspect text
173 ---Category: Methods to modify the class definition
175 GetTextFontAspect( me ) returns FontAspect from Font;
177 ---Purpose: Returns text FontAspect
179 SetShaderProgram ( me : mutable;
180 theProgram : ShaderProgram from Graphic3d );
182 ---Purpose: Sets up OpenGL/GLSL shader program.
184 ----------------------------
185 -- Category: Inquire methods
186 ----------------------------
189 AColor : out Color from Quantity;
190 AFont : out CString from Standard;
191 AnExpansionFactor : out Real from Standard;
192 ASpace : out Real from Standard)
195 ---Purpose: Returns the current values of the group <me>.
196 ---Category: Inquire methods
201 AColor : out Color from Quantity;
202 AFont : out CString from Standard;
203 AnExpansionFactor : out Real from Standard;
204 ASpace : out Real from Standard;
205 AStyle : out TypeOfStyleText from Aspect;
206 ADisplayType : out TypeOfDisplayText from Aspect;
207 AColorSubTitle : out Color from Quantity
211 ---Purpose: Returns the current values of the group <me>.
212 ---Category: Inquire methods
215 AColor : out Color from Quantity;
216 AFont : out CString from Standard;
217 AnExpansionFactor : out Real from Standard;
218 ASpace : out Real from Standard;
219 AStyle : out TypeOfStyleText from Aspect;
220 ADisplayType : out TypeOfDisplayText from Aspect;
221 AColorSubTitle : out Color from Quantity;
222 ATextZoomable : out Boolean from Standard;
223 ATextAngle : out Real from Standard)
226 ---Purpose: Returns the current values of the group <me>.
227 ---Category: Inquire methods
230 AColor : out Color from Quantity;
231 AFont : out CString from Standard;
232 AnExpansionFactor : out Real from Standard;
233 ASpace : out Real from Standard;
234 AStyle : out TypeOfStyleText from Aspect;
235 ADisplayType : out TypeOfDisplayText from Aspect;
236 AColorSubTitle : out Color from Quantity;
237 ATextZoomable : out Boolean from Standard;
238 ATextAngle : out Real from Standard;
239 ATextFontAspect : out FontAspect from Font)
242 ---Purpose: Returns the current values of the group <me>.
243 ---Category: Inquire methods
246 returns ShaderProgram from Graphic3d;
247 ---C++: return const &
254 -- Class : Graphic3d_AspectText3d
256 -- Purpose : Declaration of variables specific to a context for
259 -- Reminder : A text writing context is defined by:
263 -- - the space between characters
267 MyFont : AsciiString from TCollection;
270 MyColor : Color from Quantity;
273 MyFactor : Real from Standard;
275 -- the space between characters
276 MySpace : Real from Standard;
278 -- the style of the text
279 MyStyle : TypeOfStyleText from Aspect;
281 -- the display type of the text
282 MyDisplayType : TypeOfDisplayText from Aspect;
284 -- the colour of the sub-title and background for the dekale.
285 MyColorSubTitle : Color from Quantity;
287 -- the flag turning text zoomable on/off
288 MyTextZoomable : Boolean from Standard;
290 -- the variable turning angle of the text
291 MyTextAngle : Real from Standard;
293 -- the variable turning FontAspect of the text
294 MyTextFontAspect : FontAspect from Font;
296 MyShaderProgram : ShaderProgram from Graphic3d;