Salome HOME
0022513: [CEA 1084] _objref_SMESH_Mesh instance has no attribute 'GetMEDMesh'
[modules/gui.git] / src / SOCC / SOCC_ViewModel.cxx
index 2d586ee0276ba80920dfe3f8f5c4e1ebc5b10c52..25fdb6547d146cb9301f7e8666a8154838f63033 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -159,11 +159,14 @@ bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj,
   AIS_ListOfInteractive List;
   getAISContext()->DisplayedObjects(List);
 
+#if OCC_VERSION_LARGE <= 0x06060000
   if( !onlyInViewer ) {
     AIS_ListOfInteractive List1;
     getAISContext()->ObjectsInCollector(List1);
     List.Append(List1);
-  }
+}
+#endif
+
 
   AIS_ListIteratorOfListOfInteractive ite(List);
   for ( ; ite.More(); ite.Next() )
@@ -359,6 +362,7 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
           continue;
         }
 
+#if OCC_VERSION_LARGE <= 0x06060000
       // then try to find presentation in the collector
       if(ic->IsInCollector(anAIS))
         {
@@ -380,7 +384,7 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
           //}
           continue;
         }
-
+#endif
       // if object is not displayed and not found in the collector - display it
       if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
       {
@@ -391,17 +395,21 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
       }
 
       ic->Display( anAIS, false );
-      
-#if OCC_VERSION_LARGE > 0x06050200 
-      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(anAIS);
-      if ( !aSh.IsNull() ) {
-          bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
+      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast (anAIS);
+      if (!aSh.IsNull())
+      {
+        aSh->SetClippable (prs->IsClippable());
+        applyExistingClipPlanesToObject (anAIS);
+#if OCC_VERSION_LARGE > 0x06050200
+        bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
              ic->SetZLayer( aSh, top ? getTopLayerId() : 0 );
-                 if(!aSh->toActivate()) {
-                       ic->Deactivate( aSh );
-                 }
-      }
+                   if(!aSh->toActivate())
+        {
+                           ic->Deactivate( aSh );
+                   }
 #endif
+      }
+
       //Register anAIS (if it has an entry) in entry2aisobjects map
       Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
       if ( !anObj.IsNull() && anObj->hasEntry())
@@ -473,8 +481,11 @@ void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
     if ( !anAIS.IsNull() ) {
       // erase the object from context : move it to collector
+#if OCC_VERSION_LARGE <= 0x06060000
       ic->Erase( anAIS, false, forced ? false : true );
-
+#else
+      ic->Erase( anAIS, false );
+#endif
       // Set visibility flag if necessary
       // Temporarily commented to avoid awful dependecy on SALOMEDS
       // TODO: better mechanism of storing display/erse status in a study
@@ -524,7 +535,11 @@ void SOCC_Viewer::EraseAll( const bool forced )
 
     // erase an object
     Handle(AIS_InteractiveObject) anIO = anIter.Value();
+#if OCC_VERSION_LARGE <= 0x06060000
     ic->Erase( anIO, false, forced ? false : true );
+#else
+    ic->Erase( anIO, false );
+#endif
     
     // Set visibility flag if necessary
     // Temporarily commented to avoid awful dependecy on SALOMEDS
@@ -564,7 +579,11 @@ SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
         for ( unsigned int ind = 0; ind < List.size(); ind++ )
           {
             Handle(AIS_InteractiveObject) anAIS=List[ind];
-            if(ic->IsDisplayed(anAIS)||ic->IsInCollector(anAIS))
+            if(ic->IsDisplayed(anAIS)
+#if OCC_VERSION_LARGE <= 0x06060000
+               || ic->IsInCollector(anAIS)
+#endif
+              )
               {
                 prs->AddObject( anAIS );
               }