1 -- Created on: 1991-09-17
2 -- Created by: NW,JPB,CAL
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
21 -- 05-97: CAL; Ajout du Clear sur les TOS_COMPUTED.
22 -- 10-97: CAL; Retrait des DataStructure.
23 -- 11-97: CAL; Retrait de la dependance avec math.Calcul developpe.
24 -- 11-97: CAL; Ajout de NumberOfDisplayedStructures
25 -- 05-98: CAL; Perfs. Connection entre structures COMPUTED.
26 -- 16-09-98: BGN; Points d'entree du Triedre (S3819, Phase 1)
27 -- 22-09-98: BGN; S3989 (anciennement S3819)
28 -- TypeOfTriedron* from Aspect(et pas Visual3d)
29 -- 02-12-98: S4062. Ajout des layers.
30 -- 13-09-99: GG; GER61454 Adds LightLimit() and PlaneLimit() methods
31 -- 10-11-99: GG; Add PRO19603 Redraw( area ) method
32 -- 14-01-00: GG; Add IMP140100 ViewManager() method
33 -- 25-01-00: EUG: G003
34 -- -> Add backfacing management methods
35 -- SetBackfacingModel() & BackfacingModel().
36 -- -> Change SetAnimationModeIsOn() adding degenerate flag
37 -- -> SetDegenerateModeOn() and Off() become private.
38 -- Use instead SetComputedMode() for managing
40 -- THA - 17/08/00 Thomas HARTL <t-hartl@muenchen.matra-dtv.fr>
41 -- -> Add Print methods (works only under Windows).-
42 -- GG - RIC120302 Add NEW SetWindow method.
43 -- 30-04-02: JMB; MyDisplayedStructure is now a Map instead
44 -- of a Set. Improves performance of Selection
47 -- SAV - 22/10/01 -> Add EnableDepthTest() & IsDepthTestEnabled() methods.
48 -- SAV - 25/10/01 -> Add EnableGLLight() & IsGLLightEnabled() methods.
49 -- VSV - 28/05/02: ZBUFFER mode of Trihedron
50 -- SAV - 23/12/02 Added methods too set background image
52 class View from Visual3d inherits DataStructureManager from Graphic3d
56 ---Purpose: Creation and edition of a view in a 3D visualiser.
57 -- A 3D view is composed of an "orientation" part defined
58 -- by the position of the observer, the direction of view,
59 -- and a "mapping" part defined by the type of projection
60 -- (parallel or perspective) and by the window-viewport
61 -- couple which allows passage from the projected coordinate
62 -- space into the screen space.
63 -- Summary of 3D Viewing
64 -- To define a view, you must define:
65 -- - The view orientation transformation
66 -- - The view mapping transformation
67 -- - The view representation.
68 -- To activate a view, you must define:
69 -- - The associated window.
74 Array2OfReal from TColStd,
76 Background from Aspect,
77 GradientBackground from Aspect,
79 TypeOfUpdate from Aspect,
80 TypeOfHighlightMethod from Aspect,
81 TypeOfTriedronEcho from Aspect,
82 TypeOfTriedronPosition from Aspect,
84 RenderingContext from Aspect,
85 GraphicCallbackProc from Aspect,
86 ColorScale from Aspect,
87 PrintAlgo from Aspect,
89 BufferType from Graphic3d,
90 CBitFields8 from Graphic3d,
92 GraphicDriver from Graphic3d,
93 PtrFrameBuffer from Graphic3d,
94 Plotter from Graphic3d,
95 Structure from Graphic3d,
96 SequenceOfStructure from Graphic3d,
97 MapOfStructure from Graphic3d,
99 ContextView from Visual3d,
100 ClipPlane from Visual3d,
103 SetOfClipPlane from Visual3d,
104 SetOfLight from Visual3d,
105 TypeOfAnswer from Visual3d,
106 ViewMapping from Visual3d,
107 ViewOrientation from Visual3d,
108 ViewManager from Visual3d,
109 ViewManagerPtr from Visual3d,
111 TypeOfBackfacingModel from Visual3d,
113 NameOfColor from Quantity,
114 FillMethod from Aspect,
115 GradientFillMethod from Aspect,
116 ExportFormat from Graphic3d,
117 SortType from Graphic3d,
119 FontAspect from Font,
120 AsciiString from TCollection,
121 ExtendedString from TCollection,
122 CGraduatedTrihedron from Graphic3d,
127 TransformError from Visual3d,
128 ViewDefinitionError from Visual3d
132 ----------------------------------------------
133 -- Summary of 3D Viewing --
135 -- To define a view, you must define --
137 -- The view orientation transformation --
138 -- The view mapping transformation --
139 -- The view representation. --
141 -- To activate a view, you must define --
143 -- The associated window. --
144 ----------------------------------------------
146 Create ( AManager : mutable ViewManager from Visual3d )
147 returns mutable View from Visual3d;
149 ---Purpose: Creates a view in the viewer <AManager> with a default
150 -- orientation and a default mapping.
152 Create ( AManager : mutable ViewManager from Visual3d;
153 VO : ViewOrientation from Visual3d;
154 VM : ViewMapping from Visual3d;
155 CTX : ContextView from Visual3d )
156 returns mutable View from Visual3d;
158 ---Purpose: Creates a view in the viewer <AManager> with the orientation
159 -- <VO>, the mapping <VM>, and the context<CTX>.
161 ---------------------------------------------------
162 -- Category: Methods to modify the class definition
163 ---------------------------------------------------
165 Activate ( me : mutable )
167 ---Purpose: Activates the view <me>.
168 -- Map the associated window on the screen and
169 -- post the view in this window.
170 -- Category: Methods to modify the class definition
171 -- Warning: Raises ViewDefinitionError if the associated
172 -- window isn't defined.
173 raises ViewDefinitionError from Visual3d is static;
175 Deactivate ( me : mutable )
177 ---Purpose: Deactivates the view <me>.
178 -- Unmap the associated window on the screen and
179 -- unpost the view in this window.
180 -- Category: Methods to modify the class definition
181 -- Warning: Raises ViewDefinitionError if the associated
182 -- window isn't defined.
183 raises ViewDefinitionError from Visual3d is static;
185 Destroy ( me : mutable )
188 ---Purpose: Deletes and erases the view <me>.
189 ---Category: Methods to modify the class definition
192 Redraw ( me : mutable )
195 ---Purpose: Updates screen in all cases.
196 ---Category: Methods to modify the class definition
198 Redraw ( me : mutable; x,y,width,height: Integer from Standard )
201 ---Purpose: Updates screen area in all cases.
202 -- area is given by his xy min corner and size in pixel coordinates
203 ---Category: Methods to modify the class definition
205 Redraw ( me : mutable;
206 AnUnderLayer : Layer from Visual3d;
207 AnOverLayer : Layer from Visual3d )
210 ---Purpose: Updates screen in all cases.
211 ---Category: Methods to modify the class definition
213 Redraw ( me : mutable;
214 AnUnderLayer : Layer from Visual3d;
215 AnOverLayer : Layer from Visual3d;
216 x,y,width,height: Integer from Standard )
219 ---Purpose: Updates screen area in all cases.
220 -- area is given by his xy min corner and size in pixel coordinates
221 ---Category: Methods to modify the class definition
223 Remove ( me : mutable )
226 ---Purpose: Deletes and erases the view <me>.
227 -- Warning: No more graphic operations in <me> after this call.
228 ---Category: Methods to modify the class definition
230 Resized ( me : mutable )
232 ---Purpose: Updates the view <me> after the modification
233 -- of the associated window.
234 -- Category: Methods to modify the class definition
235 -- Warning: Raises ViewDefinitionError if the associated
236 -- window isn't defined.
237 raises ViewDefinitionError from Visual3d is static;
239 SetBackground ( me : mutable;
240 ABack : Background from Aspect )
242 ---Purpose: Modifies the default window background.
243 -- Category: Methods to modify the class definition
244 -- Warning: Raises ViewDefinitionError if the associated
245 -- window isn't defined.
246 raises ViewDefinitionError from Visual3d is static;
248 SetBackgroundImage( me : mutable; FileName : CString from Standard;
249 FillStyle : FillMethod from Aspect;
250 update : Boolean from Standard )
253 -- Category: Methods to modify the class definition
254 -- Warning: Raises ViewDefinitionError if the associated
255 -- window isn't defined.
256 raises ViewDefinitionError from Visual3d is static;
258 SetBgImageStyle( me : mutable; FillStyle : FillMethod from Aspect;
259 update : Boolean from Standard )
262 -- Category: Methods to modify the class definition
263 -- Warning: Raises ViewDefinitionError if the associated
264 -- window isn't defined.
265 raises ViewDefinitionError from Visual3d is static;
267 SetGradientBackground ( me : mutable;
268 ABack : GradientBackground from Aspect;
269 update : Boolean from Standard )
271 ---Purpose: Modifies the gradient window background.
272 -- Category: Methods to modify the class definition
273 -- Warning: Raises ViewDefinitionError if the associated
274 -- window isn't defined.
275 raises ViewDefinitionError from Visual3d is static;
277 SetBgGradientStyle( me : mutable;
278 FillStyle : GradientFillMethod from Aspect;
279 update : Boolean from Standard )
282 -- Category: Methods to modify the class definition
283 -- Warning: Raises ViewDefinitionError if the associated
284 -- window isn't defined.
285 raises ViewDefinitionError from Visual3d is static;
287 SetBackFacingModel ( me : mutable;
288 aModel : TypeOfBackfacingModel from Visual3d
291 ---Purpose : Manages display of the back faces
293 BackFacingModel ( me )
294 returns TypeOfBackfacingModel from Visual3d is static;
296 ---Purpose : Returns current state of the back faces display
298 SetContext ( me : mutable;
299 CTX : ContextView from Visual3d )
302 ---Purpose: Sets the context <CTX> in the view <me>.
303 ---Category: Methods to modify the class definition
305 SetTransform ( me : mutable;
306 AMatrix : Array2OfReal from TColStd )
308 ---Purpose: Sets the transformation matrix that is applied
309 -- to <MyViewOrientation> field of the view <me>.
311 -- <AMatrix> is defined as a 4*4 real matrix.
313 -- -------------------
314 -- | a11 a12 a13 t1 |
315 -- | a21 a22 a23 t2 |
316 -- | a31 a32 a33 t3 |
318 -- -------------------
320 -- Category: Methods to modify the class definition
321 -- Warning: Raises TransformError if the matrix isn't a 4x4 matrix.
322 raises TransformError from Visual3d is static;
324 SetViewMapping ( me : mutable;
325 VM : ViewMapping from Visual3d )
328 ---Purpose: Modifies the mapping of the view <me>.
329 ---Category: Methods to modify the class definition
331 SetViewMappingDefault ( me : mutable )
334 ---Purpose: Saves the current mapping which will be the
335 -- reference value for the reset of the mapping
336 -- done by the ViewmappingReset method.
337 ---Category: Methods to modify the class definition
339 SetViewOrientation ( me : mutable;
340 VO : ViewOrientation from Visual3d )
343 ---Purpose: Modifies the orientation of <me>.
344 ---Category: Methods to modify the class definition
346 SetViewOrientationDefault ( me : mutable )
349 ---Purpose: Saves the current orientation which will be the
350 -- reference value for the reset of the orientation
351 -- done by the ViewOrientationReset method.
352 ---Category: Methods to modify the class definition
354 SetWindow ( me : mutable;
355 AWindow : Window from Aspect )
357 ---Purpose: Associates the window <AWindow> to the view <me>.
358 -- No new association if the window is already defined.
359 -- Category: Methods to modify the class definition
360 -- Warning: Raises ViewDefinitionError if it is impossible
361 -- to associate a view and a window.
362 -- (association already done or another problem)
363 -- Modifies the viewmapping of the associated view
364 -- when it calls the SetRatio method.
365 raises ViewDefinitionError from Visual3d is static;
367 -- After this call, each view is mapped in an unique window.
369 -- Programming example :
371 -- An example when we have 1 view and 1 window
372 -- -------------------------------------------
374 -- Handle(Aspect_DisplayConnection) aDisplayConnection;
376 -- // Display connection initialization only needed on Linux platform
377 -- // and on Mac OS X, in cases when you use Xlib for windows drawing.
378 -- aDisplayConnection = new Aspect_DisplayConnection();
380 -- // Graphic driver initialization
381 -- Handle(Graphic3d_GraphicDriver) aGraphicDriver =
382 -- Graphic3d::InitGraphicDriver (aDisplayConnection);
384 -- // Define a view manager
385 -- Handle(Visual3d_ViewManager) aVisualManager = new Visual3d_ViewManager (aGraphicDriver);
388 -- Handle(Visual3d_View) aView = new Visual3d_View (aVisaulManager);
390 -- // Define a window
391 -- Handle(Xw_Window) aWindow = new Xw_Window
392 -- (aDisplayConnection, "Graphic View 1", 0.695, 0.695, 0.600, 0.600, Quantity_NOC_MATRAGRAY);
394 -- // Associate the view and the window
395 -- aView->SetWindow (aWindow);
400 -- // Activate the view
401 -- aView->Activate ();
404 SetWindow ( me : mutable;
405 AWindow : Window from Aspect;
406 AContext: RenderingContext from Aspect;
407 ADisplayCB: GraphicCallbackProc from Aspect;
408 AClientData: Address from Standard
411 ---Purpose: Associates the window <AWindow> and context <AContext>
413 -- If <AContext> is not NULL the graphic context is used
414 -- directly to draw something in this view.
415 -- Otherwise an internal context is created.
416 -- If <ADisplayCB> is not NULL then a user display CB is
417 -- call at the end of the OCC graphic traversal and just
418 -- before the swap of buffers. The <aClientData> is pass
419 -- to this call back.
420 -- No new association if the window is already defined.
421 -- Category: Methods to modify the class definition
422 -- Warning: Raises ViewDefinitionError if it is impossible
423 -- to associate a view and a window.
424 -- (association already done or another problem)
425 -- Modifies the viewmapping of the associated view
426 -- when it calls the SetRatio method.
427 raises ViewDefinitionError from Visual3d is static;
429 -- After this call, each view is mapped in an unique window.
431 Update ( me : mutable )
434 ---Purpose: Updates screen in function of modifications of
436 ---Category: Methods to modify the class definition
438 Update ( me : mutable;
439 AnUnderLayer : Layer from Visual3d;
440 AnOverLayer : Layer from Visual3d )
443 ---Purpose: Updates screen in function of modifications of
445 ---Category: Methods to modify the class definition
447 ViewMappingReset ( me : mutable )
450 ---Purpose: Sets the value of the mapping to be the same as
451 -- the mapping saved by the SetViewMappingDefaut method.
452 ---Category: Methods to modify the class definition
454 ViewOrientationReset ( me : mutable )
457 ---Purpose: Sets the value of the orientation to be the same as the
458 -- orientation saved by the SetViewOrientationDefaut method.
459 ---Category: Methods to modify the class definition
461 ---------------------------------------------------
462 -- Category: Methods to modify the class definition
464 ---------------------------------------------------
466 SetAnimationModeOn ( me : mutable;
467 degenerate : Boolean from Standard = Standard_False )
470 ---Purpose: Activates animation mode with an optional degeneration
471 -- according to the TypeOfDegenerateModel of each graphic structure
472 -- When the animation mode is activated in the view,
473 -- all Graphic3d_Structure are stored in a graphic object.
474 -- Warning: only ONE view may have animation mode turned on
476 ---Category: Methods to modify the class definition
478 SetAnimationModeOff ( me : mutable )
481 ---Purpose: Deactivates the animation mode.
482 ---Category: Methods to modify the class definition
484 AnimationModeIsOn ( me )
485 returns Boolean from Standard
488 ---Purpose: Returns the activity of the animation mode.
489 ---Category: Inquire methods
491 ---------------------------------------------------
492 -- Category: Methods to modify the class definition
494 ---------------------------------------------------
496 SetDegenerateModeOn ( me : mutable )
499 ---Purpose: Activates degenerate mode.
500 -- When the degenerate mode is activated in the view,
501 -- all Graphic3d_Structure with the type TOS_COMPUTED
502 -- displayed in this view are not computed.
503 ---Category: Methods to modify the class definition
505 SetDegenerateModeOff ( me : mutable )
508 ---Purpose: Deactivates the degenerate mode.
509 ---Category: Methods to modify the class definition
511 DegenerateModeIsOn ( me )
512 returns Boolean from Standard
515 ---Purpose: Returns the activity of the degenerate mode.
516 ---Category: Inquire methods
518 SetComputedMode ( me : mutable; aMode : Boolean from Standard ) is static;
520 ---Purpose: Switches computed HLR mode in the view
521 ---Category: Methods to modify the class definition
523 ComputedMode ( me ) returns Boolean from Standard is static;
525 ---Purpose: Returns the computed HLR mode state
526 ---Category: Inquire methods
528 ---------------------------------------------------
529 -- Category: Methods to modify the class definition
531 ---------------------------------------------------
533 ZBufferTriedronSetup ( me : mutable;
534 XColor : NameOfColor from Quantity = Quantity_NOC_RED;
535 YColor : NameOfColor from Quantity = Quantity_NOC_GREEN;
536 ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1;
537 SizeRatio : Real from Standard = 0.8;
538 AxisDiametr : Real from Standard = 0.05;
539 NbFacettes : Integer from Standard = 12)
542 ---Purpose: Customization of the ZBUFFER Triedron.
543 --- Initializes Colors of X Y and axis
544 --- Scale ratio defines decreasing of trihedron size when
545 --- its position is out of a View
547 TriedronDisplay ( me : mutable;
548 APosition : TypeOfTriedronPosition from Aspect = Aspect_TOTP_CENTER;
549 AColor : NameOfColor from Quantity = Quantity_NOC_WHITE ;
550 AScale : Real from Standard = 0.02;
551 AsWireframe : Boolean from Standard = Standard_True )
554 ---Purpose: Display of the Triedron.
555 --- Initialize position, color and length of Triedron axes.
556 --- The scale is a percent of the window width.
557 --- If AsWireframe is FALSE triedron is shown in shaded mode
558 --- AColor is not considered for ZBUFFER mode
561 TriedronErase ( me : mutable )
564 ---Purpose: Erases the Triedron.
567 TriedronEcho ( me : mutable;
568 AType : TypeOfTriedronEcho from Aspect = Aspect_TOTE_NONE )
571 ---Purpose: Highlights the echo zone of the Triedron.
574 ------------------------------------------
575 ---Category: Graduated trihedron
576 ------------------------------------------
578 GetGraduatedTrihedron(me;
580 xname, yname, zname : out ExtendedString from TCollection;
582 xdrawname, ydrawname, zdrawname : out Boolean from Standard;
584 xdrawvalues, ydrawvalues, zdrawvalues : out Boolean from Standard;
586 drawgrid : out Boolean from Standard;
588 drawaxes : out Boolean from Standard;
589 -- Number of splits along axes --
590 nbx, nby, nbz : out Integer from Standard;
591 -- Offset for drawing values --
592 xoffset, yoffset, zoffset : out Integer from Standard;
593 -- Offset for drawing names of axes --
594 xaxisoffset, yaxisoffset, zaxisoffset : out Integer from Standard;
596 xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : out Boolean from Standard;
597 -- Length of tickmarks --
598 xtickmarklength, ytickmarklength, ztickmarklength : out Integer from Standard;
600 gridcolor : out Color from Quantity;
601 -- Colors of axis names --
602 xnamecolor, ynamecolor, znamecolor : out Color from Quantity;
603 -- Colors of axis and values --
604 xcolor, ycolor, zcolor : out Color from Quantity;
605 -- Name of font for names of axes --
606 fontOfNames : out AsciiString from TCollection;
607 -- Style of names of axes --
608 styleOfNames : out FontAspect from Font;
609 -- Size of names of axes --
610 sizeOfNames : out Integer from Standard;
611 -- Name of font for values --
612 fontOfValues : out AsciiString from TCollection;
613 -- Style of values --
614 styleOfValues : out FontAspect from Font;
616 sizeOfValues : out Integer from Standard)
617 returns Boolean from Standard
619 ---Purpose: Returns data of a graduated trihedron if displayed (return value is True)
621 GraduatedTrihedronDisplay(me : mutable;
623 xname, yname, zname : ExtendedString from TCollection;
625 xdrawname, ydrawname, zdrawname : Boolean from Standard;
627 xdrawvalues, ydrawvalues, zdrawvalues : Boolean from Standard;
629 drawgrid : Boolean from Standard;
631 drawaxes : Boolean from Standard;
632 -- Number of splits along axes --
633 nbx, nby, nbz : Integer from Standard;
634 -- Offset for drawing values --
635 xoffset, yoffset, zoffset : Integer from Standard;
636 -- Offset for drawing names of axes --
637 xaxisoffset, yaxisoffset, zaxisoffset : Integer from Standard;
639 xdrawtickmarks, ydrawtickmarks, zdrawtickmarks : Boolean from Standard;
640 -- Length of tickmarks --
641 xtickmarklength, ytickmarklength, ztickmarklength : Integer from Standard;
643 gridcolor : Color from Quantity;
644 -- Colors of axis names --
645 xnamecolor, ynamecolor, znamecolor : Color from Quantity;
646 -- Colors of axis and values --
647 xcolor, ycolor, zcolor : Color from Quantity;
648 -- Name of font for names of axes --
649 fontOfNames : AsciiString from TCollection;
650 -- Style of names of axes --
651 styleOfNames : FontAspect from Font;
652 -- Size of names of axes --
653 sizeOfNames : Integer from Standard;
654 -- Name of font for values --
655 fontOfValues : AsciiString from TCollection;
656 -- Style of values --
657 styleOfValues : FontAspect from Font;
659 sizeOfValues : Integer from Standard)
660 ---Purpose: Displays a graduated trihedron.
663 GraduatedTrihedronErase(me : mutable)
664 ---Purpose: Erases a graduated trihedron from the view.
667 ----------------------------
668 ---Category: Inquire methods
669 ----------------------------
672 returns Background from Aspect
675 ---Purpose: Returns the value of the default window background.
677 GradientBackground ( me )
678 returns GradientBackground from Aspect
681 ---Purpose: Returns the value of the window background.
684 returns Boolean from Standard
687 ---Purpose: Returns Standard_True if one of the structures
688 -- displayed in the view <me> contains Polygons,
689 -- Triangles or Quadrangles.
692 ASet : MapOfStructure from Graphic3d )
693 returns Boolean from Standard
696 ---Purpose: Returns Standard_True if one of the structures
697 -- in the set <ASet> contains Polygons, Triangles
701 returns ContextView from Visual3d
704 ---Purpose: Returns the current context of the view <me>.
705 ---C++: return const &
707 DisplayedStructures ( me; SG: in out MapOfStructure from Graphic3d )
710 ---Purpose: Returns the set of structures displayed in
714 returns Boolean from Standard
717 ---Purpose: Returns the activity flag of the view <me>.
720 returns Boolean from Standard
723 ---Purpose: Returns True if the window associated to the view
727 returns Boolean from Standard
730 ---Purpose: Returns Standard_True is the view <me> is deleted.
731 -- <me> is deleted after the call Remove (me).
732 ---Category: Inquire methods
735 XMin, YMin, ZMin : out Real from Standard;
736 XMax, YMax, ZMax : out Real from Standard )
739 ---Purpose: Returns the coordinates of the boundary box of all
740 -- structures displayed in the view <me>.
743 ASet : MapOfStructure from Graphic3d;
744 XMin, YMin, ZMin : out Real from Standard;
745 XMax, YMax, ZMax : out Real from Standard )
748 ---Purpose: Returns the coordinates of the boundary box of all
749 -- structures in the set <ASet>.
751 MinMaxValues ( me : mutable;
752 XMin, YMin : out Real from Standard;
753 XMax, YMax : out Real from Standard )
756 ---Purpose: Returns the coordinates of the projection of the
757 -- boundary box of all structures displayed in the view <me>.
759 MinMaxValues ( me : mutable;
760 ASet : MapOfStructure from Graphic3d;
761 XMin, YMin : out Real from Standard;
762 XMax, YMax : out Real from Standard )
765 ---Purpose: Returns the coordinates of the projection of the
766 -- boundary box of all structures in the set <ASet>.
768 NumberOfDisplayedStructures ( me )
769 returns Integer from Standard
772 ---Purpose: Returns number of displayed structures in
775 Projects ( me : mutable;
776 AX, AY, AZ : Real from Standard;
777 APX, APY, APZ : out Real from Standard )
780 ---Purpose: Returns the coordinates of the projection of the
781 -- 3d coordinates <AX>, <AY>, <AZ>.
784 returns Array2OfReal from TColStd
787 ---Purpose: Returns the transformation associated to the view <me>
788 ---C++: return const &
791 returns ViewMapping from Visual3d
794 ---Purpose: Returns the current mapping of the view <me>.
796 ViewMappingDefault ( me )
797 returns ViewMapping from Visual3d
800 ---Purpose: Returns the current reset mapping of the view <me>.
802 ViewOrientation ( me )
803 returns ViewOrientation from Visual3d
806 ---Purpose: Returns the current orientation of the view <me>.
808 ViewOrientationDefault ( me )
809 returns ViewOrientation from Visual3d
812 ---Purpose: Returns the current reset orientation of the view <me>.
815 returns Window from Aspect
817 ---Purpose: Returns the window associated to the view <me>.
818 -- Warning: Raises ViewDefinitionError if the associated
819 -- window isn't defined.
820 raises ViewDefinitionError from Visual3d is static;
822 LightLimit ( me ) returns Integer is static;
824 ---Purpose: Returns the MAX number of light associated to the view <me>.
826 PlaneLimit ( me ) returns Integer is static;
828 ---Purpose: Returns the MAX number of clipping planes
829 -- associated to the view <me>.
831 ViewManager ( me ) returns ViewManager from Visual3d is static;
833 ---Purpose: Returns the view manager handle which manage this view
835 ----------------------------
836 -- Category: Private methods
837 ----------------------------
840 AStructure : Structure from Graphic3d )
841 returns TypeOfAnswer from Visual3d
844 ---Purpose: Is it possible to display the structure
845 -- <AStructure> in the view <me> ?
846 ---Category: Private methods
848 ReCompute ( me : mutable;
849 AStructure : Structure from Graphic3d );
851 ---Purpose: Computes the new presentation of the
852 -- structure <AStructure> displayed in <me>
853 -- with the type Graphic3d_TOS_COMPUTED.
854 ---Category: Private methods
856 Compute ( me : mutable ) is static private;
858 ---Purpose: Computes the new presentation of the
859 -- Structures displayed in <me> with the type
860 -- Graphic3d_TOS_COMPUTED.
861 ---Category: Private methods
863 ChangeDisplayPriority ( me : mutable;
864 AStructure : Structure from Graphic3d;
865 OldPriority : Integer from Standard;
866 NewPriority : Integer from Standard )
869 ---Purpose: Changes the display priority of the structure <AStructure>.
870 ---Category: Private methods
872 AddZLayer ( me : mutable;
873 theLayerId : Integer from Standard )
875 ---Purpose: Add a new top-level Z layer to the view with ID
876 -- <theLayerId>. The z layer mechanism allows to display
877 -- structures in higher layers in overlay of structures in lower layers.
878 -- The layers in a particular view should be managed centrally
879 -- by its view manager so to avoid IDs mismatching and provide correct
880 -- display of graphics in all views.
882 RemoveZLayer ( me : mutable;
883 theLayerId : Integer from Standard )
885 ---Purpose: Remove z layer from the view by its ID.
887 ChangeZLayer ( me : mutable;
888 theStructure : Structure from Graphic3d;
889 theLayerId : Integer from Standard )
891 ---Purpose: Change Z layer of already displayed structure in the view.
893 Clear ( me : mutable;
894 AStructure : Structure from Graphic3d;
895 WithDestruction : Boolean from Standard )
898 ---Purpose: Clears the structure <AStructure> to the view <me>.
899 ---Category: Private methods
901 Connect ( me : mutable;
902 AMother : Structure from Graphic3d;
903 ADaughter : Structure from Graphic3d )
906 ---Purpose: Connects the structures <AMother> and <ADaughter>.
907 ---Category: Private methods
909 Disconnect ( me : mutable;
910 AMother : Structure from Graphic3d;
911 ADaughter : Structure from Graphic3d )
914 ---Purpose: Disconnects the structures <AMother> and <ADaughter>.
915 ---Category: Private methods
917 Display ( me : mutable;
918 AStructure : Structure from Graphic3d )
921 ---Purpose: Display the structure <AStructure> to the view <me>.
922 ---Category: Private methods
924 Display ( me : mutable;
925 AStructure : Structure from Graphic3d;
926 AnUpdateMode : TypeOfUpdate from Aspect )
929 ---Purpose: Display the structure <AStructure> to the view <me>.
930 ---Category: Private methods
932 Erase ( me : mutable;
933 AStructure : Structure from Graphic3d )
936 ---Purpose: Erases the structure <AStructure> from the view <me>.
937 ---Category: Private methods
939 Erase ( me : mutable;
940 AStructure : Structure from Graphic3d;
941 AnUpdateMode : TypeOfUpdate from Aspect )
944 ---Purpose: Erases the structure <AStructure> from the view <me>.
945 ---Category: Private methods
947 Highlight ( me : mutable;
948 AStructure : Structure from Graphic3d;
949 AMethod : TypeOfHighlightMethod from Aspect )
952 ---Purpose: Highlights the structure <AStructure> in the view <me>.
953 ---Category: Private methods
955 SetTransform ( me : mutable;
956 AStructure : Structure from Graphic3d;
957 ATrsf : Array2OfReal from TColStd )
960 ---Purpose: Transforms the structure <AStructure> in the view <me>.
961 ---Category: Private methods
963 UnHighlight ( me : mutable;
964 AStructure : Structure from Graphic3d )
967 ---Purpose: Suppress the highlighting on the structure <AStructure>
969 ---Category: Private methods
972 AStructure : Structure from Graphic3d )
973 returns Integer from Standard
976 ---Purpose: Returns an index != 0 if the structure <AStructure>
977 -- have another structure computed for the view <me>.
978 ---Category: Private methods
980 Identification ( me )
981 returns Integer from Standard
984 ---Purpose: Returns the identification number of the view <me>.
985 ---Category: Private methods
988 AStructure : Structure from Graphic3d )
989 returns Boolean from Standard
992 ---Purpose: Returns true if the structure <AStructure> is
993 -- displayed in the view <me>.
994 ---Category: Private methods
996 MatrixOfMapping ( me : mutable )
997 returns Array2OfReal from TColStd
998 is static; -- private;
999 ---C++: return const &
1001 ---Purpose: Returns the current matrix of mapping of the view <me>.
1002 -- Warning: Stores the current matrix of mapping.
1004 MatrixOfOrientation ( me : mutable )
1005 returns Array2OfReal from TColStd
1006 is static; -- private;
1007 ---C++: return const &
1009 ---Purpose: Returns the current matrix of orientation of the view <me>.
1010 -- Warning: Stores the current matrix of orientation.
1012 SetRatio ( me : mutable )
1015 ---Purpose: Modifies the aspect ratio of the view <me> when the
1016 -- associated window is defined or resized.
1017 ---Category: Private methods
1019 UpdateLights ( me : mutable )
1022 ---Purpose: Updates the lights when the associated window is defined
1023 -- and when the view is activated.
1024 ---Category: Private methods
1026 UpdatePlanes ( me : mutable )
1029 ---Purpose: Updates the planes when the associated window is defined
1030 -- and when the view is activated.
1031 ---Category: Private methods
1033 UpdateView ( me : mutable )
1036 ---Purpose: Updates the associated c structure before a call to the
1038 ---Category: Private methods
1040 -----------------------------
1041 -- Category: Internal methods
1042 -----------------------------
1045 returns Address from Standard
1048 ---Purpose: Returns the c structure associated to <me>.
1049 ---Category: Private methods
1051 GraphicDriver ( me )
1052 returns GraphicDriver from Graphic3d
1055 ---Purpose: Returns the associated GraphicDriver.
1056 ---Category: Internal methods
1057 ---C++: return const &
1059 HaveTheSameOwner ( me;
1060 AStructure : Structure from Graphic3d )
1061 returns Integer from Standard
1064 ---Purpose: Returns an index != 0 if the structure <AStructure>
1065 -- have the same owner than another structure in the
1066 -- sequence of the computed structures.
1067 ---Category: Private methods
1070 APlotter : Plotter from Graphic3d )
1073 ---Purpose: Calls the method Plot for each Structure
1074 -- displayed in <me>.
1075 ---Category: Private methods
1077 Print (me; AnUnderLayer : Layer from Visual3d;
1078 AnOverLayer : Layer from Visual3d;
1079 hPrnDC : Handle from Aspect;
1080 showBackground : Boolean;
1082 printAlgorithm : PrintAlgo from Aspect = Aspect_PA_STRETCH;
1083 theScaleFactor : Real from Standard = 1.0)
1084 returns Boolean from Standard is static;
1087 ---Purpose: print the contents of all layers of the view to the printer.
1088 -- <hPrnDC> : Pass the PrinterDeviceContext (HDC),
1089 -- <showBackground> : When set to FALSE then print the view without background color
1090 -- (background is white)
1091 -- else set to TRUE for printing with current background color.
1092 -- <filename>: If != NULL, then the view will be printed to a file.
1093 -- <printAlgo>: Select print algorithm: stretch, tile.
1094 -- <theScaleFactor>: Scaling coefficient, used internally to scale the
1095 -- printings accordingly to the scale factor selected in the printer
1096 -- properties dialog.
1097 -- Returns Standard_True if the data is passed to the printer, otherwise
1098 -- Standard_False if the print operation failed due to printer error
1099 -- or insufficient memory.
1100 -- Warning: Works only under Windows.
1102 Print (me; hPrnDC : Handle from Aspect;
1103 showBackground : Boolean;
1105 printAlgorithm : PrintAlgo from Aspect = Aspect_PA_STRETCH;
1106 theScaleFactor : Real from Standard = 1.0 )
1107 returns Boolean from Standard is static;
1110 ---Purpose: print the contents of the view to printer.
1111 -- <hPrnDC> : Pass the PrinterDeviceContext (HDC),
1112 -- <showBackground> : When set to FALSE then print the view without background color
1113 -- (background is white)
1114 -- else set to TRUE for printing with current background color.
1115 -- <filename>: If != NULL, then the view will be printed to a file.
1116 -- <printAlgo>: Select print algorithm: stretch, tile.
1117 -- <theScaleFactor>: Scaling coefficient, used internally to scale the
1118 -- printings accordingly to the scale factor selected in the printer
1119 -- properties dialog.
1120 -- Returns Standard_True if the data is passed to the printer, otherwise
1121 -- Standard_False if the print operation failed due to printer error
1122 -- or insufficient memory.
1123 -- Warning: Works only under Windows.
1125 SetTransparency ( me : mutable;
1126 AFlag : Boolean from Standard )
1129 ---Purpose: if <AFlag> is Standard_True then the transparency
1130 -- is managed in the view <me>.
1131 -- Default Standard_False
1132 ---Category: Internal methods
1134 ZBufferIsActivated ( me )
1135 returns Boolean from Standard
1138 ---Purpose: Returns Standard_True if the ZBuffer is activated
1139 -- in the view <me> and Standard_False if not.
1140 ---Category: Internal methods
1142 SetZBufferActivity ( me : mutable; AnActivity : Integer from Standard )
1145 ---Purpose: Activates the ZBuffer if the integer <AnActivity>
1147 -- Deactivates the ZBuffer if the integer <AnActivity>
1149 -- If the integer <AnActivity> is equal to -1 then
1150 -- - the ZBuffer is activated if
1151 -- me->Context ().Visualization () == Visual3d_TOV_SHADING
1152 -- - the ZBuffer is deactivated if
1153 -- me->Context ().Visualization () == Visual3d_TOV_WIREFRAME
1154 ---Category: Internal methods
1157 returns Layer from Visual3d;
1159 ---Purpose: Returns the underlay of the view <me>.
1160 ---Category: Private methods
1161 ---C++: return const &
1164 returns Layer from Visual3d;
1166 ---Purpose: Returns the underlay of the view <me>.
1167 ---Category: Private methods
1168 ---C++: return const &
1170 EnableDepthTest( me; enable : Boolean from Standard )
1173 ---Purpose: turns on/off opengl depth
1175 IsDepthTestEnabled( me ) returns Boolean from Standard
1178 ---Purpose: returns current state of the opengl depth testing
1180 ReadDepths( me; x,y,width,height: Integer from Standard;
1183 ---Purpose: Reads depths of shown pixels of the given rectangle
1185 FBOCreate( me : mutable; width,height: Integer from Standard )
1186 returns PtrFrameBuffer from Graphic3d
1189 ---Purpose: Generate offscreen FBO in the graphic library
1191 FBORelease( me : mutable;
1192 fboPtr : in out PtrFrameBuffer from Graphic3d )
1195 ---Purpose: Remove offscreen FBO from the graphic library
1197 FBOGetDimensions( me : mutable;
1198 fboPtr : PtrFrameBuffer from Graphic3d;
1199 width, height : out Integer from Standard;
1200 widthMax, heightMax : out Integer from Standard )
1203 ---Purpose: Read offscreen FBO configuration.
1205 FBOChangeViewport( me : mutable;
1206 fboPtr : in out PtrFrameBuffer from Graphic3d;
1207 width, height : Integer from Standard )
1210 ---Purpose: Change offscreen FBO viewport.
1212 BufferDump( me : mutable;
1213 theImage : in out PixMap from Image;
1214 theBufferType : BufferType from Graphic3d )
1215 returns Boolean from Standard
1218 ---Purpose: Dump active rendering buffer into specified memory buffer.
1220 EnableGLLight( me; enable : Boolean from Standard )
1223 ---Purpose: turns on/off opengl lighting, currently used in triedron displaying
1225 IsGLLightEnabled( me ) returns Boolean from Standard
1228 ---Purpose: returns the current state of the gl lighting
1229 -- currently used in triedron displaying
1232 theFileName : CString from Standard;
1233 theFormat : ExportFormat from Graphic3d;
1234 theSortType : SortType from Graphic3d = Graphic3d_ST_BSP_Tree;
1235 thePrecision : Real from Standard = 0.005;
1236 theProgressBarFunc : Address from Standard = NULL;
1237 theProgressObject : Address from Standard = NULL )
1238 returns Boolean from Standard;
1240 -- Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
1241 -- In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer).
1242 -- Notice however that results may differ a lot and do not contain some elements.
1247 -- Classe : Visual3d_View
1249 -- Purpose : Declaration of the variables specific to views.
1251 -- Reminder : A view is defined by:
1255 -- - a ViewOrientation
1258 -- the associated C structure
1259 MyCView : CView from Graphic3d;
1261 -- the context of the view : Aliasing, Depth-Cueing, Lights ...
1262 MyContext : ContextView from Visual3d;
1264 -- the current mapping of the view
1265 MyViewMapping : ViewMapping from Visual3d;
1267 -- the reset mapping of the view
1268 MyViewMappingReset : ViewMapping from Visual3d;
1270 -- the current orientation of the view
1271 MyViewOrientation : ViewOrientation from Visual3d;
1273 -- the reset orientation of the view
1274 MyViewOrientationReset : ViewOrientation from Visual3d;
1276 -- the associated window
1277 MyWindow : Window from Aspect;
1279 -- the transformation
1280 MyTransformation : Array2OfReal from TColStd;
1282 -- the matrix management
1283 MyMatrixOfMapping : Array2OfReal from TColStd;
1284 MyMatrixOfOrientation : Array2OfReal from TColStd;
1286 -- association Structure_COMPUTE and Structure_Computed
1287 MyTOCOMPUTESequence : SequenceOfStructure from Graphic3d;
1288 MyCOMPUTEDSequence : SequenceOfStructure from Graphic3d;
1290 -- the graphic driver used
1291 MyGraphicDriver : GraphicDriver from Graphic3d;
1293 -- the background of the associated window
1294 MyBackground : Background from Aspect;
1296 -- the gradient background of the associated window
1297 MyGradientBackground : GradientBackground from Aspect;
1299 -- the displayed structures in the view
1300 MyDisplayedStructure : MapOfStructure from Graphic3d;
1302 -- the ViewManager associated with the view
1303 -- MyPtrViewManager : Address from Standard;
1304 MyPtrViewManager : ViewManagerPtr from Visual3d;
1307 MyCBitFields : CBitFields8 from Graphic3d;
1309 MyGTrihedron : CGraduatedTrihedron from Graphic3d;
1313 class ViewManager from Visual3d