]> OCCT Git - occt-copy.git/commitdiff
0025552: Visualization - provide the way to hide the object in specified view of...
authorkgv <kgv@opencascade.com>
Wed, 24 Dec 2014 09:19:39 +0000 (12:19 +0300)
committerkgv <kgv@opencascade.com>
Wed, 24 Dec 2014 13:06:22 +0000 (16:06 +0300)
53 files changed:
src/AIS/AIS.cdl
src/AIS/AIS_InteractiveContext.cdl
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext_1.cxx
src/AIS/AIS_LocalContext_1.cxx
src/Graphic3d/FILES
src/Graphic3d/Graphic3d.cdl
src/Graphic3d/Graphic3d_CStructure.hxx
src/Graphic3d/Graphic3d_GraphicDriver.cdl
src/Graphic3d/Graphic3d_MapIteratorOfMapOfStructure.hxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_MapOfObject.hxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_MapOfStructure.hxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_NMapOfTransient.hxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_Structure.cdl
src/Graphic3d/Graphic3d_Structure.cxx
src/Graphic3d/Graphic3d_StructureManager.cdl
src/Graphic3d/Graphic3d_StructureManager.cxx
src/Graphic3d/Graphic3d_ViewAffinity.cxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_ViewAffinity.hxx [new file with mode: 0644]
src/OpenGl/FILES
src/OpenGl/OpenGl_BVHClipPrimitiveSet.cxx
src/OpenGl/OpenGl_BVHClipPrimitiveSet.hxx
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_GraphicDriver.hxx
src/OpenGl/OpenGl_GraphicDriver_4.cxx
src/OpenGl/OpenGl_GraphicDriver_7.cxx
src/OpenGl/OpenGl_LayerList.cxx
src/OpenGl/OpenGl_LayerList.hxx
src/OpenGl/OpenGl_PriorityList.cxx
src/OpenGl/OpenGl_PriorityList.hxx
src/OpenGl/OpenGl_SequenceOfStructure.hxx [new file with mode: 0644]
src/OpenGl/OpenGl_View.hxx
src/OpenGl/OpenGl_View_2.cxx
src/OpenGl/OpenGl_Workspace.cxx
src/OpenGl/OpenGl_Workspace.hxx
src/OpenGl/OpenGl_Workspace_Raytrace.cxx
src/Prs3d/Prs3d_Presentation.cdl
src/Prs3d/Prs3d_Presentation.cxx
src/PrsMgr/PrsMgr.cdl
src/PrsMgr/PrsMgr_Presentation.cdl
src/PrsMgr/PrsMgr_Presentation.cxx
src/PrsMgr/PrsMgr_PresentationManager.cdl
src/PrsMgr/PrsMgr_PresentationManager.cxx
src/SelectMgr/FILES
src/SelectMgr/SelectMgr_OrFilter.cdl
src/SelectMgr/SelectMgr_OrFilter.cxx
src/StdSelect/StdSelect_BRepOwner.cxx
src/V3d/V3d.cdl
src/ViewerTest/ViewerTest.cxx
src/Visual3d/Visual3d_View.cdl
src/Visual3d/Visual3d_View.cxx
src/Visual3d/Visual3d_ViewManager.cdl
src/Visual3d/Visual3d_ViewManager.cxx

index 657e746594a7374c85e4536b0c85922b0e9b619a..b67cae0a9b251efbe330a9d7227227b81369938e 100644 (file)
@@ -180,21 +180,22 @@ is
     TOI_IsoV,
     TOI_Both;
         ---Purpose: Declares the type of isoparameter displayed.           
-    
-    enumeration DisplayStatus is 
-    DS_Displayed,  
-    DS_Erased,     
-    DS_Temporary, 
-    DS_None;     
-        ---Purpose:
-        -- To give the display status of an Interactive Object.
-        -- This will be one of the following:
-        -- -   DS_Displayed: the Interactive Object is
-        --   displayed in the main viewer;
-        -- -   DS_Erased: the Interactive Object is hidden in main viewer;
-        -- -   DS_Temporary: the Interactive Object is temporarily displayed;
-        -- -   DS_None: the Interactive Object is nowhere displayed.
-        
+
+    enumeration DisplayStatus is
+    DS_Displayed,
+    DS_Erased,
+    DS_Temporary,
+    DS_DispImmediate,
+    DS_None;
+    ---Purpose:
+    -- To give the display status of an Interactive Object.
+    -- This will be one of the following:
+    -- - DS_Displayed:     the Interactive Object is displayed in the main viewer;
+    -- - DS_Erased:        the Interactive Object is hidden in main viewer;
+    -- - DS_Temporary:     temporarily displayed (in local context);
+    -- - DS_DispImmediate: displayed in the list of immediate presentations (highly interactive);
+    -- - DS_None:          nowhere displayed.
+
     enumeration SelectStatus is 
     SS_Added,
     SS_Removed,
index 50f94200e4b869394824f7c8437ecdb9239f39a2..50eaad2e58c60aa3abe2eac142b4cd15f58fe9bf 100644 (file)
@@ -172,30 +172,31 @@ is
        -- local context without selection, use the syntax below,
        -- setting aSelectionMode to -1.
 
-    Display(me                 : mutable;
-           anIobj             : InteractiveObject from AIS;
-           amode              : Integer from Standard ;
-           aSelectionMode     : Integer from Standard ;
-           updateviewer       : Boolean from Standard = Standard_True;
-           allowdecomposition : Boolean from Standard = Standard_True);
+    Display (me                      : mutable;
+             theIObj                 : InteractiveObject from AIS;
+             theDispMode             : Integer from Standard;
+             theSelectionMode        : Integer from Standard;
+             theToUpdateViewer       : Boolean from Standard = Standard_True;
+             theToAllowDecomposition : Boolean from Standard = Standard_True;
+             theDispStatus           : DisplayStatus from AIS = AIS_DS_None);
        ---Purpose: Controls the choice between the using the display
        -- and selection modes of open local context which you
        -- have defined and activating those available by default.
        -- If no Local Context is opened. and the Interactive
-       -- Object aniobj has no display mode of its own, the
-       -- default display mode, 0, is used. Likewise, if aniobj
+       -- Object theIObj has no display mode of its own, the
+       -- default display mode, 0, is used. Likewise, if theIObj
        -- has no selection mode of its own, the default one, 0, is used.
-       -- If a local context is open and if updateviewer equals
+       -- If a local context is open and if theToUpdateViewer equals
        -- Standard_False, the presentation of the Interactive
        -- Object activates the selection mode; the object is
        -- displayed but no viewer will be updated.
-       -- If aSelectionMode equals -1, anIobj will not be
+       -- If theSelectionMode equals -1, theIObj will not be
        -- activated: it will be displayed but will not be selectable.
        -- Use this if you want to view the object in open local
        -- context without selection. Note: This option is only
        -- available in Local Context.
-       -- If allowDecomposition equals true, anIObj can have
-       -- subshapes detected by selection mechanisms. anIObj
+       -- If theToAllowDecomposition equals true, theIObj can have
+       -- subshapes detected by selection mechanisms. theIObj
        -- must be able to give a shape selection modes which
        -- fit the AIS_Shape selection modes:
        -- -   vertices: 1
@@ -2030,6 +2031,19 @@ is
     ---Purpose: returns if possible,
     --          the first local context where the object is seen
 
+    SetViewAffinity (me           : mutable;
+                     theIObj      : InteractiveObject from AIS;
+                     theView      : View from V3d;
+                     theIsVisible : Boolean from Standard) is static;
+    ---Purpose: setup object visibility in specified view,
+    -- has no effect if object is not disaplyed in this context.
+
+    ObjectsForView (me;
+                    theListOfIO        : in out ListOfInteractive from AIS;
+                    theView            : View from V3d;
+                    theIsVisibleInView : Boolean from Standard;
+                    theStatus          : DisplayStatus from AIS = AIS_DS_None) is static;
+    ---Purpose: Query objects visible or hidden in specified view due to affinity mask.
 
     InitAttributes(me:mutable) is static private;
 
index 8f3e0bd0b460cd2581ff03314ec751a01377c0ad..f220dbab6fb2bee8d9c420b0c4fa7e51dd25bccd 100644 (file)
@@ -33,6 +33,7 @@
 #include <AIS_MapIteratorOfMapOfInteractive.hxx>
 #include <PrsMgr_ModedPresentation.hxx>
 #include <Visual3d_ViewManager.hxx>
+#include <Visual3d_View.hxx>
 #include <Prs3d_ShadingAspect.hxx>
 #include <AIS_Shape.hxx>
 #include <Graphic3d_AspectFillArea3d.hxx>
@@ -266,8 +267,12 @@ void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive
 {
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    if (anObjIter.Value()->GraphicStatus() != theStatus
-     || anObjIter.Key()->Type() != theKind)
+    if (theStatus != AIS_DS_None
+     && anObjIter.Value()->GraphicStatus() != theStatus)
+    {
+      continue;
+    }
+    else if (anObjIter.Key()->Type() != theKind)
     {
       continue;
     }
@@ -313,6 +318,35 @@ void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive&      theListO
   }
 }
 
+//=======================================================================
+//function : ObjectsForView
+//purpose  :
+//=======================================================================
+void AIS_InteractiveContext::ObjectsForView (AIS_ListOfInteractive&  theListOfIO,
+                                             const Handle(V3d_View)& theView,
+                                             const Standard_Boolean  theIsVisibleInView,
+                                             const AIS_DisplayStatus theStatus) const
+{
+  const Graphic3d_CView* aCView  = reinterpret_cast<const Graphic3d_CView* >(theView->View()->CView());
+  const Standard_Integer aViewId = aCView->ViewId;
+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
+  {
+    if (theStatus != AIS_DS_None
+     && anObjIter.Value()->GraphicStatus() != theStatus)
+    {
+      theListOfIO.Append (anObjIter.Key());
+      continue;
+    }
+
+    Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->ObjectAffinity (anObjIter.Key());
+    const Standard_Boolean isVisible = anAffinity->IsVisible (aViewId);
+    if (isVisible == theIsVisibleInView)
+    {
+      theListOfIO.Append (anObjIter.Key());
+    }
+  }
+}
+
 //=======================================================================
 //function : Display
 //purpose  :
@@ -332,6 +366,33 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
            theToUpdateViewer, theIObj->AcceptShapeDecomposition());
 }
 
+//=======================================================================
+//function : SetViewAffinity
+//purpose  :
+//=======================================================================
+void AIS_InteractiveContext::SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj,
+                                              const Handle(V3d_View)&              theView,
+                                              const Standard_Boolean               theIsVisible)
+{
+  if (theIObj.IsNull()
+  || !myObjects.IsBound (theIObj))
+  {
+    return;
+  }
+
+  Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->ObjectAffinity (theIObj);
+  const Graphic3d_CView* aCView = reinterpret_cast<const Graphic3d_CView* >(theView->View()->CView());
+  anAffinity->SetVisible (aCView->ViewId, theIsVisible == Standard_True);
+  if (theIsVisible)
+  {
+    theView->View()->ChangeHiddenObjects()->Remove (theIObj);
+  }
+  else
+  {
+    theView->View()->ChangeHiddenObjects()->Add (theIObj);
+  }
+}
+
 //=======================================================================
 //function : Display
 //purpose  :
@@ -340,33 +401,67 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
                                       const Standard_Integer               theDispMode,
                                       const Standard_Integer               theSelectionMode,
                                       const Standard_Boolean               theToUpdateViewer,
