0025552: Visualization - provide the way to hide the object in specified view of...
authorkgv <kgv@opencascade.com>
Thu, 5 Mar 2015 10:50:47 +0000 (13:50 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 5 Mar 2015 10:52:43 +0000 (13:52 +0300)
Add test case bugs/vis/bug25552
OpenGl_GraphicDriver - do not use View and Workspace identifiers on level of entire Driver

32 files changed:
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_MapOfObject.hxx [new file with mode: 0644]
src/Graphic3d/Graphic3d_NMapOfTransient.hxx [new file with mode: 0644]
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/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_GraphicDriver.hxx
src/OpenGl/OpenGl_GraphicDriver_7.cxx
src/OpenGl/OpenGl_Layer.cxx
src/OpenGl/OpenGl_Workspace.cxx
src/OpenGl/OpenGl_Workspace.hxx
src/OpenGl/OpenGl_Workspace_Raytrace.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.cxx
tests/bugs/vis/bug25552 [new file with mode: 0644]

index a8ae057..6398d8c 100644 (file)
@@ -2010,6 +2010,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 ac16518..d026bce 100644 (file)
@@ -322,6 +322,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  :
@@ -341,6 +370,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  :
@@ -392,6 +448,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
   {
     Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
     myObjects.Bind   (theIObj, aStatus);
+    Handle(Graphic3d_ViewAffinity) anAffinity = myMainVwr->Viewer()->RegisterObject (theIObj);
     myMainPM->Display(theIObj, theDispMode);
     if (theSelectionMode != -1)
     {
@@ -2355,6 +2412,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 7e22eda..b8423a9 100644 (file)
@@ -32,6 +32,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>
@@ -71,7 +72,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 2a8ca1b..13042c5 100644 (file)
@@ -35,6 +35,7 @@
 #include <SelectBasics_SensitiveEntity.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <NCollection_Map.hxx>
+#include <Visual3d_View.hxx>
 
 #include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
 #include <SelectMgr_Selection.hxx>
@@ -71,6 +72,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 272a3bd..47cf7ee 100755 (executable)
@@ -22,6 +22,9 @@ Graphic3d_CLight.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
@@ -71,3 +74,4 @@ Graphic3d_Camera.cxx
 Graphic3d_Camera.hxx
 Graphic3d_Camera_Handle.hxx
 Graphic3d_RenderingParams.hxx
+Graphic3d_NMapOfTransient.hxx
index bbeabd8..4dcc3a7 100644 (file)
@@ -495,6 +495,10 @@ is
     imported Vertex;
     ---Category: Classes
 
+    imported transient class ViewAffinity;
+    imported MapOfObject;
+    imported transient class NMapOfTransient;
+
     imported MapOfStructure;
     imported SequenceOfDisplayedStructures;
 
index d69510b..4eb318f 100644 (file)
@@ -21,6 +21,7 @@
 #include <Graphic3d_SequenceOfGroup.hxx>
 #include <Graphic3d_SequenceOfHClipPlane.hxx>
 #include <Graphic3d_TypeOfComposition.hxx>
+#include <Graphic3d_ViewAffinity.hxx>
 #include <Graphic3d_Vec3.hxx>
 #include <Graphic3d_ZLayerId.hxx>
 #include <Standard_Transient.hxx>
@@ -133,6 +134,8 @@ public:
 
   int   ContainsFacet;
 
+  Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
+
   unsigned IsInfinite     : 1;
   unsigned stick          : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
   unsigned highlight      : 1;
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_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 14516cf..5b690b7 100644 (file)
@@ -50,6 +50,8 @@ uses
        AspectText3d            from Graphic3d,
        Structure               from Graphic3d,
        MapOfStructure          from Graphic3d,
+  MapOfObject       from Graphic3d,
+  ViewAffinity      from Graphic3d,
        SequenceOfStructure     from Graphic3d,
     GraphicDriver    from Graphic3d
 
@@ -443,6 +445,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
@@ -474,6 +489,8 @@ fields
        MyDisplayedStructure    :       MapOfStructure from Graphic3d
                                                                is protected;
 
+  myRegisteredObjects : MapOfObject from Graphic3d is protected;
+
        -- the highlighted structures
        MyHighlightedStructure  :       MapOfStructure from Graphic3d
                                                                is protected;
index e6bc225..799311d 100644 (file)
@@ -289,3 +289,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 82010a1..6f67945 100644 (file)
@@ -110,7 +110,7 @@ OpenGl_GraphicDriver::~OpenGl_GraphicDriver()
 void OpenGl_GraphicDriver::ReleaseContext()
 {
   Handle(OpenGl_Context) aCtxShared;
-  for (NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>::Iterator aWindowIter (myMapOfWS);
+  for (NCollection_Map<Handle(OpenGl_Workspace)>::Iterator aWindowIter (myMapOfWS);
        aWindowIter.More(); aWindowIter.Next())
   {
     const Handle(OpenGl_Workspace)& aWindow = aWindowIter.ChangeValue();
@@ -126,7 +126,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
   {
     aCtxShared->MakeCurrent();
   }
-  for (NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>::Iterator aViewIter (myMapOfView);
+  for (NCollection_Map<Handle(OpenGl_View)>::Iterator aViewIter (myMapOfView);
        aViewIter.More(); aViewIter.Next())
   {
     const Handle(OpenGl_View)& aView = aViewIter.ChangeValue();
@@ -142,7 +142,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
   myTempText->Release (aCtxShared.operator->());
   myDeviceLostFlag = myDeviceLostFlag || !myMapOfStructure.IsEmpty();
 
-  for (NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>::Iterator aWindowIter (myMapOfWS);
+  for (NCollection_Map<Handle(OpenGl_Workspace)>::Iterator aWindowIter (myMapOfWS);
        aWindowIter.More(); aWindowIter.Next())
   {
     const Handle(OpenGl_Workspace)& aWindow = aWindowIter.ChangeValue();
@@ -373,7 +373,7 @@ const Handle(OpenGl_Context)& OpenGl_GraphicDriver::GetSharedContext() const
     return TheNullGlCtx;
   }
 
-  NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)>::Iterator anIter (myMapOfWS);
+  NCollection_Map<Handle(OpenGl_Workspace)>::Iterator anIter (myMapOfWS);
   return anIter.Value()->GetGlContext();
 }
 
index 6eb10a1..cb5d482 100644 (file)
@@ -348,8 +348,8 @@ private:
 #endif
 
   Handle(OpenGl_Caps)                                             myCaps;
-  NCollection_DataMap<Standard_Integer, Handle(OpenGl_View)>      myMapOfView;
-  NCollection_DataMap<Standard_Integer, Handle(OpenGl_Workspace)> myMapOfWS;
+  NCollection_Map<Handle(OpenGl_View)>                            myMapOfView;
+  NCollection_Map<Handle(OpenGl_Workspace)>                       myMapOfWS;
   NCollection_DataMap<Standard_Integer, OpenGl_Structure*>        myMapOfStructure;
   mutable Handle(OpenGl_PrinterContext)                           myPrintContext;
   OpenGl_UserDrawCallback_t                                       myUserDrawCallback;
index 24dae48..232eaad 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);
   }
 }
 
@@ -390,37 +390,40 @@ Standard_Boolean OpenGl_Workspace::BufferDump (OpenGl_FrameBuffer*         theFB
 
 void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
 {
-  Handle(OpenGl_Context)   aCtx = GetSharedContext();
-  Handle(OpenGl_View)      aView;
-  Handle(OpenGl_Workspace) aWindow;
-  if (myMapOfWS.Find (theCView.WsId, aWindow))
+  Handle(OpenGl_Context) aCtx   = GetSharedContext();
+  OpenGl_CView*          aCView = (OpenGl_CView* )theCView.ptrView;
+  if (aCView == NULL
+   || aCView->View.IsNull()
+   || aCView->WS.IsNull())
   {
-    myMapOfWS.UnBind (theCView.WsId);
+    return;
   }
-  if (!aWindow.IsNull())
+
+  Handle(OpenGl_View)      aView   = aCView->View;
+  Handle(OpenGl_Workspace) aWindow = aCView->WS;
+  if (!myMapOfWS  .Remove (aWindow)
+   || !myMapOfView.Remove (aView))
   {
-    if (aWindow->GetGlContext()->MakeCurrent())
-    {
-      aCtx = aWindow->GetGlContext();
-    }
-    else
-    {
-      // try to hijack another context if any
-      const Handle(OpenGl_Context)& anOtherCtx = GetSharedContext();
-      if (!anOtherCtx.IsNull()
-       && anOtherCtx != aWindow->GetGlContext())
-      {
-        aCtx = anOtherCtx;
-        aCtx->MakeCurrent();
-      }
-    }
+    return;
   }
-  if (myMapOfView.Find (theCView.ViewId, aView))
+
+  if (aWindow->GetGlContext()->MakeCurrent())
   {
-    aView->ReleaseGlResources (aCtx);
-    myMapOfView.UnBind (theCView.ViewId);
+    aCtx = aWindow->GetGlContext();
+  }
+  else
+  {
+    // try to hijack another context if any
+    const Handle(OpenGl_Context)& anOtherCtx = GetSharedContext();
+    if (!anOtherCtx.IsNull()
+      && anOtherCtx != aWindow->GetGlContext())
+    {
+      aCtx = anOtherCtx;
+      aCtx->MakeCurrent();
+    }
   }
 
+  aView->ReleaseGlResources (aCtx);
   if (myMapOfWS.IsEmpty())
   {
     // The last view removed but some objects still present.
@@ -435,7 +438,6 @@ void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
     myDeviceLostFlag = !myMapOfStructure.IsEmpty();
   }
 
-  OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
   delete aCView;
   ((Graphic3d_CView *)&theCView)->ptrView = NULL;
 
@@ -499,34 +501,30 @@ void OpenGl_GraphicDriver::InvalidateBVHData (Graphic3d_CView& theCView, const S
 Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& theCView)
 {
   Handle(OpenGl_Context) aShareCtx = GetSharedContext();
-  if (myMapOfView.IsBound (theCView.ViewId))
+  OpenGl_CView*          aCView = (OpenGl_CView* )theCView.ptrView;
+  if (aCView != NULL
+   && myMapOfView.Contains (aCView->View))
   {
-    OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
-    if (!myMapOfWS.IsBound (theCView.WsId)
-     || aCView == NULL)
-    {
-      return Standard_False;
-    }
-
-    Handle(OpenGl_Workspace) aWS = new OpenGl_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
+    Handle(OpenGl_Workspace) anOldWS = aCView->WS;
+    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);
+    myMapOfWS.Remove (anOldWS);
+    myMapOfWS.Add    (aWS);
     return Standard_True;
   }
 
   Handle(OpenGl_Workspace) aWS       = new OpenGl_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
   Handle(OpenGl_View)      aView     = new OpenGl_View (theCView.Context, &myStateCounter);
-  myMapOfWS  .Bind (theCView.WsId,   aWS);
-  myMapOfView.Bind (theCView.ViewId, aView);
+  myMapOfWS  .Add (aWS);
+  myMapOfView.Add (aView);
 
-  OpenGl_CView* aCView = new OpenGl_CView();
+  aCView = new OpenGl_CView();
   aCView->View = aView;
   aCView->WS   = aWS;
   theCView.ptrView = aCView;
-  aWS->SetActiveView (aCView->View);
+  aWS->SetActiveView (aCView->View, theCView.ViewId);
 
   return Standard_True;
 }
index 57f8141..5ab137c 100644 (file)
@@ -123,6 +123,7 @@ void OpenGl_Layer::InvalidateBVHData()
 void OpenGl_Layer::renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const
 {
   const Standard_Integer aNbPriorities = myArray.Length();
+  const Standard_Integer aViewId       = theWorkspace->ActiveViewId();
   for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
   {
     for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
@@ -132,6 +133,11 @@ void OpenGl_Layer::renderAll (const Handle(OpenGl_Workspace)& theWorkspace) cons
       {
         continue;
       }
+      else if (!aStruct->ViewAffinity.IsNull()
+            && !aStruct->ViewAffinity->IsVisible (aViewId))
+      {
+        continue;
+      }
 
       aStruct->Render (theWorkspace);
     }
@@ -154,6 +160,7 @@ void OpenGl_Layer::renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace)
   traverse (aSelector);
 
   const Standard_Integer aNbPriorities = myArray.Length();
+  const Standard_Integer aViewId       = theWorkspace->ActiveViewId();
   for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
   {
     for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
@@ -164,6 +171,11 @@ void OpenGl_Layer::renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace)
       {
         continue;
       }
+      else if (!aStruct->ViewAffinity.IsNull()
+            && !aStruct->ViewAffinity->IsVisible (aViewId))
+      {
+        continue;
+      }
 
       aStruct->Render (theWorkspace);
       aStruct->ResetCullingStatus();
index d9f8cca..88e073d 100644 (file)
@@ -154,6 +154,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),
index 2c8523f..4b36fc4 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,
@@ -658,6 +666,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 2f1118f..33435e6 100644 (file)
@@ -96,6 +96,11 @@ Standard_Boolean OpenGl_Workspace::UpdateRaytraceGeometry (GeomUpdateMode theMod
           {
             continue;
           }
+          else if (!aStructure->ViewAffinity.IsNull()
+                && !aStructure->ViewAffinity->IsVisible (myViewId))
+          {
+            continue;
+          }
 
           for (OpenGl_Structure::GroupIterator aGroupIter (aStructure->DrawGroups()); aGroupIter.More(); aGroupIter.Next())
           {
index 52dfb93..cc0f813 100644 (file)
@@ -169,7 +169,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.
@@ -235,11 +236,13 @@ is
   Presentation (me;
                 thePrsObject : PresentableObject from PrsMgr;
                 theMode      : Integer from Standard = 0;
-                theToCreate  : Boolean from Standard = Standard_False)
+                theToCreate  : Boolean from Standard = Standard_False;
+                theSelObj    : PresentableObject from PrsMgr = NULL)
   returns Presentation from PrsMgr
   is static;
   ---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;
index 83bb668..702faad 100644 (file)
@@ -405,7 +405,8 @@ Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMg
 // =======================================================================
 Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObj,
                                                                       const Standard_Integer                  theMode,
-                                                                      const Standard_Boolean                  theToCreate) const
+                                                                      const Standard_Boolean                  theToCreate,
+                                                                      const Handle(PrsMgr_PresentableObject)& theSelObj) const
 {
   const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations();
   for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
@@ -426,6 +427,7 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand
 
   Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj);
   aPrs->SetZLayer (thePrsObj->ZLayer());
+  aPrs->Presentation()->CStructure()->ViewAffinity = myStructureManager->ObjectAffinity (!theSelObj.IsNull() ? theSelObj : thePrsObj);
   thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode));
   thePrsObj->Fill (this, aPrs, theMode);
 
@@ -516,7 +518,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())
   {
@@ -527,7 +530,7 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)&
     return;
   }
 
