Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI_SalomeTools.cxx
index 27a62c43d07076589a73b7ad9dad8a5c7d4bce46..cde214ad1d9c4ebcb6937b325b99911eaf66e359 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2009-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
 #include <vtkActorCollection.h>
 #include <vtkUnstructuredGrid.h>
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <SUIT_Session.h>
 
-#include <SalomeApp_Study.h>
 #include <SalomeApp_Application.h>
 
 #include <OCCViewer_ViewWindow.h>
@@ -89,13 +86,12 @@ namespace GUI
        }
 
 
-       _PTR(Study) GetActiveStudyDocument()
+       _PTR(Study) getStudy()
        {
-               SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(GetActiveStudy());
-               if (aStudy)
-                       return aStudy->studyDS();
-               else
-                       return _PTR(Study)();
+      static _PTR(Study) _study;
+        if(!_study)
+          _study = SalomeApp_Application::getStudy();
+      return _study;
        }
 
 
@@ -130,17 +126,17 @@ namespace GUI
 
                theName = "";
 
-               TColStd_IndexedMapOfInteger aMapIndex;
+               SVTK_TIndexedMapOfVtkId aMapIndex;
                theSelector->GetIndex(theIO,aMapIndex);
 
                typedef std::set<int> TIdContainer;
 
-               std::set<int> anIdContainer;
+               std::set<vtkIdType> anIdContainer;
 
-               for( int i = 1; i <= aMapIndex.Extent(); i++)
+               for( vtkIdType i = 1; i <= aMapIndex.Extent(); i++)
                        anIdContainer.insert(aMapIndex(i));
 
-               std::set<int>::const_iterator anIter = anIdContainer.begin();
+               std::set<vtkIdType>::const_iterator anIter = anIdContainer.begin();
 
                for( ; anIter != anIdContainer.end(); anIter++)
                        theName += QString(" %1").arg(*anIter);
@@ -173,16 +169,13 @@ namespace GUI
                                continue;
 
                        Handle(SelectMgr_Selection) sel = theObj->Selection( m );
-
-                       for ( sel->Init(); sel->More(); sel->Next() ) {
-#if OCC_VERSION_LARGE > 0x06080100
-                                const Handle(SelectMgr_SensitiveEntity) aHSenEntity = sel->Sensitive();
+                        const NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>& selected = sel->Entities();
+                        for ( NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator selIter( selected );
+                              selIter.More(); selIter.Next() ) {
+                                const Handle(SelectMgr_SensitiveEntity) aHSenEntity = selIter.Value();
                                 if ( aHSenEntity.IsNull() )
                                         continue;
                                 Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive();
-#else
-                               Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive();
-#endif
                                if ( entity.IsNull() )
                                        continue;