Salome HOME
Implementation of change orientation in Repair in GEOM.
[modules/geom.git] / src / GEOMGUI / GEOMGUI_OCCSelector.cxx
index c2afc40b993f84b9079c2a194a3834a4fcf6bf2f..3db11fd4ec7e8ee488025f62845cf8bcdaaf1043 100644 (file)
@@ -1,6 +1,25 @@
+// Copyright (C) 2005  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 
+// 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 "GEOMGUI_OCCSelector.h"
 
-#include <SalomeApp_DataSubOwner.h>
+#include <LightApp_DataSubOwner.h>
 
 #include <OCCViewer_ViewModel.h>
 
 #include <SelectMgr_IndexedMapOfOwner.hxx>
 #include <NCollection_DataMap.hxx>
 
+#include <SUIT_Session.h>
+#include <SalomeApp_Study.h>
+
 
 //================================================================
 // Function : GEOMGUI_OCCSelector
 // Purpose  : 
 //================================================================
 GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr )
-: SalomeApp_OCCSelector( viewer, mgr )
+: LightApp_OCCSelector( viewer, mgr )
 {
 }
 
@@ -79,11 +101,11 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
          
          if ( !entryStr.isEmpty() )
            {
-             SalomeApp_DataOwner* owner;
+             LightApp_DataOwner* owner;
              if ( index > -1 ) // Local Selection
-               owner = new SalomeApp_DataSubOwner( entryStr, index );
+               owner = new LightApp_DataSubOwner( entryStr, index );
              else // Global Selection
-               owner = new SalomeApp_DataOwner( entryStr );
+               owner = new LightApp_DataOwner( entryStr );
 
              aList.append( SUIT_DataOwnerPtr( owner ) );
            }
@@ -99,7 +121,7 @@ void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
          
          if ( !entryStr.isEmpty() )
            {
-             SalomeApp_DataOwner* owner = new SalomeApp_DataOwner( entryStr );
+             LightApp_DataOwner* owner = new LightApp_DataOwner( entryStr );
              aList.append( SUIT_DataOwnerPtr( owner ) );
            }
        }
@@ -153,7 +175,11 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
 
   Handle(AIS_InteractiveContext) ic = vw->getAISContext();
 
+#ifndef WNT
   NCollection_DataMap<TCollection_AsciiString, TColStd_IndexedMapOfInteger> indexesMap; // "entry - list_of_int" map for LOCAL selection
+#else
+  NCollection_DataMap<Standard_CString, TColStd_IndexedMapOfInteger> indexesMap; // "entry - list_of_int" map for LOCAL selection
+#endif
   QMap<QString,int> globalSelMap; // only Key=entry from this map is used.  value(int) is NOT used at all.
   SelectMgr_IndexedMapOfOwner ownersmap; // map of owners to be selected
   
@@ -164,11 +190,15 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
   // "entry - to - list_of_ids" map
   for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
   {
-    const SalomeApp_DataSubOwner* subOwner = dynamic_cast<const SalomeApp_DataSubOwner*>( (*itr).operator->() );
+    const LightApp_DataSubOwner* subOwner = dynamic_cast<const LightApp_DataSubOwner*>( (*itr).operator->() );
     if ( subOwner )
     {
       QString entry = subOwner->entry();
+#ifndef WNT
       if ( indexesMap.IsBound( TCollection_AsciiString((char*)entry.latin1())))
+#else
+         if ( indexesMap.IsBound( (char*)entry.latin1()))
+#endif
       {
        TColStd_IndexedMapOfInteger& subIndexes = indexesMap.ChangeFind((char*)entry.latin1());
        subIndexes.Add( subOwner->index() );
@@ -183,10 +213,13 @@ void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
     } 
     else // the owner is NOT a sub owner, maybe it is a DataOwner == GLOBAL selection
     {
-      const SalomeApp_DataOwner* owner = dynamic_cast<const SalomeApp_DataOwner*>( (*itr).operator->() );
+      const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
       if ( owner )
       {
-       globalSelMap[owner->entry()] = 1;
+       SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+       QString anEntry = appStudy->referencedToEntry( owner->entry() );
+       
+       globalSelMap[anEntry] = 1;
       }
     }
   }