0024837: Visualization - revise design and implementation of connected Interactive...
[occt.git] / src / PrsMgr / PrsMgr_PresentableObject.cdl
old mode 100755 (executable)
new mode 100644 (file)
index a35ec9e..c4a26f7
@@ -1,22 +1,18 @@
 -- Created on: 1995-01-25
 -- Created by: Jean-Louis Frenkel
 -- Copyright (c) 1995-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
 --
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
+-- This file is part of Open CASCADE Technology software library.
 --
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+-- 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.
 --
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
 
 -- Modified by  Rob (18/12/96) -> information about modes to update.
 --              Rob (04/07/97) ->   TypeOfPresentation3d () Method 
@@ -35,7 +31,7 @@
 deferred class PresentableObject from PrsMgr inherits TShared from MMgt
 
 
-       ---Purpose: A framework to supply the Graphic2d or Graphic3d
+       ---Purpose: A framework to supply the Graphic3d
        -- structure of the object to be presented. On the first
        -- display request, this structure is created by calling the
        -- appropriate algorithm and retaining this frameworkfor
@@ -52,23 +48,26 @@ deferred class PresentableObject from PrsMgr inherits TShared from MMgt
        -- creation of new interactive objects.
 
 uses
-    Presentation          from PrsMgr,
-    Presentation          from Prs3d,
-    GraphicObject         from Graphic2d,
-    Presentations         from PrsMgr,
-    PresentationManager   from PrsMgr,
-    PresentationManager2d from PrsMgr,
-    PresentationManager3d from PrsMgr,
-    TypeOfPresentation3d  from PrsMgr,
-    DataStructureManager  from Graphic3d,
-    Projector             from Prs3d,
-    Transformation        from Geom,
-    ListOfInteger         from TColStd,
-    Location              from TopLoc, 
+    Presentation           from PrsMgr,
+    Presentation           from Prs3d,
+    Presentations          from PrsMgr,
+    PresentationManager    from PrsMgr,
+    PresentationManager3d  from PrsMgr,
+    TypeOfPresentation3d   from PrsMgr,
+    ListOfPresentableObjects from PrsMgr,
+    PresentableObjectPointer from PrsMgr,
+    DataStructureManager   from Graphic3d,
+    Projector              from Prs3d,
+    Transformation         from Geom,
+    ListOfInteger          from TColStd,
+    Location               from TopLoc, 
+    ClipPlane_Handle       from Graphic3d,
+    SequenceOfHClipPlane   from Graphic3d,
     --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
-    TransModeFlags        from Graphic3d, 
-    Pnt                   from gp, 
-    CTransPersStruct      from  Graphic3d      
+    TransModeFlags         from Graphic3d, 
+    Pnt                    from gp,
+    Trsf                   from gp, 
+    CTransPersStruct       from  Graphic3d      
     --   ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate )
 
 raises
@@ -77,26 +76,14 @@ is
 
 
     Initialize(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView);
+      ---C++: alias "Standard_EXPORT virtual ~PrsMgr_PresentableObject();"
     
 ---Category: deferred methods.
 --           
-    Compute(me:mutable;
-                aPresentationManager: PresentationManager2d from PrsMgr;
-                aPresentation: mutable GraphicObject from Graphic2d;
-                aMode: Integer from Standard = 0)
-       ---Purpose: Calculates the 2D view aPresentation and its
-       -- updates. The latter are managed by aPresentationManager.
-       -- aPresentableObject has the display mode aMode;
-       -- this has the default value of 0, that is, the wireframe display mode.
-       -- Note that this syntax is not used in AIS as that
-       -- package only concerns 3D display.
-                
-    raises NotImplemented from Standard
-    is virtual protected;
     
     Compute(me:mutable;
                 aPresentationManager: PresentationManager3d from PrsMgr;
-                aPresentation: mutable Presentation from Prs3d;
+                aPresentation: Presentation from Prs3d;
                 aMode: Integer from Standard = 0)
        ---Purpose: Calculates the 3D view aPresentation and its
        -- updates. The latter are managed by aPresentationManager.
