Salome HOME
Merge ASERIS development.
authorrnv <rnv@opencascade.com>
Mon, 18 Dec 2017 17:09:18 +0000 (20:09 +0300)
committerrnv <rnv@opencascade.com>
Mon, 18 Dec 2017 17:09:18 +0000 (20:09 +0300)
src/SALOME_SWIG/SALOMEGUI_Swig.cxx
src/SVTK/CMakeLists.txt
src/SVTK/SALOME_Actor.cxx
src/SVTK/SVTK_Actor.cxx
src/SVTK/SVTK_Actor.h
src/SVTK/SVTK_Hash.h [new file with mode: 0644]
src/SVTK/SVTK_Selector.cxx
src/SVTK/SVTK_Selector.h
src/SVTK/SVTK_SelectorDef.h
src/VTKViewer/VTKViewer_Actor.cxx
src/VTKViewer/VTKViewer_Actor.h

index c6b25bdaddce4ba376b61fee700b01a343914b59..32178b8948880aea4b46df82e65f9d687cd2bb27 100644 (file)
@@ -628,7 +628,7 @@ public:
       if (!viewMgr) return;
       SUIT_ViewWindow* window = viewMgr->getActiveView();
       if ( window ) {
-        SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getActiveView() );
+        SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
         if ( view ) {
           SALOME_Prs* aPrs = view->CreatePrs( myEntry.toLatin1() );
           myResult = !aPrs->IsNull();
@@ -658,7 +658,7 @@ void SALOMEGUI_Swig::UpdateView()
         if (!viewMgr) return;
         SUIT_ViewWindow* window = viewMgr->getActiveView();
         if ( window ) {
-          SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getActiveView() );
+          SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
           if ( view )
             view->Repaint();
         }
index 493e5651ced4e8d99dc0affcb0cb8057a3da3edb..611319e1444e8bbd0380b036fd1839fd8b26177e 100755 (executable)
@@ -99,6 +99,7 @@ SET(_other_HEADERS
    SVTK_Selector.h
    SVTK_SpaceMouse.h
    SVTK_Utils.h
+   SVTK_Hash.h
 )
 
 # header files / no moc processing / internal
index eafd19747ba007a0da949ec9c543fabc5cb8381f..b0e88eca65708c3ee17f737cedf3d104b3712bf0 100644 (file)
@@ -84,9 +84,11 @@ int SALOME_LINE_WIDTH = 3;
 namespace
 {
   int
-  GetEdgeId(SALOME_Actor* theActor,
-            vtkPicker* thePicker, 
-            int theObjId)
+  GetEdgeAndNodesId(SALOME_Actor* theActor,
+                    vtkPicker* thePicker,
+                    int theObjId,
+                    int& theFirstNodeId,
+                    int& theSecondNodeId)
   {
     int anEdgeId = 0;
     if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
@@ -104,6 +106,8 @@ namespace
           if (aDist < aMinDist) {
             aMinDist = aDist;
             anEdgeId = -1 - i;
+            theFirstNodeId = aSelEdge->GetPointId(0);
+            theSecondNodeId = aSelEdge->GetPointId(1);
           }
         }
       }
