]> OCCT Git - occt.git/commitdiff
0032162: Visualization - move AIS_DisplayStatus from AIS_GlobalStatus to PrsMgr_Prese...
authorkgv <kgv@opencascade.com>
Wed, 24 Feb 2021 12:37:57 +0000 (15:37 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 25 Feb 2021 15:58:49 +0000 (18:58 +0300)
AIS_DisplayStatus has been renamed to PrsMgr_DisplayStatus
and moved from AIS_GlobalStatus class field to PrsMgr_PresentableObject.

0032167: Visualization, AIS_InteractiveContext - setObjectStatus sets wrong status when AIS_DS_Erased

AIS_InteractiveContext::setObjectStatus() Fixed setting unexpected Displayed status to Erased objects.

14 files changed:
src/AIS/AIS_DisplayStatus.hxx
src/AIS/AIS_GlobalStatus.cxx
src/AIS/AIS_GlobalStatus.hxx
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_InteractiveContext_1.cxx
src/AIS/AIS_InteractiveContext_2.cxx
src/AIS/AIS_InteractiveContext_3.cxx
src/AIS/AIS_InteractiveObject.cxx
src/AIS/AIS_InteractiveObject.hxx
src/PrsMgr/FILES
src/PrsMgr/PrsMgr_DisplayStatus.hxx [new file with mode: 0644]
src/PrsMgr/PrsMgr_PresentableObject.cxx
src/PrsMgr/PrsMgr_PresentableObject.hxx

index 32f117af73afdcc19117db4e8185f9de9c065982..b05c87237b10dce48731f01e2b4cd41e95752375 100644 (file)
 #ifndef _AIS_DisplayStatus_HeaderFile
 #define _AIS_DisplayStatus_HeaderFile
 
+#include <PrsMgr_DisplayStatus.hxx>
+
 //! To give the display status of an Interactive Object.
-enum AIS_DisplayStatus
-{
-  AIS_DS_Displayed, //!< the Interactive Object is displayed in the main viewer
-  AIS_DS_Erased,    //!< the Interactive Object is hidden in main viewer
-  AIS_DS_None       //!< the Interactive Object is nowhere displayed
-};
+typedef PrsMgr_DisplayStatus AIS_DisplayStatus;
 
 #endif // _AIS_DisplayStatus_HeaderFile
index 28ae7bef15ea2dc5ddf398342f68455e5dc24ab7..012ed5e5b1b36334de9541bd581811fece0f565e 100644 (file)
@@ -23,7 +23,6 @@
 IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
 
 AIS_GlobalStatus::AIS_GlobalStatus():
-myStatus(AIS_DS_None),
 myDispMode(AIS_WireFrame),
 myLayerIndex(0),
 myIsHilit(Standard_False),
@@ -31,18 +30,15 @@ mySubInt(Standard_False)
 {  
 }
 
-AIS_GlobalStatus::AIS_GlobalStatus(const AIS_DisplayStatus DS,
-                                  const Standard_Integer DMode,
-                                  const Standard_Integer SMode,
-                                  const Standard_Boolean /*ishilighted*/,
-                                  const Standard_Integer Layer):
-myStatus(DS),
-myDispMode(DMode),
-myLayerIndex(Layer),
-myIsHilit(Standard_False),
-mySubInt(Standard_False)
+AIS_GlobalStatus::AIS_GlobalStatus (const Standard_Integer theDMode,
+                                    const Standard_Integer theSMode,
+                                    const Standard_Integer theLayer):
+myDispMode (theDMode),
+myLayerIndex (theLayer),
+myIsHilit (Standard_False),
+mySubInt (Standard_False)
 {
-  mySelModes.Append(SMode);
+  mySelModes.Append (theSMode);
 }
 
 void AIS_GlobalStatus::RemoveSelectionMode(const Standard_Integer aMode)
index d5ca4bbb0f89322160fde6bff109cc496e03c19d..df7cf8847c0b428a003f21ded180d5524810ff41 100644 (file)
@@ -43,9 +43,9 @@ public:
 
   Standard_EXPORT AIS_GlobalStatus();
   
-  Standard_EXPORT AIS_GlobalStatus(const AIS_DisplayStatus aStat, const Standard_Integer aDispMode, const Standard_Integer aSelMode, const Standard_Boolean ishilighted = Standard_False, const Standard_Integer aLayerIndex = 0);
-
-  void SetGraphicStatus (const AIS_DisplayStatus theStatus) { myStatus = theStatus; }
+  Standard_EXPORT AIS_GlobalStatus (const Standard_Integer theDispMode,
+                                    const Standard_Integer theSelMode,
+                                    const Standard_Integer theLayerIndex = 0);
 
   void AddSelectionMode (const Standard_Integer theMode) { if (!IsSModeIn (theMode)) mySelModes.Append (theMode); }
 
@@ -74,9 +74,7 @@ public:
   Standard_EXPORT void RemoveSelectionMode (const Standard_Integer aMode);
   
   Standard_EXPORT void ClearSelectionModes();
-  
-  AIS_DisplayStatus GraphicStatus() const { return myStatus; }
-  
+
   //! keeps the active selection modes of the object
   //! in the main viewer.
   const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; }