@@ -107,7 +94,7 @@ is
     
     Compute(me            : mutable;
             aProjector    : Projector from Prs3d;
-            aPresentation  : mutable Presentation from Prs3d)
+            aPresentation  : Presentation from Prs3d)
        ---Purpose: Calculates the 3D view aPresentation and its
        -- updates. The latter are managed by
        -- aPresentationManager. Each of the views in the
@@ -124,7 +111,7 @@ is
     Compute(me            : mutable;
             aProjector    : Projector from Prs3d;
             aTrsf         : Transformation from Geom;
-            aPresentation : mutable Presentation from Prs3d)
+            aPresentation : Presentation from Prs3d)
     is virtual protected;
        ---Purpose: Calculates the 3D view aPresentation and its
        -- updates. The latter are managed by
@@ -153,7 +140,7 @@ is
     
     Fill(me: mutable; 
                 aPresentationManager: PresentationManager from PrsMgr;
-                aPresentation: mutable Presentation from PrsMgr;
+                aPresentation: Presentation from PrsMgr;
                 aMode: Integer from Standard = 0)
     -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
     is virtual protected;
@@ -166,7 +153,7 @@ is
     -- is static private;
     
     Presentations(me : mutable) returns Presentations from PrsMgr
-    is static protected;
+    is static;
        ---C++: return &
             
    TypeOfPresentation3d(me) returns TypeOfPresentation3d from PrsMgr
@@ -235,19 +222,30 @@ is
    ToBeUpdated(me;ListOfMode : out ListOfInteger from TColStd);
    ---Purpose: gives the list of modes which are flagged "to be updated".
     
-   SetLocation(me:mutable;aLoc:Location from TopLoc) is virtual;
+   SetLocalTransformation(me:mutable; theTransformation:Trsf from gp) is virtual;
+   ---Purpose: Sets local transformation to theTransformation.
+
+   SetCombinedParentTransform(me:mutable; theTransformation:Trsf from gp) is virtual protected;
+   ---Purpose: Sets myCombinedParentTransform to theTransformation. Thus object receives transformation
+   -- from parent node and able to derive its own.
     
-   HasLocation(me) returns Boolean from Standard;
+   HasTransformation(me) returns Boolean from Standard;
+   ---Purpose: Returns true if object has a transformation that is different from the identity.
    
-   Location(me) returns any Location from TopLoc;
+   LocalTransformation(me) returns any Trsf from gp;
+   ---C++: inline
+   ---C++: return const&
+
+   Transformation(me) returns any Trsf from gp;
    ---C++: inline
    ---C++: return const&
    
-   ResetLocation(me:mutable)  is virtual;
+   ResetTransformation(me:mutable)  is virtual;
+   ---Purpose: resets local transformation to identity.
 
-   UpdateLocation(me:mutable) is virtual;
+   UpdateTransformation(me:mutable) is virtual;
     
