3923253a70f6297e9064e244b276d760ccdca2b9
[occt.git] / src / Graphic3d / Graphic3d_AspectText3d.cdl
1 -- Created by: NW,JPB,CAL
2 -- Copyright (c) 1991-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 -- Modified FMN: 30-11-98 : S4069. Textes always visible.    
17
18 class AspectText3d from Graphic3d inherits TShared
19
20     ---Version:
21
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.
26     --
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.
32     
33 uses
34
35     Color                 from Quantity,
36     TypeOfStyleText       from Aspect,
37     TypeOfDisplayText     from Aspect,
38     AsciiString           from TCollection,
39     FontAspect            from Font,
40     ShaderProgram_Handle  from Graphic3d
41
42 raises
43
44     AspectTextDefinitionError   from Graphic3d
45
46 is
47
48     Create
49         returns AspectText3d from Graphic3d;
50     ---Level: Public
51     ---Purpose: Creates a context table for text primitives
52     --      defined with the following default values:
53     --
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
60
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
68     ---Level: Public
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")
74     --
75     raises AspectTextDefinitionError from Graphic3d;
76     -- if <AExpansionFactor> is a negative value
77
78     ---------------------------------------------------
79     -- Category: Methods to modify the class definition
80     ---------------------------------------------------
81
82     SetColor ( me       : mutable;
83                AColor   : Color from Quantity )
84         is static;
85     ---Purpose: Modifies the colour of <me>.
86
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
94     --      negative value .
95     raises AspectTextDefinitionError from Graphic3d is static;
96
97     SetFont ( me    : mutable;
98               AFont : CString from Standard )
99         is static;
100     ---Level: Public
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")
106
107
108     SetSpace ( me       : mutable;
109                ASpace   : Real from Standard )
110         is static;
111     ---Level: Public
112     ---Purpose: Modifies the space between the characters.
113     ---Category: Methods to modify the class definition
114
115     SetStyle ( me       : mutable;
116                AStyle   : TypeOfStyleText from Aspect )
117         is static;
118     ---Level: Public
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 
122     --              point of view. 
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
126
127     SetDisplayType ( me             : mutable;
128                      ADisplayType   : TypeOfDisplayText from Aspect )
129         is static;
130     ---Level: Public
131     ---Purpose: Define the display type of the text.    
132     --
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
139
140     SetColorSubTitle ( me       : mutable;
141                        AColor   : Color from Quantity )
142         is static;
143     ---Level: Public
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
147
148     
149     SetTextZoomable ( me        : mutable;
150                       AFlag     : Boolean from Standard );
151     ---Level: Public
152     ---Purpose: Turns usage of text zoomable on/off
153     ---Category: Methods to modify the class definition
154
155     GetTextZoomable( me ) returns Boolean from Standard;
156     ---Level: Public 
157     ---Purpose: Returns TRUE when the Text Zoomable is on.
158
159     SetTextAngle ( me       : mutable;
160                    AAngle   : Real from Standard );
161     ---Level: Public
162     ---Purpose: Turns usage of text rotated
163     ---Category: Methods to modify the class definition
164
165     GetTextAngle( me ) returns Real from Standard;
166     ---Level: Public 
167     ---Purpose: Returns Angle of degree
168
169     SetTextFontAspect ( me          : mutable;
170                         AFontAspect : FontAspect from Font );
171     ---Level: Public
172     ---Purpose: Turns usage of Aspect text 
173     ---Category: Methods to modify the class definition
174
175     GetTextFontAspect( me ) returns FontAspect from Font;
176     ---Level: Public 
177     ---Purpose: Returns text FontAspect
178
179     SetShaderProgram ( me  :  mutable; 
180                        theProgram  :  ShaderProgram_Handle from Graphic3d );
181     ---Level: Public
182     ---Purpose: Sets up OpenGL/GLSL shader program.
183
184     ----------------------------
185     -- Category: Inquire methods
186     ----------------------------
187
188     Values ( me;
189              AColor             : out Color from Quantity;
190              AFont              : out CString from Standard;
191              AnExpansionFactor  : out Real from Standard;
192              ASpace             : out Real from Standard)
193             is static;
194     ---Level: Public
195     ---Purpose: Returns the current values of the group <me>.
196     ---Category: Inquire methods
197
198
199
200     Values ( me;
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
208             )
209         is static;
210     ---Level: Public
211     ---Purpose: Returns the current values of the group <me>.
212     ---Category: Inquire methods
213
214     Values ( me;
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)
224             is static;
225     ---Level: Public
226     ---Purpose: Returns the current values of the group <me>.
227     ---Category: Inquire methods
228
229     Values ( me;
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)
240             is static;
241     ---Level: Public
242     ---Purpose: Returns the current values of the group <me>.
243     ---Category: Inquire methods
244
245     ShaderProgram ( me )
246     returns ShaderProgram_Handle from Graphic3d;
247     ---C++: return const &
248
249 --
250
251 fields
252
253 --
254 -- Class    :   Graphic3d_AspectText3d
255 --
256 -- Purpose  :   Declaration of variables specific to a context for
257 --          writing 3d text
258 --
259 -- Reminder :   A text writing context is defined by:
260 --          - the font
261 --          - the colour
262 --          - the scale
263 --          - the space between characters
264 --
265
266     -- the font utilised
267     MyFont      :   AsciiString from TCollection;
268
269     -- the colour
270     MyColor     :   Color from Quantity;
271
272     -- the scale
273     MyFactor    :   Real from Standard;
274
275     -- the space between characters
276     MySpace     :   Real from Standard;
277
278     -- the style of the text
279     MyStyle     :   TypeOfStyleText from Aspect;
280
281     -- the display type of the text
282     MyDisplayType   :   TypeOfDisplayText from Aspect;
283
284     -- the colour of the sub-title and background for the dekale.
285     MyColorSubTitle :   Color from Quantity;
286
287     -- the flag turning text zoomable on/off
288     MyTextZoomable  :   Boolean from Standard;
289     
290     -- the variable turning angle of the text
291     MyTextAngle :   Real from Standard;
292
293     -- the variable turning FontAspect of the text
294     MyTextFontAspect :  FontAspect from Font;
295
296     MyShaderProgram  :  ShaderProgram_Handle  from  Graphic3d; 
297
298 end AspectText3d;