-                                      const Standard_Boolean               theToAllowDecomposition)
+                                      const Standard_Boolean               theToAllowDecomposition,
+                                      const AIS_DisplayStatus              theDispStatus)
 {
   if (theIObj.IsNull())
   {
     return;
   }
 
+  if (theDispStatus == AIS_DS_Erased)
+  {
+    Erase  (theIObj, theToUpdateViewer);
+    Load (theIObj, theSelectionMode, theToAllowDecomposition);
+    return;
+  }
+
   if (!theIObj->HasInteractiveContext())
   {
     theIObj->SetContext (this);
   }
 
-  if (HasOpenedContext())
+  if (theDispStatus == AIS_DS_Temporary
+  && !HasOpenedContext())
   {
-    myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
-    if (theToUpdateViewer)
+    return;
+  }
+  else if (HasOpenedContext())
+  {
+    if (theDispStatus == AIS_DS_None
+     || theDispStatus == AIS_DS_Temporary)
     {
-      myMainVwr->Update();
+      myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
+      if (theToUpdateViewer)
+      {
+        myMainVwr->Update();
+      }
+      return;
     }
-    return;
   }
 
+  const AIS_DisplayStatus aDispStatus = theDispStatus != AIS_DS_None ? theDispStatus : AIS_DS_Displayed;
   if (!myObjects.IsBound (theIObj))
   {
-    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
-    myObjects.Bind   (theIObj, aStatus);
-    myMainPM->Display(theIObj, theDispMode);
+    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (aDispStatus, theDispMode, theSelectionMode);
+    myObjects.Bind (theIObj, aStatus);
+    Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->RegisterObject (theIObj);
+
+    switch (aDispStatus)
+    {
+      case AIS_DS_Displayed:
+      {
+        myMainPM->Display (theIObj, theDispMode, Standard_False);
+        break;
+      }
+      case AIS_DS_DispImmediate:
+      {
+        myMainPM->Display (theIObj, theDispMode, Standard_True);
+        break;
+      }
+      default: break;
+    }
+
     if (theSelectionMode != -1)
     {
       if (!mgrSelector->Contains (theIObj))
@@ -379,8 +474,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
   else
   {
     Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-    if (aStatus->GraphicStatus() != AIS_DS_Displayed
-     && aStatus->GraphicStatus() != AIS_DS_Erased)
+    if (aStatus->GraphicStatus() == AIS_DS_Temporary)
     {
       return;
     }
@@ -413,11 +507,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
       aStatus->AddDisplayMode (theDispMode);
     }
 
-    myMainPM->Display (theIObj, theDispMode);
-    if (aStatus->GraphicStatus() == AIS_DS_Erased)
-    {
-      aStatus->SetGraphicStatus (AIS_DS_Displayed);
-    }
+    myMainPM->Display (theIObj, theDispMode, aDispStatus == AIS_DS_DispImmediate);
+    aStatus->SetGraphicStatus (aDispStatus);
     if (aStatus->IsHilighted())
     {
       const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
@@ -829,7 +920,8 @@ void AIS_InteractiveContext::Hilight (const Handle(AIS_InteractiveObject)& theIO
 
     Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
     aStatus->SetHilightStatus (Standard_True);
-    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+    if (aStatus->GraphicStatus() != AIS_DS_Erased
+     && aStatus->GraphicStatus() != AIS_DS_Temporary)
     {
       Standard_Integer aHilightMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
       myMainPM->Highlight (theIObj, aHilightMode);
@@ -862,14 +954,15 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
   {
     if(!myObjects.IsBound(anIObj)) return;
 
-    const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
-    STATUS->SetHilightStatus (Standard_True);
+    const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
+    aStatus->SetHilightStatus (Standard_True);
 
-    if (STATUS->GraphicStatus() == AIS_DS_Displayed)
+    if (aStatus->GraphicStatus() != AIS_DS_Erased
+     && aStatus->GraphicStatus() != AIS_DS_Temporary)
     {
-      Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
+      const Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
       myMainPM->Color (anIObj, aCol, aHilightMode);
-      STATUS->SetHilightColor (aCol);
+      aStatus->SetHilightColor (aCol);
     }
   }
   else
@@ -892,11 +985,12 @@ void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIO
   {
     if(!myObjects.IsBound(anIObj)) return;
 
-    const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
-    STATUS->SetHilightStatus (Standard_False);
-    STATUS->SetHilightColor(Quantity_NOC_WHITE);
+    const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
+    aStatus->SetHilightStatus (Standard_False);
+    aStatus->SetHilightColor(Quantity_NOC_WHITE);
 
-    if (STATUS->GraphicStatus() == AIS_DS_Displayed)
+    if (aStatus->GraphicStatus() != AIS_DS_Erased
+     && aStatus->GraphicStatus() != AIS_DS_Temporary)
     {
       Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
       myMainPM->Unhighlight (anIObj, aHilightMode);
@@ -1430,14 +1524,15 @@ void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode  theMode,
     }
 
     aStatus->AddDisplayMode (theMode);
-    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+    if (aStatus->GraphicStatus() == AIS_DS_Displayed
+     || aStatus->GraphicStatus() == AIS_DS_DispImmediate)
     {
-      myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
-      myMainPM->Display (anObj, theMode);
+      myMainPM->Display (anObj, theMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
       if (aStatus->IsSubIntensityOn())
       {
         myMainPM->Color (anObj, mySubIntensity, theMode);
       }
+      myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
     }
   }
 
@@ -1477,7 +1572,8 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
   }
 
   Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-  if (aStatus->GraphicStatus() != AIS_DS_Displayed)
+  if (aStatus->GraphicStatus() != AIS_DS_Displayed
+   && aStatus->GraphicStatus() != AIS_DS_DispImmediate)
   {
     theIObj->SetDisplayMode (theMode);
     return;
@@ -1509,7 +1605,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
     aStatus->AddDisplayMode (theMode);
   }
 
-  myMainPM->Display (theIObj, theMode);
+  myMainPM->Display (theIObj, theMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
   Standard_Integer aDispMode, aHiMode, aSelMode;
   GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
   if (aStatus->IsHilighted())
@@ -1560,14 +1656,15 @@ void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObjec
     aStatus->AddDisplayMode (myDisplayMode);
   }
 
-  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+  if (aStatus->GraphicStatus() == AIS_DS_Displayed
+   || aStatus->GraphicStatus() == AIS_DS_DispImmediate)
   {
     if (myMainPM->IsHighlighted (theIObj, anOldMode))
     {
       myMainPM->Unhighlight (theIObj, anOldMode);
     }
     myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
-    myMainPM->Display (theIObj, myDisplayMode);
+    myMainPM->Display (theIObj, myDisplayMode, aStatus->GraphicStatus() == AIS_DS_DispImmediate);
 
     Standard_Integer aDispMode, aHiMode, aSelMode;
     GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
@@ -2234,35 +2331,39 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
 
   Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
 
-  Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
-  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+  const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
+  if (aStatus->GraphicStatus() == AIS_DS_Temporary
+   || aStatus->GraphicStatus() == AIS_DS_Erased)
   {
-    for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
-    {
-      if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
-      {
-        myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
-      }
-      myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
-    }
+    return;
+  }
 
-    if (IsCurrent (theIObj)
-    && !aStatus->IsDModeIn (aDispMode))
+  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
+  {
+    if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
     {
-      myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
+      myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
     }
 
-    for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
-    {
-      mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
-    }
+    myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
+  }
 
-    if (theToUpdateviewer)
-    {
-      myMainVwr->Update();
-    }
+  if (IsCurrent (theIObj)
+  && !aStatus->IsDModeIn (aDispMode))
+  {
+    myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
+  }
+
+  for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
+  {
+    mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
   }
   aStatus->SetGraphicStatus (AIS_DS_Erased);
+
+  if (theToUpdateviewer)
+  {
+    myMainVwr->Update();
+  }
 }
 
 //=======================================================================
@@ -2326,6 +2427,11 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
   mgrSelector->Remove (theIObj);
 
   myObjects.UnBind (theIObj);
+  myMainVwr->Viewer()->UnregisterObject (theIObj);
+  for (myMainVwr->InitDefinedViews(); myMainVwr->MoreDefinedViews(); myMainVwr->NextDefinedViews())
+  {
+    myMainVwr->DefinedView()->View()->ChangeHiddenObjects()->Remove (theIObj);
+  }
 
   if (theToUpdateviewer
    && aStatus->GraphicStatus() == AIS_DS_Displayed)
index 50257ac640ad256f656c4aaccbd3805cde963b6b..5aeddc5987c8339ff197a0a58a87c1f676ce7cda 100644 (file)
@@ -43,6 +43,7 @@
 #include <V3d_SpotLight.hxx>
 #include <V3d_DirectionalLight.hxx>
 #include <V3d_AmbientLight.hxx>
+#include <Visual3d_View.hxx>
 
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <SelectMgr_Selection.hxx>
@@ -84,7 +85,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer  th
   AIS_StatusOfDetection aStatus        = AIS_SOD_Nothing;
   Standard_Boolean      toUpdateViewer = Standard_False;
 
-  // allonzy
+  myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
   myMainSel->Pick (theXPix, theYPix, theView);
 
   // filling of myAISDetectedSeq sequence storing information about detected AIS objects
index 2301294576bf83de684e66fb112a56194a91fd23..89214658c42f9c65261ba47ef065bace3c0ea049 100644 (file)
@@ -87,6 +87,7 @@
 #include <SelectBasics_SensitiveEntity.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <NCollection_Map.hxx>
+#include <Visual3d_View.hxx>
 
 #ifdef OCC9026
 #include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
@@ -128,6 +129,7 @@ AIS_StatusOfDetection AIS_LocalContext::MoveTo (const Standard_Integer  theXpix,
 
   myCurDetected = 0;
   myDetectedSeq.Clear();
+  myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
   myMainVS->Pick (theXpix, theYpix, theView);
 
   const Standard_Integer aDetectedNb = myMainVS->NbPicked();
index 96a87af0060f4dd0b99b9c3fd6297199f202b247..13251f067932b03d1c02c49eb634af5ffa39e709 100755 (executable)
@@ -23,6 +23,9 @@ Graphic3d_CPick.hxx
 Graphic3d_CUserDraw.hxx
 Graphic3d_CView.hxx
 Graphic3d_CGraduatedTrihedron.hxx
+Graphic3d_ViewAffinity.hxx
+Graphic3d_ViewAffinity.cxx
+Graphic3d_MapOfObject.hxx
 Graphic3d_Structure.lxx
 Graphic3d_Structure.pxx
 Graphic3d_ShaderObject.hxx
@@ -35,6 +38,8 @@ Graphic3d_ShaderVariable.lxx
 Graphic3d_ShaderObject_Handle.hxx
 Graphic3d_ShaderProgram_Handle.hxx
 Graphic3d_ShaderVariable_Handle.hxx
+Graphic3d_MapOfStructure.hxx
+Graphic3d_MapIteratorOfMapOfStructure.hxx
 Graphic3d_TypeOfShaderObject.hxx
 Graphic3d_DataStructure.pxx
 Graphic3d_StructureManager.pxx
@@ -69,3 +74,4 @@ Graphic3d_Camera.cxx
 Graphic3d_Camera.hxx
 Graphic3d_Camera_Handle.hxx
 Graphic3d_RenderingParams.hxx
+Graphic3d_NMapOfTransient.hxx
index 64ffa5263959769e96ee2c543486dc72a337245a..843698a04a913ff5463c82006689246e3612a4a8 100644 (file)
@@ -493,20 +493,18 @@ is
     imported Vertex;
     ---Category: Classes
 
+    imported transient class ViewAffinity;
+    imported MapOfStructure;
+    imported SequenceOfDisplayedStructures;
+    imported MapOfObject;
+    imported transient class NMapOfTransient;
+
     ---------------------------------
     -- Category: Instantiated classes
     ---------------------------------
 
     imported SequenceOfGroup;
 
-    ---Category: Instantiated classes
-
-    class MapOfStructure instantiates
-            Map from TCollection (Structure from Graphic3d,MapTransientHasher from TColStd);
-
-
-    ---Category: Instantiated classes
-
     class SequenceOfStructure instantiates
             Sequence from TCollection
             (Structure from Graphic3d);
index 92fd2ff186a6277c3c863f534c6c836857e8c4b6..f315461558a0d892076b5ff19ae28f47a2c60e46 100644 (file)
@@ -22,6 +22,7 @@
 #include <Graphic3d_SequenceOfHClipPlane.hxx>
 #include <Graphic3d_TypeOfComposition.hxx>
 #include <Graphic3d_Vec3.hxx>
+#include <Graphic3d_ViewAffinity.hxx>
 #include <Standard_Transient.hxx>
 #include <Handle_Graphic3d_GraphicDriver.hxx>
 
@@ -122,6 +123,8 @@ public:
 
   int   ContainsFacet;
 
+  Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
+
   unsigned IsInfinite     : 1;
   unsigned stick          : 1;
   unsigned highlight      : 1;
index 1145d25b89fd61e6e8d80203a726610a64bb0cba..0dd2a25a6cc812a82fbac2a80a878f306f36a3f8 100644 (file)
@@ -123,16 +123,16 @@ is
     -- Category: Structure management methods
     -----------------------------------------
 
-    DisplayStructure ( me            : mutable;
-                       theCView      : CView from Graphic3d;
-                       theCStructure : in out CStructure from Graphic3d;
-                       thePriority   : Integer from Standard )
+    DisplayStructure ( me           : mutable;
+                       theCView     : CView from Graphic3d;
+                       theStructure : Structure from Graphic3d;
+                       thePriority  : Integer from Standard )
         is deferred;
     ---Purpose: call_togl_displaystructure
 
-    EraseStructure ( me            : mutable;
-                     theCView      : CView from Graphic3d;
-                     theCStructure : in out CStructure from Graphic3d )
+    EraseStructure ( me           : mutable;
+                     theCView     : CView from Graphic3d;
+                     theStructure : Structure from Graphic3d )
         is deferred;
     ---Purpose: call_togl_erasestructure
 
@@ -369,9 +369,9 @@ is
     --    But it works in any case and is especially useful for view dump because the dump image is read from the back buffer.
     -- @return previous mode.
 
-    DisplayImmediateStructure ( me            : mutable;
-                                theCView      : CView      from Graphic3d;
-                                theCStructure : CStructure from Graphic3d )
+    DisplayImmediateStructure ( me           : mutable;
+                                theCView     : CView      from Graphic3d;
+                                theStructure : Structure from Graphic3d )
     is deferred;
     ---Purpose: Display structure in immediate mode on top of general presentation
 
diff --git a/src/Graphic3d/Graphic3d_MapIteratorOfMapOfStructure.hxx b/src/Graphic3d/Graphic3d_MapIteratorOfMapOfStructure.hxx
new file mode 100644 (file)
index 0000000..65368a5
--- /dev/null
@@ -0,0 +1,23 @@
+// Created on: 2014-12-18
+// Created by: Kirill Gavrilov
+// Copyright (c) 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.
+
+#ifndef _Graphic3d_MapIteratorOfMapOfStructure
+#define _Graphic3d_MapIteratorOfMapOfStructure
+
+#include <Graphic3d_MapOfStructure.hxx>
+
+typedef Graphic3d_MapOfStructure::Iterator Graphic3d_MapIteratorOfMapOfStructure;
+
+#endif // _Graphic3d_MapIteratorOfMapOfStructure
diff --git a/src/Graphic3d/Graphic3d_MapOfObject.hxx b/src/Graphic3d/Graphic3d_MapOfObject.hxx
new file mode 100644 (file)
index 0000000..c3bf0d2
--- /dev/null
@@ -0,0 +1,24 @@
+// Created on: 2014-12-18
+// Created by: Kirill Gavrilov
+// Copyright (c) 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.
+
+#ifndef _Graphic3d_MapOfObject
+#define _Graphic3d_MapOfObject
+
+#include <Graphic3d_ViewAffinity.hxx>
+#include <NCollection_DataMap.hxx>
+
+typedef NCollection_DataMap<const Standard_Transient* , Handle(Graphic3d_ViewAffinity)> Graphic3d_MapOfObject;
+
+#endif // _Graphic3d_MapOfObject
diff --git a/src/Graphic3d/Graphic3d_MapOfStructure.hxx b/src/Graphic3d/Graphic3d_MapOfStructure.hxx
new file mode 100644 (file)
index 0000000..6c8b230
--- /dev/null
@@ -0,0 +1,24 @@
+// Created on: 2014-12-18
+// Created by: Kirill Gavrilov
+// Copyright (c) 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.
+
+#ifndef _Graphic3d_MapOfStructure
+#define _Graphic3d_MapOfStructure
+
+#include <Handle_Graphic3d_Structure.hxx>
+#include <NCollection_Map.hxx>
+
+typedef NCollection_Map<Handle(Graphic3d_Structure)> Graphic3d_MapOfStructure;
+
+#endif // _Graphic3d_MapOfStructure
diff --git a/src/Graphic3d/Graphic3d_NMapOfTransient.hxx b/src/Graphic3d/Graphic3d_NMapOfTransient.hxx
new file mode 100644 (file)
index 0000000..c661e99
--- /dev/null
@@ -0,0 +1,25 @@
+// Created on: 2014-12-08
+// Copyright (c) 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.
+
+#ifndef _Graphic3d_NMapOfTransient_HeaderFile
+#define _Graphic3d_NMapOfTransient_HeaderFile
+
+#include <Standard_Transient.hxx>
+#include <NCollection_Map.hxx>
+#include <NCollection_Handle.hxx>
+
+typedef NCollection_Map<const Standard_Transient* >          Graphic3d_NMapOfTransient;
+typedef NCollection_Handle<Graphic3d_NMapOfTransient> Handle(Graphic3d_NMapOfTransient);
+
+#endif // _Graphic3d_NMapOfTransient_HeaderFile
index 46e1f861421cb2296c2a0c10dd884b94445782b8..38bfddec44340f95128abdd30a1a89a8c1f6f2cb 100644 (file)
@@ -190,20 +190,15 @@ is
        --          of the visualiser.
        ---Category: Methods to modify the class definition
 
-       Highlight ( me          : mutable;
-                   Method      : TypeOfHighlightMethod from Aspect )
+  Highlight ( me : mutable;
+              theMethod : TypeOfHighlightMethod from Aspect;
+              theColor  : Color                 from Quantity;
+              theToUpdateMgr : Boolean from Standard = Standard_True)
                is static;
        ---Level: Public
-       ---Purpose: Highlights the structure <me> in all the
-       --          views of the visualiser, using the following methods:
-       --
-       --   TOHM_COLOR         = drawn in the highlight color
-       --                                (default white)
-       --          TOHM_BLINK          = blinking
-       --   TOHM_BOUNDBOX      = enclosed by the boundary box
-       --                                (default white)
-       --
-       ---Category: Methods to modify the class definition
+       ---Purpose: Highlights the structure <me> in all the views of the visualiser, using the following methods:
+       --  TOHM_COLOR    = drawn in the highlight color
+       --  TOHM_BOUNDBOX = enclosed by the boundary box
 
        Remove ( me     : mutable )
                is static;
@@ -219,14 +214,6 @@ is
        ---Purpose: Computes axis-aligned bounding box of a structure.
        --  Category: Methods to modify the class definition
 
-       SetHighlightColor ( me          : mutable;
-                           AColor      : Color from Quantity )
-               is static;
-       ---Level: Public
-       ---Purpose: Modifies the highlight color for the Highlight method
-       --          with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
-       ---Category: Methods to modify the class definition
-
     SetInfiniteState (me : mutable; theToSet : Boolean from Standard) is static;
     ---Level: Internal
     ---Purpose: If <theToSet> is Standard_True then <me> is infinite and
index 92a42502f99a853dda9ed4cd41529a899a1a4487..83de47223f600d04972e6e7033f45d9eaef5cff3 100644 (file)
@@ -204,6 +204,7 @@ void Graphic3d_Structure::Display()
   }
 
   myCStructure->visible = 1;
+  //myCStructure->UpdateNamedStatus();
 }
 
 //=============================================================================
@@ -312,13 +313,17 @@ void Graphic3d_Structure::Erase()
 //function : Highlight
 //purpose  :
 //=============================================================================
-void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod)
+void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
+                                     const Quantity_Color&              theColor,
+                                     const Standard_Boolean             theToUpdateMgr)
 {
   if (IsDeleted())
   {
     return;
   }
 
+  myHighlightColor = theColor;
+
   // Highlight on already Highlighted structure.
   if (myCStructure->highlight)
   {
@@ -340,47 +345,18 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
   SetDisplayPriority (Structure_MAX_PRIORITY - 1);
 
   GraphicHighlight (theMethod);
-  if (myCStructure->stick)
-  {
-    myStructureManager->Highlight (this, theMethod);
-  }
 
-  Update();
-}
-
-//=============================================================================
-//function : SetHighlightColor
-//purpose  :
-//=============================================================================
-void Graphic3d_Structure::SetHighlightColor (const Quantity_Color& theColor)
-{
-  if (IsDeleted())
+  if (!theToUpdateMgr)
   {
     return;
   }
 
-  if (!myCStructure->highlight)
+  if (myCStructure->stick)
   {
-    myHighlightColor = theColor;
-    return;
+    myStructureManager->Highlight (this, theMethod);
   }
 
-  // Change highlight color on already Highlighted structure.
-  Aspect_TypeOfUpdate anUpdateMode  = myStructureManager->UpdateMode();
-  if (anUpdateMode == Aspect_TOU_WAIT)
-  {
-    UnHighlight();
-  }
-  else
-  {
-    // To avoid call of method : Update()
-    // Not useful and can be costly.
-    myStructureManager->SetUpdateMode (Aspect_TOU_WAIT);
-    UnHighlight();
-    myStructureManager->SetUpdateMode (anUpdateMode);
-  }
-  myHighlightColor = theColor;
-  Highlight (myHighlightMethod);
+  Update();
 }
 
 //=============================================================================
index f800563d4ee326eddee5e012878634b40e586ec6..713dca8abeeef8da57ce96ceab40832cb3e41e5c 100644 (file)
@@ -49,6 +49,8 @@ uses
        AspectText3d            from Graphic3d,
        Structure               from Graphic3d,
        MapOfStructure          from Graphic3d,
+  MapOfObject       from Graphic3d,
+  ViewAffinity      from Graphic3d,
        SequenceOfStructure     from Graphic3d,
     GraphicDriver    from Graphic3d
 
@@ -469,6 +471,19 @@ is
                        theStructures : MapOfStructure from Graphic3d);
   ---Purpose: Recomputes all structures from theStructures.
 
+  RegisterObject (me : mutable;
+                  theObject : Transient from Standard)
+  returns ViewAffinity from Graphic3d
+  is static;
+
+  UnregisterObject (me : mutable;
+                    theObject : Transient from Standard) is static;
+
+  ObjectAffinity (me;
+                  theObject : Transient from Standard)
+  returns ViewAffinity from Graphic3d
+  is static;
+
 --
 
 fields
@@ -500,6 +515,8 @@ fields
        MyDisplayedStructure    :       MapOfStructure from Graphic3d
                                                                is protected;
 
+  myRegisteredObjects : MapOfObject from Graphic3d is protected;
+
        -- the highlighted structures
        MyHighlightedStructure  :       MapOfStructure from Graphic3d
                                                                is protected;
index 8c7a92b364fcdcd389e4258b4afc65f53ce718f3..da39b3fe4604d322d64c82693896fc379535dc50 100644 (file)
@@ -358,3 +358,28 @@ void Graphic3d_StructureManager::RecomputeStructures (const Graphic3d_MapOfStruc
     aStruct->Compute();
   }
 }
+
+Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::RegisterObject (const Handle(Standard_Transient)& theObject)
+{
+  Handle(Graphic3d_ViewAffinity) aResult;
+  if (myRegisteredObjects.Find (theObject.operator->(), aResult))
+  {
+    return aResult;
+  }
+
+  aResult = new Graphic3d_ViewAffinity();
+  myRegisteredObjects.Bind (theObject.operator->(), aResult);
+  return aResult;
+}
+
+void Graphic3d_StructureManager::UnregisterObject (const Handle(Standard_Transient)& theObject)
+{
+  myRegisteredObjects.UnBind (theObject.operator->());
+}
+
+Handle(Graphic3d_ViewAffinity) Graphic3d_StructureManager::ObjectAffinity (const Handle(Standard_Transient)& theObject) const
+{
+  Handle(Graphic3d_ViewAffinity) aResult;
+  myRegisteredObjects.Find (theObject.operator->(), aResult);
+  return aResult;
+}
diff --git a/src/Graphic3d/Graphic3d_ViewAffinity.cxx b/src/Graphic3d/Graphic3d_ViewAffinity.cxx
new file mode 100644 (file)
index 0000000..c108a76
--- /dev/null
@@ -0,0 +1,19 @@
+// Created on: 2014-12-18
+// Created by: Kirill Gavrilov
+// Copyright (c) 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.
+
+#include <Graphic3d_ViewAffinity.hxx>
+
+IMPLEMENT_STANDARD_HANDLE (Graphic3d_ViewAffinity, Standard_Transient)
+IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ViewAffinity, Standard_Transient)
diff --git a/src/Graphic3d/Graphic3d_ViewAffinity.hxx b/src/Graphic3d/Graphic3d_ViewAffinity.hxx
new file mode 100644 (file)
index 0000000..f6b0b48
--- /dev/null
@@ -0,0 +1,66 @@
+// Created on: 2014-12-18
+// Created by: Kirill Gavrilov
+// Copyright (c) 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.
+
+#ifndef _Graphic3d_ViewAffinity_HeaderFile
+#define _Graphic3d_ViewAffinity_HeaderFile
+
+#include <Graphic3d_Structure.hxx>
+
+//! Structure display state.
+class Graphic3d_ViewAffinity : public Standard_Transient
+{
+public:
+
+  //! Empty constructor.
+  Graphic3d_ViewAffinity()
+  {
+    ::memset (&myMask, 0xFF, sizeof(myMask));
+  }
+
+  //! Return visibility flag.
+  bool IsVisible (const Standard_Integer theViewId) const
+  {
+    const unsigned int aBit = 1 << theViewId;
+    return (myMask & aBit) != 0;
+  }
+
+  //! Setup visibility flag.
+  void SetVisible (const Standard_Integer theViewId,
+                   const bool             theIsVisible)
+  {
+    const unsigned int aBit = 1 << theViewId;
+    if (theIsVisible)
+    {
+      myMask |=  aBit;
+    }
+    else
+    {
+      myMask &= ~aBit;
+    }
+  }
+
+private:
+
+  unsigned int myMask; //!< affinity mask
+
+public:
+
+  DEFINE_STANDARD_RTTI(Graphic3d_ViewAffinity)
+
+};
+
+DEFINE_STANDARD_HANDLE(Graphic3d_ViewAffinity, Standard_Transient)
+
+#endif // _Graphic3d_ViewAffinity_HeaderFile
index 77f09480003e41adfec86627d9ef5b2fda483f7c..8d2b4542a94cbe8842e60367da33680489b0b768 100755 (executable)
@@ -141,6 +141,7 @@ OpenGl_ShaderManager.hxx
 OpenGl_ShaderManager.cxx
 OpenGl_ShaderStates.hxx
 OpenGl_ShaderStates.cxx
+OpenGl_SequenceOfStructure.hxx
 Handle_OpenGl_ShaderObject.hxx
 Handle_OpenGl_ShaderProgram.hxx
 Handle_OpenGl_ShaderManager.hxx
index 4f3b9e83a9e3e2874f47e4d36df142cf49a21bd1..cda8413d10a877150304f290b55ab32d40989be4 100644 (file)
@@ -81,11 +81,9 @@ void OpenGl_BVHClipPrimitiveSet::Assign (const OpenGl_ArrayOfStructure& theStruc
   myStructs.Clear();
 
   const Standard_Integer aNbPriorities = theStructs.Length();
-  OpenGl_SequenceOfStructure::Iterator aStructIter;
   for (Standard_Integer aPriorityIdx = 0; aPriorityIdx < aNbPriorities; ++aPriorityIdx)
   {
-    const OpenGl_SequenceOfStructure& aSeq = theStructs (aPriorityIdx);
-    for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
+    for (OpenGl_SequenceOfStructure::Iterator aStructIter (theStructs (aPriorityIdx)); aStructIter.More(); aStructIter.Next())
     {
       const OpenGl_Structure* aStruct = aStructIter.Value();
       if (!aStruct->IsAlwaysRendered())
index 9a5c18a2fe4cb376cf7dd7232b7bb2c3581c3434..bf3b607f4e89bdc52343e1492764ff10cf374d0b 100644 (file)
 #define _OpenGl_BVHClipPrimitiveSet_HeaderFile
 
 #include <BVH_PrimitiveSet.hxx>
-
 #include <NCollection_Array1.hxx>
-#include <NCollection_Sequence.hxx>
 
 #include <OpenGl_Vec.hxx>
 #include <OpenGl_Structure.hxx>
+#include <OpenGl_SequenceOfStructure.hxx>
 
-typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
 typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
 
 //! Set of OpenGl_Structures for building BVH tree.
index 574c82e441b4dca55cb7a9051963d4be1afd9716..82010a1304ca5fdd45c7109db4ac1f5ed25111f3 100644 (file)
@@ -419,17 +419,16 @@ Standard_Boolean OpenGl_GraphicDriver::SetImmediateModeDrawToFront (const Graphi
 // function : DisplayImmediateStructure
 // purpose  :
 // =======================================================================
-void OpenGl_GraphicDriver::DisplayImmediateStructure (const Graphic3d_CView&      theCView,
-                                                      const Graphic3d_CStructure& theCStructure)
+void OpenGl_GraphicDriver::DisplayImmediateStructure (const Graphic3d_CView&             theCView,
+                                                      const Handle(Graphic3d_Structure)& theStructure)
 {
-  OpenGl_CView*     aCView     = (OpenGl_CView*     )theCView.ptrView;
-  OpenGl_Structure* aStructure = (OpenGl_Structure* )&theCStructure;
+  OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
   if (aCView == NULL)
   {
     return;
   }
 
-  aCView->View->DisplayImmediateStructure (aStructure);
+  aCView->View->DisplayImmediateStructure (theStructure);
 }
 
 // =======================================================================
index 7eb94c14cd314413ca121fc4d621b990792f639a..90a836b0f24fae3f6453adad9d4d7c27befa51e4 100644 (file)
@@ -122,18 +122,18 @@ public:
 
 public: // Methods for graphical structures
 
-  Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView,
-                                         Graphic3d_CStructure&  theCStructure,
-                                         const Standard_Integer thePriority);
-  Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView,
-                                       Graphic3d_CStructure&  theCStructure);
+  Standard_EXPORT void DisplayStructure (const Graphic3d_CView&             theCView,
+                                         const Handle(Graphic3d_Structure)& theStructure,
+                                         const Standard_Integer             thePriority);
+  Standard_EXPORT void EraseStructure (const Graphic3d_CView&             theCView,
+                                       const Handle(Graphic3d_Structure)& theStructure);
   Standard_EXPORT void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure);
   Standard_EXPORT Handle(Graphic3d_CStructure) Structure (const Handle(Graphic3d_StructureManager)& theManager);
 
   Standard_EXPORT Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView,
                                                                 const Standard_Boolean theDrawToFrontBuffer);
-  Standard_EXPORT void DisplayImmediateStructure (const Graphic3d_CView&      theCView,
-                                                  const Graphic3d_CStructure& theCStructure);
+  Standard_EXPORT void DisplayImmediateStructure (const Graphic3d_CView&             theCView,
+                                                  const Handle(Graphic3d_Structure)& theStructure);
   Standard_EXPORT void EraseImmediateStructure (const Graphic3d_CView&      theCView,
                                                 const Graphic3d_CStructure& theCStructure);
 
index 5e6a01514ab504d4e85c0ced429d87d182391112..3f3e65fd30e1375268ba43134cbc9e1a99e143af 100644 (file)
 #include <OpenGl_Structure.hxx>
 #include <OpenGl_CView.hxx>
 
-void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView,
-                                             Graphic3d_CStructure&  theCStructure,
-                                             const Standard_Integer thePriority)
+void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView&             theCView,
+                                             const Handle(Graphic3d_Structure)& theStructure,
+                                             const Standard_Integer             thePriority)
 {
-  const OpenGl_CView* aCView     = (const OpenGl_CView* )theCView.ptrView;
-  OpenGl_Structure*   aStructure = (OpenGl_Structure* )&theCStructure;
+  const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
   if (aCView == NULL)
     return;
 
-  aCView->View->DisplayStructure (aStructure, thePriority);
+  aCView->View->DisplayStructure (theStructure, thePriority);
 }
 
