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,
47 Vector from Graphic3d,
48 ViewManager from Visual3d,
49 NameOfColor from Quantity,
50 TypeOfColor from Quantity,
53 PlaneAngle from Quantity,
54 Background from Aspect,
55 GradientBackground from Aspect,
56 Parameter from Quantity,
57 OrthographicView from V3d,
58 PerspectiveView from V3d,
59 AsciiString,ExtendedString from TCollection,
60 Ax3 from gp,Structure from Graphic3d,
61 Vertex from Graphic3d,
63 AspectMarker3d from Graphic3d,
64 RectangularGrid from V3d,
65 CircularGrid from V3d,
68 GridDrawMode from Aspect,
69 GradientFillMethod from Aspect
77 Create ( Device : GraphicDevice from Aspect;
78 aName : ExtString from Standard;
79 aDomain : CString from Standard = "";
80 ViewSize : Length from Quantity = 1000.0 ;
81 ViewProj : TypeOfOrientation from V3d= V3d_XposYnegZpos ;
82 ViewBackground : NameOfColor from Quantity = Quantity_NOC_GRAY30;
83 Visualization : TypeOfVisualization from V3d = V3d_ZBUFFER;
84 ShadingModel : TypeOfShadingModel from V3d = V3d_GOURAUD ;
85 UpdateMode : TypeOfUpdate from V3d = V3d_WAIT;
86 ComputedMode : Boolean from Standard = Standard_True;
87 DefaultComputedMode: Boolean from Standard = Standard_True;
88 SurfaceDetail : TypeOfSurfaceDetail from V3d = V3d_TEX_NONE)
89 returns mutable Viewer from V3d
90 ---Purpose: Create a Viewer on the given device with the given parameters or
91 -- with their default values.
92 raises BadValue from Viewer ;
93 ---Purpose: If the size of the view is <= 0
94 -- if ComputedMode is false, only the degenerate mode will be used.
96 -- Warning: Client must creates a graphic-device of type
97 -- Graphic3d_GraphicDevice under UNIX
98 -- or Graphic3d_WNTGraphicDevice under WindowsNT
100 CreateView (me: mutable) returns mutable View from V3d;
102 ---Purpose: creates a view in the viewer according to its
103 -- default parameters.
105 DefaultOrthographicView(me: mutable) returns mutable OrthographicView from V3d;
107 DefaultPerspectiveView(me: mutable) returns mutable PerspectiveView from V3d;
109 -------------------------------------------------------
110 ---Category: Methods to modify the status of the viewer
111 -------------------------------------------------------
113 SetViewOn (me:mutable );
115 ---Purpose: Activates all of the views of a viewer attached
118 SetViewOn (me:mutable; View : View from V3d )
120 ---Purpose: Activates a particular view in the Viewer .
121 -- Must be call if the Window attached to the view
122 -- has been Deiconified .
123 raises BadValue from Viewer;
124 -- If the view is not mapped on the window.
126 SetViewOff (me:mutable);
128 ---Purpose: Deactivates all the views of a Viewer
129 -- attached to a window.
131 SetViewOff (me:mutable; View : View from V3d)
133 ---Purpose: Deactivates a particular view in the Viewer.
134 -- Must be call if the Window attached to the view
135 -- has been Iconified .
136 raises BadValue from Viewer;
137 -- If the view is not mapped on the window.
139 Update (me:mutable ) is redefined static;
141 ---Purpose: Updates the display of all the views of a viewer.
142 -- Must be called when the views must be updated
143 -- simultaneously while the Update mode is deferred (WAIT).
145 UpdateLights (me: mutable);
147 ---Purpose: Updates the lights of all the views of a viewer.
151 ---Purpose: Redraws all the views of the Viewer even if no
152 -- modification has taken place. Must be called if
153 -- all the views of the Viewer are exposed, as for
154 -- example in a global DeIconification.
158 ---Purpose: Suppresses the Viewer.
162 ---Purpose: Erase all Objects in All the views.
166 ---Purpose: UnHighlight all Objects in All the views.
168 SetDefaultBackgroundColor (me:mutable; Type : TypeOfColor; V1, V2, V3 : Parameter );
170 ---Purpose: Defines the default base colour of views attached
171 -- to the Viewer by supplying the type of colour
172 -- definition and the three component values..
174 SetDefaultBackgroundColor (me:mutable; Name : NameOfColor );
176 ---Purpose: Defines the default background colour of views
177 -- attached to the viewer by supplying the name of the
178 -- colour under the form Quantity_NOC_xxxx .
180 SetDefaultBackgroundColor (me:mutable; Color : Color from Quantity);
182 ---Purpose: Defines the default background colour of views
183 -- attached to the viewer by supplying the color object
185 SetDefaultBgGradientColors ( me:mutable;
188 FillStyle : GradientFillMethod from Aspect = Aspect_GFM_HOR );
190 ---Purpose: Defines the default gradient background colours of view
191 -- attached to the viewer by supplying the name of the
192 -- colours under the form Quantity_NOC_xxxx .
194 SetDefaultBgGradientColors ( me : mutable ;
195 Color1 : Color from Quantity;
196 Color2 : Color from Quantity;
197 FillStyle : GradientFillMethod from Aspect = Aspect_GFM_HOR );
199 ---Purpose: Defines the default gradient background colours of views
200 -- attached to the viewer by supplying the colour objects
202 SetDefaultViewSize (me:mutable; Size : Length )
204 ---Purpose: Gives a default size for the creation of views of
206 raises BadValue from Viewer;
207 -- If the size of the view is <= 0
209 SetDefaultViewProj (me:mutable; Orientation : TypeOfOrientation );
211 ---Purpose: Gives the default projection for creating views
214 SetDefaultVisualization(me:mutable; Type : TypeOfVisualization from V3d);
216 ---Purpose: Gives the default visualisation mode..
219 SetZBufferManagment(me: mutable; Automatic: Boolean from Standard);
221 ---Purpose: defines the strategy concerning the ZBuffer activity.
222 -- If Automatic is true, ZBuffer will be activated or
223 -- deactivated depending on the fact that faces exist or
224 -- not in the Viewer. This will optimize the response time
225 -- in the case where only wireframe objects are displayed.
226 -- If Automatic is False, ZBuffer will be activated or
227 -- deactivated depending on the choice of SetVisualization
229 -- Note that by default, the ZBufferManagment is not automatic.
231 ZBufferManagment(me) returns Boolean from Standard;
233 ---Purpose: returns the ZBuffer stategy choice.
235 SetDefaultShadingModel(me:mutable; Type : TypeOfShadingModel from V3d);
237 ---Purpose: Gives the default type of SHADING.
239 SetDefaultSurfaceDetail(me:mutable; Type : TypeOfSurfaceDetail from V3d);
241 ---Purpose: Gives the default type of texture mapping.
243 SetDefaultAngle (me:mutable; Angle : PlaneAngle from Quantity);
246 SetUpdateMode ( me: mutable ; Mode : TypeOfUpdate from V3d );
248 ---Purpose: Defines the mode of regenerating the views making
249 -- up the viewer. This can be immediate <ASAP> or
250 -- deferred <WAIT>. In this latter case, the views are
251 -- updated when the method Update(me) is called.
253 SetDefaultTypeOfView(me:mutable; Type : TypeOfView from V3d);
257 SetPrivilegedPlane(me: mutable; aPlane: Ax3 from gp);
260 PrivilegedPlane(me) returns Ax3 from gp;
263 DisplayPrivilegedPlane(me: mutable; OnOff: Boolean from Standard; aSize: Length from Quantity = 1);
266 SetLightOn(me:mutable; MyLight : Light from V3d )
268 ---Purpose: Activates MyLight in the viewer.
269 raises BadValue from Viewer;
270 -- If No More Light can be activated in MyViewer .
272 SetLightOn(me:mutable)
274 ---Purpose: Activates all the lights defined in this viewer.
275 raises BadValue from Viewer;
276 -- If No More Light can be activated in MyViewer .
278 SetLightOff(me:mutable; MyLight : Light from V3d );
280 ---Purpose: Desactivate MyLight in this viewer.
282 SetLightOff(me:mutable);
284 ---Purpose: Deactivate all the Lights defined in this viewer.
286 DelLight(me:mutable; MyLight : Light from V3d);
288 ---Purpose: Delete Light in Sequence Of Lights.
290 SetCurrentSelectedLight (me : mutable; TheLight : Light from V3d);
292 ---Purpose: Defines the selected light.
294 ClearCurrentSelectedLight (me : mutable);
296 ---Purpose: Defines the selected light at NULL.
298 -----------------------------------------
299 ---Category: Inquire methods
300 -----------------------------------------
302 DefaultBackgroundColor ( me ; Type : TypeOfColor ; V1,V2,V3 : out Parameter);
304 ---Purpose: Returns the default background colour depending of the type.
305 DefaultBackgroundColor ( me ) returns Color from Quantity;
307 ---Purpose: Returns the default background colour object.
309 DefaultBgGradientColors( me;
310 Color1 : out Color from Quantity;
311 Color2 : out Color from Quantity) ;
313 ---Purpose: Returns the gradient background colour objects of the view.
315 DefaultViewSize ( me) returns Length;
317 ---Purpose: Returns the default size of the view.
319 DefaultViewProj ( me) returns TypeOfOrientation;
321 ---Purpose: Returns the default Projection.
323 DefaultVisualization ( me ) returns TypeOfVisualization from V3d;
325 ---Purpose: Returns the default type of Visualization.
327 DefaultShadingModel ( me ) returns TypeOfShadingModel from V3d;
329 ---Purpose: Returns the default type of Shading
331 DefaultSurfaceDetail ( me ) returns TypeOfSurfaceDetail from V3d;
333 ---Purpose: Returns the default type of texture mapping
335 DefaultAngle ( me ) returns PlaneAngle from Quantity;
338 UpdateMode ( me ) returns TypeOfUpdate from V3d;
340 ---Purpose: Returns the regeneration mode of views in the viewer.
342 IfMoreViews( me ) returns Boolean;
344 ---Purpose: Returns True if One View more can be
345 -- activated in this Viewer.
348 ------------------------------
349 ---Category: iteration methods
350 ------------------------------
352 InitActiveViews(me: mutable);
354 ---Purpose: initializes an iteration on the active views.
356 MoreActiveViews (me) returns Boolean from Standard;
358 ---Purpose: returns true if there are more active view(s) to return.
360 NextActiveViews (me: mutable);
362 ---Purpose : Go to the next active view
363 -- (if there is not, ActiveView will raise an exception)
365 ActiveView(me) returns mutable View from V3d;
368 LastActiveView(me) returns Boolean from Standard;
370 ---Purpose: returns true if there is only
373 InitDefinedViews(me: mutable);
375 ---Purpose: initializes an iteration on the Defined views.
378 MoreDefinedViews (me) returns Boolean from Standard;
380 ---Purpose: returns true if there are more Defined view(s) to return.
383 NextDefinedViews (me: mutable);
385 ---Purpose : Go to the next Defined view
386 -- (if there is not, DefinedView will raise an exception)
388 DefinedView(me) returns View from V3d;
391 InitActiveLights(me: mutable);
393 ---Purpose: initializes an iteration on the active Lights.
395 MoreActiveLights (me) returns Boolean from Standard;
397 ---Purpose: returns true if there are more active Light(s) to return.
400 NextActiveLights (me: mutable);
402 ---Purpose : Go to the next active Light
403 -- (if there is not, ActiveLight will raise an exception)
406 ActiveLight(me) returns mutable Light from V3d;
409 InitDefinedLights(me: mutable);
411 ---Purpose: initializes an iteration on the Defined Lights.
413 MoreDefinedLights (me) returns Boolean from Standard;
415 ---Purpose: returns true if there are more Defined Light(s) to return.
417 NextDefinedLights (me: mutable);
419 ---Purpose : Go to the next Defined Light
420 -- (if there is not, DefinedLight will raise an exception)
422 DefinedLight(me) returns Light from V3d;
425 AddPlane( me: mutable; MyPlane : Plane from V3d);
426 ---Purpose: Adds Plane in Sequence Of Planes.
428 DelPlane( me: mutable; MyPlane : Plane from V3d);
429 ---Purpose: Delete Plane in Sequence Of Planes.
431 InitDefinedPlanes(me: mutable);
433 ---Purpose: initializes an iteration on the Defined Planes.
435 MoreDefinedPlanes (me) returns Boolean from Standard;
437 ---Purpose: returns true if there are more Defined Plane(s) to return.
439 NextDefinedPlanes (me: mutable);
441 ---Purpose : Go to the next Defined Plane
442 -- (if there is not, DefinedPlane will raise an exception)
444 DefinedPlane(me) returns Plane from V3d;
447 Viewer (me) returns mutable ViewManager ;
449 ---Purpose: Returns the viewer associated to Visual3d .
451 CurrentSelectedLight (me) returns Light from V3d;
453 ---Purpose: Returns the Selected Light.
455 IsGlobalLight (me; TheLight : Light from V3d) returns Boolean;
458 ComputedMode(me) returns Boolean from Standard;
460 ---Purpose: returns true if the computed mode can be used.
462 DefaultComputedMode(me) returns Boolean from Standard;
464 ---Purpose: returns true if by default the computed mode must be used.
466 -----------------------------------------
467 ---Category: grid management
468 -----------------------------------------
470 ActivateGrid (me : mutable;
471 aGridType : GridType from Aspect;
472 aGridDrawMode : GridDrawMode from Aspect)
474 ---Purpose: Activates the grid in all views of <me>.
476 ---Category: grid management
478 DeactivateGrid (me : mutable)
480 ---Purpose: Deactivates the grid in all views of <me>.
482 ---Category: grid management
484 SetGridEcho (me : mutable;
485 showGrid: Boolean from Standard = Standard_True) is static;
486 ---Purpose: Show/Don't show grid echo to the hit point.
487 -- If TRUE,the grid echo will be shown at ConvertToGrid() time.
489 ---Category: grid management
491 SetGridEcho (me : mutable;
492 aMarker: AspectMarker3d from Graphic3d) is static;
493 ---Purpose: Show grid echo <aMarker> to the hit point.
494 -- Warning: When the grid echo marker is not set,
495 -- a default marker is build with the attributes:
496 -- marker type : Aspect_TOM_STAR
497 -- marker color : Quantity_NOC_GRAY90
500 ---Category: grid management
502 GridEcho (me) returns Boolean from Standard is static;
503 ---Purpose: Returns TRUE when grid echo must be displayed
506 ---Category: grid management
509 returns Boolean from Standard
511 ---Purpose: Returns Standard_True if a grid is activated in <me>.
513 ---Category: grid management
516 returns mutable Grid from Aspect
518 ---Purpose : Returns the defined grid in <me>.
520 ---Category: grid management
523 returns GridType from Aspect
525 ---Purpose: Returns the current grid type defined in <me>.
527 ---Category: grid management
530 returns GridDrawMode from Aspect
532 ---Purpose: Returns the current grid draw mode defined in <me>.
534 ---Category: grid management
536 RectangularGridValues (me;
537 XOrigin, YOrigin : out Length from Quantity;
538 XStep, YStep : out Length from Quantity;
539 RotationAngle : out PlaneAngle from Quantity)
541 ---Purpose: Returns the definition of the rectangular grid.
543 ---Category: grid management
545 SetRectangularGridValues (me : mutable;
546 XOrigin, YOrigin : Length from Quantity;
547 XStep, YStep : Length from Quantity;
548 RotationAngle : PlaneAngle from Quantity)
550 ---Purpose: Sets the definition of the rectangular grid.
551 --- <XOrigin>, <YOrigin> defines the origin of the grid.
552 --- <XStep> defines the interval between 2 vertical lines.
553 --- <YStep> defines the interval between 2 horizontal lines.
554 --- <RotationAngle> defines the rotation angle of the grid.
556 ---Category: grid management
558 CircularGridValues (me;
559 XOrigin, YOrigin : out Length from Quantity;
560 RadiusStep : out Length from Quantity;
561 DivisionNumber : out Integer from Standard;
562 RotationAngle : out PlaneAngle from Quantity)
564 ---Purpose: Returns the definition of the circular grid.
566 ---Category: grid management
568 SetCircularGridValues (me : mutable;
569 XOrigin, YOrigin : Length from Quantity;
570 RadiusStep : Length from Quantity;
571 DivisionNumber : Integer from Standard;
572 RotationAngle : PlaneAngle from Quantity)
574 ---Purpose: Sets the definition of the circular grid.
575 --- <XOrigin>, <YOrigin> defines the origin of the grid.
576 --- <RadiusStep> defines the interval between 2 circles.
577 --- <DivisionNumber> defines the section number of one half circle.
578 --- <RotationAngle> defines the rotation angle of the grid.
580 ---Category: grid management
582 CircularGridGraphicValues (me;
583 Radius : out Length from Quantity;
584 OffSet : out Length from Quantity)
586 ---Purpose: Returns the location and the size of the grid.
588 ---Category: grid management
590 SetCircularGridGraphicValues (me : mutable;
591 Radius : Length from Quantity;
592 OffSet : Length from Quantity)
594 ---Purpose: Sets the location and the size of the grid.
595 --- <XSize> defines the width of the grid.
596 --- <YSize> defines the height of the grid.
597 --- <OffSet> defines the displacement along the plane normal.
599 ---Category: grid management
601 RectangularGridGraphicValues (me;
602 XSize, YSize : out Length from Quantity;
603 OffSet : out Length from Quantity)
605 ---Purpose: Returns the location and the size of the grid.
607 ---Category: grid management
609 SetRectangularGridGraphicValues (me : mutable;
610 XSize, YSize : Length from Quantity;
611 OffSet : Length from Quantity)
613 ---Purpose: Sets the location and the size of the grid.
614 --- <XSize> defines the width of the grid.
615 --- <YSize> defines the height of the grid.
616 --- <OffSet> defines the displacement along the plane normal.
618 ---Category: grid management
620 -----------------------------------------
621 ---Category: Private or Protected methods
622 -----------------------------------------
624 GetBackgroundColor ( me )
625 returns Background from Aspect is private;
626 ---Purpose: Returns the default background colour.
628 GetGradientBackground ( me ) returns GradientBackground from Aspect;
630 ---Purpose: Returns the gradient background of the view.
632 AddView( me: mutable; MyView : View from V3d) is private;
633 ---Purpose: Adds View in Sequence Of Views.
635 DelView( me: mutable; MyView : View from V3d) is private;
636 ---Purpose: Delete View in Sequence Of Views.
638 AddLight( me: mutable; MyLight : Light from V3d) is private;
639 ---Purpose: Adds Light in Sequence Of Lights.
641 SetDefaultLights(me: mutable);
642 ---Purpose: defines default lights -
643 -- positional-light 0.3 0. 0.
644 -- directional-light V3d_XnegYposZpos
645 -- directional-light V3d_XnegYneg
650 IsActive(me; aView: View from V3d)
651 returns Boolean from Standard is private;
653 ShowGridEcho(me : mutable;
654 aView: View from V3d;
655 aPoint: Vertex from Graphic3d) is private;
657 -- Display grid echo at requested point in the view.
661 MyViewer: ViewManager from Visual3d ;
662 MyDefinedViews: ListOfTransient from V3d;
663 MyActiveViews: ListOfTransient from V3d;
664 MyDefinedLights: ListOfTransient from V3d;
665 MyActiveLights: ListOfTransient from V3d;
666 MyDefinedPlanes: ListOfTransient from V3d;
667 MyBackground: Background from Aspect ;
668 MyGradientBackground: GradientBackground from Aspect ;
670 MyViewProj: TypeOfOrientation from V3d ;
671 MyVisualization: TypeOfVisualization from V3d ;
672 MyShadingModel: TypeOfShadingModel from V3d ;
673 MySurfaceDetail: TypeOfSurfaceDetail from V3d ;
674 MyDefaultAngle: PlaneAngle from Quantity;
675 MyDefaultTypeOfView: TypeOfView from V3d;
676 MyDefaultOrthographicView: OrthographicView from V3d;
677 MyDefaultPerspectiveView: PerspectiveView from V3d;
678 MyCurrentSelectedLight: Light from V3d;
679 myActiveViewsIterator: ListIteratorOfListOfTransient from TColStd;
680 myDefinedViewsIterator: ListIteratorOfListOfTransient from TColStd;
681 myActiveLightsIterator: ListIteratorOfListOfTransient from TColStd;
682 myDefinedLightsIterator: ListIteratorOfListOfTransient from TColStd;
683 myDefinedPlanesIterator: ListIteratorOfListOfTransient from TColStd;
684 myComputedMode: Boolean from Standard;
685 myDefaultComputedMode: Boolean from Standard;
686 myPrivilegedPlane: Ax3 from gp;
687 myPlaneStructure: Structure from Graphic3d;
688 myDisplayPlane: Boolean from Standard;
689 myDisplayPlaneLength: Length from Quantity;
691 myRGrid: RectangularGrid from V3d;
692 myCGrid: CircularGrid from V3d;
693 myGridType: GridType from Aspect;
695 myGridEcho: Boolean from Standard;
696 myGridEchoStructure: Structure from Graphic3d;
697 myGridEchoGroup: Group from Graphic3d;
698 myGridEchoAspect : AspectMarker3d from Graphic3d;
702 class Light from V3d,
703 class Plane from V3d,
704 SetPlane from package V3d (aViewer: Viewer from V3d; x1,y1,z1,x2,y2,z2: Length from Quantity)