0024637: Visualization - clean up implementation of rendering in immediate mode
[occt.git] / src / V3d / V3d_Viewer.cdl
old mode 100755 (executable)
new mode 100644 (file)
index 7873c53..86f759b
@@ -1,6 +1,19 @@
--- File:    Viewer.cdl
--- Created: Fri Jan 17 11:23:08 1992
--- Author:  GG
+-- Created on: 1992-01-17
+-- Created by: GG
+-- Copyright (c) 1992-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
 -- Modified FMN - 02/02/98 -> Specifique UNIX
 --          CAL - 16/07/98 -> S3892. Ajout grilles 3d.
 --          GG  - 15/12/99 -> GER61351 Add SetDefaultBackgroundColor()
 --                                      Add GridEcho() method.
 --                                      Add ShowGridEcho() private method
 --          SAV - 26/11/02 -> Add new field to store grid echo aspect
---
----Copyright:        Matra Datavision 1992
 
-class Viewer from V3d
+class Viewer from V3d inherits TShared from MMgt
 
         ---Version:
 
@@ -26,13 +37,9 @@ class Viewer from V3d
 
         ---References:
 
-inherits
-
-        Viewer from Viewer
-
 uses
 
-        GraphicDevice from Aspect,
+        GraphicDriver from Graphic3d,
         TypeOfUpdate from V3d,
         TypeOfVisualization from V3d,
         TypeOfShadingModel from V3d,
@@ -40,9 +47,9 @@ uses
         TypeOfOrientation from V3d,
         View from V3d,
         Light from V3d,
-        Plane from V3d,
         ListOfTransient from V3d,
         ListIteratorOfListOfTransient from TColStd,
+        SequenceOfInteger from TColStd,
         TypeOfView from V3d,
         Vector from Graphic3d,
         ViewManager from Visual3d,
@@ -54,8 +61,6 @@ uses
         Background from Aspect,
         GradientBackground from Aspect,
         Parameter from Quantity,
-        OrthographicView from V3d,
-        PerspectiveView from V3d,
         AsciiString,ExtendedString from TCollection,
         Ax3 from gp,Structure from Graphic3d,
         Vertex from Graphic3d,
@@ -70,42 +75,37 @@ uses
 
 raises
 
-        BadValue from Viewer
+        BadValue from V3d
 
 is
 
-        Create ( Device     : GraphicDevice from Aspect;
-             aName          : ExtString from Standard;
-             aDomain        : CString from Standard = "";
-             ViewSize       : Length from Quantity = 1000.0 ;
-             ViewProj       : TypeOfOrientation from V3d= V3d_XposYnegZpos ;
-             ViewBackground : NameOfColor from Quantity = Quantity_NOC_GRAY30;
-             Visualization  : TypeOfVisualization from V3d = V3d_ZBUFFER;
-             ShadingModel   : TypeOfShadingModel  from V3d = V3d_GOURAUD ;
-             UpdateMode     : TypeOfUpdate from V3d = V3d_WAIT;
-             ComputedMode   : Boolean from Standard = Standard_True;
-             DefaultComputedMode: Boolean from Standard = Standard_True;
-             SurfaceDetail  : TypeOfSurfaceDetail  from V3d = V3d_TEX_NONE)
+        Create (theDriver         : GraphicDriver from Graphic3d;
+                theName           : ExtString from Standard;
+                theDomain         : CString from Standard = "";
+                theViewSize       : Length from Quantity = 1000.0 ;
+                theViewProj       : TypeOfOrientation from V3d= V3d_XposYnegZpos ;
+                theViewBackground : NameOfColor from Quantity = Quantity_NOC_GRAY30;
+                theVisualization  : TypeOfVisualization from V3d = V3d_ZBUFFER;
+                theShadingModel   : TypeOfShadingModel  from V3d = V3d_GOURAUD ;
+                theUpdateMode     : TypeOfUpdate from V3d = V3d_WAIT;
+                theComputedMode   : Boolean from Standard = Standard_True;
+                theDefaultComputedMode: Boolean from Standard = Standard_True;
+                theSurfaceDetail  : TypeOfSurfaceDetail  from V3d = V3d_TEX_NONE)
         returns mutable Viewer from V3d
-        ---Purpose: Create a Viewer on the given device with the given parameters  or
+        ---Purpose: Create a Viewer with the given graphic driver and the given parameters  or
         --          with their default values.
-        raises BadValue from Viewer ;
+        --          Currently creating of more than 100 viewer instances 
+             --          is not supported and leads to an exception.
+             --          This limitation might be addressed in some future OCCT releases.
+        raises BadValue from V3d ;
         ---Purpose:        If the size of the view is <= 0