-  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True);
+  Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode, Standard_True, theSelObj);
   if (aPrs->MustBeUpdated())
   {
     Update (thePrsObj, theMode);
index e3e59f5..076e4ef 100755 (executable)
@@ -1 +1 @@
-SelectMgr_CompareResults.hxx
\ No newline at end of file
+SelectMgr_CompareResults.hxx
index 0daba7f..78da724 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 f87fb0c..d104668 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 a4e3a7e..fb3feff 100644 (file)
@@ -149,14 +149,18 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
     }
 
     // highlight with color and set layer
-    PM->Color (myPrsSh, aCol, M);
+    PM->Color (myPrsSh, aCol, M, aSel);
   }
   else
   {
-    if(myPrsSh.IsNull())
-      PM->Color(aSel, aCol, M);
+    if (!myPrsSh.IsNull())
+    {
+      PM->Color (myPrsSh, aCol, M, aSel);
+    }
     else
-      PM->Color(myPrsSh,aCol,M);
+    {
+      PM->Color (aSel, aCol, M);
+    }
   }
 }
 
index 2346113..7d1f50d 100644 (file)
@@ -35,6 +35,7 @@ uses
         TColStd,
         Graphic3d,
         Visual3d,
+        SelectMgr,
         MMgt,
         TCollection,
         Quantity,
