]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Selection of inxexes added
authorsln <sln@opencascade.com>
Tue, 14 Nov 2006 09:57:07 +0000 (09:57 +0000)
committersln <sln@opencascade.com>
Tue, 14 Nov 2006 09:57:07 +0000 (09:57 +0000)
src/LightApp/LightApp_VTKSelector.cxx
src/LightApp/LightApp_VTKSelector.h

index 5cc226cbbb6d876866c920a8a01c4d05157b95f8..7a52332cb6d41255d44ee50f4f0e83d7b69e7b51 100644 (file)
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D\r
-// \r
-// This library is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU Lesser General Public\r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License.\r
-// \r
-// This library is distributed in the hope that it will be useful \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-// Lesser General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU Lesser General Public  \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
-//\r
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
-//\r
-#include "LightApp_VTKSelector.h"\r
-#include "LightApp_DataOwner.h"\r
-\r
-#ifndef DISABLE_VTKVIEWER\r
-  #include "SVTK_ViewModelBase.h"\r
-  #include "SVTK_ViewManager.h"\r
-  #include "SVTK_Selector.h"\r
-  #include "SVTK_ViewWindow.h"\r
-  #include "SVTK_Functor.h"\r
-  #include "VTKViewer_Algorithm.h"\r
-  #include <vtkRenderer.h>\r
-#endif\r
-\r
-#ifndef DISABLE_SALOMEOBJECT\r
-  #include "SALOME_Actor.h"\r
-  #include "SALOME_ListIteratorOfListIO.hxx"\r
-#endif\r
-\r
-\r
-\r
-#ifndef DISABLE_VTKVIEWER\r
-#ifndef DISABLE_SALOMEOBJECT\r
-/*!\r
-  Constructor.\r
-*/\r
-LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,\r
-                                                                 SUIT_Desktop* theDesktop )\r
-: LightApp_DataOwner( theIO ),\r
-myDesktop( theDesktop )\r
-{\r
-}\r
-#else\r
-LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const QString& theEntry )\r
-: LightApp_DataOwner( theEntry )\r
-{\r
-}\r
-#endif\r
-\r
-/*!\r
-  \return active SVTK view window\r
-*/\r
-SVTK_ViewWindow* \r
-LightApp_SVTKDataOwner\r
-::GetActiveViewWindow() const\r
-{\r
-  if(SUIT_ViewWindow* aViewWindow = myDesktop->activeWindow())\r
-    return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);\r
-\r
-  return NULL;\r
-}\r
-\r
-/*!\r
-  Gets dataowners ids list.\r
-*/\r
-const TColStd_IndexedMapOfInteger& \r
-LightApp_SVTKDataOwner\r
-::GetIds() const\r
-{\r
-  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){\r
-    if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){\r
-      aSelector->GetIndex(IO(),myIds);\r
-    }\r
-  }\r
-\r
-  return myIds;\r
-}\r
-\r
-/*!\r
-  Gets selection mode.\r
-*/\r
-Selection_Mode\r
-LightApp_SVTKDataOwner\r
-::GetMode() const\r
-{\r
-  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){\r
-    if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){\r
-      return aSelector->SelectionMode();\r
-    }\r
-  }\r
-  \r
-  return -1;\r
-}\r
-\r
-/*!\r
-  Gets actor pointer.\r
-*/\r
-SALOME_Actor* \r
-LightApp_SVTKDataOwner\r
-::GetActor() const\r
-{\r
-  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){\r
-    using namespace SVTK;\r
-    return Find<SALOME_Actor>(aViewWindow->getRenderer()->GetActors(),TIsSameIObject<SALOME_Actor>(IO()));\r
-  }\r
-\r
-  return NULL;\r
-}\r
-\r
-#endif\r
-\r
-/*!\r
-  Destuctor.\r
-*/\r
-/*\r
-LightApp_SVTKDataOwner::~LightApp_SVTKDataOwner()\r
-{\r
-}\r
-*/\r
-\r
-#ifndef DISABLE_VTKVIEWER\r
-/*!\r
-  Constructor.\r
-*/\r
-LightApp_VTKSelector\r
-::LightApp_VTKSelector( SVTK_ViewModelBase* viewer, \r
-                       SUIT_SelectionMgr* mgr ): \r
-  SUIT_Selector( mgr, viewer ),\r
-  myViewer( viewer )\r
-{\r
-  if ( myViewer )\r
-    connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );\r
-}\r
-\r
-/*!\r
-  Gets viewer.\r
-*/\r
-SVTK_ViewModelBase* \r
-LightApp_VTKSelector\r
-::viewer() const\r
-{\r
-  return myViewer;\r
-}\r
-\r
-/*!\r
-  Gets type of salome vtk viewer.\r
-*/\r
-QString\r
-LightApp_VTKSelector\r
-::type() const\r
-{ \r
-  return myViewer->getType(); \r
-}\r
-\r
-#endif\r
-/*!\r
-  On selection changed.\r
-*/\r
-void\r
-LightApp_VTKSelector\r
-::onSelectionChanged()\r
-{\r
-  selectionChanged();\r
-}\r
-\r
-#ifndef DISABLE_VTKVIEWER\r
-\r
-/*!\r
-  Gets list of selected data owners.(output \a aList).\r
-*/\r
-void\r
-LightApp_VTKSelector\r
-::getSelection( SUIT_DataOwnerPtrList& aList ) const\r
-{\r
-  if(myViewer){\r
-    if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){\r
-      if(SVTK_ViewManager* aViewMgr = dynamic_cast<SVTK_ViewManager*>(aViewManager)){\r
-       if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){\r
-         if(SVTK_Selector* aSelector = aView->GetSelector()){\r
-           const SALOME_ListIO& aListIO = aSelector->StoredIObjects();\r
-           SALOME_ListIteratorOfListIO anIter(aListIO);\r
-           for(; anIter.More(); anIter.Next()){\r
-             Handle(SALOME_InteractiveObject) anIO = anIter.Value();\r
-             if(anIO->hasEntry())\r
-               aList.append(new LightApp_SVTKDataOwner(anIO,aViewMgr->getDesktop()));\r
-           }\r
-         }\r
-       }\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-/*!\r
-  Sets selection to selector from data owner list \a theList.\r
-*/\r
-void \r
-LightApp_VTKSelector\r
-::setSelection( const SUIT_DataOwnerPtrList& theList )\r
-{\r
-  if(myViewer){\r
-    if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){\r
-      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){\r
-       if(SVTK_Selector* aSelector = aView->GetSelector()){\r
-         SALOME_ListIO anAppendList;\r
-         const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();\r
-         SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();\r
-         for(; anIter != theList.end(); ++anIter){\r
-           const SUIT_DataOwner* aDataOwner = (*anIter).get();\r
-           if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast<const LightApp_SVTKDataOwner*>(aDataOwner)){\r
-             aSelector->SetSelectionMode(anOwner->GetMode());\r
-             Handle(SALOME_InteractiveObject) anIO = anOwner->IO();\r
-\r
-             aSelector->AddIObject(anIO);\r
-\r
-             anAppendList.Append(anIO);\r
-             aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);\r
-           }else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner)){\r
-             Handle(SALOME_InteractiveObject) anIO = \r
-               new SALOME_InteractiveObject(anOwner->entry().latin1(),"");\r
-             aSelector->AddIObject(anIO);\r
-             anAppendList.Append(anIO);\r
-           }\r
-         }\r
-         // To remove IOs, which is not selected.\r
-         QMap< QString, Handle( SALOME_InteractiveObject )> toRemove;\r
-         SALOME_ListIteratorOfListIO anIt( aStoredList );\r
-         for( ; anIt.More(); anIt.Next() )\r
-           if( !anIt.Value().IsNull() )\r
-             toRemove[ anIt.Value()->getEntry() ] = anIt.Value();\r
-\r
-         anIt = SALOME_ListIteratorOfListIO(anAppendList);\r
-         for( ; anIt.More(); anIt.Next() )\r
-           toRemove.remove( anIt.Value()->getEntry() );\r
-\r
-         QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),\r
-                                                                            REnd = toRemove.end();\r
-         for( ; RIt!=REnd; RIt++ )\r
-           aSelector->RemoveIObject( RIt.data() );\r
-         \r
-         aView->onSelectionChanged();\r
-       }\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-#endif\r
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "LightApp_VTKSelector.h"
+#include "LightApp_DataOwner.h"
+
+#ifndef DISABLE_VTKVIEWER
+  #include "SVTK_ViewModelBase.h"
+  #include "SVTK_ViewManager.h"
+  #include "SVTK_Selector.h"
+  #include "SVTK_ViewWindow.h"
+  #include "SVTK_Functor.h"
+  #include "VTKViewer_Algorithm.h"
+  #include <vtkRenderer.h>
+#endif
+
+#ifndef DISABLE_SALOMEOBJECT
+  #include "SALOME_Actor.h"
+  #include "SALOME_ListIteratorOfListIO.hxx"
+#include <LightApp_DataSubOwner.h>
+#endif
+
+
+
+#ifndef DISABLE_VTKVIEWER
+#ifndef DISABLE_SALOMEOBJECT
+/*!
+  Constructor.
+*/
+LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
+                                                                 SUIT_Desktop* theDesktop )
+: LightApp_DataOwner( theIO ),
+myDesktop( theDesktop )
+{
+}
+#else
+LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const QString& theEntry )
+: LightApp_DataOwner( theEntry )
+{
+}
+#endif
+
+/*!
+  \return active SVTK view window
+*/
+SVTK_ViewWindow* 
+LightApp_SVTKDataOwner
+::GetActiveViewWindow() const
+{
+  if(SUIT_ViewWindow* aViewWindow = myDesktop->activeWindow())
+    return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+
+  return NULL;
+}
+
+/*!
+  Gets dataowners ids list.
+*/
+const TColStd_IndexedMapOfInteger& 
+LightApp_SVTKDataOwner
+::GetIds() const
+{
+  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){
+    if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){
+      aSelector->GetIndex(IO(),myIds);
+    }
+  }
+  return myIds;
+}
+
+/*!
+  Sets dataowners ids list.
+*/
+void LightApp_SVTKDataOwner::SetIds( const TColStd_IndexedMapOfInteger& theIds )
+{
+  myIds = theIds;
+}
+
+/*!
+  Gets selection mode.
+*/
+Selection_Mode
+LightApp_SVTKDataOwner
+::GetMode() const
+{
+  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){
+    if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){
+      return aSelector->SelectionMode();
+    }
+  }
+  
+  return -1;
+}
+
+/*!
+  Gets actor pointer.
+*/
+SALOME_Actor* 
+LightApp_SVTKDataOwner
+::GetActor() const
+{
+  if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){
+    using namespace SVTK;
+    return Find<SALOME_Actor>(aViewWindow->getRenderer()->GetActors(),TIsSameIObject<SALOME_Actor>(IO()));
+  }
+
+  return NULL;
+}
+
+#endif
+
+/*!
+  Destuctor.
+*/
+/*
+LightApp_SVTKDataOwner::~LightApp_SVTKDataOwner()
+{
+}
+*/
+
+#ifndef DISABLE_VTKVIEWER
+/*!
+  Constructor.
+*/
+LightApp_VTKSelector
+::LightApp_VTKSelector( SVTK_ViewModelBase* viewer, 
+                       SUIT_SelectionMgr* mgr ): 
+  SUIT_Selector( mgr, viewer ),
+  myViewer( viewer )
+{
+  if ( myViewer )
+    connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+}
+
+/*!
+  Gets viewer.
+*/
+SVTK_ViewModelBase* 
+LightApp_VTKSelector
+::viewer() const
+{
+  return myViewer;
+}
+
+/*!
+  Gets type of salome vtk viewer.
+*/
+QString
+LightApp_VTKSelector
+::type() const
+{ 
+  return myViewer->getType(); 
+}
+
+#endif
+/*!
+  On selection changed.
+*/
+void
+LightApp_VTKSelector
+::onSelectionChanged()
+{
+  selectionChanged();
+}
+
+#ifndef DISABLE_VTKVIEWER
+
+/*!
+  Gets list of selected data owners.(output \a aList).
+*/
+void
+LightApp_VTKSelector
+::getSelection( SUIT_DataOwnerPtrList& aList ) const
+{
+  if(myViewer){
+    if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){
+      if(SVTK_ViewManager* aViewMgr = dynamic_cast<SVTK_ViewManager*>(aViewManager)){
+       if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
+         if(SVTK_Selector* aSelector = aView->GetSelector()){
+           const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+           SALOME_ListIteratorOfListIO anIter(aListIO);
+           for(; anIter.More(); anIter.Next()){
+             Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+             if(anIO->hasEntry())
+              {
+                LightApp_SVTKDataOwner* anOwner = 
+                  new LightApp_SVTKDataOwner( anIO, aViewMgr->getDesktop() );
+                TColStd_IndexedMapOfInteger anIndex;
+                aSelector->GetIndex( anIO, anIndex );
+                anOwner->SetIds( anIndex );
+               aList.append( anOwner );
+              }
+           }
+         }
+       }
+      }
+    }
+  }
+}
+
+/*!
+  Sets selection to selector from data owner list \a theList.
+*/
+void 
+LightApp_VTKSelector
+::setSelection( const SUIT_DataOwnerPtrList& theList )
+{
+  if ( myViewer )
+  {
+    if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
+      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
+       if(SVTK_Selector* aSelector = aView->GetSelector()){
+         SALOME_ListIO anAppendList;
+         const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
+         SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();
+         for(; anIter != theList.end(); ++anIter){
+           const SUIT_DataOwner* aDataOwner = (*anIter).get();
+           if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast<const LightApp_SVTKDataOwner*>(aDataOwner)){
+            //if(const LightApp_DataSubOwner* anOwner = dynamic_cast<const LightApp_DataSubOwner*>(aDataOwner)){
+             aSelector->SetSelectionMode(anOwner->GetMode());
+             Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
+
+             aSelector->AddIObject(anIO);
+
+             anAppendList.Append(anIO);
+             aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
+           }
+            else if ( const LightApp_DataSubOwner* anOwner = 
+              dynamic_cast<const LightApp_DataSubOwner*>( aDataOwner))
+            {
+             Handle(SALOME_InteractiveObject) anIO = 
+               new SALOME_InteractiveObject( anOwner->entry().latin1(),"" ); 
+             aSelector->AddIObject(anIO);
+             anAppendList.Append(anIO);
+              TColStd_IndexedMapOfInteger aMap;
+              aMap.Add( anOwner->index() );
+              aSelector->AddOrRemoveIndex( anIO,aMap, false );
+           }
+         }
+         // To remove IOs, which is not selected.
+         QMap< QString, Handle( SALOME_InteractiveObject )> toRemove;
+         SALOME_ListIteratorOfListIO anIt( aStoredList );
+         for( ; anIt.More(); anIt.Next() )
+           if( !anIt.Value().IsNull() )
+             toRemove[ anIt.Value()->getEntry() ] = anIt.Value();
+
+         anIt = SALOME_ListIteratorOfListIO(anAppendList);
+         for( ; anIt.More(); anIt.Next() )
+           toRemove.remove( anIt.Value()->getEntry() );
+
+         QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),
+                                                                            REnd = toRemove.end();
+         for( ; RIt!=REnd; RIt++ )
+           aSelector->RemoveIObject( RIt.data() );
+         
+         aView->onSelectionChanged();
+       }
+      }
+    }
+  }
+}
+
+#endif
index 3c17f04e25f4a2f0574bf48a4464fe28abb45733..37df66a01a77b384934ee8c1b225805de6e1d13b 100644 (file)
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D\r
-// \r
-// This library is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU Lesser General Public\r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License.\r
-// \r
-// This library is distributed in the hope that it will be useful \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU \r
-// Lesser General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU Lesser General Public  \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
-//\r
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
-//\r
-#ifndef LIGHTAPP_VTKSELECTOR_H\r
-#define LIGHTAPP_VTKSELECTOR_H\r
-\r
-#include "SUIT_Selector.h"\r
-#include "LightApp.h"\r
-#include "LightApp_DataOwner.h"\r
-\r
-class SUIT_Desktop;\r
-\r
-#ifndef DISABLE_VTKVIEWER\r
-  #include <vtkSmartPointer.h>\r
-  #include <TColStd_IndexedMapOfInteger.hxx>\r
-  #include "SVTK_Selection.h"\r
-#ifndef DISABLE_SALOMEOBJECT\r
-  #include "SALOME_InteractiveObject.hxx"\r
-#endif\r
-  class SALOME_Actor;\r
-  class SVTK_ViewWindow;\r
-  class SVTK_ViewModelBase;\r
-#endif\r
-\r
-/*!\r
-  Provide salome vtk data owner list.\r
-*/\r
-class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner\r
-{\r
- public:\r
-   virtual ~LightApp_SVTKDataOwner() {};\r
-#ifndef DISABLE_VTKVIEWER\r
-   #ifndef DISABLE_SALOMEOBJECT\r
-    LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)&, SUIT_Desktop* );\r
-   #else\r
-    LightApp_SVTKDataOwner( const QString& );\r
-   #endif\r
-\r
-    /*!Gets dataowners ids list.*/\r
-    const TColStd_IndexedMapOfInteger& GetIds() const;\r
-\r
-    /*!Gets selection mode.*/\r
-    Selection_Mode GetMode() const;\r
-\r
-    /*!Finds corresponding actor in the active viewer.*/\r
-    SALOME_Actor* GetActor() const;\r
-\r
- protected:\r
-    mutable TColStd_IndexedMapOfInteger myIds;\r
-\r
-    SVTK_ViewWindow* GetActiveViewWindow() const;\r
-    SUIT_Desktop* myDesktop;\r
-#endif\r
-};\r
-\r
-\r
-/*!\r
-  \class LightApp_VTKSelector\r
-  Custom selector to get/set selection from object browser\r
-*/\r
-class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector\r
-{\r
-  Q_OBJECT;\r
-\r
-public:\r
-  virtual ~LightApp_VTKSelector() {};\r
-#ifndef DISABLE_VTKVIEWER\r
-  LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );\r
-\r
-  SVTK_ViewModelBase* viewer() const;\r
-\r
-  virtual QString type() const;\r
-#else\r
-  LightApp_VTKSelector( SUIT_SelectionMgr* );\r
-#endif\r
-\r
-private slots:\r
-  void              onSelectionChanged();\r
-\r
-#ifndef DISABLE_VTKVIEWER\r
-protected:\r
-  virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;\r
-  virtual void      setSelection( const SUIT_DataOwnerPtrList& );\r
-\r
-private:\r
-  SVTK_ViewModelBase* myViewer;\r
-\r
-#endif\r
-};\r
-\r
-#endif\r
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// 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.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef LIGHTAPP_VTKSELECTOR_H
+#define LIGHTAPP_VTKSELECTOR_H
+
+#include "SUIT_Selector.h"
+#include "LightApp.h"
+#include "LightApp_DataOwner.h"
+
+class SUIT_Desktop;
+
+#ifndef DISABLE_VTKVIEWER
+  #include <vtkSmartPointer.h>
+  #include <TColStd_IndexedMapOfInteger.hxx>
+  #include "SVTK_Selection.h"
+#ifndef DISABLE_SALOMEOBJECT
+  #include "SALOME_InteractiveObject.hxx"
+#endif
+  class SALOME_Actor;
+  class SVTK_ViewWindow;
+  class SVTK_ViewModelBase;
+#endif
+
+/*!
+  Provide salome vtk data owner list.
+*/
+class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner
+{
+ public:
+   virtual ~LightApp_SVTKDataOwner() {};
+#ifndef DISABLE_VTKVIEWER
+   #ifndef DISABLE_SALOMEOBJECT
+    LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)&, SUIT_Desktop* );
+   #else
+    LightApp_SVTKDataOwner( const QString& );
+   #endif
+
+    /*!Gets dataowners ids list.*/
+    const TColStd_IndexedMapOfInteger& GetIds() const;
+
+    /*!Sets dataowners ids list.*/
+    void SetIds( const TColStd_IndexedMapOfInteger& );
+
+    /*!Gets selection mode.*/
+    Selection_Mode GetMode() const;
+
+    /*!Finds corresponding actor in the active viewer.*/
+    SALOME_Actor* GetActor() const;
+
+ protected:
+    mutable TColStd_IndexedMapOfInteger myIds;
+
+    SVTK_ViewWindow* GetActiveViewWindow() const;
+    SUIT_Desktop* myDesktop;
+#endif
+};
+
+
+/*!
+  \class LightApp_VTKSelector
+  Custom selector to get/set selection from object browser
+*/
+class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector
+{
+  Q_OBJECT;
+
+public:
+  virtual ~LightApp_VTKSelector() {};
+#ifndef DISABLE_VTKVIEWER
+  LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* );
+
+  SVTK_ViewModelBase* viewer() const;
+
+  virtual QString type() const;
+#else
+  LightApp_VTKSelector( SUIT_SelectionMgr* );
+#endif
+
+private slots:
+  void              onSelectionChanged();
+
+#ifndef DISABLE_VTKVIEWER
+protected:
+  virtual void      getSelection( SUIT_DataOwnerPtrList& ) const;
+  virtual void      setSelection( const SUIT_DataOwnerPtrList& );
+
+private:
+  SVTK_ViewModelBase* myViewer;
+
+#endif
+};
+
+#endif