-void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView,
-                                           Graphic3d_CStructure&  theCStructure)
+void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView&             theCView,
+                                           const Handle(Graphic3d_Structure)& theStructure)
 {
-  const OpenGl_CView* aCView     = (const OpenGl_CView* )theCView.ptrView;
-  OpenGl_Structure*   aStructure = (OpenGl_Structure* )&theCStructure;
-  if (aCView == NULL || aStructure == NULL)
+  const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
+  if (aCView == NULL)
     return;
 
-  aCView->View->EraseStructure (aStructure);
+  aCView->View->EraseStructure (theStructure);
 }
 
 void OpenGl_GraphicDriver::RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure)
index 6340198045a8fa25c1407b4c412bd7c49d680db2..63baa86483ff5618956cb882bac93da4f321ece0 100644 (file)
@@ -27,7 +27,7 @@ void OpenGl_GraphicDriver::ActivateView (const Graphic3d_CView& ACView)
 {
   const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
   if (aCView)
-    aCView->WS->SetActiveView(aCView->View);
+    aCView->WS->SetActiveView(aCView->View, ACView.ViewId);
 }
 
 void OpenGl_GraphicDriver::AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
@@ -77,7 +77,7 @@ void OpenGl_GraphicDriver::DeactivateView (const Graphic3d_CView& ACView)
   if (aCView)
   {
     const Handle(OpenGl_View) aDummyView;
-    aCView->WS->SetActiveView(aDummyView);
+    aCView->WS->SetActiveView (aDummyView, -1);
   }
 }
 
@@ -510,7 +510,7 @@ Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& theCView)
 
     Handle(OpenGl_Workspace) aWS = new OpenGl_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
     aCView->WS = aWS;
-    aWS->SetActiveView (aCView->View);
+    aWS->SetActiveView (aCView->View, theCView.ViewId);
 
     myMapOfWS.UnBind (theCView.WsId);
     myMapOfWS.Bind   (theCView.WsId, aWS);
@@ -526,7 +526,7 @@ Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& theCView)
   aCView->View = aView;
   aCView->WS   = aWS;
   theCView.ptrView = aCView;
-  aWS->SetActiveView (aCView->View);
+  aWS->SetActiveView (aCView->View, theCView.ViewId);
 
   return Standard_True;
 }
index 93896580b7e9f5777a1121b410cd19f7336a213c..0575e0dc65a2d1d2416a36c24a1ee21a429b5b7d 100644 (file)
@@ -154,18 +154,19 @@ void OpenGl_LayerList::RemoveLayer (const Standard_Integer theLayerId)
 //purpose  :
 //=======================================================================
 
