2 -- Created: Fri Jan 17 11:23:08 1992
4 -- Modified FMN - 02/02/98 -> Specifique UNIX
5 -- CAL - 16/07/98 -> S3892. Ajout grilles 3d.
6 -- GG - 15/12/99 -> GER61351 Add SetDefaultBackgroundColor()
7 -- and DefaultBackgroundColor() methods
8 -- GG - 20/01/00 -> IMP200100 Add GridDrawMode() method
9 -- GG - 24/01/00 -> IMP240100 Add SetGridEcho() methods
10 -- Add GridEcho() method.
11 -- Add ShowGridEcho() private method
12 -- SAV - 26/11/02 -> Add new field to store grid echo aspect
14 ---Copyright: Matra Datavision 1992
20 ---Purpose: Defines services on Viewer type objects.
21 -- The methods of this class allow editing and
22 -- interrogation of the parameters linked to the viewer
23 -- its friend classes (View,light,plane).
25 ---Keywords: Viewer,Default Attributes
35 GraphicDevice from Aspect,
36 TypeOfUpdate from V3d,
37 TypeOfVisualization from V3d,
38 TypeOfShadingModel from V3d,
39 TypeOfSurfaceDetail from V3d,
40 TypeOfOrientation from V3d,
44 ListOfTransient from V3d,
45 ListIteratorOfListOfTransient from TColStd,
46 SequenceOfInteger from TColStd,
48 Vector from Graphic3d,
49 ViewManager from Visual3d,
50 NameOfColor from Quantity,
51 TypeOfColor from Quantity,
54 PlaneAngle from Quantity,
55 Background from Aspect,
56 GradientBackground from Aspect,
57 Parameter from Quantity,
58 OrthographicView from V3d,
59 PerspectiveView from V3d,
60 AsciiString,ExtendedString from TCollection,
61 Ax3 from gp,Structure from Graphic3d,
62 Vertex from Graphic3d,
64 AspectMarker3d from Graphic3d,
65 RectangularGrid from V3d,
66 CircularGrid from V3d,
69 GridDrawMode from Aspect,
70 GradientFillMethod from Aspect
78 Create ( Device : GraphicDevice from Aspect;
79 aName : ExtString from Standard;
80 aDomain : CString from Standard = "";
81 ViewSize : Length from Quantity = 1000.0 ;
82 ViewProj : TypeOfOrientation from V3d= V3d_XposYnegZpos ;
83 ViewBackground : NameOfColor from Quantity = Quantity_NOC_GRAY30;
84 Visualization : TypeOfVisualization from V3d = V3d_ZBUFFER;
85 ShadingModel : TypeOfShadingModel from V3d = V3d_GOURAUD ;
86 UpdateMode : TypeOfUpdate from V3d = V3d_WAIT;
87 ComputedMode : Boolean from Standard = Standard_True;
88 DefaultComputedMode: Boolean from Standard = Standard_True;
89 SurfaceDetail : TypeOfSurfaceDetail from V3d = V3d_TEX_NONE)
90 returns mutable Viewer from V3d
91 ---Purpose: Create a Viewer on the given device with the given parameters or
92 -- with their default values.
93 raises BadValue from Viewer ;
94 ---Purpose: If the size of the view is <= 0
95 -- if ComputedMode is false, only the degenerate mode will be used.
97 -- Warning: Client must creates a graphic-device of type
98 -- Graphic3d_GraphicDevice under UNIX
99 -- or Graphic3d_WNTGraphicDevice under WindowsNT
101 CreateView (me: mutable) returns mutable View from V3d;
103 ---Purpose: creates a view in the viewer according to its
104 -- default parameters.
106 DefaultOrthographicView(me: mutable) returns mutable OrthographicView from V3d;
108 DefaultPerspectiveView(me: mutable) returns mutable PerspectiveView from V3d;
110 -------------------------------------------------------
111 ---Category: Methods to modify the status of the viewer
112 -------------------------------------------------------
114 SetViewOn (me:mutable );
116 ---Purpose: Activates all of the views of a viewer attached
119 SetViewOn (me:mutable; View : View from V3d )
121 ---Purpose: Activates a particular view in the Viewer .
122 -- Must be call if the Window attached to the view
123 -- has been Deiconified .
124 raises BadValue from Viewer;
125 -- If the view is not mapped on the window.
127 SetViewOff (me:mutable);
129 ---Purpose: Deactivates all the views of a Viewer
130 -- attached to a window.
132 SetViewOff (me:mutable; View : View from V3d)
134 ---Purpose: Deactivates a particular view in the Viewer.
135 -- Must be call if the Window attached to the view
136 -- has been Iconified .
137 raises BadValue from Viewer;
138 -- If the view is not mapped on the window.
140 Update (me:mutable ) is redefined static;
142 ---Purpose: Updates the display of all the views of a viewer.
143 -- Must be called when the views must be updated
144 -- simultaneously while the Update mode is deferred (WAIT).
146 UpdateLights (me: mutable);
148 ---Purpose: Updates the lights of all the views of a viewer.
152 ---Purpose: Redraws all the views of the Viewer even if no
153 -- modification has taken place. Must be called if
154 -- all the views of the Viewer are exposed, as for
155 -- example in a global DeIconification.
159 ---Purpose: Suppresses the Viewer.
163 ---Purpose: Erase all Objects in All the views.
167 ---Purpose: UnHighlight all Objects in All the views.
169 SetDefaultBackgroundColor (me:mutable; Type : TypeOfColor; V1, V2, V3 : Parameter );
171 ---Purpose: Defines the default base colour of views attached
172 -- to the Viewer by supplying the type of colour
173 -- definition and the three component values..
175 SetDefaultBackgroundColor (me:mutable; Name : NameOfColor );
177 ---Purpose: Defines the default background colour of views
178 -- attached to the viewer by supplying the name of the
179 -- colour under the form Quantity_NOC_xxxx .
181 SetDefaultBackgroundColor (me:mutable; Color : Color from Quantity);
183 ---Purpose: Defines the default background colour of views
184 -- attached to the viewer by supplying the color object
186 SetDefaultBgGradientColors ( me:mutable;
189 FillStyle : GradientFillMethod from Aspect = Aspect_GFM_HOR );
191 ---Purpose: Defines the default gradient background colours of view
192 -- attached to the viewer by supplying the name of the
193 -- colours under the form Quantity_NOC_xxxx .
195 SetDefaultBgGradientColors ( me : mutable ;
196 Color1 : Color from Quantity;
197 Color2 : Color from Quantity;
198 FillStyle : GradientFillMethod from Aspect = Aspect_GFM_HOR );
200 ---Purpose: Defines the default gradient background colours of views
201 -- attached to the viewer by supplying the colour objects
203 SetDefaultViewSize (me:mutable; Size : Length )
205 ---Purpose: Gives a default size for the creation of views of
207 raises BadValue from Viewer;
208 -- If the size of the view is <= 0
210 SetDefaultViewProj (me:mutable; Orientation : TypeOfOrientation );
212 ---Purpose: Gives the default projection for creating views
215 SetDefaultVisualization(me:mutable; Type : TypeOfVisualization from V3d);
217 ---Purpose: Gives the default visualisation mode..
220 SetZBufferManagment(me: mutable; Automatic: Boolean from Standard);
222 ---Purpose: defines the strategy concerning the ZBuffer activity.
223 -- If Automatic is true, ZBuffer will be activated or
224 -- deactivated depending on the fact that faces exist or
225 -- not in the Viewer. This will optimize the response time
226 -- in the case where only wireframe objects are displayed.
227 -- If Automatic is False, ZBuffer will be activated or
228 -- deactivated depending on the choice of SetVisualization
230 -- Note that by default, the ZBufferManagment is not automatic.
232 ZBufferManagment(me) returns Boolean from Standard;
234 ---Purpose: returns the ZBuffer stategy choice.
236 SetDefaultShadingModel(me:mutable; Type : TypeOfShadingModel from V3d);
238 ---Purpose: Gives the default type of SHADING.
240 SetDefaultSurfaceDetail(me:mutable; Type : TypeOfSurfaceDetail from V3d);
242 ---Purpose: Gives the default type of texture mapping.
244 SetDefaultAngle (me:mutable; Angle : PlaneAngle from Quantity);
247 SetUpdateMode ( me: mutable ; Mode : TypeOfUpdate from V3d );
249 ---Purpose: Defines the mode of regenerating the views making
250 -- up the viewer. This can be immediate <ASAP> or
251 -- deferred <WAIT>. In this latter case, the views are
252 -- updated when the method Update(me) is called.
254 SetDefaultTypeOfView(me:mutable; Type : TypeOfView from V3d);
258 SetPrivilegedPlane(me: mutable; aPlane: Ax3 from gp);
261 PrivilegedPlane(me) returns Ax3 from gp;
264 DisplayPrivilegedPlane(me: mutable; OnOff: Boolean from Standard; aSize: Length from Quantity = 1);
267 SetLightOn(me:mutable; MyLight : Light from V3d )
269 ---Purpose: Activates MyLight in the viewer.
270 raises BadValue from Viewer;
271 -- If No More Light can be activated in MyViewer .
273 SetLightOn(me:mutable)
275 ---Purpose: Activates all the lights defined in this viewer.
276 raises BadValue from Viewer;
277 -- If No More Light can be activated in MyViewer .
279 SetLightOff(me:mutable; MyLight : Light from V3d );
281 ---Purpose: Desactivate MyLight in this viewer.
283 SetLightOff(me:mutable);
285 ---Purpose: Deactivate all the Lights defined in this viewer.
287 DelLight(me:mutable; MyLight : Light from V3d);
289 ---Purpose: Delete Light in Sequence Of Lights.
291 SetCurrentSelectedLight (me : mutable; TheLight : Light from V3d);
293 ---Purpose: Defines the selected light.
295 ClearCurrentSelectedLight (me : mutable);
297 ---Purpose: Defines the selected light at NULL.
299 -----------------------------------------
300 ---Category: Inquire methods
301 -----------------------------------------
303 DefaultBackgroundColor ( me ; Type : TypeOfColor ; V1,V2,V3 : out Parameter);
305 ---Purpose: Returns the default background colour depending of the type.
306 DefaultBackgroundColor ( me ) returns Color from Quantity;
308 ---Purpose: Returns the default background colour object.
310 DefaultBgGradientColors( me;
311 Color1 : out Color from Quantity;
312 Color2 : out Color from Quantity) ;
314 ---Purpose: Returns the gradient background colour objects of the view.
316 DefaultViewSize ( me) returns Length;
318 ---Purpose: Returns the default size of the view.
320 DefaultViewProj ( me) returns TypeOfOrientation;
322 ---Purpose: Returns the default Projection.
324 DefaultVisualization ( me ) returns TypeOfVisualization from V3d;
326 ---Purpose: Returns the default type of Visualization.
328 DefaultShadingModel ( me ) returns TypeOfShadingModel from V3d;
330 ---Purpose: Returns the default type of Shading
332 DefaultSurfaceDetail ( me ) returns TypeOfSurfaceDetail from V3d;
334 ---Purpose: Returns the default type of texture mapping
336 DefaultAngle ( me ) returns PlaneAngle from Quantity;
339 UpdateMode ( me ) returns TypeOfUpdate from V3d;
341 ---Purpose: Returns the regeneration mode of views in the viewer.
343 IfMoreViews( me ) returns Boolean;
345 ---Purpose: Returns True if One View more can be
346 -- activated in this Viewer.
349 ------------------------------
350 ---Category: iteration methods
351 ------------------------------
353 InitActiveViews(me: mutable);
355 ---Purpose: initializes an iteration on the active views.
357 MoreActiveViews (me) returns Boolean from Standard;
359 ---Purpose: returns true if there are more active view(s) to return.
361 NextActiveViews (me: mutable);
363 ---Purpose : Go to the next active view
364 -- (if there is not, ActiveView will raise an exception)
366 ActiveView(me) returns mutable View from V3d;
369 LastActiveView(me) returns Boolean from Standard;
371 ---Purpose: returns true if there is only
374 InitDefinedViews(me: mutable);
376 ---Purpose: initializes an iteration on the Defined views.
379 MoreDefinedViews (me) returns Boolean from Standard;
381 ---Purpose: returns true if there are more Defined view(s) to return.
384 NextDefinedViews (me: mutable);
386 ---Purpose : Go to the next Defined view
387 -- (if there is not, DefinedView will raise an exception)
389 DefinedView(me) returns View from V3d;
392 InitActiveLights(me: mutable);
394 ---Purpose: initializes an iteration on the active Lights.
396 MoreActiveLights (me) returns Boolean from Standard;
398 ---Purpose: returns true if there are more active Light(s) to return.
401 NextActiveLights (me: mutable);
403 ---Purpose : Go to the next active Light
404 -- (if there is not, ActiveLight will raise an exception)
407 ActiveLight(me) returns mutable Light from V3d;
410 InitDefinedLights(me: mutable);
412 ---Purpose: initializes an iteration on the Defined Lights.
414 MoreDefinedLights (me) returns Boolean from Standard;
416 ---Purpose: returns true if there are more Defined Light(s) to return.
418 NextDefinedLights (me: mutable);
420 ---Purpose : Go to the next Defined Light
421 -- (if there is not, DefinedLight will raise an exception)
423 DefinedLight(me) returns Light from V3d;
426 AddPlane( me: mutable; MyPlane : Plane from V3d);
427 ---Purpose: Adds Plane in Sequence Of Planes.
429 DelPlane( me: mutable; MyPlane : Plane from V3d);
430 ---Purpose: Delete Plane in Sequence Of Planes.
432 InitDefinedPlanes(me: mutable);
434 ---Purpose: initializes an iteration on the Defined Planes.
436 MoreDefinedPlanes (me) returns Boolean from Standard;
438 ---Purpose: returns true if there are more Defined Plane(s) to return.
440 NextDefinedPlanes (me: mutable);
442 ---Purpose : Go to the next Defined Plane
443 -- (if there is not, DefinedPlane will raise an exception)
445 DefinedPlane(me) returns Plane from V3d;
448 Viewer (me) returns mutable ViewManager ;
450 ---Purpose: Returns the viewer associated to Visual3d .
452 CurrentSelectedLight (me) returns Light from V3d;
454 ---Purpose: Returns the Selected Light.
456 IsGlobalLight (me; TheLight : Light from V3d) returns Boolean;
459 ComputedMode(me) returns Boolean from Standard;
461 ---Purpose: returns true if the computed mode can be used.
463 DefaultComputedMode(me) returns Boolean from Standard;
465 ---Purpose: returns true if by default the computed mode must be used.
467 -----------------------------------------
468 ---Category: grid management
469 -----------------------------------------
471 ActivateGrid (me : mutable;
472 aGridType : GridType from Aspect;
473 aGridDrawMode : GridDrawMode from Aspect)
475 ---Purpose: Activates the grid in all views of <me>.
477 ---Category: grid management
479 DeactivateGrid (me : mutable)
481 ---Purpose: Deactivates the grid in all views of <me>.
483 ---Category: grid management
485 SetGridEcho (me : mutable;
486 showGrid: Boolean from Standard = Standard_True) is static;
487 ---Purpose: Show/Don't show grid echo to the hit point.
488 -- If TRUE,the grid echo will be shown at ConvertToGrid() time.
490 ---Category: grid management
492 SetGridEcho (me : mutable;
493 aMarker: AspectMarker3d from Graphic3d) is static;
494 ---Purpose: Show grid echo <aMarker> to the hit point.
495 -- Warning: When the grid echo marker is not set,
496 -- a default marker is build with the attributes:
497 -- marker type : Aspect_TOM_STAR
498 -- marker color : Quantity_NOC_GRAY90
501 ---Category: grid management
503 GridEcho (me) returns Boolean from Standard is static;
504 ---Purpose: Returns TRUE when grid echo must be displayed
507 ---Category: grid management
510 returns Boolean from Standard
512 ---Purpose: Returns Standard_True if a grid is activated in <me>.
514 ---Category: grid management
517 returns mutable Grid from Aspect
519 ---Purpose : Returns the defined grid in <me>.
521 ---Category: grid management
524 returns GridType from Aspect
526 ---Purpose: Returns the current grid type defined in <me>.
528 ---Category: grid management
531 returns GridDrawMode from Aspect
533 ---Purpose: Returns the current grid draw mode defined in <me>.
535 ---Category: grid management
537 RectangularGridValues (me;
538 XOrigin, YOrigin : out Length from Quantity;
539 XStep, YStep : out Length from Quantity;
540 RotationAngle : out PlaneAngle from Quantity)
542 ---Purpose: Returns the definition of the rectangular grid.
544 ---Category: grid management
546 SetRectangularGridValues (me : mutable;
547 XOrigin, YOrigin : Length from Quantity;
548 XStep, YStep : Length from Quantity;
549 RotationAngle : PlaneAngle from Quantity)
551 ---Purpose: Sets the definition of the rectangular grid.
552 --- <XOrigin>, <YOrigin> defines the origin of the grid.
553 --- <XStep> defines the interval between 2 vertical lines.
554 --- <YStep> defines the interval between 2 horizontal lines.
555 --- <RotationAngle> defines the rotation angle of the grid.
557 ---Category: grid management
559 CircularGridValues (me;
560 XOrigin, YOrigin : out Length from Quantity;
561 RadiusStep : out Length from Quantity;
562 DivisionNumber : out Integer from Standard;
563 RotationAngle : out PlaneAngle from Quantity)
565 ---Purpose: Returns the definition of the circular grid.
567 ---Category: grid management
569 SetCircularGridValues (me : mutable;
570 XOrigin, YOrigin : Length from Quantity;
571 RadiusStep : Length from Quantity;
572 DivisionNumber : Integer from Standard;
573 RotationAngle : PlaneAngle from Quantity)
575 ---Purpose: Sets the definition of the circular grid.
576 --- <XOrigin>, <YOrigin> defines the origin of the grid.
577 --- <RadiusStep> defines the interval between 2 circles.
578 --- <DivisionNumber> defines the section number of one half circle.
579 --- <RotationAngle> defines the rotation angle of the grid.
581 ---Category: grid management
583 CircularGridGraphicValues (me;
584 Radius : out Length from Quantity;
585 OffSet : out Length from Quantity)
587 ---Purpose: Returns the location and the size of the grid.
589 ---Category: grid management
591 SetCircularGridGraphicValues (me : mutable;
592 Radius : Length from Quantity;
593 OffSet : Length from Quantity)
595 ---Purpose: Sets the location and the size of the grid.
596 --- <XSize> defines the width of the grid.
597 --- <YSize> defines the height of the grid.
598 --- <OffSet> defines the displacement along the plane normal.
600 ---Category: grid management
602 RectangularGridGraphicValues (me;
603 XSize, YSize : out Length from Quantity;
604 OffSet : out Length from Quantity)
606 ---Purpose: Returns the location and the size of the grid.
608 ---Category: grid management
610 SetRectangularGridGraphicValues (me : mutable;
611 XSize, YSize : Length from Quantity;
612 OffSet : Length from Quantity)
614 ---Purpose: Sets the location and the size of the grid.
615 --- <XSize> defines the width of the grid.
616 --- <YSize> defines the height of the grid.
617 --- <OffSet> defines the displacement along the plane normal.
619 ---Category: grid management
621 -----------------------------------------
622 ---Category: Private or Protected methods
623 -----------------------------------------
625 GetBackgroundColor ( me )
626 returns Background from Aspect is private;
627 ---Purpose: Returns the default background colour.
629 GetGradientBackground ( me ) returns GradientBackground from Aspect;
631 ---Purpose: Returns the gradient background of the view.
633 AddView( me: mutable; MyView : View from V3d) is private;
634 ---Purpose: Adds View in Sequence Of Views.
636 DelView( me: mutable; MyView : View from V3d) is private;
637 ---Purpose: Delete View in Sequence Of Views.
639 AddLight( me: mutable; MyLight : Light from V3d) is private;
640 ---Purpose: Adds Light in Sequence Of Lights.
642 SetDefaultLights(me: mutable);
643 ---Purpose: defines default lights -
644 -- positional-light 0.3 0. 0.
645 -- directional-light V3d_XnegYposZpos
646 -- directional-light V3d_XnegYneg
651 IsActive(me; aView: View from V3d)
652 returns Boolean from Standard is private;
654 ShowGridEcho(me : mutable;
655 aView: View from V3d;
656 aPoint: Vertex from Graphic3d) is private;
658 -- Display grid echo at requested point in the view.
660 AddZLayer ( me : mutable;
661 theLayerId : in out Integer from Standard )
662 returns Boolean from Standard is static;
663 ---Purpose: Add a new top-level Z layer to all managed views and get
664 -- its ID as <theLayerId> value. The Z layers are controlled entirely
665 -- by viewer, it is not possible to add a layer to a
666 -- particular view. The method returns Standard_False if the layer can
667 -- not be created. The layer mechanism allows to display structures
668 -- in higher layers in overlay of structures in lower layers.
670 RemoveZLayer ( me : mutable;
671 theLayerId : Integer from Standard )
672 returns Boolean from Standard is static;
673 ---Purpose: Remove Z layer with ID <theLayerId>. Method returns
674 -- Standard_False if the layer can not be removed or doesn't exists.
675 -- By default, there are always default bottom-level layer that can't
679 theLayerSeq : out SequenceOfInteger from TColStd )
681 ---Purpose: Return all Z layer ids in sequence ordered by overlay level
682 -- from lowest layer to highest ( foreground ). The first layer ID
683 -- in sequence is the default layer that can't be removed.
687 MyViewer: ViewManager from Visual3d ;
688 MyDefinedViews: ListOfTransient from V3d;
689 MyActiveViews: ListOfTransient from V3d;
690 MyDefinedLights: ListOfTransient from V3d;
691 MyActiveLights: ListOfTransient from V3d;
692 MyDefinedPlanes: ListOfTransient from V3d;
693 MyBackground: Background from Aspect ;
694 MyGradientBackground: GradientBackground from Aspect ;
696 MyViewProj: TypeOfOrientation from V3d ;
697 MyVisualization: TypeOfVisualization from V3d ;
698 MyShadingModel: TypeOfShadingModel from V3d ;
699 MySurfaceDetail: TypeOfSurfaceDetail from V3d ;
700 MyDefaultAngle: PlaneAngle from Quantity;
701 MyDefaultTypeOfView: TypeOfView from V3d;
702 MyDefaultOrthographicView: OrthographicView from V3d;
703 MyDefaultPerspectiveView: PerspectiveView from V3d;
704 MyCurrentSelectedLight: Light from V3d;
705 myActiveViewsIterator: ListIteratorOfListOfTransient from TColStd;
706 myDefinedViewsIterator: ListIteratorOfListOfTransient from TColStd;
707 myActiveLightsIterator: ListIteratorOfListOfTransient from TColStd;
708 myDefinedLightsIterator: ListIteratorOfListOfTransient from TColStd;
709 myDefinedPlanesIterator: ListIteratorOfListOfTransient from TColStd;
710 myComputedMode: Boolean from Standard;
711 myDefaultComputedMode: Boolean from Standard;
712 myPrivilegedPlane: Ax3 from gp;
713 myPlaneStructure: Structure from Graphic3d;
714 myDisplayPlane: Boolean from Standard;
715 myDisplayPlaneLength: Length from Quantity;
717 myRGrid: RectangularGrid from V3d;
718 myCGrid: CircularGrid from V3d;
719 myGridType: GridType from Aspect;
721 myGridEcho: Boolean from Standard;
722 myGridEchoStructure: Structure from Graphic3d;
723 myGridEchoGroup: Group from Graphic3d;
724 myGridEchoAspect : AspectMarker3d from Graphic3d;
728 class Light from V3d,
729 class Plane from V3d,
730 SetPlane from package V3d (aViewer: Viewer from V3d; x1,y1,z1,x2,y2,z2: Length from Quantity)