0023062: Incorrect display of edge in draw axo viewer
[occt.git] / src / Visual3d / Visual3d_TransientManager.cdl
CommitLineData
b311480e 1-- Created on: 1995-10-10
2-- Created by: GG
3-- Copyright (c) 1995-1999 Matra Datavision
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
7fd59977 5--
b311480e 6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
7fd59977 10--
b311480e 11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
7fd59977 13--
b311480e 14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
21-- 05-97: CAL; Ajout du Clear sur les TOS_COMPUTED.
7fd59977 22
23class TransientManager from Visual3d inherits TShared
24
25 ---Version:
26
27 ---Purpose: This class allows to manage transient graphics
28 -- above one View.
29 -- A simple way to drawn something very quicly above
30 -- a complex scene (Hilighting,Sketching,...)
31 -- All transient graphics will be drawn with
32 -- the projection defined by the view with the current
33 -- attributes depending of the primitive type :
34 -- Lines,Markers,Polygons,Texts
35 -- All transient graphics will be erased at the next
36 -- View::BeginDraw().
37 -- If RetainMode is active,
38 -- All transient graphics will be kept at the
39 -- next View::Update(),Redraw(). The transient graphics
40 -- is stored by this object and graphic library, the
41 -- graphic managed itself exposure,resizing,...
42 -- The method View::ClearDraw() is necessary to erase
43 -- all transient graphics.
44 -- If RetainMode is deactivate,
45 -- All transient graphics will be erased at the
46 -- next View::Update(),Redraw().
47 -- Remember that nothing is stored by this object and
48 -- graphic library,the application must managed itself
49 -- exposure,resizing,...
50 -- If double_buffering is activate,
51 -- all graphics are drawn in the back buffer and flushed
52 -- in the front buffer at the end of drawing but nothing
53 -- is done for to separate transient from structured
54 -- graphics,the only way to regenerate the structured
55 -- view is to Redraw() the view.
56 -- If double_buffering is deactivate,
57 -- the back buffer is preserved and used for restoring
58 -- the front buffer at begin drawing time.I recommend
59 -- to use the second way (without DB) if you want
60 -- to preserve the graphics and the performances!
61
62
63uses
64
65 Array2OfReal from TColStd,
66
67 ExtendedString from TCollection,
68
69 PlaneAngle from Quantity,
70
71 Structure from Graphic3d,
72 AspectLine3d from Graphic3d,
73 AspectFillArea3d from Graphic3d,
74 AspectText3d from Graphic3d,
75 AspectMarker3d from Graphic3d,
76 TypeOfComposition from Graphic3d,
77 TextPath from Graphic3d,
78 HorizontalTextAlignment from Graphic3d,
79 VerticalTextAlignment from Graphic3d,
80
81 View from Visual3d
82
83raises
84 TransientDefinitionError from Visual3d,
85 TransformError from Graphic3d
86
87is
88 -------------------------
89 -- Category: Constructors
90 -------------------------
91
92 Create returns mutable TransientManager from Visual3d;
93 ---Purpose: Creates a TransientManager <aView>.
94 ---Category: Constructors
95
96 ------------------------
97 -- Category: Destructors
98 ------------------------
99
100 Destroy (me : mutable);
101 ---Level: Public
102 ---Purpose: Suppress the TransientManager <me>.
103 ---Category: Destructors
104 ---C++: alias ~
105
106 ---------------------------------------------------
107 -- Category: Methods to modify the class definition
108 ---------------------------------------------------
109
110 BeginDraw (myclass;
111 aView : View from Visual3d;
112 DoubleBuffer: Boolean = Standard_False;
113 RetainMode: Boolean = Standard_False)
114 returns Boolean from Standard
115 ---Level: Public
116 ---Purpose: Begins any graphics in the view <aView>
117 -- Redraw any structured graphics in the back buffer before
118 -- if <DoubleBuffer> is TRUE.
119 -- Restore the front buffer from the back before
120 -- if <DoubleBuffer> is FALSE.
121 -- if <RetainMode> is TRUE.
122 -- the graphic managed itself exposure,resizing ...
123 -- if <RetainMode> is FALSE.
124 -- the application must managed itself exposure,resizing ...
125 --
126 -- Warning: Returns TRUE if transient drawing is enabled in
127 -- the associated view.
128 -- Returns FALSE ,if nothing works because something
129 -- is wrong for the transient principle :
130 -- Immediat mode is not implemented depending of the
131 -- graphic library used.
132 -- MBX,PIXMAP double buffering don't works depending of
133 -- the graphic board and the visual of the window supporting
134 -- the view.
135 -- Warning: No default attributes
136 -- Raises TransientDefinitionError from Visual3d;
137 -- if Drawing is already opened.
138 -- or the associated view is not mapped on a window.
139 raises TransientDefinitionError from Visual3d;
140
141 EndDraw (myclass;
142 Synchronize: Boolean = Standard_False)
143 ---Level: Public
144 ---Purpose: Flush all graphics to the front buffer.
145 -- Synchronize graphics to the screen if <Synchronize> is
146 -- TRUE (make becarefull to the performances!).
147 -- Raises TransientDefinitionError from Visual3d;
148 -- if Drawing is not opened.
149 raises TransientDefinitionError from Visual3d;
150
151 ClearDraw (myclass; aView : View from Visual3d;
152 aFlush : Boolean from Standard = Standard_True)
153 ---Level: Public
154 ---Purpose: Clear all transient graphics in the view <aView>
155 --- updates a scene if <aFlush> = true
156 -- Raises TransientDefinitionError from Visual3d;
157 -- if Drawing is already opened.
158 -- or the associated view is not mapped on a window.
159 raises TransientDefinitionError from Visual3d;
160
161 ---------------------------------------------------
162 -- Category: Methods to modify the class definition
163 ---------------------------------------------------
164
165 BeginAddDraw (myclass;
166 aView : View from Visual3d)
167 returns Boolean from Standard
168 ---Level: Public
169 ---Purpose: Begins any add graphics in the view <aView>
170 -- the application must managed itself exposure,resizing ...
171 --
172 -- Warning: Returns TRUE if transient drawing is enabled in
173 -- the associated view.
174 -- Returns FALSE ,if nothing works because something
175 -- is wrong for the transient principle :
176 -- Immediat mode is not implemented depending of the
177 -- graphic library used.
178 -- MBX,PIXMAP double buffering don't works depending of
179 -- the graphic board and the visual of the window supporting
180 -- the view.
181 -- Warning: No default attributes
182 -- Raises TransientDefinitionError from Visual3d;
183 -- if Drawing is already opened.
184 -- or the associated view is not mapped on a window.
185 raises TransientDefinitionError from Visual3d;
186
187 EndAddDraw (myclass)
188 ---Purpose: Flush all add graphics to the front buffer.
189 -- Raises TransientDefinitionError from Visual3d;
190 -- if Drawing is not opened.
191raises TransientDefinitionError from Visual3d;
192
193 ---------------------------------------
194 -- Category: Graphic definition methods
195 ---------------------------------------
196
197 BeginPolyline (myclass)
198 ---Level: Public
199 ---Purpose: After this call, <me> is ready to receive
200 -- a definition of a polyline with AddVertex().
201 -- Raises TransientDefinitionError from Visual3d;
202 -- if a Begin... primitive is already opened,
203 -- or Drawing is not opened.
204 raises TransientDefinitionError from Visual3d;
205
206
207 BeginPolygon (myclass)
208 ---Level: Public
209 ---Purpose: After this call, <me> is ready to receive
210 -- a definition of a polygon with AddVertex().
211 -- Raises TransientDefinitionError from Visual3d;
212 -- if a Begin... primitive is already opened,
213 -- or Drawing is not opened.
214 raises TransientDefinitionError from Visual3d;
215
216
217 BeginTriangleMesh (myclass)
218 ---Level: Public
219 ---Purpose: After this call, <me> is ready to receive
220 -- a definition of a triangle mesh with AddVertex().
221 -- Raises TransientDefinitionError from Visual3d;
222 -- if a Begin... primitive is already opened,
223 -- or Drawing is not opened.
224 raises TransientDefinitionError from Visual3d;
225
226
227 BeginMarker (myclass)
228 ---Level: Public
229 ---Purpose: After this call, <me> is ready to receive
230 -- a definition of a marker with AddVertex().
231 -- Raises TransientDefinitionError from Visual3d;
232 -- if a Begin... primitive is already opened,
233 -- or Drawing is not opened.
234 raises TransientDefinitionError from Visual3d;
235
236
237 BeginBezier (myclass)
238 ---Level: Public
239 ---Purpose: After this call, <me> is ready to receive
240 -- a definition of a curve with AddVertex().
241 -- Raises TransientDefinitionError from Visual3d;
242 -- if a Begin... primitive is already opened,
243 -- or Drawing is not opened.
244 raises TransientDefinitionError from Visual3d;
245
246
247 AddVertex (myclass;
248 X, Y, Z : Real from Standard;
249 AFlag : Boolean from Standard = Standard_True)
250 ---Level: Public
251 ---Purpose: Puts <X, Y, Z> as a new point in the current primitive.
252 -- If <AFlag> then it is a draw between last point and
253 -- this point else it is a move between last point and
254 -- this point.
255 -- Raises TransientDefinitionError from Visual3d;
256 -- if a Begin... primitive is not opened,
257 -- or Drawing is not opened.
258 raises TransientDefinitionError from Visual3d;
259
260
261 AddVertex (myclass;
262 X, Y, Z, W : Real from Standard;
263 AFlag : Boolean from Standard = Standard_True)
264 ---Level: Public
265 ---Purpose: Puts <X, Y, Z, W> as a new point coordinates and
266 -- weight in the current primitive.
267 -- If <AFlag> then it is a draw between last point and
268 -- this point else it is a move between last point and
269 -- this point.
270 -- Raises TransientDefinitionError from Visual3d;
271 -- if a Begin... primitive is not opened,
272 -- or Drawing is not opened.
273 raises TransientDefinitionError from Visual3d;
274
275
276 AddVertex (myclass;
277 X, Y, Z : Real from Standard;
278 NX, NY, NZ : Real from Standard;
279 AFlag : Boolean from Standard = Standard_True)
280 ---Level: Public
281 ---Purpose: Puts <X, Y, Z> as a new point in the current primitive.
282 -- Puts <NX, NY, NZ> as a new normal in the current
283 -- primitive.
284 -- If <AFlag> then it is a draw between last point and
285 -- this point else it is a move between last point and
286 -- this point.
287 -- Raises TransientDefinitionError from Visual3d;
288 -- if a Begin... primitive is not opened,
289 -- or Drawing is not opened.
290 raises TransientDefinitionError from Visual3d;
291
292
293 ClosePrimitive (myclass)
294 ---Level: Public
295 ---Purpose: After this call, <me> stops the reception of
296 -- a definition of a Begin... primitive.
297 -- Raises TransientDefinitionError from Visual3d;
298 -- if a Begin... primitive is not opened,
299 -- or Drawing is not opened.
300 raises TransientDefinitionError from Visual3d;
301
302
303 DrawText (myclass;
304 AText : ExtendedString from TCollection;
305 X, Y, Z : Real from Standard;
306 AHeight : Real from Standard;
307 AAngle : PlaneAngle from Quantity = 0.0;
308 ATp : TextPath from Graphic3d = Graphic3d_TP_RIGHT;
309 AHta : HorizontalTextAlignment from Graphic3d = Graphic3d_HTA_LEFT;
310 AVta : VerticalTextAlignment from Graphic3d = Graphic3d_VTA_BOTTOM)
311 ---Purpose: Drawn the string <AText> at position <X,Y,Z>.
312 -- The 3D point of attachment is projected. The text is
313 -- written in the plane of projection.
314 -- The attributes are given with respect to the plane of
315 -- projection.
316 -- AHeight : Height of text.
317 -- (Relative to the Normalized Projection
318 -- Coordinates (NPC) Space).
319 -- AAngle : Orientation of the text
320 -- (with respect to the horizontal).
321 -- Raises TransientDefinitionError from Visual3d;
322 -- if Drawing is not opened.
323 raises TransientDefinitionError from Visual3d;
324
325
326 DrawStructure (myclass;
327 AStructure : Structure from Graphic3d)
328 ---Purpose: Drawn the structure <AStructure>.
329 -- Raises TransientDefinitionError from Visual3d;
330 -- if Drawing is not opened.
331 raises TransientDefinitionError from Visual3d;
332
333
334 ------------------------------------------------
335 -- Summary of attributes --
336 ------------------------------------------------
337
338 SetPrimitivesAspect (myclass;
339 CTX : AspectLine3d from Graphic3d)
340 ---Level: Public
341 ---Purpose: Modifies the current lines attributes.
342 -- Warning: No default attributes
343 -- Raises TransientDefinitionError from Visual3d;
344 -- if Drawing is not opened.
345 raises TransientDefinitionError from Visual3d;
346
347 SetPrimitivesAspect (myclass;
348 CTX : AspectFillArea3d from Graphic3d)
349 ---Level: Public
350 ---Purpose: Modifies the current faces attributes
351 -- Warning: No default attributes
352 -- Raises TransientDefinitionError from Visual3d;
353 -- if Drawing is not opened.
354 raises TransientDefinitionError from Visual3d;
355
356
357 SetPrimitivesAspect (myclass;
358 CTX : AspectText3d from Graphic3d)
359 ---Level: Public
360 ---Purpose: Modifies the current texts attributes
361 -- Warning: No default attributes
362 -- Raises TransientDefinitionError from Visual3d;
363 -- if Drawing is not opened.
364 raises TransientDefinitionError from Visual3d;
365
366 SetPrimitivesAspect (myclass;
367 CTX : AspectMarker3d from Graphic3d)
368 ---Level: Public
369 ---Purpose: Modifies the current markers attributes
370 -- Warning: No default attributes
371 -- Raises TransientDefinitionError from Visual3d;
372 -- if Drawing is not opened.
373 raises TransientDefinitionError from Visual3d;
374
375 ----------------------------
376 -- Category: Inquire methods
377 ----------------------------
378
379 MinMaxValues (myclass;
380 XMin, YMin, ZMin : out Real from Standard;
381 XMax, YMax, ZMax : out Real from Standard);
382 ---Level: Public
383 ---Purpose: Returns the coordinates of the boundary box
384 -- of the Transient graphics actually drawn
385 -- since BeginDraw() has been call.
386 -- Warning: If nothing has been drawn then :
387 -- XMin = YMin = ZMin = RealFirst ().
388 -- XMax = YMax = ZMax = RealLast ().
389 ---Category: Inquire methods
390
391 MinMaxValues (myclass;
392 UMin, VMin : out Real from Standard;
393 UMax, VMax : out Real from Standard);
394 ---Level: Public
395 ---Purpose: Returns the coordinates of the boundary box projection
396 -- of the Transient graphics actually drawn
397 -- since BeginDraw() has been call.
398 -- Warning: If nothing has been drawn then :
399 -- XMin = YMin = ZMin = RealFirst ().
400 -- XMax = YMax = ZMax = RealLast ().
401 ---Category: Inquire methods
402
403 -----------------------------------------------------------
404 -- Category: Methods to manage the graphics transformation
405 -----------------------------------------------------------
406
407 SetTransform (myclass;
408 AMatrix : Array2OfReal from TColStd;
409 AType : TypeOfComposition from Graphic3d =
410 Graphic3d_TOC_REPLACE)
411 ---Level: Public
412 ---Purpose: Modifies the current local modelling transformation
413 -- of the transient graphics.
414 --
415 -- It is defined as a 4*4 real matrix.
416 --
417 -- -------------------
418 -- | a11 a12 a13 t1 |
419 -- | a21 a22 a23 t2 |
420 -- | a31 a32 a33 t3 |
421 -- | 0 0 0 1 |
422 -- -------------------
423 --
424 -- TypeOfComposition : TOC_REPLACE
425 -- TOC_POSTCONCATENATE
426 --
427 ---Category: Methods to manage the graphic transformation
428 -- Raises TransformError from Graphic3d
429 -- if Drawing is not opened.
430 -- or the matrix is not a 4x4 matrix.
431 raises TransformError from Graphic3d;
432
433end TransientManager from Visual3d;