@@ -447,15 +451,11 @@ SALOME_Actor
     if(mySelectionMode != ActorSelection){
       TColStd_IndexedMapOfInteger aMapIndex;
       mySelector->GetIndex( getIO(), aMapIndex );
-      switch( mySelectionMode ){
+      switch( mySelectionMode ) {
       case NodeSelection:
         myHighlightActor->GetProperty()->SetRepresentationToPoints();
         myHighlightActor->MapPoints( this, aMapIndex );
         break;
-      case EdgeOfCellSelection:
-        myHighlightActor->GetProperty()->SetRepresentationToWireframe();
-        myHighlightActor->MapEdge( this, aMapIndex );
-        break;
       case CellSelection:
       case EdgeSelection:
       case FaceSelection:
@@ -465,6 +465,12 @@ SALOME_Actor
         myHighlightActor->GetProperty()->SetRepresentationToSurface();
         myHighlightActor->MapCells( this, aMapIndex );
         break;
+      case EdgeOfCellSelection:
+       SVTK_IndexedMapOfIds aMapCompositeIndex;
+       mySelector->GetCompositeIndex( getIO(), aMapCompositeIndex );
+        myHighlightActor->GetProperty()->SetRepresentationToWireframe();
+       myHighlightActor->MapEdge( this, aMapCompositeIndex );
+       break;
       }
       myHighlightActor->SetVisibility( GetVisibility() && theIsHighlight );
     }
@@ -597,20 +603,24 @@ SALOME_Actor
       if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId )) {
         int anObjId = GetElemObjId( aVtkId );
         if ( anObjId >= 0 ) {
-          int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
+          int aFNId, aSNId;
+          int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId);
           myIsPreselected = anEdgeId < 0;
           if(myIsPreselected){
-            const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
-            int anExtent = aMapIndex.Extent();
-            anIsChanged |= (anExtent == 0 || anExtent == 1);
-            anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
-            if(anIsChanged){
-              TColStd_IndexedMapOfInteger aMapIndex;
-              aMapIndex.Add( anObjId );
-              aMapIndex.Add( anEdgeId );
-
+           int aFNObjId = GetNodeObjId( aFNId );
+           int aSNObjId = GetNodeObjId( aSNId );
+            const SVTK_IndexedMapOfIds& aMapIds = myPreHighlightActor->GetMapCompositeIndex();
+            int anExtent = aMapIds.Extent();
+            anIsChanged |= (anExtent == 0 || (anExtent > 0 && aMapIds(1).size() == 2 && 
+                                            (aFNObjId != aMapIds(1)[0] || aSNObjId != aMapIds(1)[1] ) ) );
+            if( anIsChanged ) {
+             SVTK_IndexedMapOfIds aMapIds;
+             SVTK_ListOfInteger aCompositeID;
+              aCompositeID.push_back( aFNObjId );
+              aCompositeID.push_back( aSNObjId );
+             aMapIds.Add( aCompositeID );
               myPreHighlightActor->GetProperty()->SetRepresentationToWireframe();
-              myPreHighlightActor->MapEdge( this, aMapIndex );
+              myPreHighlightActor->MapEdge( this, aMapIds );
             }
             myPreHighlightActor->SetVisibility( true );
           }
@@ -798,6 +808,50 @@ SALOME_Actor
         else if ( !anIsShift )
           mySelector->RemoveIObject( this );
       }
+      break;
+    }
+    case EdgeOfCellSelection:
+    {
+      SVTK::TPickLimiter aPickLimiter( myCellAreaPicker, this );
+      if( theSelectionEvent->myIsRectangle )
+        myCellAreaPicker->Pick( x1, y1, x2, y2, aRenderer, SVTK_AreaPicker::RectangleMode );
+      else if( theSelectionEvent->myIsPolygon )
+        myCellAreaPicker->Pick( theSelectionEvent->myPolygonPoints, aRenderer, SVTK_AreaPicker::PolygonMode );
+
+      const SVTK_AreaPicker::TVectorIdsMap& aVectorIdsMap = myCellAreaPicker->GetCellIdsMap();
+      SVTK_AreaPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
+      SVTK_IndexedMapOfIds anIndexes;
+      if(aMapIter != aVectorIdsMap.end()){
+        const SVTK_AreaPicker::TVectorIds& aVectorIds = aMapIter->second;
+        vtkIdType anEnd = aVectorIds.size();
+        for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
+          int aCellId = aVectorIds[anId];
+          if ( !mySelector->IsValid( this, aCellId ) )
+            continue;
+
+          int anObjId = GetElemObjId( aCellId );
+          if( anObjId != -1 ) {
+            int aFNId, aSNId;
+            int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId);
+            if( anEdgeId < 0 ) {
+             SVTK_ListOfInteger aCompositeID;
+              aCompositeID.push_back( GetNodeObjId( aFNId ) );
+              aCompositeID.push_back( GetNodeObjId( aSNId ) );
+             anIndexes.Add( aCompositeID );
+            }
+          }
+        }
+      }
+
+      if ( hasIO() ) {
+        if( !anIndexes.IsEmpty() ) {
+          mySelector->AddOrRemoveCompositeIndex( myIO, anIndexes, anIsShift );
+          mySelector->AddIObject( this );
+          anIndexes.Clear();
+        }
+        else if ( !anIsShift )
+          mySelector->RemoveIObject( this );
+      }
     }
     default:
       break;
