From: eap Date: Wed, 17 Mar 2021 12:03:40 +0000 (+0300) Subject: bos #20256: [CEA 18523] Porting SMESH to int 64 bits X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d1b9aa0bfad500afe3cb332c1d8a4559dfe4c87;p=modules%2Fgui.git bos #20256: [CEA 18523] Porting SMESH to int 64 bits --- diff --git a/src/LightApp/LightApp_VTKSelector.cxx b/src/LightApp/LightApp_VTKSelector.cxx index 04feca42a..989325ba6 100644 --- a/src/LightApp/LightApp_VTKSelector.cxx +++ b/src/LightApp/LightApp_VTKSelector.cxx @@ -77,7 +77,7 @@ LightApp_SVTKDataOwner /*! Gets dataowners ids list. */ -const TColStd_IndexedMapOfInteger& +const SVTK_TIndexedMapOfVtkId& LightApp_SVTKDataOwner ::GetIds() const { diff --git a/src/LightApp/LightApp_VTKSelector.h b/src/LightApp/LightApp_VTKSelector.h index c5db9aaf0..66a19569a 100644 --- a/src/LightApp/LightApp_VTKSelector.h +++ b/src/LightApp/LightApp_VTKSelector.h @@ -33,6 +33,7 @@ class SUIT_Desktop; #ifndef DISABLE_VTKVIEWER #include + #include "SVTK_Hash.h" #include "SVTK_Selection.h" #ifndef DISABLE_SALOMEOBJECT #include "SALOME_InteractiveObject.hxx" @@ -57,7 +58,7 @@ class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner #endif /*!Gets dataowners ids list.*/ - const TColStd_IndexedMapOfInteger& GetIds() const; + const SVTK_TIndexedMapOfVtkId& GetIds() const; /*!Gets selection mode.*/ Selection_Mode GetMode() const; @@ -66,7 +67,7 @@ class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner SALOME_Actor* GetActor() const; protected: - mutable TColStd_IndexedMapOfInteger myIds; + mutable SVTK_TIndexedMapOfVtkId myIds; SVTK_ViewWindow* GetActiveViewWindow() const; SUIT_Desktop* myDesktop; diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 503cf1e91..48a212d61 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -86,9 +86,9 @@ namespace int GetEdgeAndNodesId(SALOME_Actor* theActor, vtkPicker* thePicker, - int theObjId, - int& theFirstNodeId, - int& theSecondNodeId) + vtkIdType theObjId, + vtkIdType& theFirstNodeId, + vtkIdType& theSecondNodeId) { int anEdgeId = 0; if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) { @@ -449,7 +449,7 @@ SALOME_Actor if(mySelector.GetPointer()){ if(mySelectionMode != ActorSelection){ - TColStd_IndexedMapOfInteger aMapIndex; + SVTK_TIndexedMapOfVtkId aMapIndex; mySelector->GetIndex( getIO(), aMapIndex ); switch( mySelectionMode ) { case NodeSelection: @@ -466,7 +466,7 @@ SALOME_Actor myHighlightActor->MapCells( this, aMapIndex ); break; case EdgeOfCellSelection: - SVTK_IndexedMapOfIds aMapCompositeIndex; + SVTK_IndexedMapOfVtkIds aMapCompositeIndex; mySelector->GetCompositeIndex( getIO(), aMapCompositeIndex ); myHighlightActor->GetProperty()->SetRepresentationToWireframe(); myHighlightActor->MapEdge( this, aMapCompositeIndex ); @@ -542,16 +542,16 @@ SALOME_Actor SVTK::TPickLimiter aPickLimiter( myPointPicker, this ); myPointPicker->Pick( x, y, z, aRenderer ); - int aVtkId = myPointPicker->GetPointId(); + vtkIdType aVtkId = myPointPicker->GetPointId(); if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) { - int anObjId = GetNodeObjId( aVtkId ); + vtkIdType anObjId = GetNodeObjId( aVtkId ); myIsPreselected = (anObjId >= 0); if(myIsPreselected){ - const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex(); - int anExtent = aMapIndex.Extent(); + const SVTK_TIndexedMapOfVtkId& aMapIndex = myPreHighlightActor->GetMapIndex(); + vtkIdType anExtent = aMapIndex.Extent(); anIsChanged |= (anExtent == 0 || (anExtent > 0 && anObjId != aMapIndex(1))); if(anIsChanged){ - TColStd_IndexedMapOfInteger aMapIndex; + SVTK_TIndexedMapOfVtkId aMapIndex; aMapIndex.Add( anObjId ); myPreHighlightActor->GetProperty()->SetRepresentationToPoints(); @@ -572,17 +572,17 @@ SALOME_Actor SVTK::TPickLimiter aPickLimiter( myCellPicker, this ); myCellPicker->Pick( x, y, z, aRenderer ); - int aVtkId = myCellPicker->GetCellId(); + vtkIdType aVtkId = myCellPicker->GetCellId(); if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) && hasIO() ) { - int anObjId = GetElemObjId (aVtkId ); + vtkIdType anObjId = GetElemObjId (aVtkId ); if ( anObjId >= 0 ) { myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId); if(myIsPreselected){ - const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex(); - int anExtent = aMapIndex.Extent(); + const SVTK_TIndexedMapOfVtkId& aMapIndex = myPreHighlightActor->GetMapIndex(); + vtkIdType anExtent = aMapIndex.Extent(); anIsChanged |= (anExtent == 0 || (anExtent > 0 && anObjId != aMapIndex(1))); if(anIsChanged){ - TColStd_IndexedMapOfInteger aMapIndex; + SVTK_TIndexedMapOfVtkId aMapIndex; aMapIndex.Add( anObjId ); myPreHighlightActor->GetProperty()->SetRepresentationToSurface(); @@ -599,23 +599,23 @@ SALOME_Actor SVTK::TPickLimiter aPickLimiter( myCellPicker, this ); myCellPicker->Pick( x, y, z, aRenderer ); - int aVtkId = myCellPicker->GetCellId(); + vtkIdType aVtkId = myCellPicker->GetCellId(); if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId )) { - int anObjId = GetElemObjId( aVtkId ); + vtkIdType anObjId = GetElemObjId( aVtkId ); if ( anObjId >= 0 ) { - int aFNId, aSNId; + vtkIdType aFNId, aSNId; int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId); myIsPreselected = anEdgeId < 0; if(myIsPreselected){ - int aFNObjId = GetNodeObjId( aFNId ); - int aSNObjId = GetNodeObjId( aSNId ); - const SVTK_IndexedMapOfIds& aMapIds = myPreHighlightActor->GetMapCompositeIndex(); - int anExtent = aMapIds.Extent(); + vtkIdType aFNObjId = GetNodeObjId( aFNId ); + vtkIdType aSNObjId = GetNodeObjId( aSNId ); + const SVTK_IndexedMapOfVtkIds& aMapIds = myPreHighlightActor->GetMapCompositeIndex(); + vtkIdType 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 ); @@ -709,14 +709,14 @@ SALOME_Actor const SVTK_AreaPicker::TVectorIdsMap& aVectorIdsMap = myPointAreaPicker->GetPointIdsMap(); SVTK_AreaPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this); - TColStd_MapOfInteger anIndexes; + SVTK_TVtkIDsMap anIndexes; if(aMapIter != aVectorIdsMap.end()){ const SVTK_AreaPicker::TVectorIds& aVectorIds = aMapIter->second; vtkIdType anEnd = (int)aVectorIds.size(); //!< TODO: conversion from size_t to int for(vtkIdType anId = 0; anId < anEnd; anId++ ) { - int aPointId = aVectorIds[anId]; + vtkIdType aPointId = aVectorIds[anId]; if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) { - int anObjId = GetNodeObjId( aPointId ); + vtkIdType anObjId = GetNodeObjId( aPointId ); anIndexes.Add( anObjId ); } } @@ -785,16 +785,16 @@ SALOME_Actor const SVTK_AreaPicker::TVectorIdsMap& aVectorIdsMap = myCellAreaPicker->GetCellIdsMap(); SVTK_AreaPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this); - TColStd_MapOfInteger anIndexes; + SVTK_TVtkIDsMap anIndexes; if(aMapIter != aVectorIdsMap.end()){ const SVTK_AreaPicker::TVectorIds& aVectorIds = aMapIter->second; vtkIdType anEnd = (int)aVectorIds.size(); //!< TODO: conversion from size_t to int for(vtkIdType anId = 0; anId < anEnd; anId++ ) { - int aCellId = aVectorIds[anId]; + vtkIdType aCellId = aVectorIds[anId]; if ( !mySelector->IsValid( this, aCellId ) ) continue; - int anObjId = GetElemObjId( aCellId ); + vtkIdType anObjId = GetElemObjId( aCellId ); if( anObjId != -1 ) if ( CheckDimensionId(aSelectionMode,this,anObjId) ) { anIndexes.Add(anObjId); @@ -823,21 +823,21 @@ SALOME_Actor 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 for(vtkIdType anId = 0; anId < anEnd; anId++ ) { - int aCellId = aVectorIds[anId]; + vtkIdType aCellId = aVectorIds[anId]; if ( !mySelector->IsValid( this, aCellId ) ) continue; - int anObjId = GetElemObjId( aCellId ); + vtkIdType anObjId = GetElemObjId( aCellId ); if( anObjId != -1 ) { - int aFNId, aSNId; + 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 ); @@ -866,9 +866,9 @@ SALOME_Actor SVTK::TPickLimiter aPickLimiter( myPointPicker, this ); myPointPicker->Pick( x, y, 0.0, aRenderer ); - int aVtkId = myPointPicker->GetPointId(); + vtkIdType aVtkId = myPointPicker->GetPointId(); if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) { - int anObjId = GetNodeObjId( aVtkId ); + vtkIdType anObjId = GetNodeObjId( aVtkId ); if( hasIO() && anObjId >= 0 ) { mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift ); mySelector->AddIObject( this ); @@ -886,9 +886,9 @@ SALOME_Actor SVTK::TPickLimiter aPickLimiter( myCellPicker, this ); myCellPicker->Pick( x, y, 0.0, aRenderer ); - int aVtkId = myCellPicker->GetCellId(); + vtkIdType aVtkId = myCellPicker->GetCellId(); if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) { - int anObjId = GetElemObjId( aVtkId ); + vtkIdType anObjId = GetElemObjId( aVtkId ); if( anObjId >= 0 ) { if ( hasIO() && CheckDimensionId(aSelectionMode,this,anObjId) ) { mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift ); @@ -903,14 +903,14 @@ SALOME_Actor SVTK::TPickLimiter aPickLimiter( myCellPicker, this ); myCellPicker->Pick( x, y, 0.0, aRenderer ); - int aVtkId = myCellPicker->GetCellId(); + vtkIdType aVtkId = myCellPicker->GetCellId(); if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) { - int anObjId = GetElemObjId( aVtkId ); + vtkIdType anObjId = GetElemObjId( aVtkId ); if( anObjId >= 0 ) { - int aFNId, aSNId; + 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 ); diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index a534ea44a..a6c963b21 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -96,7 +96,7 @@ SVTK_Actor { } -const TColStd_IndexedMapOfInteger& +const SVTK_TIndexedMapOfVtkId& SVTK_Actor ::GetMapIndex() const { @@ -104,7 +104,7 @@ SVTK_Actor } -const SVTK_IndexedMapOfIds& +const SVTK_IndexedMapOfVtkIds& SVTK_Actor ::GetMapCompositeIndex() const { @@ -114,7 +114,7 @@ SVTK_Actor void SVTK_Actor ::MapCells(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex) + const SVTK_TIndexedMapOfVtkId& theMapIndex) { myUnstructuredGrid->Initialize(); myUnstructuredGrid->Allocate(); @@ -156,7 +156,7 @@ SVTK_Actor void SVTK_Actor ::MapPoints(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex) + const SVTK_TIndexedMapOfVtkId& theMapIndex) { myUnstructuredGrid->Initialize(); myUnstructuredGrid->Allocate(); @@ -165,7 +165,7 @@ SVTK_Actor vtkPoints *aPoints = vtkPoints::New(); aPoints->SetNumberOfPoints(aNbOfParts); for(vtkIdType i = 0; i < aNbOfParts; i++){ - int aPartId = theMapIndex( i+1 ); + vtkIdType aPartId = theMapIndex( i+1 ); if(double* aCoord = theMapActor->GetNodeCoord(aPartId)){ aPoints->SetPoint(i,aCoord); // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK @@ -185,7 +185,7 @@ SVTK_Actor void SVTK_Actor ::MapEdge(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex) + const SVTK_TIndexedMapOfVtkId& theMapIndex) { myUnstructuredGrid->Initialize(); myUnstructuredGrid->Allocate(); @@ -224,16 +224,16 @@ SVTK_Actor void SVTK_Actor ::MapEdge( SALOME_Actor* theMapActor, - const SVTK_IndexedMapOfIds& theMapCompositeIndex) { + const SVTK_IndexedMapOfVtkIds& 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 ); + vtkIdType aNbOfParts = theMapCompositeIndex.Extent(); + for(vtkIdType 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] ) ); diff --git a/src/SVTK/SVTK_Actor.h b/src/SVTK/SVTK_Actor.h index a42db7998..ad35ee7a4 100644 --- a/src/SVTK/SVTK_Actor.h +++ b/src/SVTK/SVTK_Actor.h @@ -72,33 +72,33 @@ public: //! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes virtual void MapCells(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex); + const SVTK_TIndexedMapOfVtkId& theMapIndex); //! Allow to recostruct selected points from source SALOME_Actor and map of subindexes virtual void MapPoints(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex); + const SVTK_TIndexedMapOfVtkId& theMapIndex); //! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes virtual void MapEdge(SALOME_Actor* theMapActor, - const TColStd_IndexedMapOfInteger& theMapIndex); + const SVTK_TIndexedMapOfVtkId& 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 SVTK_IndexedMapOfVtkIds& theMapCompositeIndex); - const TColStd_IndexedMapOfInteger& + const SVTK_TIndexedMapOfVtkId& GetMapIndex() const; - const SVTK_IndexedMapOfIds& + const SVTK_IndexedMapOfVtkIds& GetMapCompositeIndex() const; protected: - TColStd_IndexedMapOfInteger myMapIndex; - SVTK_IndexedMapOfIds myMapCompositeIndex; + SVTK_TIndexedMapOfVtkId myMapIndex; + SVTK_IndexedMapOfVtkIds myMapCompositeIndex; vtkSmartPointer myUnstructuredGrid; diff --git a/src/SVTK/SVTK_DeviceActor.cxx b/src/SVTK/SVTK_DeviceActor.cxx index b7f4f42c8..4e7ad5247 100644 --- a/src/SVTK/SVTK_DeviceActor.cxx +++ b/src/SVTK/SVTK_DeviceActor.cxx @@ -268,8 +268,8 @@ SVTK_DeviceActor myPassFilter[ 0 ]->Update(); if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() ) { - int numCells=aDataSet->GetNumberOfCells(); - int numPts = aDataSet->GetNumberOfPoints(); + vtkIdType numCells=aDataSet->GetNumberOfCells(); + vtkIdType numPts = aDataSet->GetNumberOfPoints(); //It's impossible to use to apply "shrink" for "empty" dataset if (numCells < 1 || numPts < 1) return; @@ -576,9 +576,9 @@ SVTK_DeviceActor /*! Maps VTK index of a node to corresponding object index */ -int +vtkIdType SVTK_DeviceActor -::GetNodeObjId(int theVtkID) +::GetNodeObjId(vtkIdType theVtkID) { return theVtkID; } @@ -588,7 +588,7 @@ SVTK_DeviceActor */ double* SVTK_DeviceActor -::GetNodeCoord(int theObjID) +::GetNodeCoord(vtkIdType theObjID) { return GetInput()->GetPoint(theObjID); } @@ -599,7 +599,7 @@ SVTK_DeviceActor */ vtkCell* SVTK_DeviceActor -::GetElemCell(int theObjID) +::GetElemCell(vtkIdType theObjID) { return GetInput()->GetCell(theObjID); } @@ -607,9 +607,9 @@ SVTK_DeviceActor /*! Maps VTK index of a cell to corresponding object index */ -int +vtkIdType SVTK_DeviceActor -::GetElemObjId(int theVtkID) +::GetElemObjId(vtkIdType theVtkID) { return theVtkID; } diff --git a/src/SVTK/SVTK_DeviceActor.h b/src/SVTK/SVTK_DeviceActor.h index 82c31e1c5..0d5c8fc13 100644 --- a/src/SVTK/SVTK_DeviceActor.h +++ b/src/SVTK/SVTK_DeviceActor.h @@ -90,20 +90,20 @@ class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor /** @name For selection mapping purpose */ //@{ virtual - int - GetNodeObjId(int theVtkID); + vtkIdType + GetNodeObjId(vtkIdType theVtkID); virtual double* - GetNodeCoord(int theObjID); + GetNodeCoord(vtkIdType theObjID); virtual - int - GetElemObjId(int theVtkID); + vtkIdType + GetElemObjId(vtkIdType theVtkID); virtual vtkCell* - GetElemCell(int theObjID); + GetElemCell(vtkIdType theObjID); //! To provide VTK to Object and backward mapping virtual diff --git a/src/SVTK/SVTK_Hash.h b/src/SVTK/SVTK_Hash.h index afd6227ef..48adf6747 100644 --- a/src/SVTK/SVTK_Hash.h +++ b/src/SVTK/SVTK_Hash.h @@ -29,29 +29,71 @@ #include #include +#include #include +#include +#include typedef std::vector SVTK_ListOfInteger; +typedef std::vector SVTK_ListOfVtk; class SVTK_Hasher { public: - static Standard_Integer HashCode(const std::vector ids, - const Standard_Integer upper) { - Standard_Integer seed = (Standard_Integer)ids.size(); //!< TODO: conversion from size_t to int - 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; - } + static Standard_Integer HashCode(const std::vector ids, + const Standard_Integer upper) + { + Standard_Integer seed = (Standard_Integer)ids.size(); + for ( Standard_Integer v : ids ) + 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; + } +}; + +class SVTK_vtkHasher { + +public: + static vtkIdType HashCode(const std::vector ids, + const Standard_Integer upper) + { + vtkIdType seed = (vtkIdType)ids.size(); + for ( vtkIdType v : ids ) + seed ^= v + 0x9e3779b97f4a7c15 + ( seed << 6 ) + ( seed >> 2 ); + + return ::HashCode((Standard_Integer) seed, upper); + } + + static vtkIdType IsEqual(const SVTK_ListOfVtk& theKey1, + const SVTK_ListOfVtk& theKey2) + { + return theKey1 == theKey2; + } +}; + +struct svtkIdHasher +{ + static int HashCode(const vtkIdType theValue, const int theUpperBound) + { + return static_cast ((theValue & (std::numeric_limits::max)()) % theUpperBound + 1); + } + + static bool IsEqual( const vtkIdType& id1, const vtkIdType& id2 ) + { + return id1 == id2; + } }; typedef NCollection_IndexedMap SVTK_IndexedMapOfIds; +typedef NCollection_IndexedMap SVTK_IndexedMapOfVtkIds; +typedef NCollection_Map< vtkIdType, svtkIdHasher > SVTK_TVtkIDsMap; +typedef NCollection_Map< vtkIdType, svtkIdHasher >::Iterator SVTK_TVtkIDsMapIterator; +typedef NCollection_IndexedMap SVTK_TIndexedMapOfVtkId; #endif // SVTK_HASH_H diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index d3610ed9f..d0360fb92 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -539,7 +539,7 @@ void SVTK_InteractorStyle::OnLeftButtonDown(int ctrl, int shift, { Selection_Mode aSelectionMode = GetSelector()->SelectionMode(); double* aCoords = NULL; - int aVtkId; + vtkIdType aVtkId; bool isTrueType = false; if( myCurrFocalPointType == SVTK::StartFocalPointSelection || @@ -553,7 +553,7 @@ void SVTK_InteractorStyle::OnLeftButtonDown(int ctrl, int shift, aVtkId = myPointPicker->GetPointId(); if ( aVtkId >= 0 ) { - int anObjId = anActor->GetNodeObjId( aVtkId ); + vtkIdType anObjId = anActor->GetNodeObjId( aVtkId ); aCoords = anActor->GetNodeCoord(anObjId); isTrueType = true; } @@ -569,7 +569,7 @@ void SVTK_InteractorStyle::OnLeftButtonDown(int ctrl, int shift, 0.0, GetCurrentRenderer() ); aVtkId = aCellPicker->GetCellId(); - int aCellId = anActor->GetElemObjId( aVtkId ); + vtkIdType aCellId = anActor->GetElemObjId( aVtkId ); if( aSelectionMode == EdgeSelection ) isTrueType = anActor->GetObjDimension( aCellId ) == 1; @@ -1370,11 +1370,11 @@ void SVTK_InteractorStyle::onCursorMove(QPoint /*mousePos*/) { SVTK::TPickLimiter aPickLimiter( myPointPicker, anActor ); myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() ); - int aVtkId = myPointPicker->GetPointId(); + vtkIdType aVtkId = myPointPicker->GetPointId(); if ( aVtkId >= 0 ) { - int anObjId = anActor->GetNodeObjId( aVtkId ); + vtkIdType anObjId = anActor->GetNodeObjId( aVtkId ); - TColStd_IndexedMapOfInteger aMapIndex; + SVTK_TIndexedMapOfVtkId aMapIndex; aMapIndex.Add( anObjId ); myHighlightSelectionPointActor->MapPoints( anActor, aMapIndex ); diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index dae45cfeb..a33540d49 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -273,7 +273,7 @@ SVTK_SelectorDef void SVTK_SelectorDef ::GetIndex( const Handle(SALOME_InteractiveObject)& theIO, - TColStd_IndexedMapOfInteger& theIndex) + SVTK_TIndexedMapOfVtkId& theIndex) { TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO); if(anIter != myMapIOSubIndex.end()) @@ -294,14 +294,14 @@ SVTK_SelectorDef { TMapIOSubIndex::const_iterator anIter = myMapIOSubIndex.find(theIO); if(anIter != myMapIOSubIndex.end()){ - const TColStd_IndexedMapOfInteger& aMapIndex = anIter->second.myMap; + const SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap; return aMapIndex.Contains( theIndex ) == Standard_True; } return false; } -static bool removeIndex(TColStd_IndexedMapOfInteger& theMapIndex, const int theIndex) +static bool removeIndex(SVTK_TIndexedMapOfVtkId& theMapIndex, const int theIndex) { int anId = theMapIndex.FindIndex(theIndex); // i==0 if Index is not in the MapIndex if(anId){ @@ -310,7 +310,7 @@ static bool removeIndex(TColStd_IndexedMapOfInteger& theMapIndex, const int theI if(aLastId == anId) theMapIndex.RemoveLast(); else{ - TColStd_IndexedMapOfInteger aNewMap; + SVTK_TIndexedMapOfVtkId aNewMap; aNewMap.ReSize(theMapIndex.Extent()-1); for(int j = 1; j <= theMapIndex.Extent(); j++){ int anIndex = theMapIndex(j); @@ -323,19 +323,19 @@ static bool removeIndex(TColStd_IndexedMapOfInteger& theMapIndex, const int theI 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 ); } @@ -355,7 +355,7 @@ static bool removeCompositeIndex( SVTK_IndexedMapOfIds& theMapIndex, const SVTK_ bool SVTK_SelectorDef ::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_IndexedMapOfInteger& theIndices, + const SVTK_TIndexedMapOfVtkId& theIndices, bool theIsModeShift) { TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO); @@ -364,7 +364,7 @@ SVTK_SelectorDef aMapIter = myMapIOSubIndex. insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first; } - TColStd_IndexedMapOfInteger& aMapIndex = aMapIter->second.myMap; + SVTK_TIndexedMapOfVtkId& aMapIndex = aMapIter->second.myMap; if(!theIsModeShift) aMapIndex.Clear(); @@ -390,7 +390,7 @@ SVTK_SelectorDef bool SVTK_SelectorDef ::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_MapOfInteger& theIndices, + const SVTK_TVtkIDsMap& theIndices, bool theIsModeShift) { TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO); @@ -399,12 +399,12 @@ SVTK_SelectorDef aMapIter = myMapIOSubIndex. insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first; } - TColStd_IndexedMapOfInteger& aMapIndex = aMapIter->second.myMap; + SVTK_TIndexedMapOfVtkId& aMapIndex = aMapIter->second.myMap; if(!theIsModeShift) aMapIndex.Clear(); - TColStd_MapIteratorOfMapOfInteger anIter(theIndices); + SVTK_TVtkIDsMapIterator anIter(theIndices); for(; anIter.More(); anIter.Next()) aMapIndex.Add(anIter.Key()); @@ -435,7 +435,7 @@ SVTK_SelectorDef anIter = myMapIOSubIndex. insert(TMapIOSubIndex::value_type(theIO,anEmpty)).first; } - TColStd_IndexedMapOfInteger& aMapIndex = anIter->second.myMap; + SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap; bool anIsConatains = aMapIndex.Contains( theIndex ) == Standard_True; if ( anIsConatains ) @@ -466,7 +466,7 @@ SVTK_SelectorDef { if(IsIndexSelected(theIO,theIndex)){ TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO); - TColStd_IndexedMapOfInteger& aMapIndex = anIter->second.myMap; + SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap; removeIndex(aMapIndex,theIndex); } } @@ -499,7 +499,7 @@ SVTK_SelectorDef 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() ) @@ -517,15 +517,15 @@ SVTK_SelectorDef 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(); @@ -549,16 +549,16 @@ SVTK_SelectorDef 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 ) @@ -584,11 +584,11 @@ SVTK_SelectorDef 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 ); } } @@ -601,11 +601,11 @@ SVTK_SelectorDef 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; diff --git a/src/SVTK/SVTK_Selector.h b/src/SVTK/SVTK_Selector.h index a61e90f73..4dbca1183 100644 --- a/src/SVTK/SVTK_Selector.h +++ b/src/SVTK/SVTK_Selector.h @@ -130,20 +130,20 @@ public: virtual void GetIndex( const Handle(SALOME_InteractiveObject)& theIO, - TColStd_IndexedMapOfInteger& theIndex ) = 0; + SVTK_TIndexedMapOfVtkId& theIndex ) = 0; //! Change indices of subselection for given #SALOME_InteractiveObject virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_IndexedMapOfInteger& theIndices, + const SVTK_TIndexedMapOfVtkId& theIndices, bool theIsModeShift) = 0; //! Change indexes of subslection for given #SALOME_InteractiveObject virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_MapOfInteger& theIndices, + const SVTK_TVtkIDsMap& theIndices, bool theIsModeShift) = 0; //! Change index of subslection for given #SALOME_InteractiveObject @@ -179,33 +179,33 @@ public: 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 diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h index 81eb6d5f7..fe7b1f6f7 100644 --- a/src/SVTK/SVTK_SelectorDef.h +++ b/src/SVTK/SVTK_SelectorDef.h @@ -106,17 +106,17 @@ public: virtual void GetIndex( const Handle(SALOME_InteractiveObject)& theIO, - TColStd_IndexedMapOfInteger& theIndex ); + SVTK_TIndexedMapOfVtkId& theIndex ); virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_IndexedMapOfInteger& theIndices, + const SVTK_TIndexedMapOfVtkId& theIndices, bool theIsModeShift); virtual bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO, - const TColStd_MapOfInteger& theIndices, + const SVTK_TVtkIDsMap& theIndices, bool theIsModeShift); virtual bool @@ -144,28 +144,28 @@ public: 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 @@ -255,7 +255,7 @@ private: struct TIndexedMapOfInteger { - TColStd_IndexedMapOfInteger myMap; + SVTK_TIndexedMapOfVtkId myMap; TIndexedMapOfInteger() {} TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger) @@ -280,7 +280,7 @@ private: TMapIOSubIndex myMapIOSubIndex; typedef std::map TMapIOSubCompositeIndex; TMapIOSubCompositeIndex myMapIOSubCompositeIndex; diff --git a/src/VTKViewer/CMakeLists.txt b/src/VTKViewer/CMakeLists.txt index 85b561eef..626793ce8 100644 --- a/src/VTKViewer/CMakeLists.txt +++ b/src/VTKViewer/CMakeLists.txt @@ -71,7 +71,6 @@ SET(_other_HEADERS VTKViewer_Algorithm.h VTKViewer_ArcBuilder.h VTKViewer_CellCenters.h - VTKViewer_CellLocationsArray.h VTKViewer_ConvexTool.h VTKViewer_DataSetMapper.h VTKViewer_ExtractUnstructuredGrid.h @@ -155,7 +154,6 @@ SET(_other_SOURCES VTKViewer_AppendFilter.cxx VTKViewer_ArcBuilder.cxx VTKViewer_CellCenters.cxx - VTKViewer_CellLocationsArray.cxx VTKViewer_ConvexTool.cxx VTKViewer_DataSetMapper.cxx VTKViewer_ExtractUnstructuredGrid.cxx diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx index 49e98cbac..a0f37ded4 100644 --- a/src/VTKViewer/VTKViewer_Actor.cxx +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -433,9 +433,9 @@ VTKViewer_Actor /*! Maps VTK index of a node to corresponding object index */ -int +vtkIdType VTKViewer_Actor -::GetNodeObjId(int theVtkID) +::GetNodeObjId(vtkIdType theVtkID) { return theVtkID; } @@ -445,7 +445,7 @@ VTKViewer_Actor */ double* VTKViewer_Actor -::GetNodeCoord(int theObjID) +::GetNodeCoord(vtkIdType theObjID) { return GetInput()->GetPoint(theObjID); } @@ -453,9 +453,9 @@ VTKViewer_Actor /*! Maps object index of a node to corresponding VTK index */ -int +vtkIdType VTKViewer_Actor -::GetNodeVtkId( int theObjID ) +::GetNodeVtkId( vtkIdType theObjID ) { return theObjID; } @@ -466,7 +466,7 @@ VTKViewer_Actor */ vtkCell* VTKViewer_Actor -::GetElemCell(int theObjID) +::GetElemCell(vtkIdType theObjID) { return GetInput()->GetCell(theObjID); } @@ -474,9 +474,9 @@ VTKViewer_Actor /*! Maps VTK index of a cell to corresponding object index */ -int +vtkIdType VTKViewer_Actor -::GetElemObjId(int theVtkID) +::GetElemObjId(vtkIdType theVtkID) { return theVtkID; } @@ -487,7 +487,7 @@ VTKViewer_Actor */ int VTKViewer_Actor -::GetObjDimension( const int theObjId ) +::GetObjDimension( const vtkIdType theObjId ) { if ( vtkCell* aCell = GetElemCell(theObjId) ) return aCell->GetCellDimension(); diff --git a/src/VTKViewer/VTKViewer_Actor.h b/src/VTKViewer/VTKViewer_Actor.h index 805eaca23..1bc0e2625 100644 --- a/src/VTKViewer/VTKViewer_Actor.h +++ b/src/VTKViewer/VTKViewer_Actor.h @@ -31,6 +31,10 @@ #include #include +#include + +#include +#include #include #include @@ -138,34 +142,34 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor // For selection mapping purpose //! Maps VTK index of a node to corresponding object index virtual - int - GetNodeObjId(int theVtkID); + vtkIdType + GetNodeObjId(vtkIdType theVtkID); //! Get coordinates of a node for given object index virtual double* - GetNodeCoord(int theObjID); + GetNodeCoord(vtkIdType theObjID); //! Maps object index of a node to corresponding VTK index virtual - int - GetNodeVtkId(int theObjID); + vtkIdType + GetNodeVtkId(vtkIdType theObjID); //! Maps VTK index of a cell to corresponding object index virtual - int - GetElemObjId(int theVtkID); + vtkIdType + GetElemObjId(vtkIdType theVtkID); //! Get corresponding #vtkCell for given object index virtual vtkCell* - GetElemCell(int theObjID); + GetElemCell(vtkIdType theObjID); //---------------------------------------------------------------------------- //! Get dimension of corresponding mesh element virtual int - GetObjDimension( const int theObjId ); + GetObjDimension( const vtkIdType theObjId ); //! To insert some additional filters and then sets the given #vtkMapper virtual @@ -394,6 +398,22 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor bool myIsHighlighted; }; +struct vtkIdHasher +{ + static int HashCode(const vtkIdType theValue, const int theUpperBound) + { + return static_cast ((theValue & (std::numeric_limits::max)()) % theUpperBound + 1); + } + + static bool IsEqual( const vtkIdType& id1, const vtkIdType& id2 ) + { + return id1 == id2; + } +}; + +typedef NCollection_Map< vtkIdType, vtkIdHasher > TVtkIDsMap; +typedef NCollection_IndexedMap TIndexedMapOfVtkId; + #ifdef WIN32 #pragma warning ( default:4251 ) #endif diff --git a/src/VTKViewer/VTKViewer_AppendFilter.cxx b/src/VTKViewer/VTKViewer_AppendFilter.cxx index 02f9195cd..ac12cdc45 100644 --- a/src/VTKViewer/VTKViewer_AppendFilter.cxx +++ b/src/VTKViewer/VTKViewer_AppendFilter.cxx @@ -149,7 +149,7 @@ namespace { theInputID = theInputDataSetID = -1; - vtkIdType aNbInputs = (int)theRanges.size(); //!< TODO: conversion from size_t to int + vtkIdType aNbInputs = (vtkIdType)theRanges.size(); //!< TODO: conversion from size_t to vtkIdType if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs) return -1; @@ -201,7 +201,7 @@ namespace return; vtkIdType aStartId = 0; - vtkIdType aNbInputs = (int)theRanges.size(); //!< TODO: conversion from size_t to int + vtkIdType aNbInputs = (vtkIdType)theRanges.size(); //!< TODO: conversion from size_t to vtkIdType for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){ vtkIdType aRange = theRanges[aDataSetId]; if(aRange > theOutputID){ diff --git a/src/VTKViewer/VTKViewer_ArcBuilder.cxx b/src/VTKViewer/VTKViewer_ArcBuilder.cxx index ef848bda1..87b99e556 100644 --- a/src/VTKViewer/VTKViewer_ArcBuilder.cxx +++ b/src/VTKViewer/VTKViewer_ArcBuilder.cxx @@ -640,7 +640,7 @@ vtkIdType Build1DArc(vtkIdType cellId, vtkUnstructuredGrid* input, vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > >& theCollection, const std::vector< std::vector >& theScalarCollection, vtkPoints* thePoints, - std::map& thePntId2ScalarValue, + std::map& thePntId2ScalarValue, vtkIdType* &theIds){ vtkIdType aNbPoints = 0; vtkIdType anIdCounter = 0; diff --git a/src/VTKViewer/VTKViewer_ArcBuilder.h b/src/VTKViewer/VTKViewer_ArcBuilder.h index c73c71b95..b42cd9133 100644 --- a/src/VTKViewer/VTKViewer_ArcBuilder.h +++ b/src/VTKViewer/VTKViewer_ArcBuilder.h @@ -41,7 +41,7 @@ typedef std::list PntList; vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > >& theCollection, const std::vector< std::vector >& theScalarCollection, vtkPoints* thePoints, - std::map& thePntId2ScalarValue, + std::map& thePntId2ScalarValue, vtkIdType* &theIds); vtkIdType Build1DArc(vtkIdType cellId, diff --git a/src/VTKViewer/VTKViewer_CellLocationsArray.h b/src/VTKViewer/VTKViewer_CellLocationsArray.h index e3db50ac3..2a7b42a3d 100644 --- a/src/VTKViewer/VTKViewer_CellLocationsArray.h +++ b/src/VTKViewer/VTKViewer_CellLocationsArray.h @@ -31,7 +31,7 @@ # include # define TCellLocationsArray vtkIdTypeArray #else -# include +# include # define TCellLocationsArray vtkIntArray #endif diff --git a/src/VTKViewer/VTKViewer_ConvexTool.cxx b/src/VTKViewer/VTKViewer_ConvexTool.cxx index ef39a661d..079b08084 100644 --- a/src/VTKViewer/VTKViewer_ConvexTool.cxx +++ b/src/VTKViewer/VTKViewer_ConvexTool.cxx @@ -114,7 +114,7 @@ VTKViewer_Triangulator double anAbsoluteCoord[3]; myPoints->SetNumberOfPoints(aNumPts); vtkPoints *anInputPoints = theInput->GetPoints(); - for (int aPntId = 0; aPntId < aNumPts; aPntId++) { + for (auto aPntId = 0; aPntId < aNumPts; aPntId++) { anInputPoints->GetPoint(myPointIds[aPntId], anAbsoluteCoord); myPoints->SetPoint(aPntId, anAbsoluteCoord); } @@ -216,7 +216,7 @@ VTKViewer_Triangulator double aCellCenter[3] = {0.0, 0.0, 0.0}; { double aPntCoord[3]; - for (int aPntId = 0; aPntId < aNumPts; aPntId++) { + for (auto aPntId = 0; aPntId < aNumPts; aPntId++) { aPoints->GetPoint(GetPointId(aPntId),aPntCoord); if(DEBUG_TRIA_EXECUTE) cout<<"\taPntId = "< TFace2PointIds; TFace2PointIds aFace2PointIds; - for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { + for (auto aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { vtkCell* aFace = GetFace(aFaceId); GetCellNeighbors(theInput, theCellId, aFace, myCellIds); @@ -270,7 +270,7 @@ VTKViewer_Triangulator ::TPolygons aPolygons; - for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { + for (auto aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end()) continue; @@ -405,7 +405,7 @@ VTKViewer_Triangulator if(DEBUG_TRIA_EXECUTE) cout << "; Added = FALSE" << endl; } } - int aNbPoints = (int)aPointIds.size(); //!< TODO: conversion from size_t to int + size_t aNbPoints = aPointIds.size(); aCenter[0] /= aNbPoints; aCenter[1] /= aNbPoints; aCenter[2] /= aNbPoints; @@ -523,7 +523,7 @@ VTKViewer_Triangulator } if(!aSortedPointIds.empty()){ - int aNumFacePts = (int)aSortedPointIds.size(); //!< TODO: conversion from size_t to int + size_t aNumFacePts = aSortedPointIds.size(); ::TConnectivities aConnectivities(aNumFacePts); TSortedPointIds::const_iterator anIter = aSortedPointIds.begin(); TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end(); @@ -544,8 +544,8 @@ VTKViewer_Triangulator // To check, whether the polygons give a convex polyhedron or not if(theIsCheckConvex){ - int aNbPolygons = (int)aPolygons.size(); //!< TODO: conversion from size_t to int - for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) { + size_t aNbPolygons = aPolygons.size(); + for (size_t aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) { ::TPolygon& aPolygon = aPolygons[aPolygonId]; double* aNormal = aPolygon.myNormal; double* anOrigin = aPolygon.myOrigin; @@ -569,8 +569,8 @@ VTKViewer_Triangulator // To pass resulting set of the polygons to the output { - int aNbPolygons = (int)aPolygons.size(); //!< TODO: conversion from size_t to int - for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) { + size_t aNbPolygons = aPolygons.size(); + for (size_t aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) { ::TPolygon& aPolygon = aPolygons[aPolygonId]; if(DEBUG_TRIA_EXECUTE) cout << "PoilygonId="<InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]); if(theStoreMapping) VTKViewer_GeometryFilter::InsertId( theCellId, VTK_POLYGON, theVTK2ObjIds, theDimension2VTK2ObjIds ); @@ -636,7 +636,7 @@ VTKViewer_OrderedTriangulator zSize = aBounds[5] - aBounds[4]; double anAbsoluteCoord[3]; double aParamentrucCoord[3]; - for (int aPntId = 0; aPntId < aNumPts; aPntId++) { + for (auto aPntId = 0; aPntId < aNumPts; aPntId++) { myPoints->GetPoint(aPntId, anAbsoluteCoord); aParamentrucCoord[0] = xSize==0. ? 0. : ((anAbsoluteCoord[0] - aBounds[0]) / xSize); aParamentrucCoord[1] = ySize==0. ? 0. : ((anAbsoluteCoord[1] - aBounds[2]) / ySize); diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx index 0b392acaa..b905f7026 100644 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx @@ -24,7 +24,7 @@ // Author: Alexey PETROV #include "VTKViewer_ExtractUnstructuredGrid.h" -#include "VTKViewer_CellLocationsArray.h" +//#include "VTKViewer_CellLocationsArray.h" #include #include @@ -81,12 +81,12 @@ void VTKViewer_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping) } } -vtkIdType VTKViewer_ExtractUnstructuredGrid::GetInputId(int theOutId) const +vtkIdType VTKViewer_ExtractUnstructuredGrid::GetInputId(vtkIdType theOutId) const { if ( myPassAll || ( myCellIds.empty() && myCellTypes.empty() )) return theOutId; - if ( theOutId<0 || theOutId >= (int)myOut2InId.size() ) + if ( theOutId < 0 || theOutId >= (vtkIdType) myOut2InId.size() ) return -1; return myOut2InId[theOutId]; } @@ -281,7 +281,7 @@ void VTKViewer_ExtractUnstructuredGrid::BuildOut2InMap() // } -inline int InsertCell(vtkUnstructuredGrid *theInput, +inline vtkIdType InsertCell(vtkUnstructuredGrid *theInput, vtkCellArray *theConnectivity, vtkUnsignedCharArray* theCellTypesArray, vtkIdTypeArray*& theFaces, @@ -490,7 +490,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re } } if ( vtkIdType newNbElems = aConnectivity->GetNumberOfCells() ) { - VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); + vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New(); aCellLocationsArray->SetNumberOfComponents(1); aCellLocationsArray->SetNumberOfTuples(newNbElems); aConnectivity->InitTraversal(); @@ -592,7 +592,7 @@ int VTKViewer_ExtractUnstructuredGrid::RequestData(vtkInformation *vtkNotUsed(re } } if (vtkIdType newNbElems = aConnectivity->GetNumberOfCells() ) { - VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); + vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New(); aCellLocationsArray->SetNumberOfComponents(1); aCellLocationsArray->SetNumberOfTuples( newNbElems ); aConnectivity->InitTraversal(); diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h index 64ff52fa0..9da01f33c 100644 --- a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.h @@ -95,7 +95,7 @@ public: //! Computes a map out IDs to in IDs. Call it before GetInputId()!!! void BuildOut2InMap(); //! Gets the input id by output id. Call BuildOut2InMap() before - vtkIdType GetInputId(int theOutId) const; + vtkIdType GetInputId(vtkIdType theOutId) const; //! Gets the output id by input id. //vtkIdType GetOutputId(int theInId) const; diff --git a/src/VTKViewer/VTKViewer_Filter.cxx b/src/VTKViewer/VTKViewer_Filter.cxx index 8a0e4f562..cbf29f453 100644 --- a/src/VTKViewer/VTKViewer_Filter.cxx +++ b/src/VTKViewer/VTKViewer_Filter.cxx @@ -51,7 +51,7 @@ VTKViewer_Filter::~VTKViewer_Filter() * \param theCellId - cell id. * \retval \c true - if cell id is valid, else \c false. */ -bool VTKViewer_Filter::IsValid( VTKViewer_Actor* theActor, const int theCellId ) +bool VTKViewer_Filter::IsValid( VTKViewer_Actor* theActor, const vtkIdType theCellId ) { SetActor( theActor ); return IsValid( theCellId ); diff --git a/src/VTKViewer/VTKViewer_Filter.h b/src/VTKViewer/VTKViewer_Filter.h index 4dd15b106..ddc320c2e 100644 --- a/src/VTKViewer/VTKViewer_Filter.h +++ b/src/VTKViewer/VTKViewer_Filter.h @@ -29,6 +29,7 @@ #define VTKViewer_Filter_HeaderFile #include "VTKViewer.h" +#include #include #include @@ -50,8 +51,8 @@ public: VTKVIEWER_EXPORT VTKViewer_Filter(); VTKVIEWER_EXPORT virtual ~VTKViewer_Filter(); - VTKVIEWER_EXPORT bool IsValid( VTKViewer_Actor*, const int theId ); - VTKVIEWER_EXPORT virtual bool IsValid( const int theId ) const = 0; + VTKVIEWER_EXPORT bool IsValid( VTKViewer_Actor*, const vtkIdType theId ); + VTKVIEWER_EXPORT virtual bool IsValid( const vtkIdType theId ) const = 0; VTKVIEWER_EXPORT virtual int GetId() const = 0; VTKVIEWER_EXPORT virtual bool IsNodeFilter() const = 0; diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index a4ce3be23..d43232e7a 100644 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -192,7 +192,7 @@ VTKViewer_GeometryFilter } vtkIdType cellId; - int i; + vtkIdType i; int allVisible; vtkIdType npts = 0; vtkIdType const *pts = 0; @@ -276,7 +276,7 @@ VTKViewer_GeometryFilter quad1D2DTypes.insert( VTK_BIQUADRATIC_QUAD ); quad1D2DTypes.insert( VTK_QUADRATIC_POLYGON ); - for ( int i = 0; i < types->GetNumberOfTuples() && !hasQuad1D2D; ++i ) + for ( auto i = 0; i < types->GetNumberOfTuples() && !hasQuad1D2D; ++i ) hasQuad1D2D = quad1D2DTypes.count( types->GetValue(i) ); } buildArcs = hasQuad1D2D; @@ -339,7 +339,7 @@ VTKViewer_GeometryFilter // Loop over all cells now that visibility is known // (Have to compute visibility first for 3D cell boundaries) - int progressInterval = numCells/20 + 1; + vtkIdType progressInterval = numCells/20 + 1; TMapOfVectorId aDimension2VTK2ObjIds; if ( myStoreMapping ) aDimension2VTK2ObjIds.resize( 3 ); // max dimension is 2 @@ -466,7 +466,7 @@ VTKViewer_GeometryFilter { #ifdef SHOW_COINCIDING_3D_PAL21924 faceIdsTmp->SetNumberOfIds( npts ); - for ( int ai = 0; ai < npts; ai++ ) + for ( auto ai = 0; ai < npts; ai++ ) faceIdsTmp->SetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); #endif @@ -480,7 +480,7 @@ VTKViewer_GeometryFilter faceIds->InsertNextId(pts[faceVerts[1]]); faceIds->InsertNextId(pts[faceVerts[2]]); input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); #ifdef SHOW_COINCIDING_3D_PAL21924 bool process = nbNeighbors <= 0; #else @@ -523,7 +523,7 @@ VTKViewer_GeometryFilter { #ifdef SHOW_COINCIDING_3D_PAL21924 faceIdsTmp->SetNumberOfIds( npts ); - for ( int ai = 0; ai < npts; ai++ ) + for ( auto ai = 0; ai < npts; ai++ ) faceIdsTmp->SetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); #endif @@ -538,7 +538,7 @@ VTKViewer_GeometryFilter aCellType = VTK_QUAD; numFacePts = 4; input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); #ifdef SHOW_COINCIDING_3D_PAL21924 bool process = nbNeighbors <= 0; #else @@ -581,7 +581,7 @@ VTKViewer_GeometryFilter { #ifdef SHOW_COINCIDING_3D_PAL21924 faceIdsTmp->SetNumberOfIds( npts ); - for ( int ai = 0; ai < npts; ai++ ) + for ( auto ai = 0; ai < npts; ai++ ) faceIdsTmp->SetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); #endif @@ -596,7 +596,7 @@ VTKViewer_GeometryFilter faceIds->InsertNextId(pts[faceVerts[2]]); faceIds->InsertNextId(pts[faceVerts[3]]); input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); #ifdef SHOW_COINCIDING_3D_PAL21924 bool process = nbNeighbors <= 0; #else @@ -659,7 +659,7 @@ VTKViewer_GeometryFilter numFacePts = 4; } input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); #ifdef SHOW_COINCIDING_3D_PAL21924 bool process = nbNeighbors <= 0; #else @@ -702,7 +702,7 @@ VTKViewer_GeometryFilter { #ifdef SHOW_COINCIDING_3D_PAL21924 faceIdsTmp->SetNumberOfIds( npts ); - for ( int ai = 0; ai < npts; ai++ ) + for ( auto ai = 0; ai < npts; ai++ ) faceIdsTmp->SetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); #endif @@ -724,7 +724,7 @@ VTKViewer_GeometryFilter numFacePts = 6; } input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); #ifdef SHOW_COINCIDING_3D_PAL21924 bool process = nbNeighbors <= 0; #else @@ -748,7 +748,7 @@ VTKViewer_GeometryFilter if ( myShowInside ) { aCellType = VTK_LINE; - for ( int edgeID = 0; edgeID < 8; ++edgeID ) + for ( auto edgeID = 0; edgeID < 8; ++edgeID ) { const vtkIdType *edgeVerts = vtkPyramid::GetEdgeArray( edgeID ); if ( toShowEdge( pts[edgeVerts[0]], pts[edgeVerts[1]], cellId, input )) @@ -767,7 +767,7 @@ VTKViewer_GeometryFilter { #ifdef SHOW_COINCIDING_3D_PAL21924 faceIdsTmp->SetNumberOfIds( npts ); - for ( int ai = 0; ai < npts; ai++ ) + for ( auto ai = 0; ai < npts; ai++ ) faceIdsTmp->SetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); #endif @@ -787,7 +787,7 @@ VTKViewer_GeometryFilter numFacePts = 4; } input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); #ifdef SHOW_COINCIDING_3D_PAL21924 bool process = nbNeighbors <= 0; #else @@ -812,7 +812,7 @@ VTKViewer_GeometryFilter { vtkIdType nFaces = 0; const vtkIdType* ptIds = 0; - int idp = 0; + vtkIdType idp = 0; input->GetFaceStream(cellId, nFaces, ptIds); #ifdef SHOW_COINCIDING_3D_PAL21924 if ( !myShowInside ) @@ -833,7 +833,7 @@ VTKViewer_GeometryFilter { faceIds->Reset(); numFacePts = ptIds[idp]; - int pt0 = ++idp; + vtkIdType pt0 = ++idp; for (i = 0; i < numFacePts; i++) { faceIds->InsertNextId(ptIds[idp + i]); @@ -846,7 +846,7 @@ VTKViewer_GeometryFilter default:aCellType = VTK_POLYGON; } input->GetCellNeighbors(cellId, faceIds, cellIds); - int nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - cellIdsTmp->GetNumberOfIds(); if ( myShowInside && nbNeighbors > 0 && cellId < cellIds->GetId(0) ) continue; // don't add twice same internal face in wireframe mode #ifdef SHOW_COINCIDING_3D_PAL21924 @@ -940,7 +940,7 @@ VTKViewer_GeometryFilter #ifdef SHOW_COINCIDING_3D_PAL21924 if ( !myShowInside ) { - int npts1 = 0; + vtkIdType npts1 = 0; switch (aCellType ){ case VTK_QUADRATIC_TETRA: npts1 = 4; break; case VTK_QUADRATIC_HEXAHEDRON: npts1 = 8; break; @@ -951,7 +951,7 @@ VTKViewer_GeometryFilter } faceIdsTmp->SetNumberOfIds( npts1 ); if ( npts1 > 0 ) { - for (int ai=0; aiSetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); } @@ -959,8 +959,8 @@ VTKViewer_GeometryFilter #endif aCellType = VTK_TRIANGLE; numFacePts = 3; - int nbNeighbors = 0; - for (int j=0; j < cell->GetNumberOfFaces(); j++) + vtkIdType nbNeighbors = 0; + for (auto j=0; j < cell->GetNumberOfFaces(); j++) { vtkCell *face = cell->GetFace(j); if ( !myShowInside ) { @@ -1117,11 +1117,11 @@ VTKViewer_GeometryFilter } else { - int nbCoincident = 0; + vtkIdType nbCoincident = 0; #ifdef SHOW_COINCIDING_3D_PAL21924 - int nbPnt = npts - cell->GetNumberOfEdges(); + vtkIdType nbPnt = npts - cell->GetNumberOfEdges(); faceIdsTmp->SetNumberOfIds( nbPnt ); - for ( int ai = 0; ai < nbPnt; ai++ ) + for ( auto ai = 0; ai < nbPnt; ai++ ) faceIdsTmp->SetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); nbCoincident = cellIdsTmp->GetNumberOfIds(); @@ -1132,11 +1132,11 @@ VTKViewer_GeometryFilter { vtkCell * face = cell->GetFace( faceId ); input->GetCellNeighbors( cellId, face->GetPointIds(), cellIds ); - int nbNeighbors = cellIds->GetNumberOfIds() - nbCoincident; + vtkIdType nbNeighbors = cellIds->GetNumberOfIds() - nbCoincident; if ( nbNeighbors <= 0 ) { - int nbEdges = face->GetNumberOfPoints() / 2; - for ( int edgeId = 0; edgeId < nbEdges; ++edgeId ) + vtkIdType nbEdges = face->GetNumberOfPoints() / 2; + for ( auto edgeId = 0; edgeId < nbEdges; ++edgeId ) { vtkIdType p1 = ( edgeId ); // corner vtkIdType p2 = ( edgeId + nbEdges ); // medium @@ -1315,9 +1315,9 @@ VTKViewer_GeometryFilter } -vtkIdType VTKViewer_GeometryFilter::GetElemObjId( int theVtkID ) +vtkIdType VTKViewer_GeometryFilter::GetElemObjId( vtkIdType theVtkID ) { - if( theVtkID < 0 || theVtkID >= (int)myVTK2ObjIds.size() ) + if( theVtkID < 0 || theVtkID >= (vtkIdType)myVTK2ObjIds.size() ) return -1; return myVTK2ObjIds[theVtkID]; } @@ -1428,10 +1428,10 @@ void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId, } case VTK_QUADRATIC_POLYGON: { - int nbP = aCell->GetNumberOfPoints(); + vtkIdType nbP = aCell->GetNumberOfPoints(); std::vector< Pnt > pVec( nbP + 2 ); - for ( int i = 0; i < nbP/2; ++i ) + for ( auto i = 0; i < nbP/2; ++i ) { pVec[i*2 + 0] = CreatePnt( aCell, inputScalars, i ); pVec[i*2 + 1] = CreatePnt( aCell, inputScalars, i + nbP/2 ); @@ -1439,7 +1439,7 @@ void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId, pVec[ nbP ] = pVec[ 0 ]; pVec[ nbP+1 ] = pVec[ 1 ]; - for ( int i = 0; i < nbP; i += 2 ) + for ( auto i = 0; i < nbP; i += 2 ) { VTKViewer_ArcBuilder aBuilder( pVec[i], pVec[i+1], pVec[i+2], myMaxArcAngle ); aCollection.push_back( aBuilder.GetPoints() ); @@ -1460,7 +1460,7 @@ void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId, vtkIdType aTriangleId; vtkPolygon *aPlg = vtkPolygon::New(); - std::map aPntId2ScalarValue; + std::map aPntId2ScalarValue; aNbPoints = MergevtkPoints(aCollection, aScalarCollection, aPlg->GetPoints(), aPntId2ScalarValue, aNewPoints); aPlg->GetPointIds()->SetNumberOfIds(aNbPoints); @@ -1492,7 +1492,7 @@ void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId, aPlg->Delete(); } else { - std::map aPntId2ScalarValue; + std::map aPntId2ScalarValue; aNbPoints = MergevtkPoints(aCollection, aScalarCollection, output->GetPoints(), aPntId2ScalarValue, aNewPoints); if(outputScalars) for(vtkIdType i = 0; i < aNbPoints; i++) diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.h b/src/VTKViewer/VTKViewer_GeometryFilter.h index 9a641896f..87af7952b 100644 --- a/src/VTKViewer/VTKViewer_GeometryFilter.h +++ b/src/VTKViewer/VTKViewer_GeometryFilter.h @@ -93,12 +93,12 @@ public: * \brief Return input value theVtkID * \retval theVtkID */ - virtual vtkIdType GetNodeObjId(int theVtkID) { return theVtkID;} + virtual vtkIdType GetNodeObjId(vtkIdType theVtkID) { return theVtkID;} /*! \fn virtual vtkIdType GetElemObjId(int theVtkID); * \brief Return object ID by VTK ID cell * \retval myVTK2ObjIds[theVtkID] */ - virtual vtkIdType GetElemObjId(int theVtkID); + virtual vtkIdType GetElemObjId(vtkIdType theVtkID); virtual void SetQuadraticArcMode(bool theFlag); virtual bool GetQuadraticArcMode() const; diff --git a/src/VTKViewer/VTKViewer_InteractorStyle.cxx b/src/VTKViewer/VTKViewer_InteractorStyle.cxx index 0a74de2ef..827d0e3e6 100644 --- a/src/VTKViewer/VTKViewer_InteractorStyle.cxx +++ b/src/VTKViewer/VTKViewer_InteractorStyle.cxx @@ -1485,7 +1485,7 @@ void VTKViewer_InteractorStyle::RemoveFilter( const int theId ) *\param theIsNode - boolean flag, if \c true - node, else - cell. */ bool VTKViewer_InteractorStyle::IsValid( VTKViewer_Actor* theActor, - const int theId, + const vtkIdType theId, const bool theIsNode ) { std::map::const_iterator anIter; diff --git a/src/VTKViewer/VTKViewer_InteractorStyle.h b/src/VTKViewer/VTKViewer_InteractorStyle.h index 8a2fe13f7..ff9515fb5 100644 --- a/src/VTKViewer/VTKViewer_InteractorStyle.h +++ b/src/VTKViewer/VTKViewer_InteractorStyle.h @@ -101,7 +101,7 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt bool IsFilterPresent( const int ); void RemoveFilter( const int ); bool IsValid( VTKViewer_Actor* theActor, - const int theId, + const vtkIdType theId, const bool theIsNode = false ); void IncrementalPan ( const int incrX, const int incrY ); @@ -140,9 +140,9 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt VTKViewer_Actor *myPreViewActor, *myPreSelectionActor, *mySelectedActor; - int myElemId; + vtkIdType myElemId; int myEdgeId; - int myNodeId; + vtkIdType myNodeId; public: bool eventFilter(QObject* object, QEvent* event); diff --git a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx index 59933dcb5..8fa4f8138 100644 --- a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx @@ -679,7 +679,7 @@ bool VTKViewer_RenderWindowInteractor::unHighlightAll(){ * else sets visibility to false. * \li Emit render window modified, if flag \a update - true. */ -bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex, +bool VTKViewer_RenderWindowInteractor::highlight(const TIndexedMapOfVtkId& theMapIndex, VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor, TUpdateActor theFun, bool hilight, bool update) { @@ -702,7 +702,7 @@ bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteg } /*!Sets actors data.*/ -void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex, +void VTKViewer_RenderWindowInteractor::setActorData(const TIndexedMapOfVtkId& theMapIndex, VTKViewer_Actor * theMapActor, VTKViewer_Actor * theActor, TUpdateActor theFun) diff --git a/src/VTKViewer/VTKViewer_RenderWindowInteractor.h b/src/VTKViewer/VTKViewer_RenderWindowInteractor.h index ca321e38c..e1602572e 100644 --- a/src/VTKViewer/VTKViewer_RenderWindowInteractor.h +++ b/src/VTKViewer/VTKViewer_RenderWindowInteractor.h @@ -104,15 +104,15 @@ public: /** @name Selection Management */ //@{ - bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex, + bool highlightCell(const TIndexedMapOfVtkId& MapIndex, VTKViewer_Actor* theMapActor, bool hilight, bool update = true ); - bool highlightEdge(const TColStd_IndexedMapOfInteger& MapIndex, + bool highlightEdge(const TIndexedMapOfVtkId& MapIndex, VTKViewer_Actor* theMapActor, bool hilight, bool update = true ); - bool highlightPoint(const TColStd_IndexedMapOfInteger& MapIndex, + bool highlightPoint(const TIndexedMapOfVtkId& MapIndex, VTKViewer_Actor* theMapActor, bool hilight, bool update = true ); @@ -174,7 +174,7 @@ public: VTKViewer_Actor* /*theMapActor*/, VTKViewer_Actor* /*theActor*/) {} - typedef void (*TUpdateActor)(const TColStd_IndexedMapOfInteger& theMapIndex, + typedef void (*TUpdateActor)(const TIndexedMapOfVtkId& theMapIndex, VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor); protected: @@ -184,10 +184,10 @@ public: VTKViewer_InteractorStyle* myInteractorStyle; - bool highlight(const TColStd_IndexedMapOfInteger& theMapIndex, + bool highlight(const TIndexedMapOfVtkId& theMapIndex, VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor, TUpdateActor theFun, bool hilight, bool update); - void setActorData(const TColStd_IndexedMapOfInteger& theMapIndex, + void setActorData(const TIndexedMapOfVtkId& theMapIndex, VTKViewer_Actor* theMapActor, VTKViewer_Actor *theActor, TUpdateActor theFun); diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx index 9d7d8d6a3..3cd713052 100644 --- a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx @@ -64,7 +64,8 @@ int VTKViewer_ShrinkFilter::RequestData( outInfo->Get(vtkDataObject::DATA_OBJECT())); vtkPoints *newPts; - int i, j, numIds, abort=0; + vtkIdType i, numIds, abort=0; + int j; vtkIdType cellId, numCells, numPts; vtkIdType oldId, newId; double center[3], *p, pt[3]; @@ -178,9 +179,9 @@ void VTKViewer_ShrinkFilter::SetStoreMapping(int theStoreMapping){ /*!Return node object id by vtk node id. *\retval -1 - if no object, else return id. */ -vtkIdType VTKViewer_ShrinkFilter::GetNodeObjId(int theVtkID) +vtkIdType VTKViewer_ShrinkFilter::GetNodeObjId(vtkIdType theVtkID) { - if ( myVTK2ObjIds.empty() || theVtkID > (int)myVTK2ObjIds.size() ) + if ( myVTK2ObjIds.empty() || theVtkID > (vtkIdType)myVTK2ObjIds.size() ) return -1; return myVTK2ObjIds.at(theVtkID); } diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.h b/src/VTKViewer/VTKViewer_ShrinkFilter.h index b19c19a84..62321d267 100644 --- a/src/VTKViewer/VTKViewer_ShrinkFilter.h +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.h @@ -47,9 +47,9 @@ public: /*!Gets store mapping flag.*/ int GetStoreMapping(){ return myStoreMapping;} - virtual vtkIdType GetNodeObjId(int theVtkID); + virtual vtkIdType GetNodeObjId(vtkIdType theVtkID); /*!Return element id by vtk id.*/ - virtual vtkIdType GetElemObjId(int theVtkID) { return theVtkID;} + virtual vtkIdType GetElemObjId(vtkIdType theVtkID) { return theVtkID;} protected: VTKViewer_ShrinkFilter();