-        --      if ComputedMode is false, only the degenerate mode will be used.
-        --
-        --  Warning: Client must creates a graphic-device of type
-        --            Graphic3d_GraphicDevice under UNIX
-        --         or Graphic3d_WNTGraphicDevice under WindowsNT
+        --  Warning: Client must creates a graphic driver
 
         CreateView (me: mutable) returns mutable View from V3d;
         ---Level: Public
         ---Purpose: creates a view in the viewer according to its
         --          default parameters.
 
-        DefaultOrthographicView(me: mutable) returns mutable OrthographicView from V3d;
-
-        DefaultPerspectiveView(me: mutable) returns mutable PerspectiveView from V3d;
-
         -------------------------------------------------------
         ---Category: Methods to modify the status of the viewer
         -------------------------------------------------------
@@ -120,7 +120,7 @@ is
         ---Purpose: Activates a particular view in the Viewer .
         --            Must be call if the Window attached to the view
         --            has been Deiconified .
-                raises BadValue from Viewer;
+                raises BadValue from V3d;
         --        If the view is not mapped on the window.
 
         SetViewOff (me:mutable);
@@ -133,14 +133,12 @@ is
         ---Purpose: Deactivates a particular view in the Viewer.
         --            Must be call if the Window attached to the view
         --            has been Iconified .
-                raises BadValue from Viewer;
+                raises BadValue from V3d;
         --        If the view is not mapped on the window.
 
-        Update (me:mutable ) is redefined static;
+        Update (me:mutable ) is static;
         ---Level: Public
-        ---Purpose: Updates the display of all the views of a viewer.
-        --            Must be called when the views must be updated
-        --            simultaneously while the Update mode is deferred (WAIT).
+        ---Purpose: Deprecated, Redraw() should be used instead.
 
         UpdateLights (me: mutable);
         ---Level: Public
@@ -153,6 +151,14 @@ is
         --            all the views of the Viewer are exposed, as for
         --           example in a global DeIconification.
 
+        RedrawImmediate ( me );
+        ---Level: Public
+        ---Purpose: Updates layer of immediate presentations.
+
+        Invalidate ( me );
+        ---Level: Public
+        ---Purpose: Invalidates viewer content but does not redraw it.
+
         Remove (me:mutable);
         ---Level: Public
         ---Purpose: Suppresses the Viewer.
@@ -203,7 +209,7 @@ is
         ---Level: Public
         ---Purpose: Gives a default size for the creation of views of
         --            the viewer.
-                raises BadValue from Viewer;
+                raises BadValue from V3d;
         --        If the size of the view is <= 0
 
         SetDefaultViewProj (me:mutable; Orientation : TypeOfOrientation );
@@ -266,13 +272,13 @@ is
         SetLightOn(me:mutable; MyLight : Light from V3d )
         ---Level: Public
         ---Purpose: Activates MyLight in the viewer.
-                raises BadValue from Viewer;
+                raises BadValue from V3d;
         --        If No More Light can be activated in MyViewer .
 
         SetLightOn(me:mutable)
         ---Level: Public
         ---Purpose: Activates all the lights defined in this viewer.
-                raises BadValue from Viewer;
+                raises BadValue from V3d;
         --        If No More Light can be activated in MyViewer .
 
         SetLightOff(me:mutable; MyLight : Light  from V3d );
@@ -422,28 +428,6 @@ is
         DefinedLight(me) returns Light from V3d;
         ---Level:   Advanced
 
-        AddPlane( me: mutable; MyPlane : Plane from V3d);
-        ---Purpose: Adds Plane in Sequence Of Planes.
-
-        DelPlane( me: mutable; MyPlane : Plane from V3d);
-        ---Purpose: Delete Plane in Sequence Of Planes.
-
-        InitDefinedPlanes(me: mutable);
-        ---Level:   Advanced
-        ---Purpose: initializes an iteration on the Defined Planes.
-
-        MoreDefinedPlanes (me) returns Boolean from Standard;
-        ---Level:   Advanced
-        ---Purpose: returns true if there are more Defined Plane(s) to return.
-
-        NextDefinedPlanes (me: mutable);
-        ---Level:   Advanced
-        ---Purpose : Go to the next Defined Plane
-        --           (if there is not, DefinedPlane will raise an exception)
-
-        DefinedPlane(me) returns Plane from V3d;
-        ---Level:   Advanced
-
         Viewer (me) returns mutable ViewManager ;
         ---Level:   Advanced
         ---Purpose: Returns the viewer associated to Visual3d .