@@ -850,11 +904,14 @@ SALOME_Actor
       if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
         int anObjId = GetElemObjId( aVtkId );
         if( anObjId >= 0 ) {
-          int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
+          int aFNId, aSNId;
+          int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId);
           if( hasIO() && anEdgeId < 0 ) {
-            mySelector->AddOrRemoveIndex( myIO, anObjId, false );
-            mySelector->AddOrRemoveIndex( myIO, anEdgeId, true );
-            mySelector->AddIObject( this );
+           SVTK_ListOfInteger aCompositeID;
+           aCompositeID.push_back( GetNodeObjId( aFNId ) );
+           aCompositeID.push_back( GetNodeObjId( aSNId ) );
+           mySelector->AddOrRemoveCompositeIndex( myIO, aCompositeID, anIsShift );
+           mySelector->AddIObject( this );
           }
         }
       }
index a4e404ee69cbd7bd39002f4d48c5e9bda91ff20e..d410444699a73b9501d79ad78fcf5b8194d833ea 100644 (file)
@@ -103,6 +103,14 @@ SVTK_Actor
   return myMapIndex;
 }
 
+
+const SVTK_IndexedMapOfIds&
+SVTK_Actor
+::GetMapCompositeIndex() const 
+{
+  return myMapCompositeIndex;
+}
+
 void
 SVTK_Actor
 ::MapCells(SALOME_Actor* theMapActor,
@@ -213,6 +221,34 @@ SVTK_Actor
   myMapIndex = theMapIndex;
 }
 
+void
+SVTK_Actor
+::MapEdge( SALOME_Actor* theMapActor, 
+           const SVTK_IndexedMapOfIds& theMapCompositeIndex) {
+  myUnstructuredGrid->Initialize();
+  myUnstructuredGrid->Allocate();
+
+  vtkUnstructuredGrid * aSourceGrid = ( vtkUnstructuredGrid * )theMapActor->GetInput();
+  GetSource()->SetPoints( aSourceGrid->GetPoints() );
+
+  int aNbOfParts = theMapCompositeIndex.Extent();
+  for(int ind = 1; ind <= aNbOfParts; ind++){
+      std::vector<int> aNodesIds = theMapCompositeIndex( ind );
+      vtkSmartPointer<vtkIdList> ids = vtkSmartPointer<vtkIdList>::New();
+      ids->InsertNextId(theMapActor->GetNodeVtkId( aNodesIds[0] ) );
+      ids->InsertNextId(theMapActor->GetNodeVtkId( aNodesIds[1] ) );
+      myUnstructuredGrid->InsertNextCell(VTK_LINE,ids);
+  }
+
+  UnShrink();
+  if(theMapActor->IsShrunk()){
+    SetShrinkFactor(theMapActor->GetShrinkFactor());
+    SetShrink();
+  }
+  
+  myMapCompositeIndex = theMapCompositeIndex;
+}
+
 /*!
   To publish the actor an all its internal devices
 */
index 3b18d036b28a2c74041150b6a58ec741d7bbeb61..5b27bffebdb2f45cc5b2ed025c1957b5f9f098d4 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef SVTK_ACTOR_H
 #define SVTK_ACTOR_H
 
+#include "SVTK_Selector.h"
 #include <TColStd_IndexedMapOfInteger.hxx>
 
 class vtkRenderer;
@@ -32,7 +33,7 @@ class vtkUnstructuredGrid;
 
 #include "SVTK.h"
 #include "SVTK_DeviceActor.h"
-
+#include "SVTK_Hash.h"
 #include <vtkSmartPointer.h>
 
 class SALOME_Actor;
@@ -83,11 +84,21 @@ public:
   MapEdge(SALOME_Actor* theMapActor, 
           const TColStd_IndexedMapOfInteger& theMapIndex);
 
+//! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes using corner node ids
+  virtual void 
+  MapEdge(SALOME_Actor* theMapActor, 
+          const SVTK_IndexedMapOfIds& theMapCompositeIndex);
+  
+
   const TColStd_IndexedMapOfInteger&
   GetMapIndex() const;
 
+  const SVTK_IndexedMapOfIds&
+  GetMapCompositeIndex() const;
+
  protected:
   TColStd_IndexedMapOfInteger myMapIndex;
+  SVTK_IndexedMapOfIds        myMapCompositeIndex;
 
   vtkSmartPointer<vtkUnstructuredGrid> myUnstructuredGrid;
 
