From 0b1302a73b6053fb683e1929a70eb4dc1d7a4169 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 28 Sep 2017 19:06:29 +0300 Subject: [PATCH] Implementation multiple selection of 'Edge of Cell' functionality. --- src/SVTK/CMakeLists.txt | 1 + src/SVTK/SALOME_Actor.cxx | 60 +++++------ src/SVTK/SVTK_Actor.cxx | 36 +++++++ src/SVTK/SVTK_Actor.h | 11 ++ src/SVTK/SVTK_Hash.h | 43 ++++++++ src/SVTK/SVTK_Selector.cxx | 168 +++++++++++++++++++++++++++++- src/SVTK/SVTK_Selector.h | 49 +++++++++ src/SVTK/SVTK_SelectorDef.h | 46 +++++++- src/VTKViewer/VTKViewer_Actor.cxx | 11 ++ src/VTKViewer/VTKViewer_Actor.h | 5 + 10 files changed, 398 insertions(+), 32 deletions(-) create mode 100644 src/SVTK/SVTK_Hash.h diff --git a/src/SVTK/CMakeLists.txt b/src/SVTK/CMakeLists.txt index 493e5651c..611319e14 100755 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@ -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 diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 9082bea08..b0e88eca6 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -451,9 +451,8 @@ SALOME_Actor if(mySelectionMode != ActorSelection){ TColStd_IndexedMapOfInteger aMapIndex; mySelector->GetIndex( getIO(), aMapIndex ); - switch( mySelectionMode ){ + switch( mySelectionMode ) { case NodeSelection: - case EdgeOfCellSelection: myHighlightActor->GetProperty()->SetRepresentationToPoints(); myHighlightActor->MapPoints( this, aMapIndex ); break; @@ -466,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 ); } @@ -602,17 +607,20 @@ SALOME_Actor 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 ); } @@ -812,7 +820,7 @@ SALOME_Actor const SVTK_AreaPicker::TVectorIdsMap& aVectorIdsMap = myCellAreaPicker->GetCellIdsMap(); SVTK_AreaPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this); - TColStd_MapOfInteger anIndexes; + SVTK_IndexedMapOfIds anIndexes; if(aMapIter != aVectorIdsMap.end()){ const SVTK_AreaPicker::TVectorIds& aVectorIds = aMapIter->second; vtkIdType anEnd = aVectorIds.size(); @@ -826,8 +834,10 @@ SALOME_Actor int aFNId, aSNId; int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId); if( anEdgeId < 0 ) { - anIndexes.Add(GetNodeObjId(aFNId)); - anIndexes.Add(GetNodeObjId(aSNId)); + SVTK_ListOfInteger aCompositeID; + aCompositeID.push_back( GetNodeObjId( aFNId ) ); + aCompositeID.push_back( GetNodeObjId( aSNId ) ); + anIndexes.Add( aCompositeID ); } } } @@ -835,7 +845,7 @@ SALOME_Actor if ( hasIO() ) { if( !anIndexes.IsEmpty() ) { - mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift ); + mySelector->AddOrRemoveCompositeIndex( myIO, anIndexes, anIsShift ); mySelector->AddIObject( this ); anIndexes.Clear(); } @@ -897,19 +907,11 @@ SALOME_Actor int aFNId, aSNId; int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId); if( hasIO() && anEdgeId < 0 ) { - bool isFNSelected = mySelector->IsIndexSelected( myIO, GetNodeObjId(aFNId) ); - bool isSNSelected = mySelector->IsIndexSelected( myIO, GetNodeObjId(aSNId) ); - if ( isFNSelected == isSNSelected ) { - mySelector->AddOrRemoveIndex( myIO, GetNodeObjId(aFNId), anIsShift ); - mySelector->AddOrRemoveIndex( myIO, GetNodeObjId(aSNId), true ); - } - else if ( isFNSelected ) { - mySelector->AddOrRemoveIndex( myIO, GetNodeObjId(aSNId), anIsShift ); - } - else if ( isSNSelected ) { - mySelector->AddOrRemoveIndex( myIO, GetNodeObjId(aFNId), anIsShift ); - } - mySelector->AddIObject( this ); + SVTK_ListOfInteger aCompositeID; + aCompositeID.push_back( GetNodeObjId( aFNId ) ); + aCompositeID.push_back( GetNodeObjId( aSNId ) ); + mySelector->AddOrRemoveCompositeIndex( myIO, aCompositeID, anIsShift ); + mySelector->AddIObject( this ); } } } diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index a4e404ee6..d41044469 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -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 aNodesIds = theMapCompositeIndex( ind ); + vtkSmartPointer ids = vtkSmartPointer::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 */ diff --git a/src/SVTK/SVTK_Actor.h b/src/SVTK/SVTK_Actor.h index 3b18d036b..d2e3e77be 100644 --- a/src/SVTK/SVTK_Actor.h +++ b/src/SVTK/SVTK_Actor.h @@ -23,6 +23,7 @@ #ifndef SVTK_ACTOR_H #define SVTK_ACTOR_H +#include "SVTK_Selector.h" #include class vtkRenderer; @@ -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 myUnstructuredGrid; diff --git a/src/SVTK/SVTK_Hash.h b/src/SVTK/SVTK_Hash.h new file mode 100644 index 000000000..547e2391f --- /dev/null +++ b/src/SVTK/SVTK_Hash.h @@ -0,0 +1,43 @@ +// 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 +#include + +inline Standard_Integer HashCode( const std::vector 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); +} + +#endif // SVTK_HASH_H diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index 51b32f21e..885f3485d 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -23,7 +23,6 @@ // SALOME SALOMEGUI : implementation of desktop and GUI kernel // File : SALOME_Selection.cxx // Author : Nicolas REJNERI - #include "SVTK_SelectorDef.h" #include @@ -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 diff --git a/src/SVTK/SVTK_Selector.h b/src/SVTK/SVTK_Selector.h index c5c9831a5..f7f175e3c 100644 --- a/src/SVTK/SVTK_Selector.h +++ b/src/SVTK/SVTK_Selector.h @@ -28,6 +28,7 @@ #define SVTK_SELECTOR_H #include "SVTK.h" +#include "SVTK_Hash.h" #include "SVTK_Selection.h" #include "SALOME_ListIO.hxx" @@ -44,6 +45,12 @@ class SVTK_SelectionEvent; class vtkActorCollection; class vtkRenderer; +#include + +typedef std::vector SVTK_ListOfInteger; +typedef NCollection_DefaultHasher SVTK_MapOfIdsHasher; +typedef NCollection_IndexedMap SVTK_IndexedMapOfIds; + //! Define an abstract interface for selection in SVTK package /*! The class implements selection functionality through storing corresponding @@ -168,6 +175,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; diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h index 2bec20757..c2e60309b 100644 --- a/src/SVTK/SVTK_SelectorDef.h +++ b/src/SVTK/SVTK_SelectorDef.h @@ -27,6 +27,8 @@ #ifndef SVTK_SELECTORDEF_H #define SVTK_SELECTORDEF_H +#include "SVTK_Selector.h" + #include #include @@ -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 TMapIOSubCompositeIndex; + TMapIOSubCompositeIndex myMapIOSubCompositeIndex; + + typedef std::map TFilters; TFilters myFilters; diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx index 76f5d153b..fbaa31116 100755 --- a/src/VTKViewer/VTKViewer_Actor.cxx +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -437,6 +437,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 */ diff --git a/src/VTKViewer/VTKViewer_Actor.h b/src/VTKViewer/VTKViewer_Actor.h index e09c1e3e5..56e42209d 100755 --- a/src/VTKViewer/VTKViewer_Actor.h +++ b/src/VTKViewer/VTKViewer_Actor.h @@ -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 -- 2.39.2