-void OpenGl_LayerList::AddStructure (const OpenGl_Structure *theStructure,
+void OpenGl_LayerList::AddStructure (const OpenGl_Structure* theStruct,
                                      const Standard_Integer  theLayerId,
                                      const Standard_Integer  thePriority,
-                                     Standard_Boolean isForChangePriority)
+                                     Standard_Boolean        isForChangePriority)
 {
   // add structure to associated layer,
   // if layer doesn't exists, display structure in default layer
-  OpenGl_PriorityList& aList = !HasLayer (theLayerId) ? defaultLayer ().PriorityList() :
-    myLayers.ChangeValue (myLayerIds.Find (theLayerId)).PriorityList();
+  OpenGl_PriorityList& aList = !HasLayer (theLayerId)
+                             ? defaultLayer().PriorityList()
+                             : myLayers.ChangeValue (myLayerIds.Find (theLayerId)).PriorityList();
 
-  aList.Add (theStructure, thePriority, isForChangePriority);
-  myNbStructures++;
+  aList.Add (theStruct, thePriority, isForChangePriority);
+  ++myNbStructures;
 
   // Note: In ray-tracing mode we don't modify modification
   // state here. It is redundant, because the possible changes
@@ -174,50 +175,49 @@ void OpenGl_LayerList::AddStructure (const OpenGl_Structure *theStructure,
 
 //=======================================================================
 //function : RemoveStructure
-//purpose  : 
+//purpose  :
 //=======================================================================
 
-void OpenGl_LayerList::RemoveStructure (const OpenGl_Structure *theStructure,
-                                        const Standard_Integer  theLayerId)
+void OpenGl_LayerList::RemoveStructure (const Handle(Graphic3d_Structure)& theStructure,
+                                        const Standard_Integer             theLayerId)
 {
-  Standard_Integer aSeqPos = !HasLayer (theLayerId) ?
-    1 : myLayerIds.Find (theLayerId);
-  
-  OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
+  Standard_Integer aSeqPos = !HasLayer (theLayerId) ? 1 : myLayerIds.Find (theLayerId);
+
+  OpenGl_PriorityList&    aList     = myLayers.ChangeValue (aSeqPos).PriorityList();
+  const OpenGl_Structure* aStruct   = reinterpret_cast<const OpenGl_Structure* > (theStructure->CStructure().operator->());
+  Standard_Integer        aPriority = -1;
 
   // remove structure from associated list
   // if the structure is not found there,
   // scan through layers and remove it
-  if (aList.Remove (theStructure) >= 0)
+  if (aList.Remove (aStruct, aPriority))
   {
-    myNbStructures--;
-
-    if (theStructure->IsRaytracable())
+    --myNbStructures;
+    if (aStruct->IsRaytracable())
     {
-      myModificationState++;
+      ++myModificationState;
     }
 
     return;
   }
-  
+
   // scan through layers and remove it
   Standard_Integer aSeqId = 1;
-  OpenGl_SequenceOfLayers::Iterator anIts;
-  for (anIts.Init (myLayers); anIts.More (); anIts.Next (), aSeqId++)
+  for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
   {
-    OpenGl_PriorityList& aScanList = anIts.ChangeValue ().PriorityList();
+    OpenGl_PriorityList& aScanList = anIts.ChangeValue().PriorityList();
     if (aSeqPos == aSeqId)
-      continue;
-  
-    if (aScanList.Remove (theStructure) >= 0)
     {
-      myNbStructures--;
+      continue;
+    }
 
-      if (theStructure->IsRaytracable())
+    if (aScanList.Remove (aStruct, aPriority))
+    {
+      --myNbStructures;
+      if (aStruct->IsRaytracable())
       {
-        myModificationState++;
+        ++myModificationState;
       }
-
       return;
     }
   }
@@ -242,44 +242,43 @@ void OpenGl_LayerList::InvalidateBVHData (const Standard_Integer theLayerId)
 //purpose  :
 //=======================================================================
 
-void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure *theStructure,
+void OpenGl_LayerList::ChangeLayer (const OpenGl_StructuretheStructure,
                                     const Standard_Integer  theOldLayerId,
                                     const Standard_Integer  theNewLayerId)
 {
-  Standard_Integer aSeqPos = !HasLayer (theOldLayerId) ?
-    1 : myLayerIds.Find (theOldLayerId);
-  
-  OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
-  Standard_Integer aPriority;
+  Standard_Integer     aSeqPos      = !HasLayer (theOldLayerId) ? 1 : myLayerIds.Find (theOldLayerId);
+  OpenGl_PriorityList& aForcastList = myLayers.ChangeValue (aSeqPos).PriorityList();
+  Standard_Integer     aPriority    = -1;
 
   // take priority and remove structure from list found by <theOldLayerId>
   // if the structure is not found there, scan through all other layers
-  if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
+  if (aForcastList.Remove (theStructure, aPriority, Standard_True))
   {
-    myNbStructures--;
+    --myNbStructures;
     // isForChangePriority should be Standard_False below, because we want
     // the BVH tree in the target layer to be updated with theStructure
     AddStructure (theStructure, theNewLayerId, aPriority);
+    return;
   }
-  else
+
+  // scan through layers and remove it
+  Standard_Integer aSeqId = 1;
+  for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
   {
-    // scan through layers and remove it
-    Standard_Integer aSeqId = 1;
-    OpenGl_SequenceOfLayers::Iterator anIts;
-    for (anIts.Init (myLayers); anIts.More (); anIts.Next (), aSeqId++)
+    if (aSeqPos == aSeqId)
     {
-      if (aSeqPos == aSeqId)
-        continue;
+      continue;
+    }
   
-      // try to remove structure and get priority value from this layer
-      if ((aPriority = aList.Remove (theStructure, Standard_True)) >= 0)
-      {
-        myNbStructures--;
-        // isForChangePriority should be Standard_False below, because we want
-        // the BVH tree in the target layer to be updated with theStructure
-        AddStructure (theStructure, theNewLayerId, aPriority);
-        break;
-      }
+    // try to remove structure and get priority value from this layer
+    OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
+    if (aList.Remove (theStructure, aPriority, Standard_True))
+    {
+      --myNbStructures;
+      // isForChangePriority should be Standard_False below, because we want
+      // the BVH tree in the target layer to be updated with theStructure
+      AddStructure (theStructure, theNewLayerId, aPriority);
+      return;
     }
   }
 }
@@ -288,35 +287,35 @@ void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure *theStructure,
 //function : ChangePriority
 //purpose  :
 //=======================================================================
-void OpenGl_LayerList::ChangePriority (const OpenGl_Structure *theStructure,
-                                       const Standard_Integer theLayerId,
-                                       const Standard_Integer theNewPriority)
+void OpenGl_LayerList::ChangePriority (const OpenGl_StructuretheStructure,
+                                       const Standard_Integer  theLayerId,
+                                       const Standard_Integer  theNewPriority)
 {
-  Standard_Integer aSeqPos = !HasLayer (theLayerId) ?
-    1 : myLayerIds.Find (theLayerId);
-
-  OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
+  Standard_Integer     aSeqPos       = !HasLayer (theLayerId) ? 1 : myLayerIds.Find (theLayerId);
+  OpenGl_PriorityList& aForcastList  = myLayers.ChangeValue (aSeqPos).PriorityList();
+  Standard_Integer     anOldPriority = -1;
 
-  if (aList.Remove (theStructure, Standard_True) >= 0)
+  if (aForcastList.Remove (theStructure, anOldPriority, Standard_True))
   {
-    myNbStructures--;
+    --myNbStructures;
     AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
+    return;
   }
-  else
+
+  Standard_Integer aSeqId = 1;
+  for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
   {
-    Standard_Integer aSeqId = 1;
-    OpenGl_SequenceOfLayers::Iterator anIts;
-    for (anIts.Init (myLayers); anIts.More (); anIts.Next (), aSeqId++)
+    if (aSeqPos == aSeqId)
     {
-      if (aSeqPos == aSeqId)
-        continue;
+      continue;
+    }
 
-      if (aList.Remove (theStructure, Standard_True) >= 0)
-      {
-        myNbStructures--;
-        AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
-        break;
-      }
+    OpenGl_PriorityList& aList = myLayers.ChangeValue (aSeqPos).PriorityList();
+    if (aList.Remove (theStructure, anOldPriority, Standard_True))
+    {
+      --myNbStructures;
+      AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
+      return;
     }
   }
 }
index c979feb1e7f000cb27c35cdf6c432039a04de9f5..f21374e5c3208b6f4661060d716c3dc8560d5a98 100644 (file)
@@ -32,8 +32,8 @@ typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
 
 class OpenGl_LayerList
 {
- public:
-  
+public:
+
   //! Constructor
   OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
   
@@ -58,14 +58,14 @@ class OpenGl_LayerList
   //! Add structure to list with given priority. The structure will be inserted
   //! to specified layer. If the layer isn't found, the structure will be put
   //! to default bottom-level layer.
-  void AddStructure (const OpenGl_Structure *theStructure,
+  void AddStructure (const OpenGl_Structure* theStruct,
                      const Standard_Integer  theLayerId,
                      const Standard_Integer  thePriority,
-                     Standard_Boolean isForChangePriority = Standard_False);
-  
+                     Standard_Boolean        isForChangePriority = Standard_False);
+
   //! Remove structure from structure list and return its previous priority
-  void RemoveStructure (const OpenGl_Structure *theStructure,
-                        const Standard_Integer  theZLayerId);
+  void RemoveStructure (const Handle(Graphic3d_Structure)& theStructure,
+                        const Standard_Integer             theZLayerId);
   
   //! Change structure z layer
   //! If the new layer is not presented, the structure will be displayed
index e6b8cc4d39b379d3e3592f87dd05d5e5a09dc097..7ddf6cc69d44eee9f760be81d3adb144cb259db7 100644 (file)
@@ -45,20 +45,24 @@ OpenGl_PriorityList::~OpenGl_PriorityList()
 // function : Add
 // purpose  :
 // =======================================================================
-void OpenGl_PriorityList::Add (const OpenGl_Structure* theStructure,
+void OpenGl_PriorityList::Add (const OpenGl_Structure* theStruct,
                                const Standard_Integer  thePriority,
-                               Standard_Boolean isForChangePriority)
+                               Standard_Boolean        isForChangePriority)
 {
   const Standard_Integer anIndex = Min (Max (thePriority, 0), myArray.Length() - 1);
+  if (theStruct == NULL)
+  {
+    return;
+  }
 
-  myArray (anIndex).Append (theStructure);
-  if (theStructure->IsAlwaysRendered())
+  myArray (anIndex).Append (theStruct);
+  if (theStruct->IsAlwaysRendered())
   {
-    theStructure->MarkAsNotCulled();
+    theStruct->MarkAsNotCulled();
   }
   else if (!isForChangePriority)
   {
-    myBVHPrimitives.Add (theStructure);
+    myBVHPrimitives.Add (theStruct);
   }
   ++myNbStructures;
 }
@@ -67,31 +71,39 @@ void OpenGl_PriorityList::Add (const OpenGl_Structure* theStructure,
 // function : Remove
 // purpose  :
 // =======================================================================
-Standard_Integer OpenGl_PriorityList::Remove (const OpenGl_Structure* theStructure,
-                                              Standard_Boolean isForChangePriority)
+bool OpenGl_PriorityList::Remove (const OpenGl_Structure* theStruct,
+                                  Standard_Integer&       thePriority,
+                                  Standard_Boolean        isForChangePriority)
 {
+  if (theStruct == NULL)
+  {
+    thePriority = -1;
+    return false;
+  }
+
   const Standard_Integer aNbPriorities = myArray.Length();
-  OpenGl_SequenceOfStructure::Iterator aStructIter;
   for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
   {
     OpenGl_SequenceOfStructure& aSeq = myArray (aPriorityIter);
-    for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
+    for (OpenGl_SequenceOfStructure::Iterator aStructIter (aSeq); aStructIter.More(); aStructIter.Next())
     {
-      if (aStructIter.Value() == theStructure)
+      if (aStructIter.Value() == theStruct)
       {
         aSeq.Remove (aStructIter);
-        if (!theStructure->IsAlwaysRendered()
-            && !isForChangePriority)
+        if (!theStruct->IsAlwaysRendered()
+         && !isForChangePriority)
         {
-          myBVHPrimitives.Remove (theStructure);
+          myBVHPrimitives.Remove (theStruct);
         }
         --myNbStructures;
-        return aPriorityIter;
+        thePriority = aPriorityIter;
+        return true;
       }
     }
   }
 
-  return -1;
+  thePriority = -1;
+  return false;
 }
 
 // =======================================================================
@@ -119,12 +131,23 @@ void OpenGl_PriorityList::Render (const Handle(OpenGl_Workspace)& theWorkspace)
 void OpenGl_PriorityList::renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const
 {
   const Standard_Integer aNbPriorities = myArray.Length();
-  OpenGl_SequenceOfStructure::Iterator aStructIter;
+  const Standard_Integer aViewId       = theWorkspace->ActiveViewId();
   for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
   {
-    for (aStructIter.Init (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
+    for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
     {
-      aStructIter.Value()->Render (theWorkspace);
+      const OpenGl_Structure* aStruct = aStructIter.Value();
+      if (!aStruct->visible)
+      {
+        continue;
+      }
+      else if (!aStruct->ViewAffinity.IsNull()
+            && !aStruct->ViewAffinity->IsVisible (aViewId))
+      {
+        continue;
+      }
+
+      aStruct->Render (theWorkspace);
     }
   }
 }
@@ -145,16 +168,25 @@ void OpenGl_PriorityList::renderTraverse (const Handle(OpenGl_Workspace)& theWor
   traverse (aSelector);
 
   const Standard_Integer aNbPriorities = myArray.Length();
-  OpenGl_SequenceOfStructure::Iterator aStructIter;
+  const Standard_Integer aViewId       = theWorkspace->ActiveViewId();
   for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
   {
-    for (aStructIter.Init (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
+    for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
     {
-      if (!aStructIter.Value()->IsCulled())
+      const OpenGl_Structure* aStruct = aStructIter.Value();
+      if (!aStruct->visible
+        || aStruct->IsCulled())
       {
-        aStructIter.Value()->Render (theWorkspace);
-        aStructIter.Value()->ResetCullingStatus();
+        continue;
       }
+      else if (!aStruct->ViewAffinity.IsNull()
+            && !aStruct->ViewAffinity->IsVisible (aViewId))
+      {
+        continue;
+      }
+
+      aStruct->Render (theWorkspace);
+      aStruct->ResetCullingStatus();
     }
   }
 }
@@ -248,11 +280,9 @@ Standard_Boolean OpenGl_PriorityList::Append (const OpenGl_PriorityList& theOthe
   }
 
   // add all structures to destination priority list
-  OpenGl_SequenceOfStructure::Iterator aStructIter;
   for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
   {
-    const OpenGl_SequenceOfStructure& aSeq = theOther.myArray (aPriorityIter);
-    for (aStructIter.Init (aSeq); aStructIter.More(); aStructIter.Next())
+    for (OpenGl_SequenceOfStructure::Iterator aStructIter (theOther.myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
     {
       Add (aStructIter.Value(), aPriorityIter);
     }
index dab5631f4fcba5c6028aa856c6e0af787e7c9d01..893aeafb38e1c3732676e33e6c7e506fda22a939 100644 (file)
 #include <OpenGl_BVHClipPrimitiveSet.hxx>
 #include <OpenGl_BVHTreeSelector.hxx>
 
-class OpenGl_Structure;
-
-typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
-typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
-
 class OpenGl_PriorityList
 {
 public:
@@ -40,13 +35,14 @@ public:
   //! Destructor.
   virtual ~OpenGl_PriorityList();
 
-  void Add (const OpenGl_Structure* theStructure,
+  void Add (const OpenGl_Structure* theStruct,
             const Standard_Integer  thePriority,
-            Standard_Boolean isForChangePriority = Standard_False);
+            Standard_Boolean        isForChangePriority = Standard_False);
 
   //! Remove structure and returns its priority, if the structure is not found, method returns negative value
-  Standard_Integer Remove (const OpenGl_Structure* theStructure,
-                           Standard_Boolean isForChangePriority = Standard_False);
+  bool Remove (const OpenGl_Structure* theStruct,
+               Standard_Integer&       thePriority,
+               Standard_Boolean        isForChangePriority = Standard_False);
 
   //! @return the number of structures
   Standard_Integer NbStructures() const { return myNbStructures; }
diff --git a/src/OpenGl/OpenGl_SequenceOfStructure.hxx b/src/OpenGl/OpenGl_SequenceOfStructure.hxx
new file mode 100644 (file)
index 0000000..3f33832
--- /dev/null
@@ -0,0 +1,24 @@
+// Created on: 2014-12-18
+// Created by: Kirill Gavrilov
+// Copyright (c) 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.
+
+#ifndef _OpenGl_SequenceOfStructure
+#define _OpenGl_SequenceOfStructure
+
+#include <NCollection_Sequence.hxx>
+
+class OpenGl_Structure;
+typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
+
+#endif // _OpenGl_SequenceOfStructure
index ff2885e6d0706633ae987a6f60d9d4640d6b2e50..bcd4793d19164248a8a3eacb4b6390ae5a0368f7 100644 (file)
@@ -139,14 +139,14 @@ class OpenGl_View : public MMgt_TShared
   //! The structure will be added to associated with it z layer.
   //! If the z layer is not presented in the view, the structure will
   //! be displayed in default bottom-level z layer.
-  void DisplayStructure (const OpenGl_Structure* theStructure,
-                         const Standard_Integer  thePriority);
+  void DisplayStructure (const Handle(Graphic3d_Structure)& theStructure,
+                         const Standard_Integer             thePriority);
 
   //! Erase structure from display list.
-  void EraseStructure (const OpenGl_Structure* theStructure);
+  void EraseStructure (const Handle(Graphic3d_Structure)& theStructure);
 
   //! Add structure to the list of immediate structures.
-  void DisplayImmediateStructure (const OpenGl_Structure* theStructure);
+  void DisplayImmediateStructure (const Handle(Graphic3d_Structure)& theStructure);
 
   //! Erase structure from display list.
   void EraseImmediateStructure (const OpenGl_Structure* theStructure);
index ba6f1d17c5033d59c2a6e2d4ae8b473c45c61446..1b4e06af57716fed99b9487bb2a80160be7bc7bd 100644 (file)
@@ -1024,11 +1024,12 @@ void OpenGl_View::RemoveZLayer (const Standard_Integer theLayerId)
 //purpose  :
 //=======================================================================
 
-void OpenGl_View::DisplayStructure (const OpenGl_Structure *theStructure,
-                                    const Standard_Integer  thePriority)
+void OpenGl_View::DisplayStructure (const Handle(Graphic3d_Structure)& theStructure,
+                                    const Standard_Integer             thePriority)
 {
-  Standard_Integer aZLayer = theStructure->GetZLayer ();
-  myZLayers.AddStructure (theStructure, aZLayer, thePriority);
+  const Standard_Integer  aZLayer = theStructure->GetZLayer();
+  const OpenGl_Structure* aStruct = reinterpret_cast<const OpenGl_Structure*> (theStructure->CStructure().operator->());
+  myZLayers.AddStructure (aStruct, aZLayer, thePriority);
 }
 
 //=======================================================================
@@ -1036,18 +1037,19 @@ void OpenGl_View::DisplayStructure (const OpenGl_Structure *theStructure,
 //purpose  :
 //=======================================================================
 
-void OpenGl_View::DisplayImmediateStructure (const OpenGl_Structure* theStructure)
+void OpenGl_View::DisplayImmediateStructure (const Handle(Graphic3d_Structure)& theStructure)
 {
+  const OpenGl_Structure* aStruct = reinterpret_cast<const OpenGl_Structure*> (theStructure->CStructure().operator->());
   for (OpenGl_SequenceOfStructure::Iterator anIter (myImmediateList);
        anIter.More(); anIter.Next())
   {
-    if (anIter.Value() == theStructure)
+    if (anIter.Value() == aStruct)
     {
       return;
     }
   }
 
-  myImmediateList.Append (theStructure);
+  myImmediateList.Append (aStruct);
 }
 
 //=======================================================================
@@ -1055,7 +1057,7 @@ void OpenGl_View::DisplayImmediateStructure (const OpenGl_Structure* theStructur
 //purpose  :
 //=======================================================================
 
-void OpenGl_View::EraseStructure (const OpenGl_Structure *theStructure)
+void OpenGl_View::EraseStructure (const Handle(Graphic3d_Structure)& theStructure)
 {
   Standard_Integer aZLayer = theStructure->GetZLayer ();
   myZLayers.RemoveStructure (theStructure, aZLayer);
index 75afc337ad91bdac2341d30889cecf5a825562af..c737d42a6666ff1c8282a4832de994d375314a5e 100644 (file)
@@ -152,6 +152,7 @@ OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_GraphicDriver)& theDrive
   //
   myRaytraceFilter       (new OpenGl_RaytraceFilter()),
   myToRedrawGL           (Standard_True),
+  myViewId               (-1),
   myAntiAliasingMode     (3),
   myTransientDrawToFront (Standard_True),
   myBackBufferRestored   (Standard_False),
@@ -953,6 +954,16 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
        anIter.More(); anIter.Next())
   {
     const OpenGl_Structure* aStructure = anIter.Value();
+    if (!aStructure->visible)
+    {
+      continue;
+    }
+    else if (!aStructure->ViewAffinity.IsNull()
+          && !aStructure->ViewAffinity->IsVisible (myViewId))
+    {
+      continue;
+    }
+
     aStructure->Render (aWS);
   }
 
index 6c5d4ae6b24331cb99fb6ee434ce518042b60ff9..5d02e1561062371538e6f1591efcbcd883470aa6 100644 (file)
@@ -140,8 +140,16 @@ public:
   //! Destructor
   virtual ~OpenGl_Workspace();
 
-  void SetActiveView (const Handle(OpenGl_View)& theView) { myView = theView; }
-  const Handle(OpenGl_View)& ActiveView () const { return myView; }
+  void SetActiveView (const Handle(OpenGl_View)& theView,
+                      const Standard_Integer     theViewId)
+  {
+    myView   = theView;
+    myViewId = theViewId;
+  }
+
+  const Handle(OpenGl_View)& ActiveView() const { return myView; }
+
+  Standard_Integer ActiveViewId() const { return myViewId; }
 
   //! Redraw the window.
   void Redraw (const Graphic3d_CView& theCView,
@@ -659,6 +667,7 @@ protected: //! @name protected fields
   Handle(OpenGl_PrinterContext) myPrintContext;
   Handle(OpenGl_View)           myView;
   Handle(OpenGl_LineAttributes) myLineAttribs;
+  Standard_Integer       myViewId;
   Standard_Integer       myAntiAliasingMode;
   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
   Standard_Boolean       myBackBufferRestored;
index 21fe122f9937a5212b1a3db74fe2e6ee95ff8540..ffc5453cc79c5e0c8561214d26bd326723fd29dc 100644 (file)
@@ -80,9 +80,7 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
 
     for (Standard_Integer anIndex = 0; anIndex < aStructArray.Length(); ++anIndex)
     {
-      OpenGl_SequenceOfStructure::Iterator aStructIt;
-
-      for (aStructIt.Init (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
+      for (OpenGl_SequenceOfStructure::Iterator aStructIt (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
       {
         const OpenGl_Structure* aStructure = aStructIt.Value();
 
@@ -96,8 +94,15 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
         else if (theMode == OpenGl_GUM_PREPARE)
         {
           if (!aStructure->IsRaytracable()
-           || !aStructure->IsVisible())
+           || !aStructure->visible)
+          {
+            continue;
+          }
+          else if (!aStructure->ViewAffinity.IsNull()
+                && !aStructure->ViewAffinity->IsVisible (myViewId))
+          {
             continue;
+          }
 
           for (OpenGl_Structure::GroupIterator aGroupIter (aStructure->DrawGroups()); aGroupIter.More(); aGroupIter.Next())
           {
index 4a59f6644512b650848fe58adaaa6d32c1ed6686..9ffec16c584745d6d798bcd59168c93e2755f4bc 100644 (file)
@@ -82,21 +82,6 @@ is
        ---Purpose: Returns the new Structure defined for the new visualization
        ---Category: Methods to modify the class definition
 
-
----Category: Highlighting methods.
---           
-    Highlight(me: mutable) is static;
-       ---Purpose: displays the whole content of the presentation in white.
-    Color(me: mutable; aColor: NameOfColor from Quantity) is static;
-       ---Purpose: displays the whole content of the presentation in the specified color.
-    BoundBox(me: mutable) is static;
-
-    SetIsForHighlight (me             : mutable;
-                       isForHighlight : Boolean from Standard)
-        is virtual;
-    ---Purpose: marks the structure <me> representing wired structure needed for
-    --          highlight only so it won't be added to BVH tree.
-
 ---Category: Global modification methods.
     SetShadingAspect(me: mutable; aShadingAspect: ShadingAspect from Prs3d);
     
index 57bcb11348068aceb902db85d90890a0165ce84e..11fdafe99bfc72311e9dba877afeeccff32edc71 100644 (file)
@@ -99,38 +99,6 @@ Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)
   SetPrimitivesAspect (aDefAspect);
 }
 
-//=======================================================================
-//function : Highlight
-//purpose  : 
-//=======================================================================
-void Prs3d_Presentation::Highlight()
-{
-  SetHighlightColor(Quantity_Color(Quantity_NOC_GRAY99));
-  Aspect_TypeOfHighlightMethod Method = Aspect_TOHM_COLOR;
-  Graphic3d_Structure::Highlight(Method);
-}
-
-//=======================================================================
-//function : Color
-//purpose  : 
-//=======================================================================
-void Prs3d_Presentation::Color(const Quantity_NameOfColor aColor) 
-{
-  SetHighlightColor(Quantity_Color(aColor));
-  Graphic3d_Structure::Highlight(Aspect_TOHM_COLOR);
-}
-
-//=======================================================================
-//function : BoundBox
-//purpose  : 
-//=======================================================================
-void Prs3d_Presentation::BoundBox()
-{ 
-  SetHighlightColor(Quantity_Color(Quantity_NOC_GRAY99));
-  Graphic3d_Structure::Highlight(Aspect_TOHM_BOUNDBOX);
-}
-
-
 //=======================================================================
 //function : SetShadingAspect
 //purpose  : 
@@ -287,15 +255,6 @@ Handle(Graphic3d_Group) Prs3d_Presentation::CurrentGroup () const
 }
 
 //=======================================================================
-//=======================================================================
-//function : SetIsForHighlight
-//purpose  :
-//=======================================================================
-void Prs3d_Presentation::SetIsForHighlight (const Standard_Boolean isForHighlight)
-{
-  Graphic3d_Structure::SetIsForHighlight (isForHighlight);
-}
-
 //function : Compute
 //purpose  : 
 //=======================================================================
index 990c74914d8a0a438f1e51a599fc4f69187c6bf6..db39877ca48905a0d76601240d32d451c8f6c215 100644 (file)
@@ -33,9 +33,12 @@ uses
 
     MMgt,TCollection,
     TopLoc,
-    Prs3d,Graphic3d,
+    Aspect,
+    Prs3d,
+    Graphic3d,
     Quantity,Geom,
-    V3d, 
+    Visual3d,
+    V3d,
     TColStd, 
     gp
  
index 96f276719828d1160fa7ad31ec591f7c50c8f460..220a857cc1a28250b794f9c32ab9c91c5941b0bf 100644 (file)
@@ -21,9 +21,11 @@ uses
 
   PresentationManager from PrsMgr,
   NameOfColor from Quantity,
+  Color       from Quantity,
   Transformation from Geom,
   Length from Quantity,
   ShadingAspect from Prs3d,
+  TypeOfHighlightMethod from Aspect,
   TypeOfPresentation3d from PrsMgr,
   DataStructureManager from Graphic3d,
   Structure from Graphic3d,
@@ -59,7 +61,9 @@ is
               theValue : Boolean from Standard)
   is virtual private;
 
-  Highlight (me : mutable) is virtual private;
+  Highlight (me : mutable;
+             theMethod : TypeOfHighlightMethod from Aspect;
+             theColor  : Color                 from Quantity) is virtual private;
 
   Unhighlight (me) is virtual private;
 
@@ -89,13 +93,6 @@ is
   ---Purpose: removes the whole content of the presentation.
   --          Does not remove the other connected presentations.
 
-  Color (me       : mutable;
-         theColor : NameOfColor from Quantity)
-  is virtual private;
-
-  BoundBox (me)
-  is static private;
-
 ---Category: references to other presentation.
 
   Connect (me;
index facc71efbb5f584a0d3b837b3af0b1f760eb4322..36b9d53422a8368f9a795629897ce49567435c46 100644 (file)
@@ -116,7 +116,8 @@ void PrsMgr_Presentation::SetVisible (const Standard_Boolean theValue)
 //function : Highlight
 //purpose  :
 //=======================================================================
-void PrsMgr_Presentation::Highlight()
+void PrsMgr_Presentation::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
+                                     const Quantity_Color&              theColor)
 {
   if (!IsHighlighted())
   {
@@ -124,7 +125,7 @@ void PrsMgr_Presentation::Highlight()
   }
 
   Display (Standard_True);
-  myStructure->Highlight();
+  myStructure->Highlight (theMethod, theColor);
 }
 
 //=======================================================================
@@ -134,7 +135,13 @@ void PrsMgr_Presentation::Highlight()
 void PrsMgr_Presentation::Unhighlight() const
 {
   myStructure->UnHighlight();
-  switch (myBeforeHighlightState)
+  if (myBeforeHighlightState == State_Visible)
+  {
+    return;
+  }
+
+  myStructure->SetVisible (Standard_False);
+  /**switch (myBeforeHighlightState)
   {
  case State_Visible:
     return;
@@ -144,7 +151,7 @@ void PrsMgr_Presentation::Unhighlight() const
  case State_Empty:
     myStructure->Erase();
     break;
-  }
+  }*/
 }
 
 //=======================================================================
@@ -169,30 +176,6 @@ void PrsMgr_Presentation::Clear()
   myStructure->RemoveAll();
 }
 
-//=======================================================================
-//function : Color
-//purpose  :
-//=======================================================================
-void PrsMgr_Presentation::Color (const Quantity_NameOfColor theColor)
-{
-  if (!IsHighlighted())
-  {
-    myBeforeHighlightState = StructureState (myStructure);
-  }
-
-  Display (Standard_True);
-  myStructure->Color (theColor);
-}
-
-//=======================================================================
-//function : BoundBox
-//purpose  :
-//=======================================================================
-void PrsMgr_Presentation::BoundBox() const
-{
-  myStructure->BoundBox();
-}
-
 //=======================================================================
 //function : IsDisplayed
 //purpose  :
index 970982d2b2c0e9a15722ac1c06b4c22ca73ae692..b1b3c91b750034da0a9b434c305d4f11221256ee 100644 (file)
@@ -28,10 +28,12 @@ uses
   PresentableObject   from PrsMgr,
   ListOfPresentations from PrsMgr,
   Length,NameOfColor  from Quantity,
+  Color               from Quantity,
   Transformation      from Geom,
   NameOfMaterial      from Graphic3d,
   Presentation        from PrsMgr,
   View                from V3d,
+  ViewManager         from Visual3d,
   ShadingAspect       from Prs3d,
   Presentation        from Prs3d
 
@@ -41,14 +43,15 @@ raises
 
 is
 
-  Create (theStructureManager : StructureManager from Graphic3d)
+  Create (theStructureManager : ViewManager from Visual3d)
   returns PresentationManager from PrsMgr;
   ---Purpose:
   -- Creates a framework to manage displays and graphic entities with the 3D view theStructureManager.
 
-  Display (me           : mutable;
-           thePrsObject : PresentableObject from PrsMgr;
-           theMode      : Integer from Standard = 0)
+  Display (me             : mutable;
+           thePrsObject   : PresentableObject from PrsMgr;
+           theMode        : Integer from Standard = 0;
+           theIsImmediate : Boolean from Standard = Standard_False)
   ---Purpose: Displays the presentation of the object in the given Presentation manager with the given mode.
   --          The mode should be enumerated by the object which inherits PresentableObject.
   is static;
@@ -167,7 +170,8 @@ is
   Color (me           : mutable;
          thePrsObject : PresentableObject from PrsMgr;
          theColor     : NameOfColor from Quantity = Quantity_NOC_YELLOW;
-         theMode      : Integer from Standard = 0)
+         theMode      : Integer from Standard = 0;
+         theSelObj    : PresentableObject from PrsMgr = NULL)
   ---Purpose: Highlights the graphic object thePrsObject in the color theColor.
   -- thePrsObject has the display mode theMode;
   -- this has the default value of 0, that is, the wireframe display mode.
@@ -232,30 +236,28 @@ is
 
   Presentation (me;
                 thePrsObject : PresentableObject from PrsMgr;
-                theMode      : Integer from Standard = 0)
+                theMode      : Integer from Standard = 0;
+                theToCreate  : Boolean from Standard = Standard_False;
+                theSelObj    : PresentableObject from PrsMgr = NULL)
   returns Presentation from PrsMgr
-  raises NoSuchObject from Standard
   is static;
-  ---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework. thePrsObject has the display mode theMode.
-
-  AddPresentation (me           : mutable;
-                   thePrsObject : PresentableObject from PrsMgr;
-                   theMode      : Integer from Standard = 0)
-  ---Purpose: Adds a presentation of the presentable object thePrsObject to this framework.
-  -- thePrsObject has the display mode theMode.
-  is protected;
+  ---Purpose: Returns the presentation Presentation of the presentable object thePrsObject in this framework.
+  -- When theToCreate is true - automatically creates presentation for specified mode when not exist.
+  -- Optional argument theSelObj specifies parent decomposed object to inherit its view affinity.
 
   RemovePresentation (me           : mutable;
                       thePrsObject : PresentableObject from PrsMgr;
                       theMode      : Integer from Standard = 0)
+  returns Boolean from Standard
   ---Purpose: Removes a presentation of the presentable object thePrsObject to this framework. thePrsObject has the display mode theMode.
   is protected;
 
 fields
 
-  myStructureManager : StructureManager    from Graphic3d is protected;
+  myStructureManager : ViewManager         from Visual3d  is protected;
   myImmediateModeOn  : Integer             from Standard  is protected;
   myImmediateList    : ListOfPresentations from PrsMgr    is protected;
   myImmediateView    : View                from V3d       is protected;
+  mySelectionColor   : Color               from Quantity  is protected;
 
 end PresentationManager from PrsMgr;
index 79fca1fd81686edd273f199035d3c88fbf1ade46..5ef85af98e1b0ba9dd08be2cf4c6f4f2be413e67 100644 (file)
 // function : PrsMgr_PresentationManager
 // purpose  :
 // =======================================================================
-PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_StructureManager)& theStructureManager)
+PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Visual3d_ViewManager)& theStructureManager)
 : myStructureManager (theStructureManager),
-  myImmediateModeOn  (0)
+  myImmediateModeOn  (0),
+  mySelectionColor   (Quantity_NOC_GRAY99)
 {
   //
 }
@@ -41,25 +42,30 @@ PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_S
 // purpose  :
 // =======================================================================
 void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                          const Standard_Integer                  theMode)
+                                          const Standard_Integer                  theMode,
+                                          const Standard_Boolean                  theIsImmediate)
 {
   if (thePrsObj->HasOwnPresentations())
   {
-    if (!HasPresentation (thePrsObj, theMode))
-    {
-      AddPresentation (thePrsObj, theMode);
-    }
-
-    Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
-
-    if (aPrs.IsNull()) return;
-
+    Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
     if (aPrs->MustBeUpdated())
     {
       Update (thePrsObj, theMode);
     }
 
-    if (myImmediateModeOn > 0)
+    if (theIsImmediate)
+    {
+      aPrs->Presentation()->CStructure()->stick   = 1; ///
+      aPrs->Presentation()->CStructure()->visible = 1; ///
+      ///aPrs->Display();
+      const Visual3d_SequenceOfView& aViews = myStructureManager->DefinedViews();
+      for (Standard_Integer aViewIter = 1; aViewIter <= aViews.Length(); ++aViewIter)
+      {
+        const Handle(Visual3d_View)& aView = aViews.Value (aViewIter);
+        aView->DisplayImmediate (aPrs->Presentation(), Standard_False);
+      }
+    }
+    else if (myImmediateModeOn > 0)
     {
       AddToImmediateList (aPrs->Presentation());
     }
@@ -75,7 +81,7 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)
 
   for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
   {
-    Display (anIter.Value(), theMode);
+    Display (anIter.Value(), theMode, theIsImmediate);
   }
 }
 
@@ -91,9 +97,10 @@ void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)&
     Erase (anIter.Value(), theMode);
   }
 
-  if (HasPresentation (thePrsObj, theMode))
+  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_False);
+  if (!aPrs.IsNull())
   {
-    Presentation (thePrsObj, theMode)->Erase();
+    aPrs->Erase();
     RemovePresentation (thePrsObj, theMode);
   }
 }
@@ -152,14 +159,7 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
     return;
   }
 
-  if (!HasPresentation (thePrsObj, theMode))
-  {
-    AddPresentation (thePrsObj, theMode);
-  }
-
-  if (!HasPresentation (thePrsObj, theMode)) return;
-
-  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
   if (aPrs->MustBeUpdated())
   {
     Update (thePrsObj, theMode);
@@ -168,12 +168,12 @@ void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObjec
   if (myImmediateModeOn > 0)
   {
     Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
-    aShadow->Highlight();
+    aShadow->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
     AddToImmediateList (aShadow);
   }
   else
   {
-    aPrs->Highlight();
+    aPrs->Highlight (Aspect_TOHM_COLOR, mySelectionColor);
   }
 }
 
@@ -189,9 +189,10 @@ void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObj
     Unhighlight (anIter.Value(), theMode);
   }
 
-  if (HasPresentation (thePrsObj, theMode))
+  const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  if (!aPrs.IsNull())
   {
-    Presentation (thePrsObj, theMode)->Unhighlight();
+    aPrs->Unhighlight();
   }
 }
 
@@ -208,9 +209,10 @@ void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_Present
     SetDisplayPriority (anIter.Value(), theMode, theNewPrior);
   }
 
-  if (HasPresentation (thePrsObj, theMode))
+  const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  if (!aPrs.IsNull())
   {
-    Presentation (thePrsObj, theMode)->SetDisplayPriority (theNewPrior);
+    aPrs->SetDisplayPriority (theNewPrior);
   }
 }
 