@@ -645,25 +629,69 @@ is
         --          directional-light V3d_XnegYneg
         --          ambient-light
 
-        Init(me: mutable);
-
         IsActive(me; aView: View from V3d)
         returns Boolean from Standard is private;
 
-        ShowGridEcho(me : mutable;
-                        aView: View from V3d;
-                        aPoint: Vertex from Graphic3d) is private;
+        ShowGridEcho (me       : mutable;
+                      theView  : View   from V3d;
+                      thePoint : Vertex from Graphic3d);
         ---Purpose:
         -- Display grid echo at requested point in the view.
 
+        HideGridEcho (me      : mutable;
+                      theView : View from V3d);
+        ---Purpose:
+        -- Temporarly hide grid echo.
+
+        AddZLayer ( me : mutable;
+                    theLayerId : in out Integer from Standard )
+           returns Boolean from Standard is static;
+        ---Purpose: Add a new top-level Z layer to all managed views and get
+        -- its ID as <theLayerId> value. The Z layers are controlled entirely
+        -- by viewer, it is not possible to add a layer to a
+        -- particular view. The method returns Standard_False if the layer can
+        -- not be created. The layer mechanism allows to display structures
+        -- in higher layers in overlay of structures in lower layers.
+
+        RemoveZLayer ( me : mutable;
+                       theLayerId : Integer from Standard )
+           returns Boolean from Standard is static;
+        ---Purpose: Remove Z layer with ID <theLayerId>. Method returns
+        -- Standard_False if the layer can not be removed or doesn't exists.
+        -- By default, there are always default bottom-level layer that can't
+        -- be removed.
+
+        GetAllZLayers ( me;
+                        theLayerSeq : out SequenceOfInteger from TColStd )
+           is static;
+        ---Purpose: Return all Z layer ids in sequence ordered by overlay level
+        -- from lowest layer to highest ( foreground ). The first layer ID
+        -- in sequence is the default layer that can't be removed.
+
+        Driver(me) returns mutable GraphicDriver from Graphic3d
+        is static;
+        ---C++: return const &
+
+        NextName(me) returns ExtString from Standard
+        is static;
+
+        Domain(me) returns CString from  Standard
+        is static;
+        
+        IncrCount(me:mutable) is static protected;
+
 fields
 
+        myNextCount: Integer        from Standard;
+        myDriver:    GraphicDriver  from Graphic3d;
+        myName:      ExtendedString from TCollection;
+        myDomain:    AsciiString    from TCollection;
+
         MyViewer:               ViewManager from Visual3d ;
         MyDefinedViews:                ListOfTransient from V3d;
         MyActiveViews:                ListOfTransient from V3d;
         MyDefinedLights:        ListOfTransient from V3d;
         MyActiveLights:          ListOfTransient from V3d;
-        MyDefinedPlanes:        ListOfTransient from V3d;
         MyBackground:                Background from Aspect ;
         MyGradientBackground:        GradientBackground from Aspect ;
         MyViewSize:                Real ;
@@ -673,14 +701,11 @@ fields
         MySurfaceDetail:        TypeOfSurfaceDetail from V3d ;
         MyDefaultAngle:         PlaneAngle from Quantity;
         MyDefaultTypeOfView:    TypeOfView from V3d;
-        MyDefaultOrthographicView: OrthographicView from V3d;
-        MyDefaultPerspectiveView: PerspectiveView from V3d;
         MyCurrentSelectedLight:   Light from V3d;
         myActiveViewsIterator: ListIteratorOfListOfTransient from TColStd;
         myDefinedViewsIterator: ListIteratorOfListOfTransient from TColStd;
         myActiveLightsIterator: ListIteratorOfListOfTransient from TColStd;
         myDefinedLightsIterator: ListIteratorOfListOfTransient from TColStd;
-        myDefinedPlanesIterator: ListIteratorOfListOfTransient from TColStd;
         myComputedMode: Boolean from Standard;
         myDefaultComputedMode: Boolean from Standard;
         myPrivilegedPlane: Ax3 from gp;
@@ -696,10 +721,10 @@ fields
         myGridEchoStructure: Structure from Graphic3d;
         myGridEchoGroup: Group from Graphic3d;
         myGridEchoAspect : AspectMarker3d from Graphic3d;
+        myGridEchoLastVert : Vertex from Graphic3d;
 friends
 
         class View from V3d,
         class Light from V3d,
-        class Plane from V3d,
         SetPlane  from package V3d (aViewer: Viewer from V3d; x1,y1,z1,x2,y2,z2: Length from Quantity)
 end Viewer;