index 60505dc..15008ec 100644 (file)
@@ -2513,7 +2513,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)
   {
@@ -2527,6 +2528,11 @@ int VErase (Draw_Interpretor& theDI,
     {
       toEraseLocal = Standard_True;
     }
+    else if (anArgCase == "-view"
+          || anArgCase == "-inview")
+    {
+      toEraseInView = Standard_True;
+    }
     else
     {
       aNamesOfEraseIO.Append (theArgVec[anArgIter]);
@@ -2565,7 +2571,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
       {
@@ -2588,7 +2601,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);
+        }
       }
     }
   }
@@ -2601,7 +2621,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
       {
@@ -3194,6 +3221,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
   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];
@@ -3242,6 +3270,11 @@ static int VDisplay2 (Draw_Interpretor& theDI,
 
       aZLayer = aValue.IntegerValue();
     }
+    else if (aNameCase == "-view"
+          || aNameCase == "-inview")
+    {
+      toDisplayInView = Standard_True;
+    }
     else if (aNameCase == "-local")
     {
       aDispStatus = AIS_DS_Temporary;
@@ -3305,6 +3338,14 @@ static int VDisplay2 (Draw_Interpretor& theDI,
         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;
     }
@@ -3357,6 +3398,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
         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 ec3d457..9405974 100644 (file)
@@ -105,6 +105,7 @@ uses
     AsciiString             from TCollection,
     ExtendedString          from TCollection,
     CGraduatedTrihedron     from Graphic3d,
+    NMapOfTransient         from Graphic3d,
     TypeOfStructure         from Graphic3d,
 
     PixMap                  from Image,
@@ -1152,6 +1153,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
@@ -1193,6 +1204,8 @@ fields
 
   myStructuresUpdated     : Boolean from Standard;
 
+  myHiddenObjects : NMapOfTransient from Graphic3d;
+
 friends
 
   class ViewManager from Visual3d
index a25e99d..7bfe697 100644 (file)
@@ -53,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;
@@ -1735,6 +1737,7 @@ Bnd_Box Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
                                      const Standard_Boolean          theToIgnoreInfiniteFlag) const
 {
   Bnd_Box aResult;
+  const Standard_Integer aViewId = MyCView.ViewId;
   for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (theSet); aStructIter.More(); aStructIter.Next())
   {
     const Handle(Graphic3d_Structure)& aStructure = aStructIter.Key();
@@ -1742,6 +1745,11 @@ Bnd_Box Visual3d_View::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
     {
       continue;
     }
+    else if (!aStructIter.Value()->CStructure()->ViewAffinity.IsNull()
+          && !aStructIter.Value()->CStructure()->ViewAffinity->IsVisible (aViewId))
+    {
+      continue;
+    }
 
     addStructureBndBox (aStructure, theToIgnoreInfiniteFlag, aResult);
   }