@@ -230,9 +232,10 @@ Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMg
     }
   }
 
-  return HasPresentation (thePrsObj, theMode)
-       ? Presentation (thePrsObj, theMode)->DisplayPriority()
-       : 0;
+  const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  return !aPrs.IsNull()
+        ? aPrs->DisplayPriority()
+        : 0;
 }
 
 // =======================================================================
@@ -250,8 +253,9 @@ Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (const Handle(PrsMgr_Pr
     }
   }
 
-  return HasPresentation (thePrsObj, theMode)
-      && Presentation    (thePrsObj, theMode)->IsDisplayed();
+  const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  return !aPrs.IsNull()
+       && aPrs->IsDisplayed();
 }
 
 // =======================================================================
@@ -269,8 +273,9 @@ Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (const Handle(PrsMgr_
     }
   }
 
-  return HasPresentation (thePrsObj, theMode)
-      && Presentation    (thePrsObj, theMode)->IsHighlighted();
+  const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  return !aPrs.IsNull()
+       && aPrs->IsHighlighted();
 }
 
 // =======================================================================
@@ -284,10 +289,6 @@ void PrsMgr_PresentationManager::Update (const Handle(PrsMgr_PresentableObject)&
   {
     Update (anIter.Value(), theMode);
   }
-  if (!HasPresentation(thePrsObj, theMode))
-  {
-    return;
-  }
 
   Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
   if (!aPrs.IsNull())
@@ -405,14 +406,11 @@ Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMg
 // purpose  :
 // =======================================================================
 Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                                                      const Standard_Integer                  theMode) const
