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-Tag: V9_7_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Focc%2F20256_v2;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 3d637ae40..b7cded04f 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 8d9ffcea6..84791de9e 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 9642ce0ff..d71c17d7e 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 8eef21bd2..c54cc6bb9 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 69c9337b6..fe576d1e6 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 80b1e7c33..246edae95 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 c3f60d92f..06beaa0d5 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 0b40e3414..32fe4480c 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 c0aa791c7..92c2b8199 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 02840da43..6eff6187a 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 c69227f5e..98d4427b2 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 5b9be5f73..c9cedbf9e 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 63b191753..b4b8079ac 100644 --- a/src/VTKViewer/CMakeLists.txt +++ b/src/VTKViewer/CMakeLists.txt @@ -72,7 +72,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 @@ -156,7 +155,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 9d636ca5c..202b8019f 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 0b4b53cb7..d00786a55 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 11c8dd647..9cd3778ef 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 e41504917..916b3c8e8 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 075bb2841..513107186 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 abc386a84..4c88e388f 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 ec76a011b..603c29af0 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 7af1a7e2a..ea3ccdf19 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 9d42d9d7c..cc72624ea 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 0a03f7ebe..118fd4fa6 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 742e60b02..50a27b0b0 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 ab252568d..577206a2d 100644 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -285,7 +285,7 @@ VTKViewer_GeometryFilter } vtkIdType cellId; - int i; + vtkIdType i; int allVisible; vtkIdType npts = 0; vtkIdType const *pts = 0; @@ -369,7 +369,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; @@ -432,7 +432,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 @@ -559,7 +559,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 @@ -573,7 +573,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 @@ -616,7 +616,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 @@ -631,7 +631,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 @@ -674,7 +674,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 @@ -689,7 +689,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 @@ -752,7 +752,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 @@ -795,7 +795,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 @@ -817,7 +817,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 @@ -841,7 +841,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 )) @@ -860,7 +860,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 @@ -880,7 +880,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 @@ -905,7 +905,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 ) @@ -926,7 +926,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]); @@ -939,7 +939,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 @@ -1033,7 +1033,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; @@ -1044,7 +1044,7 @@ VTKViewer_GeometryFilter } faceIdsTmp->SetNumberOfIds( npts1 ); if ( npts1 > 0 ) { - for (int ai=0; aiSetId( ai, pts[ai] ); input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp); } @@ -1052,8 +1052,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 ) { @@ -1210,11 +1210,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(); @@ -1225,11 +1225,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 @@ -1408,9 +1408,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]; } @@ -1521,10 +1521,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 ); @@ -1532,7 +1532,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() ); @@ -1553,7 +1553,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); @@ -1585,7 +1585,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 333814674..af65b0267 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 a116739b2..c2e1f862d 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 435852c65..8d6d9491b 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 e39ed18cb..da50de021 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 60123ce57..8fa0761e7 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 55d29176c..ba7713595 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 9c5e78cfa..2a382c9af 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();