Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_OCCSelector.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 4cca8df..dcbe11f
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2013-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -46,6 +46,7 @@
 #include <TColStd_IndexedMapOfInteger.hxx>
 #include <NCollection_DataMap.hxx>
 
+#include <Basics_OCCTVersion.hxx>
 
 using namespace HEXABLOCK::GUI;
 
@@ -77,24 +78,23 @@ void HEXABLOCKGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) cons
     return;
 
   Handle(AIS_InteractiveContext) ic = vw->getAISContext();
-
+#if OCC_VERSION_LARGE <= 0x07030000
   if (ic->HasOpenedContext())
   {
+#endif
     TopoDS_Shape curBigShape;
     TopTools_IndexedMapOfShape subShapes;
 
     for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected())
     {
-      Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner());
-      if (anOwner.IsNull())
-        continue;
-
-      Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
+      Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast(ic->SelectedInteractive());
 
       QString entryStr = entry(io);
       int index = -1;
 
-      if (anOwner->ComesFromDecomposition()) // == Local Selection
+      Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner());
+
+      if (!anOwner.IsNull() && anOwner->ComesFromDecomposition()) // == Local Selection
       {
         TopoDS_Shape subShape = anOwner->Shape();
         Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast(io);
@@ -124,6 +124,7 @@ void HEXABLOCKGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) cons
         aList.append(SUIT_DataOwnerPtr(owner));
       }
     }
+#if OCC_VERSION_LARGE <= 0x07030000
   }
   else
   {
@@ -143,6 +144,7 @@ void HEXABLOCKGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) cons
       }
     }
   }
+#endif
 
   // add externally selected objects
   SUIT_DataOwnerPtrList::const_iterator anExtIter, itEnd;
@@ -295,7 +297,7 @@ void HEXABLOCKGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList
     if ( owner->State() )
       continue;
 
-    if ( ic->HasOpenedContext() )
+    if ( owner->ComesFromDecomposition() )
       ic->AddOrRemoveSelected( owner, false );
     else
       ic->AddOrRemoveSelected( Handle(AIS_InteractiveObject)::DownCast(owner->Selectable()), false );