+                                                                      const Standard_Integer                  theMode,
+                                                                      const Standard_Boolean                  theToCreate,
+                                                                      const Handle(PrsMgr_PresentableObject)& theSelObj) const
 {
   const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
-  if (aPrsList.IsEmpty())
-  {
-    return Handle(PrsMgr_Presentation)();
-  }
-
   for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
   {
     const PrsMgr_ModedPresentation&           aModedPrs = aPrsList.Value (aPrsIter);
@@ -424,17 +422,13 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand
     }
   }
 
-  return Handle(PrsMgr_Presentation)();
-}
+  if (!theToCreate)
+  {
+    return Handle(PrsMgr_Presentation)();
+  }
 
-// =======================================================================
-// function : AddPresentation
-// purpose  :
-// =======================================================================
-void PrsMgr_PresentationManager::AddPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                                  const Standard_Integer                  theMode)
-{
   Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj);
+  aPrs->Presentation()->CStructure()->ViewAffinity = myStructureManager->ObjectAffinity (!theSelObj.IsNull() ? theSelObj : thePrsObj);
   thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode));
   thePrsObj->Fill (this, aPrs, theMode);
 
@@ -445,25 +439,29 @@ void PrsMgr_PresentationManager::AddPresentation (const Handle(PrsMgr_Presentabl
     aPrs->SetZLayer (aZLayerId);
   }
   aPrs->SetUpdateStatus (Standard_False);
+  return aPrs;
 }
 
 // =======================================================================
 // function : RemovePresentation
 // purpose  :
 // =======================================================================
-void PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
-                                                     const Standard_Integer                  theMode)
+Standard_Boolean PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
+                                                                 const Standard_Integer                  theMode)
 {
   PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
   for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
   {
-    if (theMode == aPrsList (aPrsIter).Mode())
-    //  && this    == aPrsMgr) ??
+    const PrsMgr_ModedPresentation&           aModedPrs = aPrsList.Value (aPrsIter);
+    const Handle(PrsMgr_PresentationManager)& aPrsMgr   = aModedPrs.Presentation()->PresentationManager();
+    if (theMode == aPrsList (aPrsIter).Mode()
+     && this    == aPrsMgr)
     {
       aPrsList.Remove (aPrsIter);
-      break;
+      return Standard_True;
     }
   }
+  return Standard_False;
 }
 
 // =======================================================================
@@ -531,15 +529,9 @@ void PrsMgr_PresentationManager::Connect (const Handle(PrsMgr_PresentableObject)
                                           const Standard_Integer                  theMode,
                                           const Standard_Integer                  theOtherMode)
 {
-  if (!HasPresentation (thePrsObject, theMode))
-  {
-    AddPresentation (thePrsObject, theMode);
-  }
-  if (!HasPresentation (theOtherObject, theOtherMode))
-  {
-    AddPresentation (theOtherObject, theOtherMode);
-  }
-  Presentation (thePrsObject, theMode)->Connect (Presentation (theOtherObject, theOtherMode));
+  Handle(PrsMgr_Presentation) aPrs      = Presentation (thePrsObject,   theMode,      Standard_True);
+  Handle(PrsMgr_Presentation) aPrsOther = Presentation (theOtherObject, theOtherMode, Standard_True);
+  aPrs->Connect (aPrsOther);
 }
 
 // =======================================================================
@@ -560,7 +552,8 @@ void PrsMgr_PresentationManager::Transform (const Handle(PrsMgr_PresentableObjec
 // =======================================================================
 void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                         const Quantity_NameOfColor              theColor,
-                                        const Standard_Integer                  theMode)
+                                        const Standard_Integer                  theMode,
+                                        const Handle(PrsMgr_PresentableObject)& theSelObj)
 {
   for (PrsMgr_ListOfPresentableObjectsIter anIter (thePrsObj->Children()); anIter.More(); anIter.Next())
   {
@@ -571,14 +564,7 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
     return;
   }
 
-  if (!HasPresentation (thePrsObj, theMode))
-  {
-    AddPresentation (thePrsObj, theMode);
-  }
-
-  if (!HasPresentation (thePrsObj, theMode)) return;
-
-  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True, theSelObj);
   if (aPrs->MustBeUpdated())
   {
     Update (thePrsObj, theMode);
@@ -587,12 +573,12 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
   if (myImmediateModeOn > 0)
   {
     Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation());
-    aShadow->Color (theColor);
+    aShadow->Highlight (Aspect_TOHM_COLOR, theColor);
     AddToImmediateList (aShadow);
   }
   else
   {
-    aPrs->Color (theColor);
+    aPrs->Highlight (Aspect_TOHM_COLOR, theColor);
   }
 }
 
@@ -600,18 +586,15 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
 // function : BoundBox
 // purpose  :
 // =======================================================================
-void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject,
+void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                            const Standard_Integer                  theMode)
 {
-  if (!HasPresentation (thePrsObject, theMode))
-  {
-    AddPresentation (thePrsObject, theMode);
-  }
-  else if (Presentation (thePrsObject, theMode)->MustBeUpdated())
+  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
+  if (aPrs->MustBeUpdated())
   {
-    Update (thePrsObject, theMode);
+    Update (thePrsObj, theMode);
   }
-  Presentation (thePrsObject, theMode)->BoundBox();
+  aPrs->Highlight (Aspect_TOHM_BOUNDBOX, mySelectionColor);
 }
 
 // =======================================================================
@@ -633,12 +616,13 @@ void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_Presentab
 // function : SetShadingAspect
 // purpose  :
 // =======================================================================
-void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject,
+void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                    const Handle(Prs3d_ShadingAspect)&      theShadingAspect,
                                                    const Standard_Integer                  theMode)
 {
-  if (HasPresentation (thePrsObject, theMode))
+  const Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode);
+  if (!aPrs.IsNull())
   {
-    Presentation (thePrsObject, theMode)->SetShadingAspect (theShadingAspect);
+    aPrs->SetShadingAspect (theShadingAspect);
   }
 }
index e3e59f51e37fc37a75408f7d1b5a766d8725e1df..076e4ef840bc2798a6cb0f1306e0886ab3637e9a 100755 (executable)
@@ -1 +1 @@
-SelectMgr_CompareResults.hxx
\ No newline at end of file
+SelectMgr_CompareResults.hxx
index 0daba7fa81d99a650a147806e56ff93d363a70a2..78da7249c4d1e6756bd303b22f0578d8d50f772e 100644 (file)
@@ -23,9 +23,10 @@ class OrFilter from SelectMgr inherits CompositionFilter from SelectMgr
        -- This selects one or another type of sensitive entity.
 uses
 
-    Filter       from SelectMgr,
-    Transient    from Standard,
-    EntityOwner  from SelectMgr
+    Filter           from SelectMgr,
+    Transient        from Standard,
+    EntityOwner      from SelectMgr,
+    NMapOfTransient  from Graphic3d
 
 is
 
@@ -35,4 +36,12 @@ is
     IsOk(me; anobj : EntityOwner from SelectMgr)
     returns Boolean from Standard ;
 
+    SetDisabledObjects (me : mutable;
+                        theObjects : NMapOfTransient from Graphic3d) is static;
+    ---Purpose: Disable selection of specified objects.
+
+fields
+
+    myDisabledObjects : NMapOfTransient from Graphic3d;
+
 end OrFilter;
index f87fb0cdcdb56123a2a55ad33f9d2f9d71b3541a..d1046680e3d1215387eb666cac41b7471b6b1209 100644 (file)
 
 #include <SelectMgr_Filter.hxx>
 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
+#include <SelectMgr_SelectableObject.hxx>
+
+//=============================================================================
+//function : SelectMgr_OrFilter
+//purpose  :
+//=============================================================================
 SelectMgr_OrFilter::SelectMgr_OrFilter()
 {
 }
 
-
-Standard_Boolean SelectMgr_OrFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anobj) const 
+//=============================================================================
+//function : SetDisabledObjects
+//purpose  :
+//=============================================================================
+void SelectMgr_OrFilter::SetDisabledObjects (const Handle(Graphic3d_NMapOfTransient)& theObjects)
 {
+  myDisabledObjects = theObjects;
+}
 
-  if(myFilters.IsEmpty())
+//=============================================================================
+//function : IsOk
+//purpose  :
+//=============================================================================
+Standard_Boolean SelectMgr_OrFilter::IsOk (const Handle(SelectMgr_EntityOwner)& theObj) const
+{
+  const SelectMgr_SelectableObject* aSelectable = theObj->Selectable().operator->();
+  if (!myDisabledObjects.IsNull()
+    && myDisabledObjects->Contains (aSelectable))
+  {
+    return Standard_False;
+  }
+  else if (myFilters.IsEmpty())
+  {
     return Standard_True;
-  SelectMgr_ListIteratorOfListOfFilter it(myFilters);
-  for ( ; it.More();it.Next())
-    if(it.Value()->IsOk(anobj))
+  }
+
+  for (SelectMgr_ListIteratorOfListOfFilter aFilterIter (myFilters); aFilterIter.More(); aFilterIter.Next())
+  {
+    if (aFilterIter.Value()->IsOk (theObj))
+    {
       return Standard_True;
+    }
+  }
+
   return Standard_False;
 }
index a91bf45e1fe8e9f0a443aeb7dd834bb41e1cedf1..4b83b9884e2d8a3ce825f9ca59f43456d9c80d1d 100644 (file)
@@ -133,6 +133,7 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
 #else
   Standard_Integer M = (myCurMode==-1) ? aMode:myCurMode;
 #endif
+  Handle(SelectMgr_SelectableObject) aSel = Selectable();
   if (myFromDecomposition)
   {
     // do the update flag check
@@ -158,8 +159,7 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
     }
 
     // highlight with color and set layer
-    PM->Color (myPrsSh, aCol, M);
-    Handle(SelectMgr_SelectableObject) aSel = Selectable();
+    PM->Color (myPrsSh, aCol, M, aSel);
     if (!aSel.IsNull())
     {
       Standard_Integer aLayer = aSel->GetZLayer (PM);
@@ -169,10 +169,14 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
   }
   else
   {
-    if(myPrsSh.IsNull())
-      PM->Color(Selectable(),aCol,M);
+    if (!myPrsSh.IsNull())
+    {
+      PM->Color (myPrsSh, aCol, M, aSel);
+    }
     else
-      PM->Color(myPrsSh,aCol,M);
+    {
+      PM->Color (aSel, aCol, M);
+    }
   }
 }
 
index 2346113ea0dc51e85d56def309cf11e2f48a28f3..7d1f50d931c4c359a2cc8125525f0077a4a21dcb 100644 (file)
@@ -35,6 +35,7 @@ uses
         TColStd,
         Graphic3d,
         Visual3d,
+        SelectMgr,
         MMgt,
         TCollection,
         Quantity,
