Salome HOME
updated copyright message
[modules/gui.git] / src / LightApp / LightApp_OCCSelector.cxx
index 534cad26e9befc79573487d5a17352aad076e88d..76a8c3e47c9fc40aa1716c20d637d40d1063b1f6 100644 (file)
@@ -1,17 +1,20 @@
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
 // 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 
+// License as published by the Free Software Foundation; either
+// 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
+// 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 
+// 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
@@ -29,6 +32,7 @@
 /*!
   Constructor
 */
+#ifndef DISABLE_OCCVIEWER
 LightApp_OCCSelector::LightApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr )
 : SUIT_Selector( mgr, viewer ),
   myViewer( viewer )
@@ -38,6 +42,11 @@ LightApp_OCCSelector::LightApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_Selec
     connect( myViewer, SIGNAL( deselection() ), this, SLOT( onDeselection() ) );
   }
 }
+#else
+LightApp_OCCSelector::LightApp_OCCSelector(  SUIT_SelectionMgr* mgr )
+: SUIT_Selector( mgr )
+{}
+#endif
 
 /*!
   Destructor.
@@ -49,10 +58,12 @@ LightApp_OCCSelector::~LightApp_OCCSelector()
 /*!
   Gets viewer.
 */
+#ifndef DISABLE_OCCVIEWER
 OCCViewer_Viewer* LightApp_OCCSelector::viewer() const
 {
   return myViewer;
 }
+#endif
 
 
 /*!On selection changed.*/
@@ -70,9 +81,13 @@ void LightApp_OCCSelector::onDeselection()
 /*!Gets selection list.*/
 void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
 {
+#ifndef DISABLE_OCCVIEWER
   if ( !myViewer )
     return;
 
+  if ( !myViewer->isSelectionEnabled() )
+    return;
+
   AIS_ListOfInteractive aSelList;
   myViewer->getSelectedObjects( aSelList );
   for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() )
@@ -91,11 +106,13 @@ void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
   for(anExtIter = mySelectedExternals.begin(); anExtIter != mySelectedExternals.end(); anExtIter++) {
     aList.append(*anExtIter);
   }
+#endif
 }
 
 /*!Sets selection list.*/
 void LightApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
 {
+#ifndef DISABLE_OCCVIEWER
   if ( !myViewer )
     return;
 
@@ -127,13 +144,15 @@ void LightApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
 
   myViewer->unHighlightAll( false );
   myViewer->setObjectsSelected( aSelList );
+#endif
 }
 
+#ifndef DISABLE_OCCVIEWER
 /*!Gets entry ob object.*/
 QString LightApp_OCCSelector::entry( const Handle(AIS_InteractiveObject)& anAIS ) const
 {
   if ( anAIS.IsNull() || !anAIS->HasOwner() )
-    return QString::null;
+    return QString();
 
   QString res;
 
@@ -145,3 +164,4 @@ QString LightApp_OCCSelector::entry( const Handle(AIS_InteractiveObject)& anAIS
 
   return res;
 }
+#endif