@@ -95,7 +93,6 @@ private:
 
   TColStd_ListOfInteger mySelModes;
   Handle(Prs3d_Drawer) myHiStyle;
-  AIS_DisplayStatus myStatus;
   Standard_Integer myDispMode;
   Standard_Integer myLayerIndex;
   Standard_Boolean myIsHilit;
index 0d6069b730350caefd34492fb40dcf9e6effcafa..964e8635bc66a857100d81c54389ef202d64925d 100644 (file)
@@ -245,7 +245,7 @@ void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfI
 {
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
+    if (anObjIter.Key()->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
     {
       theListOfIO.Append (anObjIter.Key());
     }
@@ -260,7 +260,7 @@ void AIS_InteractiveContext::DisplayedObjects (const AIS_KindOfInteractive theKi
                                                const Standard_Integer      theSign,
                                                AIS_ListOfInteractive&      theListOfIO) const
 {
-  ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Displayed, theListOfIO);
+  ObjectsByDisplayStatus (theKind, theSign, PrsMgr_DisplayStatus_Displayed, theListOfIO);
 }
 
 //=======================================================================
@@ -269,7 +269,7 @@ void AIS_InteractiveContext::DisplayedObjects (const AIS_KindOfInteractive theKi
 //=======================================================================
 void AIS_InteractiveContext::ErasedObjects (AIS_ListOfInteractive& theListOfIO) const
 {
-  ObjectsByDisplayStatus (AIS_DS_Erased, theListOfIO);
+  ObjectsByDisplayStatus (PrsMgr_DisplayStatus_Erased, theListOfIO);
 }
 
 //=======================================================================
@@ -280,19 +280,19 @@ void AIS_InteractiveContext::ErasedObjects (const AIS_KindOfInteractive theKind,
                                             const Standard_Integer      theSign,
                                             AIS_ListOfInteractive&      theListOfIO) const
 {
-  ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Erased, theListOfIO);
+  ObjectsByDisplayStatus (theKind, theSign, PrsMgr_DisplayStatus_Erased, theListOfIO);
 }
 
 //=======================================================================
 //function : ObjectsByDisplayStatus
 //purpose  :
 //=======================================================================
-void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus,
+void AIS_InteractiveContext::ObjectsByDisplayStatus (const PrsMgr_DisplayStatus theStatus,
                                                      AIS_ListOfInteractive&  theListOfIO) const
 {
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    if (anObjIter.Value()->GraphicStatus() == theStatus)
+    if (anObjIter.Key()->DisplayStatus() == theStatus)
     {
       theListOfIO.Append (anObjIter.Key());
     }
@@ -305,13 +305,13 @@ void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_DisplayStatus the
 //=======================================================================
 void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive theKind,
                                                      const Standard_Integer      theSign,
-                                                     const AIS_DisplayStatus     theStatus,
+                                                     const PrsMgr_DisplayStatus  theStatus,
                                                      AIS_ListOfInteractive&      theListOfIO) const
 {
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    if (theStatus != AIS_DS_None
-     && anObjIter.Value()->GraphicStatus() != theStatus)
+    if (theStatus != PrsMgr_DisplayStatus_None
+     && anObjIter.Key()->DisplayStatus() != theStatus)
     {
       continue;
     }
@@ -368,14 +368,14 @@ void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive&      theListO
 void AIS_InteractiveContext::ObjectsForView (AIS_ListOfInteractive&  theListOfIO,
                                              const Handle(V3d_View)& theView,
                                              const Standard_Boolean  theIsVisibleInView,
-                                             const AIS_DisplayStatus theStatus) const
+                                             const PrsMgr_DisplayStatus theStatus) const
 {
   Handle(Graphic3d_CView) aViewImpl = theView->View();
   const Standard_Integer  aViewId   = aViewImpl->Identification();
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    if (theStatus != AIS_DS_None
-     && anObjIter.Value()->GraphicStatus() != theStatus)
+    if (theStatus != PrsMgr_DisplayStatus_None
+     && anObjIter.Key()->DisplayStatus() != theStatus)
     {
       theListOfIO.Append (anObjIter.Key());
       continue;
@@ -442,14 +442,14 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
                                       const Standard_Integer               theDispMode,
                                       const Standard_Integer               theSelectionMode,
                                       const Standard_Boolean               theToUpdateViewer,
-                                      const AIS_DisplayStatus              theDispStatus)
+                                      const PrsMgr_DisplayStatus           theDispStatus)
 {
   if (theIObj.IsNull())
   {
     return;
   }
 
-  if (theDispStatus == AIS_DS_Erased)
+  if (theDispStatus == PrsMgr_DisplayStatus_Erased)
   {
     Erase  (theIObj, theToUpdateViewer);
     Load (theIObj, theSelectionMode);
@@ -463,7 +463,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
   setContextToObject (theIObj);
   if (!myObjects.IsBound (theIObj))
   {
-    setObjectStatus (theIObj, AIS_DS_Displayed, theDispMode, theSelectionMode);
+    setObjectStatus (theIObj, PrsMgr_DisplayStatus_Displayed, theDispMode, theSelectionMode);
     myMainVwr->StructureManager()->RegisterObject (theIObj);
     myMainPM->Display(theIObj, theDispMode);
     if (theSelectionMode != -1)
@@ -495,8 +495,8 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
 
     aStatus->SetDisplayMode (theDispMode);
 
+    theIObj->SetDisplayStatus (PrsMgr_DisplayStatus_Displayed);
     myMainPM->Display (theIObj, theDispMode);
-    aStatus->SetGraphicStatus (AIS_DS_Displayed);
     if (aStatus->IsHilighted())
     {
       highlightGlobal (theIObj, aStatus->HilightStyle(), theDispMode);
@@ -540,7 +540,7 @@ void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
   {
     Standard_Integer aDispMode, aHiMod, aSelModeDef;
     GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
-    setObjectStatus (theIObj, AIS_DS_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
+    setObjectStatus (theIObj, PrsMgr_DisplayStatus_Erased, aDispMode, theSelMode != -1 ? theSelMode : aSelModeDef);
     myMainVwr->StructureManager()->RegisterObject (theIObj);
   }
 
@@ -584,7 +584,7 @@ void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
 {
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
+    if (anObjIter.Key()->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
     {
       Erase (anObjIter.Key(), Standard_False);
     }
@@ -604,8 +604,8 @@ void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewe
 {
   for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
   {
-    const AIS_DisplayStatus aStatus = anObjIter.Value()->GraphicStatus();
-    if (aStatus == AIS_DS_Erased)
+    const PrsMgr_DisplayStatus aStatus = anObjIter.Key()->DisplayStatus();
+    if (aStatus == PrsMgr_DisplayStatus_Erased)
     {
       Display (anObjIter.Key(), Standard_False);
     }
@@ -659,14 +659,14 @@ void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateVi
 //function : DisplayStatus
 //purpose  :
 //=======================================================================
-AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus (const Handle(AIS_InteractiveObject)& theIObj) const
+PrsMgr_DisplayStatus AIS_InteractiveContext::DisplayStatus (const Handle(AIS_InteractiveObject)& theIObj) const
 {
   if (theIObj.IsNull())
   {
-    return AIS_DS_None;
+    return PrsMgr_DisplayStatus_None;
   }
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
-  return aStatus != NULL ? (*aStatus)->GraphicStatus() : AIS_DS_None;
+  return aStatus != NULL ? theIObj->DisplayStatus() : PrsMgr_DisplayStatus_None;
 }
 
 //=======================================================================
@@ -729,7 +729,7 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
   const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
   aStatus->SetHilightStatus (Standard_True);
 
-  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+  if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
   {
     highlightGlobal (theObj, theStyle, aStatus->DisplayMode());
     aStatus->SetHilightStyle (theStyle);
@@ -743,21 +743,26 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
 //function : Unhilight
 //purpose  : 
 //=======================================================================
-void AIS_InteractiveContext::Unhilight(const Handle(AIS_InteractiveObject)& anIObj, const Standard_Boolean updateviewer)
+void AIS_InteractiveContext::Unhilight (const Handle(AIS_InteractiveObject)& theObj,
+                                        const Standard_Boolean theToUpdateViewer)
 {
-  if(anIObj.IsNull()) return;
-  if(!myObjects.IsBound(anIObj)) return;
-
-  const Handle(AIS_GlobalStatus)& aStatus = myObjects(anIObj);
-  aStatus->SetHilightStatus (Standard_False);
-  aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
+  Handle(AIS_GlobalStatus)* aStatus = !theObj.IsNull() ? myObjects.ChangeSeek (theObj) : NULL;
+  if (aStatus == NULL)
+  {
+    return;
+  }
 
-  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+  (*aStatus)->SetHilightStatus (Standard_False);
+  (*aStatus)->SetHilightStyle (Handle(Prs3d_Drawer)());
+  if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
   {
-    unhighlightGlobal (anIObj);
+    unhighlightGlobal (theObj);
   }
 
-  if(updateviewer) myMainVwr->Update();
+  if (theToUpdateViewer)
+  {
+    myMainVwr->Update();
+  }
 }
 
 //=======================================================================
@@ -861,7 +866,7 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed(const Handle(AIS_Interactiv
 
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theObj);
   return aStatus != NULL
-    && (*aStatus)->GraphicStatus() == AIS_DS_Displayed; 
+      && theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed;
 }
 
 //=======================================================================
@@ -878,7 +883,7 @@ Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_Interacti
 
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
   return aStatus != NULL
-      && (*aStatus)->GraphicStatus() == AIS_DS_Displayed
+      && theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
       && (*aStatus)->DisplayMode() == theMode;
 }
 
@@ -895,8 +900,8 @@ Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_Inter
 
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
   if (aStatus != NULL
-   && ((*aStatus)->GraphicStatus() == AIS_DS_Displayed
-    || (*aStatus)->GraphicStatus() == AIS_DS_Erased))
+   && (theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
+    || theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Erased))
   {
     Standard_Integer aDispMode = theIObj->HasDisplayMode()
                                ? theIObj->DisplayMode()
@@ -923,8 +928,8 @@ void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObj
   setContextToObject (theIObj);
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
   if (aStatus != NULL
-   && ((*aStatus)->GraphicStatus() == AIS_DS_Displayed
-    || (*aStatus)->GraphicStatus() == AIS_DS_Erased))
+   && (theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
+    || theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Erased))
   {
     Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
                                   ? theIObj->DisplayMode()
@@ -965,7 +970,7 @@ void AIS_InteractiveContext::Redisplay (const AIS_KindOfInteractive theKOI,
     }
 
     Redisplay (anObj, Standard_False);
-    isRedisplayed = anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed
+    isRedisplayed = anObjIter.Key()->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
                  || isRedisplayed;
   }
 
@@ -998,7 +1003,7 @@ void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObjec
 
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
   if (aStatus != NULL
-   && (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
+   && theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
   {
     myMainVwr->Update();
   }
@@ -1018,7 +1023,7 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
 
   const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
   if (aStatus == NULL
-  || (*aStatus)->GraphicStatus() != AIS_DS_Displayed)
+   || theIO->DisplayStatus() != PrsMgr_DisplayStatus_Displayed)
   {
     return;
   }
@@ -1051,7 +1056,7 @@ void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIOb
   {
     const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIObj);
     if (aStatus != NULL
-     && (*aStatus)->GraphicStatus() == AIS_DS_Displayed)
+     && theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
     {
       myMainVwr->Update();
     }
@@ -1202,7 +1207,7 @@ void AIS_InteractiveContext::SetDisplayMode(const Standard_Integer theMode,
     Handle(AIS_GlobalStatus) aStatus = anObjIter.Value();
     aStatus->SetDisplayMode (theMode);
 
-    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+    if (anObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
     {
       myMainPM->Display (anObj, theMode);
       if (!myLastPicked.IsNull() && myLastPicked->IsSameSelectable (anObj))
@@ -1246,7 +1251,7 @@ void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)
   }
 
   Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-  if (aStatus->GraphicStatus() != AIS_DS_Displayed)
+  if (theIObj->DisplayStatus() != PrsMgr_DisplayStatus_Displayed)
   {
     aStatus->SetDisplayMode (theMode);
     theIObj->SetDisplayMode (theMode);
@@ -1311,7 +1316,7 @@ void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObjec
   const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
   aStatus->SetDisplayMode (myDefaultDrawer->DisplayMode());
 
-  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+  if (theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
   {
     if (myMainPM->IsHighlighted (theIObj, anOldMode))
     {
@@ -1763,14 +1768,14 @@ void AIS_InteractiveContext::Status (const Handle(AIS_InteractiveObject)& theIOb
   theStatus += "\t ____________________________________________";
   theStatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
   const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
-  switch (aStatus->GraphicStatus())
+  switch (theIObj->DisplayStatus())
   {
-    case AIS_DS_Displayed:
+    case PrsMgr_DisplayStatus_Displayed:
     {
       theStatus += "\t| -->Displayed\n";
       break;
     }
-    case AIS_DS_Erased:
+    case PrsMgr_DisplayStatus_Erased:
     {
       theStatus += "\t| -->Erased\n";
       break;
@@ -1829,7 +1834,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
   Handle(AIS_GlobalStatus) aStatus;
   if (theIObj.IsNull()
   || !myObjects.Find (theIObj, aStatus)
-  ||  aStatus->GraphicStatus() == AIS_DS_Erased)
+  ||  theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Erased)
   {
     return;
   }
@@ -1858,7 +1863,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
     mgrSelector->Deactivate (theIObj, aSelModeIter.Value());
   }
   aStatus->ClearSelectionModes();
-  aStatus->SetGraphicStatus (AIS_DS_Erased);
+  theIObj->SetDisplayStatus (PrsMgr_DisplayStatus_Erased);
 
   if (theToUpdateviewer)
   {
@@ -1944,7 +1949,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
   const Handle(SelectMgr_SelectableObject)& anObj = theIObj; // to avoid ambiguity
   mgrSelector->Remove (anObj);
 
-  setObjectStatus (theIObj, AIS_DS_None, -1, -1);
+  setObjectStatus (theIObj, PrsMgr_DisplayStatus_None, -1, -1);
   myMainVwr->StructureManager()->UnregisterObject (theIObj);
 
   for (V3d_ListOfViewIterator aDefViewIter (myMainVwr->DefinedViewIterator()); aDefViewIter.More(); aDefViewIter.Next())
@@ -1961,7 +1966,8 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
     }
   }
 
-  if (theToUpdateviewer && aStatus->GraphicStatus() == AIS_DS_Displayed)
+  if (theToUpdateviewer
+   && theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
   {
     myMainVwr->Update();
   }
@@ -1975,14 +1981,13 @@ void AIS_InteractiveContext::ClearGlobalPrs (const Handle(AIS_InteractiveObject)
                                              const Standard_Integer               theMode,
                                              const Standard_Boolean               theToUpdateViewer)
 {
-  if (theIObj.IsNull()
-  || !myObjects.IsBound (theIObj))
+  const Handle(AIS_GlobalStatus)* aStatus = !theIObj.IsNull() ? myObjects.Seek (theIObj) : NULL;
+  if (aStatus == NULL)
   {
     return;
   }
 
-  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
-  if (aStatus->DisplayMode() == theMode)
+  if ((*aStatus)->DisplayMode() == theMode)
   {
     const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
     if (aDispMode == theMode
@@ -1994,7 +1999,7 @@ void AIS_InteractiveContext::ClearGlobalPrs (const Handle(AIS_InteractiveObject)
     myMainPM->Erase (theIObj, theMode);
   }
 
-  if (aStatus->GraphicStatus() == AIS_DS_Displayed
+  if (theIObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
    && theToUpdateViewer)
   {
     myMainVwr->Update();
@@ -2429,28 +2434,34 @@ gp_Pnt AIS_InteractiveContext::GravityPoint (const Handle(V3d_View)& theView) co
 {
   return theView->GravityPoint();
 }
+
 //=======================================================================
 //function : setObjectStatus
 //purpose  :
 //=======================================================================
 void AIS_InteractiveContext::setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
-                                              const AIS_DisplayStatus theStatus,
+                                              const PrsMgr_DisplayStatus theStatus,
                                               const Standard_Integer theDispMode,
                                               const Standard_Integer theSelectionMode)
 {
-  if (theStatus != AIS_DS_None)
+  theIObj->SetDisplayStatus (theStatus);
+  if (theStatus != PrsMgr_DisplayStatus_None)
   {
-    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
+    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (theDispMode, theSelectionMode);
     myObjects.Bind (theIObj, aStatus);
   }
   else
+  {
     myObjects.UnBind (theIObj);
+  }
 
   for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (theIObj->Children()); aPrsIter.More(); aPrsIter.Next())
   {
     Handle(AIS_InteractiveObject) aChild (Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()));
     if (aChild.IsNull())
+    {
       continue;
+    }
 
     setObjectStatus (aChild, theStatus, theDispMode, theSelectionMode);
   }
index 90375a5d5dde48ecf5da882dc108722feca4556f..1cb76ff4fe90e6439310f891967c39003f39a50a 100644 (file)
@@ -84,7 +84,7 @@ public: //! @name object display management
   //! - AIS_DS_Erased    hidden in main viewer
   //! - AIS_DS_Temporary temporarily displayed
   //! - AIS_DS_None      nowhere displayed.
-  Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
+  Standard_EXPORT PrsMgr_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
 
   //! Returns the status of the Interactive Context for the view of the Interactive Object.
   Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
@@ -112,7 +112,7 @@ public: //! @name object display management
                                 const Standard_Integer               theDispMode,
                                 const Standard_Integer               theSelectionMode,
                                 const Standard_Boolean               theToUpdateViewer,
-                                const AIS_DisplayStatus              theDispStatus = AIS_DS_None);
+                                const PrsMgr_DisplayStatus           theDispStatus = PrsMgr_DisplayStatus_None);
 
   //! Allows you to load the Interactive Object with a given selection mode,
   //! and/or with the desired decomposition option, whether the object is visualized or not.
@@ -125,7 +125,7 @@ public: //! @name object display management
                 const Standard_Integer               theSelectionMode,
                 const Standard_Boolean               theToUpdateViewer,
                 const Standard_Boolean               theToAllowDecomposition,
-                const AIS_DisplayStatus              theDispStatus = AIS_DS_None)
+                const PrsMgr_DisplayStatus           theDispStatus = PrsMgr_DisplayStatus_None)
   {
     (void )theToAllowDecomposition;
     Display (theIObj, theDispMode, theSelectionMode, theToUpdateViewer, theDispStatus);
@@ -861,11 +861,14 @@ public: //! @name common properties
 
   //! Returns the list theListOfIO of objects with indicated display status particular Type WhichKind and Signature WhichSignature.
   //! By Default, WhichSignature equals 1. This means that there is a check on type only.
-  Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
+  Standard_EXPORT void ObjectsByDisplayStatus (const PrsMgr_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
 
   //! gives the list of objects with indicated display status
   //! Type and signature by Default, <WhichSignature> = -1 means control only on <WhichKind>.
-  Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
+  Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind,
+                                               const Standard_Integer WhichSignature,
+                                               const PrsMgr_DisplayStatus theStatus,
+                                               AIS_ListOfInteractive& theListOfIO) const;
   
   //! fills <aListOfIO> with objects of a particular Type and Signature with no consideration of display status.
   //! by Default, <WhichSignature> = -1 means control only on <WhichKind>.
@@ -881,7 +884,10 @@ public: //! @name common properties
   Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
 
   //! Query objects visible or hidden in specified view due to affinity mask.
-  Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
+  Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO,
+                                       const Handle(V3d_View)& theView,
+                                       const Standard_Boolean theIsVisibleInView,
+                                       const PrsMgr_DisplayStatus theStatus = PrsMgr_DisplayStatus_None) const;
 
   //! Clears all the structures which don't belong to objects displayed at neutral point
   //! only effective when no Local Context is opened...
@@ -1399,7 +1405,7 @@ protected: //! @name internal methods
   //! @param theObj [in] the object to change status
   //! @param theStatus status, if NULL, unbind object
   Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
-                                        const AIS_DisplayStatus theStatus,
+                                        const PrsMgr_DisplayStatus theStatus,
                                         const Standard_Integer theDispyMode,
                                         const Standard_Integer theSelectionMode);
 
index efb53f99147aedb8b47c53c0dfa45f169d3a9e83..dea5fea1e8c7990cc17e0fbdcaac4a1dcf893bf0 100644 (file)
@@ -248,8 +248,10 @@ void AIS_InteractiveContext::turnOnSubintensity (const Handle(AIS_InteractiveObj
     for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjsIter (myObjects); anObjsIter.More(); anObjsIter.Next())
     {
       const Handle(AIS_GlobalStatus)& aStatus = anObjsIter.Value();
-      if (aStatus->GraphicStatus() != AIS_DS_Displayed && theIsDisplayedOnly)
+      if (theObject->DisplayStatus() != PrsMgr_DisplayStatus_Displayed && theIsDisplayedOnly)
+      {
         continue;
+      }
 
       aStatus->SubIntensityOn();
       myMainPM->Color (anObjsIter.Key(), aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
@@ -259,10 +261,14 @@ void AIS_InteractiveContext::turnOnSubintensity (const Handle(AIS_InteractiveObj
   {
     Handle(AIS_GlobalStatus) aStatus;
     if (!myObjects.Find (theObject, aStatus))
+    {
       return;
+    }
 
-    if (aStatus->GraphicStatus() != AIS_DS_Displayed && theIsDisplayedOnly)
+    if (theObject->DisplayStatus() != PrsMgr_DisplayStatus_Displayed && theIsDisplayedOnly)
+    {
       return;
+    }
 
     aStatus->SubIntensityOn();
     myMainPM->Color (theObject, aSubStyle, theDispMode != -1 ? theDispMode : aStatus->DisplayMode());
index 9ce6fa886fc6bbbc90d1ead31e8b6853e17a6524..d9981f89fe00d7515bc11e4074cb6b590dd33cbb 100644 (file)
@@ -66,7 +66,7 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
    || (theMode == -1
     && theActiveFilter == AIS_SelectionModesConcurrency_Single))
   {
-    if ((*aStat)->GraphicStatus() == AIS_DS_Displayed
+    if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
      || theIsForce)
     {
       if (theMode == -1)
@@ -103,7 +103,7 @@ void AIS_InteractiveContext::SetSelectionModeActive (const Handle(AIS_Interactiv
     return;
   }
 
-  if ((*aStat)->GraphicStatus() == AIS_DS_Displayed
+  if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed
     || theIsForce)
   {
     switch (theActiveFilter)
@@ -247,7 +247,7 @@ void AIS_InteractiveContext::SubIntensityOff (const Handle(AIS_InteractiveObject
 
   (*aStatus)->SubIntensityOff();
   Standard_Boolean toUpdateMain = Standard_False;
-  if ((*aStatus)->GraphicStatus() == AIS_DS_Displayed)
+  if (theObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
   {
     myMainPM->Unhighlight (theObj);
     toUpdateMain = Standard_True;
index fc52e1aeb5fdce0e8d2bd1f35a176536a517bd84..917accd8467c3aeb3b6d1a6a7319e1cffd7ed7aa 100644 (file)
@@ -52,12 +52,11 @@ void AIS_InteractiveContext::SetPolygonOffsets(
   setContextToObject (anObj);
   anObj->SetPolygonOffsets( aMode, aFactor, aUnits );
 
-  if ( updateviewer ) {
-    if( myObjects.IsBound( anObj ) ) {
-      Handle(AIS_GlobalStatus) STATUS = myObjects(anObj);
-      if ( STATUS->GraphicStatus() == AIS_DS_Displayed )
-        myMainVwr->Update();
-    }
+  const Handle(AIS_GlobalStatus)* aStatus = updateviewer ? myObjects.Seek (anObj) : NULL;
+  if (aStatus != NULL
+   && anObj->DisplayStatus() == PrsMgr_DisplayStatus_Displayed)
+  {
+    myMainVwr->Update();
   }
 }
 
index 913cd619f3f35b5709f02bd07dc9d7ca0aced3be..f11083300f1aabe5c23c6f74c8f2bca651e7062d 100644 (file)
@@ -97,6 +97,15 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
   }
 }
 
+//=======================================================================
+//function : SetDisplayStatus
+//purpose  :
+//=======================================================================
+void AIS_InteractiveObject::SetDisplayStatus (PrsMgr_DisplayStatus theStatus)
+{
+  myDisplayStatus = theStatus;
+}
+
 //=======================================================================
 //function : HasPresentation
 //purpose  :
index 60ba4ca31985aff2a9175592c35e424e1fce542e..6f6d8152edc83da2e4ad6841ddbafae82da49db0 100644 (file)
@@ -143,6 +143,9 @@ protected:
   //! may have a presentation dependant of the view of Display.
   Standard_EXPORT AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
 
+  //! Set presentation display status.
+  Standard_EXPORT void SetDisplayStatus (PrsMgr_DisplayStatus theStatus);
+
 protected:
 
   AIS_InteractiveContext*    myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
index e09bd0bdbc36fc2865fc083194ceaeb6a6a05685..db60b822b73ea4447d407b66886b4ba5d21a9275 100644 (file)
@@ -1,3 +1,4 @@
+PrsMgr_DisplayStatus.hxx
 PrsMgr_ListOfPresentableObjects.hxx
 PrsMgr_ListOfPresentations.hxx
 PrsMgr_PresentableObject.cxx
diff --git a/src/PrsMgr/PrsMgr_DisplayStatus.hxx b/src/PrsMgr/PrsMgr_DisplayStatus.hxx
new file mode 100644 (file)
index 0000000..87515ca
--- /dev/null
@@ -0,0 +1,32 @@
+// Created on: 1996-12-11
+// Created by: Robert COUBLANC
+// Copyright (c) 1996-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _PrsMgr_DisplayStatus_HeaderFile
+#define _PrsMgr_DisplayStatus_HeaderFile
+
+//! To give the display status of an Interactive Object.
+enum PrsMgr_DisplayStatus
+{
+  PrsMgr_DisplayStatus_Displayed, //!< the Interactive Object is displayed in the main viewer
+  PrsMgr_DisplayStatus_Erased,    //!< the Interactive Object is hidden in main viewer
+  PrsMgr_DisplayStatus_None,      //!< the Interactive Object is nowhere displayed
+  // old aliases
+  AIS_DS_Displayed = PrsMgr_DisplayStatus_Displayed,
+  AIS_DS_Erased    = PrsMgr_DisplayStatus_Erased,
+  AIS_DS_None      = PrsMgr_DisplayStatus_None
+};
+
+#endif // _PrsMgr_DisplayStatus_HeaderFile
index b673ab8cf7dc4e9c83bd716e2d01ca2331176d0a..e79d10af2ffb74bd56305faf65eec88edd438d4d 100644 (file)
@@ -47,6 +47,7 @@ PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentat
 : myParent (NULL),
   myDrawer (new Prs3d_Drawer()),
   myTypeOfPresentation3d (theType),
+  myDisplayStatus (PrsMgr_DisplayStatus_None),
   //
   myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE),
   myOwnWidth (0.0f),
index 556bebc86a1c23665eb5067dfc2c07ddf6888bc4..75bb6977ffc5a2e4e865a89deb4e36c878bfe8d9 100644 (file)
@@ -28,6 +28,7 @@
 #include <PrsMgr_ListOfPresentableObjects.hxx>
 #include <PrsMgr_Presentation.hxx>
 #include <PrsMgr_Presentations.hxx>
+#include <PrsMgr_DisplayStatus.hxx>
 #include <PrsMgr_TypeOfPresentation3d.hxx>
 #include <TColStd_ListOfInteger.hxx>
 
@@ -161,6 +162,9 @@ public:
   //! Set type of presentation.
   Standard_EXPORT void SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType);
 
+  //! Return presentation display status; PrsMgr_DisplayStatus_None by default.
+  PrsMgr_DisplayStatus DisplayStatus() const { return myDisplayStatus; }
+
 public: //! @name presentation attributes
 
   //! Returns the attributes settings.
@@ -522,6 +526,7 @@ protected:
   PrsMgr_ListOfPresentableObjects        myChildren;                //!< list of children
   gp_GTrsf                               myInvTransformation;       //!< inversion of absolute transformation (combined parents + local transformations)
   PrsMgr_TypeOfPresentation3d            myTypeOfPresentation3d;    //!< presentation type
+  PrsMgr_DisplayStatus                   myDisplayStatus;           //!< presentation display status
 
   Aspect_TypeOfFacingModel               myCurrentFacingModel;      //!< current facing model
   Standard_ShortReal                     myOwnWidth;                //!< custom width value