index 843670b6e8ee7e9865d46aba52fca09695e19a8e..67c896f344d38ef123e5b3efbb88296e06a432f2 100644 (file)
@@ -2223,8 +2223,9 @@ int VErase (Draw_Interpretor& theDI,
             Standard_Integer  theArgNb,
             const char**      theArgVec)
 {
-  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
-  ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
+  const Handle(AIS_InteractiveContext)& aCtx  = ViewerTest::GetAISContext();
+  const Handle(V3d_View)&               aView = ViewerTest::CurrentView();
+  ViewerTest_AutoUpdater anUpdateTool (aCtx, aView);
   if (aCtx.IsNull())
   {
     std::cerr << "Error: no active view!\n";
@@ -2234,7 +2235,8 @@ int VErase (Draw_Interpretor& theDI,
   const Standard_Boolean toEraseAll = TCollection_AsciiString (theArgNb > 0 ? theArgVec[0] : "") == "veraseall";
 
   Standard_Integer anArgIter = 1;
-  Standard_Boolean toEraseLocal = Standard_False;
+  Standard_Boolean toEraseLocal  = Standard_False;
+  Standard_Boolean toEraseInView = Standard_False;
   TColStd_SequenceOfAsciiString aNamesOfEraseIO;
   for (; anArgIter < theArgNb; ++anArgIter)
   {
@@ -2248,6 +2250,11 @@ int VErase (Draw_Interpretor& theDI,
     {
       toEraseLocal = Standard_True;
     }
+    else if (anArgCase == "-view"
+          || anArgCase == "-inview")
+    {
+      toEraseInView = Standard_True;
+    }
     else
     {
       aNamesOfEraseIO.Append (theArgVec[anArgIter]);
@@ -2286,7 +2293,14 @@ int VErase (Draw_Interpretor& theDI,
       theDI << aName.ToCString() << " ";
       if (!anIO.IsNull())
       {
-        aCtx->Erase (anIO, Standard_False);
+        if (toEraseInView)
+        {
+          aCtx->SetViewAffinity (anIO, aView, Standard_False);
+        }
+        else
+        {
+          aCtx->Erase (anIO, Standard_False);
+        }
       }
       else
       {
@@ -2309,7 +2323,14 @@ int VErase (Draw_Interpretor& theDI,
        && aCtx->IsCurrent (anIO))
       {
         theDI << anIter.Key2().ToCString() << " ";
-        aCtx->Erase (anIO, Standard_False);
+        if (toEraseInView)
+        {
+          aCtx->SetViewAffinity (anIO, aView, Standard_False);
+        }
+        else
+        {
+          aCtx->Erase (anIO, Standard_False);
+        }
       }
     }
   }
@@ -2322,7 +2343,14 @@ int VErase (Draw_Interpretor& theDI,
       const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
       if (!anIO.IsNull())
       {
-        aCtx->Erase (anIO, Standard_False);
+        if (toEraseInView)
+        {
+          aCtx->SetViewAffinity (anIO, aView, Standard_False);
+        }
+        else
+        {
+          aCtx->Erase (anIO, Standard_False);
+        }
       }
       else
       {
@@ -2473,7 +2501,7 @@ inline void bndPresentation (Draw_Interpretor&                  theDI,
     }
     case BndAction_Show:
     {
-      thePrs->Presentation()->BoundBox();
+      thePrs->Presentation()->Highlight (Aspect_TOHM_BOUNDBOX, Quantity_NOC_GRAY99);
       break;
     }
     case BndAction_Print:
@@ -2905,9 +2933,12 @@ static int VDisplay2 (Draw_Interpretor& theDI,
 
   // Parse input arguments
   ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
-  Standard_Integer isMutable = -1;
+  Standard_Integer isMutable      = -1;
   Standard_Boolean toDisplayLocal = Standard_False;
+  Standard_Boolean toReDisplay    = Standard_False;
   TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
+  AIS_DisplayStatus aDispStatus = AIS_DS_None;
+  Standard_Integer toDisplayInView = Standard_False;
   for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
   {
     const TCollection_AsciiString aName     = theArgVec[anArgIter];
@@ -2921,10 +2952,25 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     {
       isMutable = 1;
     }
+    else if (aNameCase == "-immediate"
+          || aNameCase == "-dynamic")
+    {
+      aDispStatus = AIS_DS_DispImmediate;
+    }
+    else if (aNameCase == "-view"
+          || aNameCase == "-inview")
+    {
+      toDisplayInView = Standard_True;
+    }
     else if (aNameCase == "-local")
     {
+      aDispStatus = AIS_DS_Temporary;
       toDisplayLocal = Standard_True;
     }
+    else if (aNameCase == "-redisplay")
+    {
+      toReDisplay = Standard_True;
+    }
     else
     {
       aNamesOfDisplayIO.Append (aName);
@@ -2963,7 +3009,27 @@ static int VDisplay2 (Draw_Interpretor& theDI,
           aShape->SetMutable (isMutable == 1);
         }
         GetMapOfAIS().Bind (aShape, aName);
-        aCtx->Display (aShape, Standard_False);
+
+        Standard_Integer aDispMode = aShape->HasDisplayMode()
+                                   ? aShape->DisplayMode()
+                                   : (aShape->AcceptDisplayMode (aCtx->DisplayMode())
+                                    ? aCtx->DisplayMode()
+                                    : 0);
+        Standard_Integer aSelMode = aShape->HasSelectionMode() && aCtx->GetAutoActivateSelection()
+                                  ? aShape->SelectionMode() : -1;
+
+        aCtx->Display (aShape, aDispMode, aSelMode,
+                       Standard_False, aShape->AcceptShapeDecomposition(),
+                       aDispStatus);
+
+        if (toDisplayInView)
+        {
+          for (aCtx->CurrentViewer()->InitDefinedViews(); aCtx->CurrentViewer()->MoreDefinedViews(); aCtx->CurrentViewer()->NextDefinedViews())
+          {
+            aCtx->SetViewAffinity (aShape, aCtx->CurrentViewer()->DefinedView(), Standard_False);
+          }
+          aCtx->SetViewAffinity (aShape, ViewerTest::CurrentView(), Standard_True);
+        }
       }
       continue;
     }
@@ -2977,6 +3043,14 @@ static int VDisplay2 (Draw_Interpretor& theDI,
         aShape->SetMutable (isMutable == 1);
       }
 
+      Standard_Integer aDispMode = aShape->HasDisplayMode()
+                                  ? aShape->DisplayMode()
+                                  : (aShape->AcceptDisplayMode (aCtx->DisplayMode())
+                                  ? aCtx->DisplayMode()
+                                  : 0);
+      Standard_Integer aSelMode = aShape->HasSelectionMode() && aCtx->GetAutoActivateSelection()
+                                ? aShape->SelectionMode() : -1;
+
       if (aShape->Type() == AIS_KOI_Datum)
       {
         aCtx->Display (aShape, Standard_False);
@@ -2984,17 +3058,30 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       else
       {
         theDI << "Display " << aName.ToCString() << "\n";
-        // get the Shape from a name
-        TopoDS_Shape aNewShape = GetShapeFromName (aName.ToCString());
 
         // update the Shape in the AIS_Shape
+        TopoDS_Shape      aNewShape = GetShapeFromName (aName.ToCString());
         Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aShape);
         if (!aShapePrs.IsNull())
         {
+          if (!aShapePrs->Shape().IsEqual (aNewShape))
+          {
+            toReDisplay = Standard_True;
+          }
           aShapePrs->Set (aNewShape);
         }
-        aCtx->Redisplay (aShape, Standard_False);
-        aCtx->Display   (aShape, Standard_False);
+        if (toReDisplay)
+        {
+          aCtx->Redisplay (aShape, Standard_False);
+        }
+
+        aCtx->Display (aShape, aDispMode, aSelMode,
+                       Standard_False, aShape->AcceptShapeDecomposition(),
+                       aDispStatus);
+        if (toDisplayInView)
+        {
+          aCtx->SetViewAffinity (aShape, ViewerTest::CurrentView(), Standard_True);
+        }
       }
     }
     else if (anObj->IsKind (STANDARD_TYPE (NIS_InteractiveObject)))
index 30db5d4c6387c9936565f69b90dcb1a45665ae18..f34e4f11debf56dc6b8116736268391ebf40c2ab 100644 (file)
@@ -107,6 +107,8 @@ uses
     AsciiString             from TCollection,
     ExtendedString          from TCollection,
     CGraduatedTrihedron     from Graphic3d,
+    NMapOfTransient         from Graphic3d,
+    TypeOfStructure         from Graphic3d,
 
     PixMap                  from Image,
     Box                     from Bnd
@@ -752,14 +754,12 @@ is
        -- Category: Private methods
        ----------------------------
 
-       AcceptDisplay ( me;
-                       AStructure      : Structure from Graphic3d )
-               returns TypeOfAnswer from Visual3d
-               is static private;
-       ---Level: Internal
-       ---Purpose: Is it possible to display the structure
-       --          <AStructure> in the view <me> ?
-       ---Category: Private methods
+  acceptDisplay ( me;
+                  theStructType : TypeOfStructure from Graphic3d )
+  returns TypeOfAnswer from Visual3d
+  is static private;
+  ---Level: Internal
+  ---Purpose: Is it possible to display the structure in the view?
 
        ReCompute ( me  : mutable;
                    AStructure  : Structure from Graphic3d );
@@ -1155,6 +1155,16 @@ is
     -- In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer).
     -- Notice however that results may differ a lot and do not contain some elements.
 
+    HiddenObjects (me) returns NMapOfTransient from Graphic3d is static;
+    ---C++: return const &
+    ---Level: Public
+    ---Purpose: Returns map of objects hidden within this specific view (not viewer-wise).
+
+    ChangeHiddenObjects (me : mutable) returns NMapOfTransient from Graphic3d is static;
+    ---C++: return &
+    ---Level: Public
+    ---Purpose: Returns map of objects hidden within this specific view (not viewer-wise).
+
 fields
 
   -- the ViewManager associated with the view
@@ -1196,6 +1206,8 @@ fields
 
   myStructuresUpdated     : Boolean from Standard;
 
+  myHiddenObjects : NMapOfTransient from Graphic3d;
+
 friends
 
   class ViewManager from Visual3d
index 05b0f49fc0b29e9b1ba3982c57d6e4d01a1566ba..725eb9995e9a8af1b7a5d9736a0e8c043b0aa1f7 100644 (file)
@@ -28,7 +28,6 @@
 #include <Graphic3d_Vertex.hxx>
 #include <Visual3d_DepthCueingDefinitionError.hxx>
 #include <Visual3d_Light.hxx>
-#include <Visual3d_HSequenceOfView.hxx>
 #include <Visual3d_ZClippingDefinitionError.hxx>
 #include <OSD.hxx>
 #include <TColStd_HArray2OfReal.hxx>
@@ -54,6 +53,8 @@ Visual3d_View::Visual3d_View (const Handle(Visual3d_ViewManager)& theMgr)
   myAutoZFitScaleFactor (1.0),
   myStructuresUpdated   (Standard_True)
 {
+  myHiddenObjects = new Graphic3d_NMapOfTransient();
+
   MyCView.ViewId                  = theMgr->Identification (this);
   MyCView.Active                  = 0;
   MyCView.IsDeleted               = 0;
@@ -712,10 +713,10 @@ void Visual3d_View::SetContext (const Visual3d_ContextView& theViewCtx)
     // It is not necessary to warn ViewManager as this structure should not disappear from
     // the list of structures displayed in it.
     NCollection_Sequence<Handle(Graphic3d_Structure)> aStructs;
-    for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+    for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
     {
       const Handle(Graphic3d_Structure)& aStruct  = aStructIter.Key();
-      const Visual3d_TypeOfAnswer        anAnswer = AcceptDisplay (aStruct);
+      const Visual3d_TypeOfAnswer        anAnswer = acceptDisplay (aStruct->Visual());
       if (anAnswer == Visual3d_TOA_NO
        || anAnswer == Visual3d_TOA_COMPUTE)
       {
@@ -743,7 +744,7 @@ void Visual3d_View::SetContext (const Visual3d_ContextView& theViewCtx)
         continue;
       }
 
-      const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
+      const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
       if (anAnswer == Visual3d_TOA_YES
        || anAnswer == Visual3d_TOA_COMPUTE)
       {
@@ -780,7 +781,7 @@ void Visual3d_View::DisplayedStructures (Graphic3d_MapOfStructure& theStructures
     return;
   }
 
-  for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+  for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
   {
     theStructures.Add (aStructIter.Key());
   }
@@ -825,7 +826,7 @@ void Visual3d_View::Activate()
       }
 
       // If the structure can be displayed in the new context of the view, it is displayed.
-      const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
+      const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
       if (anAnswer == Visual3d_TOA_YES
        || anAnswer == Visual3d_TOA_COMPUTE)
       {
@@ -898,7 +899,7 @@ void Visual3d_View::Deactivate()
         continue;
       }
 
-      const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
+      const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
       if (anAnswer == Visual3d_TOA_YES
        || anAnswer == Visual3d_TOA_COMPUTE)
       {
@@ -1131,13 +1132,13 @@ void Visual3d_View::ZFitAll (const Standard_Real theScaleFactor)
 }
 
 // ========================================================================
-// function : AcceptDisplay
+// function : acceptDisplay
 // purpose  :
 // ========================================================================
-Visual3d_TypeOfAnswer Visual3d_View::AcceptDisplay (const Handle(Graphic3d_Structure)& theStruct) const
+Visual3d_TypeOfAnswer Visual3d_View::acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const
 {
-  const Visual3d_TypeOfVisualization ViewType = MyContext.Visualization();
-  switch (theStruct->Visual())
+  const Visual3d_TypeOfVisualization aViewType = MyContext.Visualization();
+  switch (theStructType)
   {
     case Graphic3d_TOS_ALL:
     {
@@ -1145,19 +1146,19 @@ Visual3d_TypeOfAnswer Visual3d_View::AcceptDisplay (const Handle(Graphic3d_Struc
     }
     case Graphic3d_TOS_SHADING:
     {
-      return ViewType == Visual3d_TOV_SHADING
+      return aViewType == Visual3d_TOV_SHADING
            ? Visual3d_TOA_YES
            : Visual3d_TOA_NO;
     }
     case Graphic3d_TOS_WIREFRAME:
     {
-      return ViewType == Visual3d_TOV_WIREFRAME
+      return aViewType == Visual3d_TOV_WIREFRAME
            ? Visual3d_TOA_YES
            : Visual3d_TOA_NO;
     }
     case Graphic3d_TOS_COMPUTED:
     {
-      return (ViewType == Visual3d_TOV_SHADING || ViewType == Visual3d_TOV_WIREFRAME)
+      return (aViewType == Visual3d_TOV_SHADING || aViewType == Visual3d_TOV_WIREFRAME)
            ?  Visual3d_TOA_COMPUTE
            :  Visual3d_TOA_NO;
     }
@@ -1260,18 +1261,18 @@ Standard_Boolean Visual3d_View::DisplayImmediate (const Handle(Graphic3d_Structu
 
   if (theIsSingleView)
   {
-    Handle(Visual3d_HSequenceOfView) aViews = myViewManager->DefinedView();
-
-    for (int i=1;i<=aViews->Length();i++)
+    const Visual3d_SequenceOfView& aViews = myViewManager->DefinedViews();
+    for (Standard_Integer aViewIter = 1; aViewIter <= aViews.Length(); ++aViewIter)
     {
-      if (aViews->Value(i).Access() != this)
+      const Handle(Visual3d_View)& aView = aViews.Value (aViewIter);
+      if (aView.Access() != this)
       {
-        aViews->Value(i)->EraseImmediate (theStructure);
+        aView->EraseImmediate (theStructure);
       }
     }
   }
 
-  myGraphicDriver->DisplayImmediateStructure (MyCView, *theStructure->CStructure());
+  myGraphicDriver->DisplayImmediateStructure (MyCView, theStructure);
   return Standard_True;
 }
 
@@ -1301,9 +1302,9 @@ Standard_Boolean Visual3d_View::ClearImmediate()
     return Standard_False;
   }
 
-  for (Graphic3d_MapIteratorOfMapOfStructure anIter (myImmediateStructures); anIter.More(); anIter.Next())
+  for (Graphic3d_MapOfStructure::Iterator aStructIter (myImmediateStructures); aStructIter.More(); aStructIter.Next())
   {
-    myGraphicDriver->EraseImmediateStructure (MyCView, *anIter.Key()->CStructure());
+    myGraphicDriver->EraseImmediateStructure (MyCView, *aStructIter.Key()->CStructure());
   }
   myImmediateStructures.Clear();
   return Standard_True;
@@ -1345,7 +1346,7 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
     anIndex = 0;
   }
 
-  Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (theStruct);
+  Visual3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
   if (anAnswer == Visual3d_TOA_NO)
   {
     return;
@@ -1358,14 +1359,13 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
 
   if (anAnswer == Visual3d_TOA_YES)
   {
-    if (IsDisplayed (theStruct))
+    if (!myStructsDisplayed.Add (theStruct))
     {
       return;
     }
 
     theStruct->CalculateBoundBox();
-    myGraphicDriver->DisplayStructure (MyCView, *theStruct->CStructure(), theStruct->DisplayPriority());
-    myStructsDisplayed.Add (theStruct);
+    myGraphicDriver->DisplayStructure (MyCView, theStruct, theStruct->DisplayPriority());
     Update (theUpdateMode);
     return;
   }
@@ -1380,14 +1380,14 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
     const Handle(Graphic3d_Structure)& anOldStruct = myStructsComputed.Value (anIndex);
     if (anOldStruct->HLRValidation())
     {
-      // Case COMPUTED valid
-      // to be displayed
-      if (!IsDisplayed (theStruct))
+      // Case COMPUTED valid, to be displayed
+      if (!myStructsDisplayed.Add (theStruct))
       {
-        myStructsDisplayed.Add (theStruct);
-        myGraphicDriver->DisplayStructure (MyCView, *anOldStruct->CStructure(), theStruct->DisplayPriority());
-        Update (theUpdateMode);
+        return;
       }
+
+      myGraphicDriver->DisplayStructure (MyCView, anOldStruct, theStruct->DisplayPriority());
+      Update (theUpdateMode);
       return;
     }
     else
@@ -1401,25 +1401,25 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
       const Standard_Integer aNewIndex = HaveTheSameOwner (theStruct);
       if (aNewIndex != 0)
       {
-        // Case of COMPUTED invalid, WITH a valid of replacement
-        // to be displayed
-        if (!IsDisplayed (theStruct))
+        // Case of COMPUTED invalid, WITH a valid of replacement; to be displayed
+        if (!myStructsDisplayed.Add (theStruct))
         {
-          const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
-          myStructsComputed.SetValue (anIndex, aNewStruct);
-          myStructsDisplayed.Add (theStruct);
-          myGraphicDriver->DisplayStructure (MyCView, *aNewStruct->CStructure(), theStruct->DisplayPriority());
-          Update (theUpdateMode);
+          return;
         }
+
+        const Handle(Graphic3d_Structure)& aNewStruct = myStructsComputed.Value (aNewIndex);
+        myStructsComputed.SetValue (anIndex, aNewStruct);
+        myGraphicDriver->DisplayStructure (MyCView, aNewStruct, theStruct->DisplayPriority());
+        Update (theUpdateMode);
         return;
       }
       else
       {
         // Case COMPUTED invalid, WITHOUT a valid of replacement
         // COMPUTED is removed if displayed
-        if (IsDisplayed (theStruct))
+        if (myStructsDisplayed.Contains (theStruct))
         {
-          myGraphicDriver->EraseStructure (MyCView, *anOldStruct->CStructure());
+          myGraphicDriver->EraseStructure (MyCView, anOldStruct);
         }
       }
     }
@@ -1484,26 +1484,26 @@ void Visual3d_View::Display (const Handle(Graphic3d_Structure)& theStruct,
   else
   {
     aStruct->SetVisual (toComputeWireframe ? Graphic3d_TOS_WIREFRAME : Graphic3d_TOS_SHADING);
-    anAnswer = AcceptDisplay (aStruct);
+    anAnswer = acceptDisplay (aStruct->Visual());
   }
 
   if (theStruct->IsHighlighted())
   {
-    aStruct->SetHighlightColor (theStruct->HighlightColor());
-    aStruct->GraphicHighlight (Aspect_TOHM_COLOR);
+    aStruct->Highlight (Aspect_TOHM_COLOR, theStruct->HighlightColor(), Standard_False);
   }
 
   // It is displayed only if the calculated structure
   // has a proper type corresponding to the one of the view.
-  if (anAnswer != Visual3d_TOA_NO)
+  if (anAnswer == Visual3d_TOA_NO)
   {
-    if (!IsDisplayed (theStruct))
-    {
-      myStructsDisplayed.Add (theStruct);
-    }
-    myGraphicDriver->DisplayStructure (MyCView, *aStruct->CStructure(), theStruct->DisplayPriority());
-    Update (theUpdateMode);
+    return;
+  }
+
+  if (myStructsDisplayed.Add (theStruct))
+  {
+    myGraphicDriver->DisplayStructure (MyCView, aStruct, theStruct->DisplayPriority());
   }
+  Update (theUpdateMode);
 }
 
 // ========================================================================
@@ -1531,7 +1531,7 @@ void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
     return;
   }
 
-  Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (theStruct);
+  Visual3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
   if (!ComputedMode())
   {
     anAnswer = Visual3d_TOA_YES;
@@ -1539,7 +1539,7 @@ void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
 
   if (anAnswer != Visual3d_TOA_COMPUTE)
   {
-    myGraphicDriver->EraseStructure (MyCView, *theStruct->CStructure());
+    myGraphicDriver->EraseStructure (MyCView, theStruct);
   }
   else if (anAnswer == Visual3d_TOA_COMPUTE
        && myIsInComputedMode)
@@ -1548,7 +1548,7 @@ void Visual3d_View::Erase (const Handle(Graphic3d_Structure)& theStruct,
     if (anIndex != 0)
     {
       const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
-      myGraphicDriver->EraseStructure (MyCView, *aCompStruct->CStructure());
+      myGraphicDriver->EraseStructure (MyCView, aCompStruct);
     }
   }
   myStructsDisplayed.Remove (theStruct);
@@ -1566,8 +1566,7 @@ void Visual3d_View::Highlight (const Handle(Graphic3d_Structure)& theStruct,
   if (anIndex != 0)
   {
     const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
-    aCompStruct->SetHighlightColor (theStruct->HighlightColor());
-    aCompStruct->GraphicHighlight (theMethod);
+    aCompStruct->Highlight (theMethod, theStruct->HighlightColor(), Standard_False);
   }
 }
 
@@ -1657,7 +1656,14 @@ Standard_Boolean Visual3d_View::IsDisplayed (const Handle(Graphic3d_Structure)&
 // ========================================================================
 Standard_Boolean Visual3d_View::ContainsFacet() const
 {
-  return ContainsFacet (myStructsDisplayed);
+  for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+  {
+    if (aStructIter.Key()->ContainsFacet())
+    {
+      return Standard_True;
+    }
+  }
+  return Standard_False;
 }
 
 // ========================================================================
@@ -1676,14 +1682,51 @@ Standard_Boolean Visual3d_View::ContainsFacet (const Graphic3d_MapOfStructure& t
   return Standard_False;
 }
 
+//! Auxiliary method for MinMaxValues() method
+inline void addStructureBndBox (const Handle(Graphic3d_Structure)& theStruct,
+                                const Standard_Boolean             theToIgnoreInfiniteFlag,
+                                Bnd_Box&                           theBndBox)
+{
+  if (!theStruct->IsVisible())
+  {
+    return;
+  }
+  else if (theStruct->IsInfinite()
+       && !theToIgnoreInfiniteFlag)
+  {
+    // XMin, YMin .... ZMax are initialized by means of infinite line data
+    const Bnd_Box aBox = theStruct->MinMaxValues (Standard_False);
+    if (!aBox.IsWhole()
+     && !aBox.IsVoid())
+    {
+      theBndBox.Add (aBox);
+    }
+    return;
+  }
+
+  // Only non-empty and non-infinite structures
+  // are taken into account for calculation of MinMax
+  if (theStruct->IsEmpty()
+   && theStruct->TransformPersistenceMode() != Graphic3d_TMF_None)
+  {
+    return;
+  }
+
+  // "FitAll" operation ignores object with transform persistence parameter
+  const Bnd_Box aBox = theStruct->MinMaxValues (theToIgnoreInfiniteFlag);
+  theBndBox.Add (aBox);
+}
+
 // ========================================================================
 // function : MinMaxValues
 // purpose  :
 // ========================================================================
 Bnd_Box Visual3d_View::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag) const
 {
-  return MinMaxValues (myStructsDisplayed,
-                       theToIgnoreInfiniteFlag);
+  Bnd_Box aResult     = MinMaxValues (myStructsDisplayed,    theToIgnoreInfiniteFlag);
+  Bnd_Box anImmediate = MinMaxValues (myImmediateStructures, theToIgnoreInfiniteFlag);
+  aResult.Add (anImmediate);
+  return aResult;
 }
 
 // ========================================================================
@@ -1691,45 +1734,24 @@ Bnd_Box Visual3d_View::MinMaxValues (const Standard_Boolean theToIgnoreInfiniteF
 // purpose  :
 // ========================================================================
 Bnd_Box Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
-                                     const Standard_Boolean theToIgnoreInfiniteFlag) const
+                                     const Standard_Boolean          theToIgnoreInfiniteFlag) const
 {
   Bnd_Box aResult;
-  if (theSet.IsEmpty ())
-  {
-    // Return an empty box.
-    return aResult;
-  }
-  Graphic3d_MapIteratorOfMapOfStructure anIterator (theSet);
-  for (anIterator.Initialize (theSet); anIterator.More(); anIterator.Next())
+  const Standard_Integer aViewId = MyCView.ViewId;
+  for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (theSet); aStructIter.More(); aStructIter.Next())
   {
-    const Handle(Graphic3d_Structure)& aStructure = anIterator.Key();
-
-    if (!aStructure->IsVisible())
-      continue;
-
-    if (aStructure->IsInfinite() && !theToIgnoreInfiniteFlag)
+    const Handle(Graphic3d_Structure)& aStructure = aStructIter.Key();
+    if (!aStructIter.Value()->IsVisible())
     {
-      //XMin, YMin .... ZMax are initialized by means of infinite line data
-      Bnd_Box aBox = aStructure->MinMaxValues (Standard_False);
-      if (!aBox.IsWhole() && !aBox.IsVoid())
-      {
-        aResult.Add (aBox);
-      }
+      continue;
     }
-
-    // Only non-empty and non-infinite structures
-    // are taken into account for calculation of MinMax
-    if ((!aStructure->IsInfinite() || theToIgnoreInfiniteFlag) && !aStructure->IsEmpty())
+    else if (!aStructIter.Value()->CStructure()->ViewAffinity.IsNull()
+          && !aStructIter.Value()->CStructure()->ViewAffinity->IsVisible (aViewId))
     {
-      Bnd_Box aBox = aStructure->MinMaxValues (theToIgnoreInfiniteFlag);
-
-      /* ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate ) */
-      //"FitAll" operation ignores object with transform persitence parameter
-      if(aStructure->TransformPersistenceMode() == Graphic3d_TMF_None )
-      {
-          aResult.Add (aBox);
-      }
+      continue;
     }
+
+    addStructureBndBox (aStructure, theToIgnoreInfiniteFlag, aResult);
   }
   return aResult;
 }
@@ -1862,9 +1884,9 @@ void Visual3d_View::Compute()
   // Remove structures that were calculated for the previous orientation.
   // Recalculation of new structures.
   NCollection_Sequence<Handle(Graphic3d_Structure)> aStructsSeq;
-  for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+  for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
   {
-    const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStructIter.Key());
+    const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStructIter.Key()->Visual());
     if (anAnswer == Visual3d_TOA_COMPUTE)
     {
       aStructsSeq.Append (aStructIter.Key()); // if the structure was calculated, it is recalculated
@@ -1902,7 +1924,7 @@ void Visual3d_View::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
     return;
   }
 
-  const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (theStruct);
+  const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
   if (anAnswer != Visual3d_TOA_COMPUTE)
   {
     return;
@@ -1950,13 +1972,12 @@ void Visual3d_View::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
 
   if (theStruct->IsHighlighted())
   {
-    aCompStruct->SetHighlightColor (theStruct->HighlightColor());
-    aCompStruct->GraphicHighlight (Aspect_TOHM_COLOR);
+    aCompStruct->Highlight (Aspect_TOHM_COLOR, theStruct->HighlightColor(), Standard_False);
   }
 
-  // The previous calculation is removed and the new one is dislayed
-  myGraphicDriver->EraseStructure   (MyCView, *aCompStructOld->CStructure());
-  myGraphicDriver->DisplayStructure (MyCView, *aCompStruct->CStructure(), theStruct->DisplayPriority());
+  // The previous calculation is removed and the new one is displayed
+  myGraphicDriver->EraseStructure   (MyCView, aCompStructOld);
+  myGraphicDriver->DisplayStructure (MyCView, aCompStruct, theStruct->DisplayPriority());
 
   // why not just replace existing items?
   //myStructsToCompute.ChangeValue (anIndex) = theStruct;
@@ -2324,10 +2345,10 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
   myIsInComputedMode = theMode;
   if (!myIsInComputedMode)
   {
-    for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
+    for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
     {
       const Handle(Graphic3d_Structure)& aStruct  = aStructIter.Key();
-      const Visual3d_TypeOfAnswer        anAnswer = AcceptDisplay (aStruct);
+      const Visual3d_TypeOfAnswer        anAnswer = acceptDisplay (aStruct->Visual());
       if (anAnswer != Visual3d_TOA_COMPUTE)
       {
         continue;
@@ -2337,17 +2358,17 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
       if (anIndex != 0)
       {
         const Handle(Graphic3d_Structure)& aStructComp = myStructsComputed.Value (anIndex);
-        myGraphicDriver->EraseStructure   (MyCView, *aStructComp->CStructure());
-        myGraphicDriver->DisplayStructure (MyCView, *aStruct->CStructure(), aStruct->DisplayPriority());
+        myGraphicDriver->EraseStructure   (MyCView, aStructComp);
+        myGraphicDriver->DisplayStructure (MyCView, aStruct, aStruct->DisplayPriority());
       }
     }
     return;
   }
 
-  for (Graphic3d_MapIteratorOfMapOfStructure aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
+  for (Graphic3d_MapOfStructure::Iterator aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
   {
-    Handle(Graphic3d_Structure) aStruct = aDispStructIter.Key();
-    const Visual3d_TypeOfAnswer anAnswer = AcceptDisplay (aStruct);
+    Handle(Graphic3d_Structure) aStruct  = aDispStructIter.Key();
+    const Visual3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
     if (anAnswer != Visual3d_TOA_COMPUTE)
     {
       continue;
@@ -2356,8 +2377,8 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
     const Standard_Integer anIndex = IsComputed (aStruct);
     if (anIndex != 0)
     {
-      myGraphicDriver->EraseStructure   (MyCView, *aStruct->CStructure());
-      myGraphicDriver->DisplayStructure (MyCView, *(myStructsComputed.Value (anIndex)->CStructure()), aStruct->DisplayPriority());
+      myGraphicDriver->EraseStructure   (MyCView, aStruct);
+      myGraphicDriver->DisplayStructure (MyCView, myStructsComputed.Value (anIndex), aStruct->DisplayPriority());
 
       Display (aStruct, Aspect_TOU_WAIT);
       if (aStruct->IsHighlighted())
@@ -2365,8 +2386,7 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
         const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
         if (!aCompStruct->IsHighlighted())
         {
-          aCompStruct->SetHighlightColor (aStruct->HighlightColor());
-          aCompStruct->GraphicHighlight (Aspect_TOHM_COLOR);
+          aCompStruct->Highlight (Aspect_TOHM_COLOR, aStruct->HighlightColor(), Standard_False);
         }
       }
     }
@@ -2387,8 +2407,7 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
 
       if (aStruct->IsHighlighted())
       {
-        aCompStruct->SetHighlightColor (aStruct->HighlightColor());
-        aCompStruct->GraphicHighlight (Aspect_TOHM_COLOR);
+        aCompStruct->Highlight (Aspect_TOHM_COLOR, aStruct->HighlightColor(), Standard_False);
       }
 
       Standard_Boolean hasResult = Standard_False;
@@ -2410,8 +2429,8 @@ void Visual3d_View::SetComputedMode (const Standard_Boolean theMode)
         myStructsComputed .Append (aCompStruct);
       }
 
-      myGraphicDriver->EraseStructure   (MyCView, *aStruct->CStructure());
-      myGraphicDriver->DisplayStructure (MyCView, *aCompStruct->CStructure(), aStruct->DisplayPriority());
+      myGraphicDriver->EraseStructure   (MyCView, aStruct);
+      myGraphicDriver->DisplayStructure (MyCView, aCompStruct, aStruct->DisplayPriority());
     }
   }
   Update (myViewManager->UpdateMode());
@@ -2679,3 +2698,21 @@ Standard_Boolean Visual3d_View::Print (const Handle(Visual3d_Layer)& theUnderLay
                                  thePrintDC, theToShowBackground, theFilename,
                                  thePrintAlgorithm, theScaleFactor);
 }
+
+//=============================================================================
+//function : HiddenObjects
+//purpose  :
+//=============================================================================
+const Handle(Graphic3d_NMapOfTransient)& Visual3d_View::HiddenObjects() const
+{
+  return myHiddenObjects;
+}
+
+//=============================================================================
+//function : HiddenObjects
+//purpose  :
+//=============================================================================
+Handle(Graphic3d_NMapOfTransient)& Visual3d_View::ChangeHiddenObjects() 
+{
+  return myHiddenObjects;
+}
index 967611b88eae05b880a67e38c17b73a337b79053..de0957d2864b987977adf0e46f1d75d25fa63c99 100644 (file)
@@ -129,9 +129,10 @@ is
        ---Purpose: Returns the group of views activated in the visualiser <me>.
        ---Category: Inquire methods
 
-       DefinedView ( me )
-               returns HSequenceOfView from Visual3d
-               is static;
+  DefinedViews (me)
+  returns SequenceOfView from Visual3d
+  is static;
+  ---C++: return const &
        ---Level: Internal
        ---Purpose: Returns the group of views defined in the visualiser <me>.
        ---Category: Inquire methods
index 9bfa0f5bb4a4291fc8d57f139433576b41269b59..90ed447a3854505f1e14a7f1ee2bac66eb5bb3eb 100644 (file)
@@ -81,7 +81,7 @@
 Visual3d_ViewManager::Visual3d_ViewManager (const Handle(Graphic3d_GraphicDriver)& theDriver):
 Graphic3d_StructureManager (theDriver),
 MyDefinedView (),
-MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1),
+MyViewGenId (0, 31),
 MyZBufferAuto (Standard_False)
 {
   // default layer is always presented in display layer sequence
@@ -423,16 +423,9 @@ Standard_Boolean Visual3d_ViewManager::ContainsComputedStructure () const
 }
 #endif
 
-Handle(Visual3d_HSequenceOfView) Visual3d_ViewManager::DefinedView () const
+const Visual3d_SequenceOfView& Visual3d_ViewManager::DefinedViews() const
 {
-  Handle (Visual3d_HSequenceOfView) SG = new Visual3d_HSequenceOfView();
-
-  for(int i=1; i<=MyDefinedView.Length(); i++)
-  {
-    SG->Append(MyDefinedView.Value(i));
-  }
-
-  return (SG);
+  return MyDefinedView;
 }
 
 Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& AWindow, Graphic3d_CView& TheCView) const