diff --git a/src/SVTK/SVTK_Hash.h b/src/SVTK/SVTK_Hash.h
new file mode 100644 (file)
index 0000000..4f045d5
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, 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, 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME SALOMEGUI : 
+//  File   : SVTK_Hash.h
+//  Author : Roman NIKOLAEV
+
+#ifndef SVTK_HASH_H
+#define SVTK_HASH_H
+
+#include <vector>
+#include <NCollection_IndexedMap.hxx>
+#include <Standard_Integer.hxx>
+
+typedef std::vector<Standard_Integer> SVTK_ListOfInteger;
+
+class SVTK_Hasher {
+
+public:
+    static Standard_Integer HashCode(const std::vector<Standard_Integer> ids,
+                                    const Standard_Integer upper) {
+        Standard_Integer seed = ids.size();
+        for( Standard_Integer i = 0; i <  (Standard_Integer) ids.size(); i++ ) {
+            Standard_Integer v = ids[i];
+            seed ^= v + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
+        }
+        return ::HashCode(seed,upper);
+    }
+
+    static Standard_Boolean IsEqual(const SVTK_ListOfInteger& theKey1,
+                                    const SVTK_ListOfInteger& theKey2) {
+        return theKey1 == theKey2;
+    }
+};
+
+typedef NCollection_IndexedMap<SVTK_ListOfInteger,SVTK_Hasher> SVTK_IndexedMapOfIds;
+
+#endif // SVTK_HASH_H
index 51b32f21efb7c7cde2c229ad30b723669cd4ca5d..885f3485d4aa11c7cded36ece172caabfe9786a7 100644 (file)
@@ -23,7 +23,6 @@
 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
 //  File   : SALOME_Selection.cxx
 //  Author : Nicolas REJNERI
-
 #include "SVTK_SelectorDef.h"
 
 #include <VTKViewer_Filter.h>
@@ -106,6 +105,7 @@ SVTK_SelectorDef
   if(mySelectionMode != theMode){
     mySelectionMode = theMode;
     myMapIOSubIndex.clear();
+    myMapIOSubCompositeIndex.clear();
     this->EndPickCallback();
   }
 }
@@ -120,6 +120,7 @@ SVTK_SelectorDef
   myIO2Actors.clear();
   myIObjects.clear();
   myMapIOSubIndex.clear();