-   UpdateLocation(me:mutable;P : mutable Presentation from Prs3d) is virtual;
+   UpdateTransformation(me:mutable;P : Presentation from Prs3d) is virtual;
     
    SetZLayer ( me         : mutable;
                thePrsMgr  : PresentationManager from PrsMgr;
@@ -264,22 +262,98 @@ is
      returns Integer from Standard is static;
    ---Purpose: Get ID of Z layer. If no presentations of object is displayed,
    -- and layer ID is unavailable, the -1 value is returned.
+
+   AddClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
+   ---Purpose: Adds clip plane for graphical clipping for all display mode
+   -- presentations. The composition of clip planes truncates the rendering
+   -- space to convex volume. Please be aware that number of supported
+   -- clip plane is limited. The planes which exceed the limit are ignored.
+   -- Besides of this, some planes can be already set in view where the object
+   -- is shown: the number of these planes should be substracted from limit
+   -- to predict the maximum possible number of object clipping planes.
+   -- @param thePlane [in] the clip plane to be appended to map of clip planes.
+
+   RemoveClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
+   ---Purpose: Removes previously added clip plane.
+   -- @param thePlane [in] the clip plane to be removed from map of clip planes.
+
+   SetClipPlanes (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d) is virtual;
+   ---Purpose: Set clip planes for graphical clipping for all display mode presentations.
+   -- The composition of clip planes truncates the rendering space to convex
+   -- volume. Please be aware that number of supported clip plane is limited.
+   -- The planes which exceed the limit are ignored. Besides of this, some
+   -- planes can be already set in view where the object is shown: the number 
+   -- of these planes should be substracted from limit to predict the maximum
+   -- possible number of object clipping planes.
+
+   GetClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d;
+   ---C++: inline
+   ---C++: return const&
+   ---Purpose: Get clip planes.
+   -- @return set of previously added clip planes for all display mode presentations.
+
+  SetMutable ( me           : mutable;
+               theIsMutable : Boolean from Standard ) is virtual;
+  ---Purpose: Sets if the object has mutable nature (content or location will be changed regularly).
+  -- This method should be called before object displaying to take effect.
+
+  IsMutable (me) returns Boolean from Standard;
+  ---C++: return const
+  ---Purpose: Returns true if object has mutable nature (content or location are be changed regularly).
+  -- Mutable object will be managed in different way than static onces (another optimizations).
+
+  AddChild ( me           : mutable;
+             theObject    : PresentableObject from PrsMgr ) is virtual;
+    --- Purpose: Makes theObject child of current object in scene hierarchy. 
+
+  RemoveChild ( me           : mutable;
+                theObject    : PresentableObject from PrsMgr ) is virtual;
+    --- Purpose: Removes theObject from children of current object in scene hierarchy. 
+
+  Children (me) returns ListOfPresentableObjects from PrsMgr is static;
+    ---C++: return const&
+    --- Purpose: Returns children of the current object.
+
+  HasOwnPresentations (me) returns Boolean from Standard is static;
+    ---C++: return const
+    --- Purpose: Returns true if object should have own presentations.
+
+  Parent (me) returns PresentableObjectPointer from PrsMgr is static;
+    ---C++: return const
+    --- Purpose: Returns parent of current object in scene hierarchy.
+
+   UpdateClipping (me : mutable) is virtual protected;
+   ---Purpose: General virtual method for internal update of presentation state
+   -- when some modifications on list of clip planes occurs. Base 
+   -- implementation propagate clip planes to every presentation.
+
 fields
     myPresentations: Presentations from PrsMgr is protected;
     myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
-    myLocation  : Location from TopLoc is protected; 
-    --myTransformPersistence  :  TransModeFlags  from  Graphic3d; 
+    myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected;
     myTransformPersistence  :  CTransPersStruct  from  Graphic3d;
+    myIsMutable : Boolean from Standard is protected;
+
+
+    myHasOwnPresentations : Boolean from Standard is protected; -- shows if object should have own presentations.
+
+    myParent : PresentableObjectPointer from PrsMgr; -- Reference to parent object in scene hierarchy.
+    myLocalTransformation : Trsf from gp;     -- Own transformation of presentable object.
+    myTransformation : Trsf from gp;          -- Combined transformation of presentable object.
+    myCombinedParentTransform : Trsf from gp; -- Combined transformation of presentable object excepting local transformation.
+
+    myChildren : ListOfPresentableObjects from PrsMgr; -- Child objects in scene hierarchy.
 
 friends
+    class Presentation        from PrsMgr,
     class PresentationManager from PrsMgr,
-    Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d),
-    Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
-                                                          aGivenStruct :  Structure from Graphic3d),
-    Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
-                                                          TheTrsf   : Transformation from Geom),
-    Compute from Presentation3d from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
-                                                          TheTrsf      : Transformation from Geom;
-                                                          aGivenStruct : Structure from Graphic3d)
+    Compute from Presentation from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d),
+    Compute from Presentation from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
+                                                        aGivenStruct :  Structure from Graphic3d),
+    Compute from Presentation from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
+                                                        TheTrsf   : Transformation from Geom),
+    Compute from Presentation from PrsMgr(me : mutable; aProjector   : DataStructureManager from Graphic3d;
+                                                        TheTrsf      : Transformation from Geom;
+                                                        aGivenStruct : Structure from Graphic3d)
 end PresentableObject from PrsMgr;