myHighlightActor->MapCells( this, aMapIndex );
break;
case EdgeOfCellSelection:
- SVTK_IndexedMapOfIds aMapCompositeIndex;
+ SVTK_IndexedMapOfVtkIds aMapCompositeIndex;
mySelector->GetCompositeIndex( getIO(), aMapCompositeIndex );
myHighlightActor->GetProperty()->SetRepresentationToWireframe();
myHighlightActor->MapEdge( this, aMapCompositeIndex );
if(myIsPreselected){
vtkIdType aFNObjId = GetNodeObjId( aFNId );
vtkIdType aSNObjId = GetNodeObjId( aSNId );
- const SVTK_IndexedMapOfIds& aMapIds = myPreHighlightActor->GetMapCompositeIndex();
+ const SVTK_IndexedMapOfVtkIds& 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;
+ SVTK_IndexedMapOfVtkIds aMapIds;
+ SVTK_ListOfVtk aCompositeID;
aCompositeID.push_back( aFNObjId );
aCompositeID.push_back( aSNObjId );
aMapIds.Add( aCompositeID );
const SVTK_AreaPicker::TVectorIdsMap& aVectorIdsMap = myCellAreaPicker->GetCellIdsMap();
SVTK_AreaPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
- SVTK_IndexedMapOfIds anIndexes;
+ SVTK_IndexedMapOfVtkIds anIndexes;
if(aMapIter != aVectorIdsMap.end()){
const SVTK_AreaPicker::TVectorIds& aVectorIds = aMapIter->second;
vtkIdType anEnd = (int)aVectorIds.size(); //!< TODO: conversion from size_t to int
vtkIdType aFNId, aSNId;
int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId);
if( anEdgeId < 0 ) {
- SVTK_ListOfInteger aCompositeID;
+ SVTK_ListOfVtk aCompositeID;
aCompositeID.push_back( GetNodeObjId( aFNId ) );
aCompositeID.push_back( GetNodeObjId( aSNId ) );
anIndexes.Add( aCompositeID );
vtkIdType aFNId, aSNId;
int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId);
if( hasIO() && anEdgeId < 0 ) {
- SVTK_ListOfInteger aCompositeID;
+ SVTK_ListOfVtk aCompositeID;
aCompositeID.push_back( GetNodeObjId( aFNId ) );
aCompositeID.push_back( GetNodeObjId( aSNId ) );
mySelector->AddOrRemoveCompositeIndex( myIO, aCompositeID, anIsShift );
}
-const SVTK_IndexedMapOfIds&
+const SVTK_IndexedMapOfVtkIds&
SVTK_Actor
::GetMapCompositeIndex() const
{
void
SVTK_Actor
::MapEdge( SALOME_Actor* theMapActor,
- const SVTK_IndexedMapOfIds& theMapCompositeIndex) {
+ const SVTK_IndexedMapOfVtkIds& theMapCompositeIndex) {
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
//! 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 SVTK_IndexedMapOfVtkIds& theMapCompositeIndex);
const TColStd_IndexedMapOfInteger&
GetMapIndex() const;
- const SVTK_IndexedMapOfIds&
+ const SVTK_IndexedMapOfVtkIds&
GetMapCompositeIndex() const;
protected:
TColStd_IndexedMapOfInteger myMapIndex;
- SVTK_IndexedMapOfIds myMapCompositeIndex;
+ SVTK_IndexedMapOfVtkIds myMapCompositeIndex;
vtkSmartPointer<vtkUnstructuredGrid> myUnstructuredGrid;
#include <vector>
#include <NCollection_IndexedMap.hxx>
#include <Standard_Integer.hxx>
+#include <vtkType.h>
typedef std::vector<Standard_Integer> SVTK_ListOfInteger;
+typedef std::vector<vtkIdType> SVTK_ListOfVtk;
class SVTK_Hasher {
}
};
+class SVTK_vtkHasher {
+
+public:
+ static vtkIdType HashCode(const std::vector<vtkIdType> ids,
+ const vtkIdType upper) {
+ vtkIdType seed = (vtkIdType)ids.size();
+ for( vtkIdType i = 0; i < ids.size(); i++) {
+ vtkIdType v = ids[i];
+ seed ^= v + 0x9e3779b97f4a7c15 + ( seed << 6 ) + ( seed >> 2 );
+ }
+ return ::HashCode(seed, upper);
+ }
+
+ static vtkIdType IsEqual(const SVTK_ListOfVtk& theKey1,
+ const SVTK_ListOfVtk& theKey2) {
+ return theKey1 == theKey2;
+ }
+};
+
typedef NCollection_IndexedMap<SVTK_ListOfInteger,SVTK_Hasher> SVTK_IndexedMapOfIds;
+typedef NCollection_IndexedMap<SVTK_ListOfVtk, SVTK_vtkHasher> SVTK_IndexedMapOfVtkIds;
#endif // SVTK_HASH_H
return anId != 0;
}
-static bool removeCompositeIndex( SVTK_IndexedMapOfIds& theMapIndex, const SVTK_ListOfInteger theIds )
+static bool removeCompositeIndex( SVTK_IndexedMapOfVtkIds& theMapIndex, const SVTK_ListOfVtk 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() );
+ SVTK_ListOfVtk aLastIds = theMapIndex.FindKey( theMapIndex.Extent() );
if( aLastIds == theIds )
theMapIndex.RemoveLast();
else {
- SVTK_IndexedMapOfIds aNewMap;
+ SVTK_IndexedMapOfVtkIds aNewMap;
aNewMap.ReSize(theMapIndex.Extent()-1);
for( int j = 1; j <= theMapIndex.Extent(); j++ ){
- SVTK_ListOfInteger anIds = theMapIndex( j );
+ SVTK_ListOfVtk anIds = theMapIndex( j );
if ( anIds != theIds )
aNewMap.Add( anIds );
}
void
SVTK_SelectorDef
::GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_IndexedMapOfIds& theIds )
+ SVTK_IndexedMapOfVtkIds& theIds )
{
TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter != myMapIOSubCompositeIndex.end() )
bool
SVTK_SelectorDef
::AddOrRemoveCompositeIndex( const Handle( SALOME_InteractiveObject )& theIO,
- const SVTK_IndexedMapOfIds& theIds,
+ const SVTK_IndexedMapOfVtkIds& theIds,
bool theIsModeShift)
{
TMapIOSubCompositeIndex::iterator aMapIter = myMapIOSubCompositeIndex.find( theIO );
if( aMapIter == myMapIOSubCompositeIndex.end() ) {
- SVTK_IndexedMapOfIds anEmpty;
+ SVTK_IndexedMapOfVtkIds anEmpty;
aMapIter = myMapIOSubCompositeIndex.insert( TMapIOSubCompositeIndex::value_type( theIO, anEmpty ) ).first;
}
- SVTK_IndexedMapOfIds& aMapIndex = aMapIter->second;
+ SVTK_IndexedMapOfVtkIds& aMapIndex = aMapIter->second;
if( !theIsModeShift )
aMapIndex.Clear();
bool
SVTK_SelectorDef
::AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds,
+ SVTK_ListOfVtk theIds,
bool theIsModeShift)
{
TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter == myMapIOSubCompositeIndex.end() ) {
- SVTK_IndexedMapOfIds anEmpty;
+ SVTK_IndexedMapOfVtkIds anEmpty;
anIter = myMapIOSubCompositeIndex.insert(TMapIOSubCompositeIndex::value_type( theIO,anEmpty ) ).first;
}
- SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+ SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
bool anIsContains = aMapIndex.Contains( theIds ) == Standard_True;
if ( anIsContains )
void
SVTK_SelectorDef
::RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds )
+ SVTK_ListOfVtk theIds )
{
if(IsCompositeIndexSelected( theIO, theIds ) ) {
TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
- SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+ SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
removeCompositeIndex( aMapIndex,theIds );
}
}
bool
SVTK_SelectorDef
::IsCompositeIndexSelected( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds ) const
+ SVTK_ListOfVtk theIds ) const
{
TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter != myMapIOSubCompositeIndex.end() ) {
- const SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+ const SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
return aMapIndex.Contains( theIds ) == Standard_True;
}
return false;
virtual
void
GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_IndexedMapOfIds& theIds ) = 0;
+ SVTK_IndexedMapOfVtkIds& theIds ) = 0;
//! Change composite indices of subselection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const SVTK_IndexedMapOfIds& theIds,
+ const SVTK_IndexedMapOfVtkIds& theIds,
bool theIsModeShift) = 0;
//! Change composite index of subslection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger ids,
+ SVTK_ListOfVtk 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;
+ SVTK_ListOfVtk 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;
+ SVTK_ListOfVtk ids ) const = 0;
//! Clear composite indexes subselection
virtual
virtual
void
GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_IndexedMapOfIds& theIds );
+ SVTK_IndexedMapOfVtkIds& theIds );
virtual
bool
AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const SVTK_IndexedMapOfIds& theIds,
+ const SVTK_IndexedMapOfVtkIds& theIds,
bool theIsModeShift);
virtual
bool
AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds,
+ SVTK_ListOfVtk theIds,
bool theIsModeShift);
virtual
void
RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds );
+ SVTK_ListOfVtk theIds );
virtual
bool
IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds ) const;
+ SVTK_ListOfVtk theIds ) const;
virtual
void
TMapIOSubIndex myMapIOSubIndex;
typedef std::map<Handle(SALOME_InteractiveObject),
- SVTK_IndexedMapOfIds,
+ SVTK_IndexedMapOfVtkIds,
TIOLessThan> TMapIOSubCompositeIndex;
TMapIOSubCompositeIndex myMapIOSubCompositeIndex;