+  myMapIOSubCompositeIndex.clear();
 }
 
 /*!
@@ -206,6 +207,7 @@ SVTK_SelectorDef
   myIObjects.erase(theIO);
   myIO2Actors.erase(theIO);
   myMapIOSubIndex.erase(theIO);
+  myMapIOSubCompositeIndex.erase(theIO);
 
   return anIsIOBound;
 }
@@ -321,6 +323,29 @@ static bool removeIndex(TColStd_IndexedMapOfInteger& theMapIndex, const int theI
   return anId != 0;
 }
 
+static bool removeCompositeIndex( SVTK_IndexedMapOfIds& theMapIndex, const SVTK_ListOfInteger theIds )
+{
+  int anId = theMapIndex.FindIndex( theIds ); // i==0 if Index is not in the MapIndex
+  if( anId ) {
+    // only the last key can be removed
+    SVTK_ListOfInteger aLastIds = theMapIndex.FindKey( theMapIndex.Extent() );
+    if( aLastIds == theIds )
+      theMapIndex.RemoveLast();
+    else {
+      SVTK_IndexedMapOfIds aNewMap;
+      aNewMap.ReSize(theMapIndex.Extent()-1);
+      for( int j = 1; j <= theMapIndex.Extent(); j++ ){
+        SVTK_ListOfInteger anIds = theMapIndex( j );
+        if ( anIds != theIds )
+          aNewMap.Add( anIds );
+      }
+      theMapIndex = aNewMap;
+    }
+  }
+  return anId != 0;
+}
+
+
 /*!
   Changes indices of subselection for SALOME_InteractiveObject
   \param theIO - SALOME_InteractiveObject
@@ -456,6 +481,147 @@ SVTK_SelectorDef
   myMapIOSubIndex.clear();  
 }
 
+/*!
+  \return true if the SALOME_InteractiveObject has a composite index subselection
+  \param theIO - SALOME_InteractiveObject
+*/
+bool 
+SVTK_SelectorDef
+::HasCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO ) const
+{
+  return myMapIOSubCompositeIndex.find( theIO ) != myMapIOSubCompositeIndex.end();
+}
+
+/*!
+  Gets composite indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+*/
+void 
+SVTK_SelectorDef
+::GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                    SVTK_IndexedMapOfIds& theIds )
+{
+  TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
+  if( anIter != myMapIOSubCompositeIndex.end() )
+    theIds = anIter->second;
+  else
+    theIds.Clear();
+}
+
+/*!
+  Changes composite indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIndices - composite id
+  \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
+bool
+SVTK_SelectorDef
+::AddOrRemoveCompositeIndex( const Handle( SALOME_InteractiveObject )& theIO, 
+                    const SVTK_IndexedMapOfIds& theIds, 
+                    bool theIsModeShift)
+{
+  TMapIOSubCompositeIndex::iterator aMapIter = myMapIOSubCompositeIndex.find( theIO );
+  if( aMapIter == myMapIOSubCompositeIndex.end() ) {
+    SVTK_IndexedMapOfIds anEmpty;
+    aMapIter = myMapIOSubCompositeIndex.insert( TMapIOSubCompositeIndex::value_type( theIO, anEmpty ) ).first;
+  }
+  SVTK_IndexedMapOfIds& aMapIndex = aMapIter->second;
+
+  if( !theIsModeShift )
+    aMapIndex.Clear();
+  
+  for( int i = 1, iEnd = theIds.Extent(); i <= iEnd; i++ )
+    aMapIndex.Add( theIds( i ) );
+  
+  if( aMapIndex.IsEmpty() ) {
+    myMapIOSubCompositeIndex.erase( theIO );
+    return false;
+  }
+  return true;
+}
+
+/*!
+  Changes indices of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIds - composite ids
+  \param theIsModeShift - if it is false, then map will be cleared before indices are added
+*/
+bool 
+SVTK_SelectorDef
+::AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            SVTK_ListOfInteger theIds,
+                            bool theIsModeShift)
+{
+  TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
+  if( anIter == myMapIOSubCompositeIndex.end() ) {
+    SVTK_IndexedMapOfIds anEmpty;
+    anIter = myMapIOSubCompositeIndex.insert(TMapIOSubCompositeIndex::value_type( theIO,anEmpty ) ).first;
+  }
+
+  SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+
+  bool anIsContains = aMapIndex.Contains( theIds ) == Standard_True;
+  if ( anIsContains )
+    removeCompositeIndex( aMapIndex, theIds );
+  
+  if ( !theIsModeShift )
+    aMapIndex.Clear();
+  
+  if ( !anIsContains )
+    aMapIndex.Add( theIds );
+
+  if ( aMapIndex.IsEmpty() )
+    myMapIOSubIndex.erase( theIO );
+
+  return false;
+}
+
+/*!
+  Removes composite index of subselection for SALOME_InteractiveObject
+  \param theIO - SALOME_InteractiveObject
+  \param theIds - index
+*/
+void
+SVTK_SelectorDef
+::RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                       SVTK_ListOfInteger theIds )
+{
+  if(IsCompositeIndexSelected( theIO, theIds ) ) {
+    TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
+    SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+    removeCompositeIndex( aMapIndex,theIds );
+  }
+}
+
+/*!
+  \return true if the composite index presents in subselection 
+  \param theIO - SALOME_InteractiveObject
+  \param theIds - index
+*/
+bool
+SVTK_SelectorDef
+::IsCompositeIndexSelected( const Handle(SALOME_InteractiveObject)& theIO, 
+                           SVTK_ListOfInteger theIds ) const
+{
+  TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
+  if( anIter != myMapIOSubCompositeIndex.end() ) {
+    const SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+    return aMapIndex.Contains( theIds ) == Standard_True;
+  }
+  return false;
+}
+
+/*!
+  Clears all composite indices of subselection
+*/
+void 
+SVTK_SelectorDef
+::ClearCompositeIndex()
+{
+  myMapIOSubCompositeIndex.clear();  
+}
+
+
 /*!
   To apply a filter on the selection
   \param theFilter - new filter
index c5c9831a58532832c5fc217e2d1a877a5d992f78..7b33b3d36964c9b6579b1bb4fa7678ad57c6c57e 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "SVTK.h"
 #include "SVTK_Selection.h"
+#include "SVTK_Hash.h"
+
 #include "SALOME_ListIO.hxx"
 
 #include <VTKViewer_Filter.h>
@@ -168,6 +170,48 @@ public:
   void 
   ClearIndex() = 0;
 
+  /// ! Composite indexes 
+  virtual
+  bool 
+  HasCompositeIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0;
+
+  //! Get composite indexes of subslection for given #SALOME_InteractiveObject
+  virtual
+  void 
+  GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                    SVTK_IndexedMapOfIds& theIds ) = 0;
+        
+  //! Change composite indices of subselection for given #SALOME_InteractiveObject
+  virtual
+  bool 
+  AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            const SVTK_IndexedMapOfIds& theIds,
+                            bool theIsModeShift) = 0;
+
+  //! Change composite index of subslection for given #SALOME_InteractiveObject
+  virtual
+  bool
+  AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            SVTK_ListOfInteger ids, 
+                            bool theIsModeShift) = 0;
+
+  //! Change composite index of subslection for given #SALOME_InteractiveObject
+  virtual
+  void 
+  RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                       SVTK_ListOfInteger ids ) = 0;
+
+  //! Check, if the given composite index is present in subselection 
+  virtual
+  bool 
+  IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
+                          SVTK_ListOfInteger ids ) const = 0;
+
+  //! Clear composite indexes subselection
+  virtual
+  void 
+  ClearCompositeIndex() = 0;
+
   //----------------------------------------------------------------------------
   typedef int TFilterID;
 
index 2bec2075727f66b2f2cb70260b7995aee40925f8..c2e60309bc1f1ed3af0e7ab045835c56651ad873 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef SVTK_SELECTORDEF_H
 #define SVTK_SELECTORDEF_H
 
+#include "SVTK_Selector.h"
+
 #include <set>
 #include <map>
 
@@ -36,8 +38,6 @@
 
 #include "SALOME_InteractiveObject.hxx"
 
-#include "SVTK_Selector.h"
-
 class SALOME_Actor;
 
 class SVTK_Viewer;
@@ -135,6 +135,42 @@ public:
   void 
   ClearIndex();
 
+  //----------------------------------------------------------------------------
+  /// ! Composite indexes 
+  virtual
+  bool 
+  HasCompositeIndex(const Handle(SALOME_InteractiveObject)& theIO ) const;
+
+  virtual
+  void 
+  GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                    SVTK_IndexedMapOfIds& theIds );        
+  virtual
+  bool 
+  AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            const SVTK_IndexedMapOfIds& theIds,
+                            bool theIsModeShift);
+
+  virtual
+  bool
+  AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                            SVTK_ListOfInteger theIds,
+                            bool theIsModeShift);
+
+  virtual
+  void 
+  RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, 
+                       SVTK_ListOfInteger theIds );
+
+  virtual
+  bool 
+  IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, 
+                          SVTK_ListOfInteger theIds ) const;
+
+  virtual
+  void 
+  ClearCompositeIndex();
+
   //----------------------------------------------------------------------------
   virtual
   void 
@@ -243,6 +279,12 @@ private:
                    TIOLessThan> TMapIOSubIndex;
   TMapIOSubIndex myMapIOSubIndex;
 
+  typedef std::map<Handle(SALOME_InteractiveObject),
+                   SVTK_IndexedMapOfIds,
+                   TIOLessThan> TMapIOSubCompositeIndex;
+  TMapIOSubCompositeIndex myMapIOSubCompositeIndex;
+
+
   typedef std::map<TFilterID,Handle(VTKViewer_Filter)> TFilters;
   TFilters myFilters;
 
index 56312d57d09a6b9f139ca15591a48b63a53de2b4..c3f17f6e0679e60ab1e92dadecff6e2a589fd4bf 100755 (executable)
@@ -450,6 +450,17 @@ VTKViewer_Actor
   return GetInput()->GetPoint(theObjID);
 }
 
+/*!
+ Maps object index of a node to corresponding VTK index
+*/
+int
+VTKViewer_Actor
+::GetNodeVtkId( int theObjID )
+{
+  return theObjID;
+}
+
+
 /*!
   Get corresponding #vtkCell for given object index
 */
index 306578bec9574cfe0634f4899f506a1d17173414..4786236386c00237ea6f3d0f771c3dce526a4f93 100755 (executable)
@@ -146,6 +146,11 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor
   double*
   GetNodeCoord(int theObjID);
 
+  //! Maps object index of a node to corresponding VTK index
+  virtual
+  int 
+  GetNodeVtkId(int theObjID);
+
   //! Maps VTK index of a cell to corresponding object index
   virtual 
   int