/*!
Gets dataowners ids list.
*/
-const TColStd_IndexedMapOfInteger&
+const SVTK_TIndexedMapOfVtkId&
LightApp_SVTKDataOwner
::GetIds() const
{
#ifndef DISABLE_VTKVIEWER
#include <TColStd_IndexedMapOfInteger.hxx>
+ #include "SVTK_Hash.h"
#include "SVTK_Selection.h"
#ifndef DISABLE_SALOMEOBJECT
#include "SALOME_InteractiveObject.hxx"
#endif
/*!Gets dataowners ids list.*/
- const TColStd_IndexedMapOfInteger& GetIds() const;
+ const SVTK_TIndexedMapOfVtkId& GetIds() const;
/*!Gets selection mode.*/
Selection_Mode GetMode() const;
SALOME_Actor* GetActor() const;
protected:
- mutable TColStd_IndexedMapOfInteger myIds;
+ mutable SVTK_TIndexedMapOfVtkId myIds;
SVTK_ViewWindow* GetActiveViewWindow() const;
SUIT_Desktop* myDesktop;
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)) {
if(mySelector.GetPointer()){
if(mySelectionMode != ActorSelection){
- TColStd_IndexedMapOfInteger aMapIndex;
+ SVTK_TIndexedMapOfVtkId aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
switch( mySelectionMode ) {
case NodeSelection:
myHighlightActor->MapCells( this, aMapIndex );
break;
case EdgeOfCellSelection:
- SVTK_IndexedMapOfIds aMapCompositeIndex;
+ SVTK_IndexedMapOfVtkIds aMapCompositeIndex;
mySelector->GetCompositeIndex( getIO(), aMapCompositeIndex );
myHighlightActor->GetProperty()->SetRepresentationToWireframe();
myHighlightActor->MapEdge( this, aMapCompositeIndex );
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();
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();
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 );
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 );
}
}
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);
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 );
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 );
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 );
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 );
{
}
-const TColStd_IndexedMapOfInteger&
+const SVTK_TIndexedMapOfVtkId&
SVTK_Actor
::GetMapIndex() const
{
}
-const SVTK_IndexedMapOfIds&
+const SVTK_IndexedMapOfVtkIds&
SVTK_Actor
::GetMapCompositeIndex() const
{
void
SVTK_Actor
::MapCells(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const SVTK_TIndexedMapOfVtkId& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
void
SVTK_Actor
::MapPoints(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const SVTK_TIndexedMapOfVtkId& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
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
void
SVTK_Actor
::MapEdge(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const SVTK_TIndexedMapOfVtkId& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
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<int> aNodesIds = theMapCompositeIndex( ind );
+ vtkIdType aNbOfParts = theMapCompositeIndex.Extent();
+ for(vtkIdType ind = 1; ind <= aNbOfParts; ind++){
+ std::vector<vtkIdType> aNodesIds = theMapCompositeIndex( ind );
vtkSmartPointer<vtkIdList> ids = vtkSmartPointer<vtkIdList>::New();
ids->InsertNextId(theMapActor->GetNodeVtkId( aNodesIds[0] ) );
ids->InsertNextId(theMapActor->GetNodeVtkId( aNodesIds[1] ) );
//! 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<vtkUnstructuredGrid> myUnstructuredGrid;
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;
/*!
Maps VTK index of a node to corresponding object index
*/
-int
+vtkIdType
SVTK_DeviceActor
-::GetNodeObjId(int theVtkID)
+::GetNodeObjId(vtkIdType theVtkID)
{
return theVtkID;
}
*/
double*
SVTK_DeviceActor
-::GetNodeCoord(int theObjID)
+::GetNodeCoord(vtkIdType theObjID)
{
return GetInput()->GetPoint(theObjID);
}
*/
vtkCell*
SVTK_DeviceActor
-::GetElemCell(int theObjID)
+::GetElemCell(vtkIdType theObjID)
{
return GetInput()->GetCell(theObjID);
}
/*!
Maps VTK index of a cell to corresponding object index
*/
-int
+vtkIdType
SVTK_DeviceActor
-::GetElemObjId(int theVtkID)
+::GetElemObjId(vtkIdType theVtkID)
{
return theVtkID;
}
/** @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
#include <vector>
#include <NCollection_IndexedMap.hxx>
+#include <NCollection_Map.hxx>
#include <Standard_Integer.hxx>
+#include <vtkType.h>
+#include <limits>
typedef std::vector<Standard_Integer> SVTK_ListOfInteger;
+typedef std::vector<vtkIdType> SVTK_ListOfVtk;
class SVTK_Hasher {
public:
- static Standard_Integer HashCode(const std::vector<Standard_Integer> 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<Standard_Integer> 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<vtkIdType> 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<int> ((theValue & (std::numeric_limits<vtkIdType>::max)()) % theUpperBound + 1);
+ }
+
+ static bool IsEqual( const vtkIdType& id1, const vtkIdType& id2 )
+ {
+ return id1 == id2;
+ }
};
typedef NCollection_IndexedMap<SVTK_ListOfInteger,SVTK_Hasher> SVTK_IndexedMapOfIds;
+typedef NCollection_IndexedMap<SVTK_ListOfVtk, SVTK_vtkHasher> SVTK_IndexedMapOfVtkIds;
+typedef NCollection_Map< vtkIdType, svtkIdHasher > SVTK_TVtkIDsMap;
+typedef NCollection_Map< vtkIdType, svtkIdHasher >::Iterator SVTK_TVtkIDsMapIterator;
+typedef NCollection_IndexedMap<vtkIdType,svtkIdHasher> SVTK_TIndexedMapOfVtkId;
#endif // SVTK_HASH_H
{
Selection_Mode aSelectionMode = GetSelector()->SelectionMode();
double* aCoords = NULL;
- int aVtkId;
+ vtkIdType aVtkId;
bool isTrueType = false;
if( myCurrFocalPointType == SVTK::StartFocalPointSelection ||
aVtkId = myPointPicker->GetPointId();
if ( aVtkId >= 0 )
{
- int anObjId = anActor->GetNodeObjId( aVtkId );
+ vtkIdType anObjId = anActor->GetNodeObjId( aVtkId );
aCoords = anActor->GetNodeCoord(anObjId);
isTrueType = true;
}
0.0,
GetCurrentRenderer() );
aVtkId = aCellPicker->GetCellId();
- int aCellId = anActor->GetElemObjId( aVtkId );
+ vtkIdType aCellId = anActor->GetElemObjId( aVtkId );
if( aSelectionMode == EdgeSelection )
isTrueType = anActor->GetObjDimension( aCellId ) == 1;
{
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 );
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())
{
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){
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);
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 );
}
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);
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();
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);
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());
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 )
{
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);
}
}
void
SVTK_SelectorDef
::GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_IndexedMapOfIds& theIds )
+ SVTK_IndexedMapOfVtkIds& theIds )
{
TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter != myMapIOSubCompositeIndex.end() )
bool
SVTK_SelectorDef
::AddOrRemoveCompositeIndex( const Handle( SALOME_InteractiveObject )& theIO,
- const SVTK_IndexedMapOfIds& theIds,
+ const SVTK_IndexedMapOfVtkIds& theIds,
bool theIsModeShift)
{
TMapIOSubCompositeIndex::iterator aMapIter = myMapIOSubCompositeIndex.find( theIO );
if( aMapIter == myMapIOSubCompositeIndex.end() ) {
- SVTK_IndexedMapOfIds anEmpty;
+ SVTK_IndexedMapOfVtkIds anEmpty;
aMapIter = myMapIOSubCompositeIndex.insert( TMapIOSubCompositeIndex::value_type( theIO, anEmpty ) ).first;
}
- SVTK_IndexedMapOfIds& aMapIndex = aMapIter->second;
+ SVTK_IndexedMapOfVtkIds& aMapIndex = aMapIter->second;
if( !theIsModeShift )
aMapIndex.Clear();
bool
SVTK_SelectorDef
::AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds,
+ SVTK_ListOfVtk theIds,
bool theIsModeShift)
{
TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter == myMapIOSubCompositeIndex.end() ) {
- SVTK_IndexedMapOfIds anEmpty;
+ SVTK_IndexedMapOfVtkIds anEmpty;
anIter = myMapIOSubCompositeIndex.insert(TMapIOSubCompositeIndex::value_type( theIO,anEmpty ) ).first;
}
- SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+ SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
bool anIsContains = aMapIndex.Contains( theIds ) == Standard_True;
if ( anIsContains )
void
SVTK_SelectorDef
::RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds )
+ SVTK_ListOfVtk theIds )
{
if(IsCompositeIndexSelected( theIO, theIds ) ) {
TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
- SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+ SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
removeCompositeIndex( aMapIndex,theIds );
}
}
bool
SVTK_SelectorDef
::IsCompositeIndexSelected( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger theIds ) const
+ SVTK_ListOfVtk theIds ) const
{
TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter != myMapIOSubCompositeIndex.end() ) {
- const SVTK_IndexedMapOfIds& aMapIndex = anIter->second;
+ const SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
return aMapIndex.Contains( theIds ) == Standard_True;
}
return false;
virtual
void
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
virtual
void
GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_IndexedMapOfIds& theIds ) = 0;
+ SVTK_IndexedMapOfVtkIds& theIds ) = 0;
//! Change composite indices of subselection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const SVTK_IndexedMapOfIds& theIds,
+ const SVTK_IndexedMapOfVtkIds& theIds,
bool theIsModeShift) = 0;
//! Change composite index of subslection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger ids,
+ SVTK_ListOfVtk ids,
bool theIsModeShift) = 0;
//! Change composite index of subslection for given #SALOME_InteractiveObject
virtual
void
RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger ids ) = 0;
+ SVTK_ListOfVtk ids ) = 0;
//! Check, if the given composite index is present in subselection
virtual
bool
IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
- SVTK_ListOfInteger ids ) const = 0;
+ SVTK_ListOfVtk ids ) const = 0;
//! Clear composite indexes subselection
virtual
virtual
void
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
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
struct TIndexedMapOfInteger
{
- TColStd_IndexedMapOfInteger myMap;
+ SVTK_TIndexedMapOfVtkId myMap;
TIndexedMapOfInteger()
{}
TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger)
TMapIOSubIndex myMapIOSubIndex;
typedef std::map<Handle(SALOME_InteractiveObject),
- SVTK_IndexedMapOfIds,
+ SVTK_IndexedMapOfVtkIds,
TIOLessThan> TMapIOSubCompositeIndex;
TMapIOSubCompositeIndex myMapIOSubCompositeIndex;
VTKViewer_Algorithm.h
VTKViewer_ArcBuilder.h
VTKViewer_CellCenters.h
- VTKViewer_CellLocationsArray.h
VTKViewer_ConvexTool.h
VTKViewer_DataSetMapper.h
VTKViewer_ExtractUnstructuredGrid.h
VTKViewer_AppendFilter.cxx
VTKViewer_ArcBuilder.cxx
VTKViewer_CellCenters.cxx
- VTKViewer_CellLocationsArray.cxx
VTKViewer_ConvexTool.cxx
VTKViewer_DataSetMapper.cxx
VTKViewer_ExtractUnstructuredGrid.cxx
/*!
Maps VTK index of a node to corresponding object index
*/
-int
+vtkIdType
VTKViewer_Actor
-::GetNodeObjId(int theVtkID)
+::GetNodeObjId(vtkIdType theVtkID)
{
return theVtkID;
}
*/
double*
VTKViewer_Actor
-::GetNodeCoord(int theObjID)
+::GetNodeCoord(vtkIdType theObjID)
{
return GetInput()->GetPoint(theObjID);
}
/*!
Maps object index of a node to corresponding VTK index
*/
-int
+vtkIdType
VTKViewer_Actor
-::GetNodeVtkId( int theObjID )
+::GetNodeVtkId( vtkIdType theObjID )
{
return theObjID;
}
*/
vtkCell*
VTKViewer_Actor
-::GetElemCell(int theObjID)
+::GetElemCell(vtkIdType theObjID)
{
return GetInput()->GetCell(theObjID);
}
/*!
Maps VTK index of a cell to corresponding object index
*/
-int
+vtkIdType
VTKViewer_Actor
-::GetElemObjId(int theVtkID)
+::GetElemObjId(vtkIdType theVtkID)
{
return theVtkID;
}
*/
int
VTKViewer_Actor
-::GetObjDimension( const int theObjId )
+::GetObjDimension( const vtkIdType theObjId )
{
if ( vtkCell* aCell = GetElemCell(theObjId) )
return aCell->GetCellDimension();
#include <string>
#include <vector>
+#include <limits>
+
+#include <NCollection_IndexedMap.hxx>
+#include <NCollection_Map.hxx>
#include <vtkLODActor.h>
#include <vtkProperty.h>
// 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
bool myIsHighlighted;
};
+struct vtkIdHasher
+{
+ static int HashCode(const vtkIdType theValue, const int theUpperBound)
+ {
+ return static_cast<int> ((theValue & (std::numeric_limits<vtkIdType>::max)()) % theUpperBound + 1);
+ }
+
+ static bool IsEqual( const vtkIdType& id1, const vtkIdType& id2 )
+ {
+ return id1 == id2;
+ }
+};
+
+typedef NCollection_Map< vtkIdType, vtkIdHasher > TVtkIDsMap;
+typedef NCollection_IndexedMap<vtkIdType,vtkIdHasher> TIndexedMapOfVtkId;
+
#ifdef WIN32
#pragma warning ( default:4251 )
#endif
{
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;
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){
vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > >& theCollection,
const std::vector< std::vector<double> >& theScalarCollection,
vtkPoints* thePoints,
- std::map<int, double>& thePntId2ScalarValue,
+ std::map<vtkIdType, double>& thePntId2ScalarValue,
vtkIdType* &theIds){
vtkIdType aNbPoints = 0;
vtkIdType anIdCounter = 0;
vtkIdType MergevtkPoints(const std::vector< vtkSmartPointer< vtkPoints > >& theCollection,
const std::vector< std::vector<double> >& theScalarCollection,
vtkPoints* thePoints,
- std::map<int, double>& thePntId2ScalarValue,
+ std::map<vtkIdType, double>& thePntId2ScalarValue,
vtkIdType* &theIds);
vtkIdType Build1DArc(vtkIdType cellId,
# include <vtkIdTypeArray.h>
# define TCellLocationsArray vtkIdTypeArray
#else
-# include <vtkIntArray.h>
+# include <vtkLongLongArray.h>
# define TCellLocationsArray vtkIntArray
#endif
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);
}
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 = "<<GetPointId(aPntId)<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}\n";
aCellCenter[0] += aPntCoord[0];
}
double aCellLength = GetCellLength();
- int aNumFaces = GetNumFaces();
+ vtkIdType aNumFaces = GetNumFaces();
static double EPS = 1.0E-2;
double aDistEps = aCellLength/3.0 * EPS;
typedef std::set<TPointIds> 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);
::TPolygons aPolygons;
- for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ for (auto aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end())
continue;
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;
}
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();
// 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;
// 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="<<aPolygonId<<" | ";
TConnectivities& aConnectivities = aPolygon.myConnectivities;
cout << aConnectivities[i] << ",";
cout << endl;
}
- int aNbPoints = (int)aConnectivities.size(); //!< TODO: conversion from size_t to int
+ int aNbPoints = (int)aConnectivities.size();
vtkIdType aNewCellId = theOutput->InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]);
if(theStoreMapping)
VTKViewer_GeometryFilter::InsertId( theCellId, VTK_POLYGON, theVTK2ObjIds, theDimension2VTK2ObjIds );
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);
// Author: Alexey PETROV
#include "VTKViewer_ExtractUnstructuredGrid.h"
-#include "VTKViewer_CellLocationsArray.h"
+//#include "VTKViewer_CellLocationsArray.h"
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
}
}
-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];
}
// }
-inline int InsertCell(vtkUnstructuredGrid *theInput,
+inline vtkIdType InsertCell(vtkUnstructuredGrid *theInput,
vtkCellArray *theConnectivity,
vtkUnsignedCharArray* theCellTypesArray,
vtkIdTypeArray*& theFaces,
}
}
if ( vtkIdType newNbElems = aConnectivity->GetNumberOfCells() ) {
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples(newNbElems);
aConnectivity->InitTraversal();
}
}
if (vtkIdType newNbElems = aConnectivity->GetNumberOfCells() ) {
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+ vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
aCellLocationsArray->SetNumberOfComponents(1);
aCellLocationsArray->SetNumberOfTuples( newNbElems );
aConnectivity->InitTraversal();
//! 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;
* \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 );
#define VTKViewer_Filter_HeaderFile
#include "VTKViewer.h"
+#include <vtkType.h>
#include <Standard_Transient.hxx>
#include <Standard_DefineHandle.hxx>
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;
}
vtkIdType cellId;
- int i;
+ vtkIdType i;
int allVisible;
vtkIdType npts = 0;
vtkIdType const *pts = 0;
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;
// 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
{
#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
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
{
#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
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
{
#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
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
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
{
#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
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
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 ))
{
#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
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
{
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 )
{
faceIds->Reset();
numFacePts = ptIds[idp];
- int pt0 = ++idp;
+ vtkIdType pt0 = ++idp;
for (i = 0; i < numFacePts; i++)
{
faceIds->InsertNextId(ptIds[idp + i]);
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
#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;
}
faceIdsTmp->SetNumberOfIds( npts1 );
if ( npts1 > 0 ) {
- for (int ai=0; ai<npts1; ai++)
+ for (auto ai=0; ai<npts1; ai++)
faceIdsTmp->SetId( ai, pts[ai] );
input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
}
#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 ) {
}
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();
{
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
}
-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];
}
}
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 );
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() );
vtkIdType aTriangleId;
vtkPolygon *aPlg = vtkPolygon::New();
- std::map<int, double> aPntId2ScalarValue;
+ std::map<vtkIdType, double> aPntId2ScalarValue;
aNbPoints = MergevtkPoints(aCollection, aScalarCollection, aPlg->GetPoints(), aPntId2ScalarValue, aNewPoints);
aPlg->GetPointIds()->SetNumberOfIds(aNbPoints);
aPlg->Delete();
}
else {
- std::map<int, double> aPntId2ScalarValue;
+ std::map<vtkIdType, double> aPntId2ScalarValue;
aNbPoints = MergevtkPoints(aCollection, aScalarCollection, output->GetPoints(), aPntId2ScalarValue, aNewPoints);
if(outputScalars)
for(vtkIdType i = 0; i < aNbPoints; i++)
* \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;
*\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<int, Handle(VTKViewer_Filter)>::const_iterator anIter;
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 );
VTKViewer_Actor *myPreViewActor, *myPreSelectionActor, *mySelectedActor;
- int myElemId;
+ vtkIdType myElemId;
int myEdgeId;
- int myNodeId;
+ vtkIdType myNodeId;
public:
bool eventFilter(QObject* object, QEvent* event);
* 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)
{
}
/*!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)
/** @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 );
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:
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);
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];
/*!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);
}
/*!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();