@@ -2690,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 bb8d59c..acc6cfe 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),
 myZLayerGenId (1, IntegerLast())
 {
diff --git a/tests/bugs/vis/bug25552 b/tests/bugs/vis/bug25552
new file mode 100644 (file)
index 0000000..1a518e5
--- /dev/null
@@ -0,0 +1,68 @@
+puts "============"
+puts "CR25552"
+puts "Provide the way to hide objects within different Views of the one Viewer"
+puts "============"
+puts ""
+
+set aSubShapeTriang $imagedir/${casename}_subshape_triangulation.png
+set aShapeTriang $imagedir/${casename}_shape_triangulation.png
+set aDiff $imagedir/${casename}_diff.png
+
+vinit View1
+vclear
+vaxo
+vsetdispmode 1
+
+vinit View2
+vclear
+vaxo
+vsetdispmode 1
+
+box b1 0 0 0 1 2 3
+box b2 3 0 0 2 3 1
+box b3 0 3 0 2 3 1
+
+vdisplay b1 b3
+# b2 should be displayed only in View2, but not in View1
+vdisplay -inview b2
+#vdisplay b2
+vaspects -noupdate b1 -setcolor RED
+vaspects -noupdate b2 -setcolor GREEN
+vfit
+# b1 should be displayed only in View1
+verase -inview b1
+vmoveto 250 350
+
+set aColorV2B1 [vreadpixel  50 250 rgb name]
+if { $aColorV2B1 != "BLACK" } {
+  puts "Error: box b1 (red) should NOT be visible in View2!"
+}
+
+set aColorV2B2 [vreadpixel 200 350 rgb name]
+if { $aColorV2B2 != "GREEN3" } {
+  puts "Error: box b2 (green) should be visible in View2!"
+}
+
+set aColorV2B3 [vreadpixel 250 200 rgb name]
+if { $aColorV2B3 != "DARKGOLDENROD3" } {
+  puts "Error: box b3 (goldenrod) should be visible in View2!"
+}
+vdump $imagedir/${casename}_v2.png
+
+vactivate View1
+vfit
+set aColorV1B1 [vreadpixel  50 250 rgb name]
+if { $aColorV1B1 != "RED3" } {
+  puts "Error: box b1 (red) should be visible in View1!"
+}
+
+set aColorV1B2 [vreadpixel 200 350 rgb name]
+if { $aColorV1B2 != "BLACK" } {
+  puts "Error: box b2 (green) should NOT be visible in View1!"
+}
+
+set aColorV1B3 [vreadpixel 250 200 rgb name]
+if { $aColorV1B3 != "DARKGOLDENROD3" } {
+  puts "Error: box b3 (goldenrod) should be visible in View1!"
+}
+vdump $imagedir/${casename}_v1.png