cce89813e9c9fc9ff02f69a1f5195acd9a081fb1
[occt.git] / src / Graphic3d / Graphic3d_AspectText3d.cdl
1 -- Created by: NW,JPB,CAL
2 -- Copyright (c) 1991-1999 Matra Datavision
3 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
4 --
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.
9 --
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.
12 --
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.
19
20 -- Modified FMN: 30-11-98 : S4069. Textes always visible.    
21
22 class AspectText3d from Graphic3d inherits TShared
23
24     ---Version:
25
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.
30     --
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.
36     
37 uses
38
39     Color             from Quantity,
40     TypeOfStyleText   from Aspect,
41     TypeOfDisplayText from Aspect,
42     AsciiString       from TCollection,
43     FontAspect        from Font 
44
45 raises
46
47     AspectTextDefinitionError   from Graphic3d
48
49 is
50
51     Create
52         returns mutable AspectText3d from Graphic3d;
53     ---Level: Public
54     ---Purpose: Creates a context table for text primitives
55     --      defined with the following default values:
56     --
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
63
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
71     ---Level: Public
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")
77     --
78     raises AspectTextDefinitionError from Graphic3d;
79     -- if <AExpansionFactor> is a negative value
80
81     ---------------------------------------------------
82     -- Category: Methods to modify the class definition
83     ---------------------------------------------------
84
85     SetColor ( me       : mutable;
86                AColor   : Color from Quantity )
87         is static;
88     ---Purpose: Modifies the colour of <me>.
89
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
97     --      negative value .
98     raises AspectTextDefinitionError from Graphic3d is static;
99
100     SetFont ( me    : mutable;
101               AFont : CString from Standard )
102         is static;
103     ---Level: Public
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")
109
110
111     SetSpace ( me       : mutable;
112                ASpace   : Real from Standard )
113         is static;
114     ---Level: Public
115     ---Purpose: Modifies the space between the characters.
116     ---Category: Methods to modify the class definition
117
118     SetStyle ( me       : mutable;
119                AStyle   : TypeOfStyleText from Aspect )
120         is static;
121     ---Level: Public
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 
125     --              point of view. 
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
129
130     SetDisplayType ( me             : mutable;
131                      ADisplayType   : TypeOfDisplayText from Aspect )
132         is static;
133     ---Level: Public
134     ---Purpose: Define the display type of the text.    
135     --
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
141
142     SetColorSubTitle ( me       : mutable;
143                        AColor   : Color from Quantity )
144         is static;
145     ---Level: Public
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
149
150     
151     SetTextZoomable ( me        : mutable;
152                       AFlag     : Boolean from Standard );
153     ---Level: Public
154     ---Purpose: Turns usage of text zoomable on/off
155     ---Category: Methods to modify the class definition
156
157     GetTextZoomable( me ) returns Boolean from Standard;
158     ---Level: Public 
159     ---Purpose: Returns TRUE when the Text Zoomable is on.
160
161     SetTextAngle ( me       : mutable;
162                    AAngle   : Real from Standard );
163     ---Level: Public
164     ---Purpose: Turns usage of text rotated
165     ---Category: Methods to modify the class definition
166
167     GetTextAngle( me ) returns Real from Standard;
168     ---Level: Public 
169     ---Purpose: Returns Angle of degree
170
171     SetTextFontAspect ( me          : mutable;
172                         AFontAspect : FontAspect from Font );
173     ---Level: Public
174     ---Purpose: Turns usage of Aspect text 
175     ---Category: Methods to modify the class definition
176
177     GetTextFontAspect( me ) returns FontAspect from Font;
178     ---Level: Public 
179     ---Purpose: Returns text FontAspect
180
181
182
183
184
185
186
187     ----------------------------
188     -- Category: Inquire methods
189     ----------------------------
190
191     Values ( me;
192              AColor             : out Color from Quantity;
193              AFont              : out CString from Standard;
194              AnExpansionFactor  : out Real from Standard;
195              ASpace             : out Real from Standard)
196             is static;
197     ---Level: Public
198     ---Purpose: Returns the current values of the group <me>.
199     ---Category: Inquire methods
200
201
202
203     Values ( me;
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
211             )
212         is static;
213     ---Level: Public
214     ---Purpose: Returns the current values of the group <me>.
215     ---Category: Inquire methods
216
217     Values ( me;
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)
227             is static;
228     ---Level: Public
229     ---Purpose: Returns the current values of the group <me>.
230     ---Category: Inquire methods
231
232     Values ( me;
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)
243             is static;
244     ---Level: Public
245     ---Purpose: Returns the current values of the group <me>.
246     ---Category: Inquire methods
247
248 --\f
249
250 fields
251
252 --
253 -- Class    :   Graphic3d_AspectText3d
254 --
255 -- Purpose  :   Declaration of variables specific to a context for
256 --          writing 3d text
257 --
258 -- Reminder :   A text writing context is defined by:
259 --          - the font
260 --          - the colour
261 --          - the scale
262 --          - the space between characters
263 --
264
265     -- the font utilised
266     MyFont      :   AsciiString from TCollection;
267
268     -- the colour
269     MyColor     :   Color from Quantity;
270
271     -- the scale
272     MyFactor    :   Real from Standard;
273
274     -- the space between characters
275     MySpace     :   Real from Standard;
276
277     -- the style of the text
278     MyStyle     :   TypeOfStyleText from Aspect;
279
280     -- the display type of the text
281     MyDisplayType   :   TypeOfDisplayText from Aspect;
282
283     -- the colour of the sub-title and background for the dekale.
284     MyColorSubTitle :   Color from Quantity;
285
286     -- the flag turning text zoomable on/off
287     MyTextZoomable  :   Boolean from Standard;
288     
289     -- the variable turning angle of the text
290     MyTextAngle :   Real from Standard;
291
292     -- the variable turning FontAspect of the text
293     MyTextFontAspect :  FontAspect from Font;
294
295 end AspectText3d;