/*!
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;
if(mySelector.GetPointer()){
if(mySelectionMode != ActorSelection){
- TColStd_IndexedMapOfInteger aMapIndex;
+ SVTK_TIndexedMapOfVtkId aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
switch( mySelectionMode ) {
case NodeSelection:
vtkIdType anObjId = GetNodeObjId( aVtkId );
myIsPreselected = (anObjId >= 0);
if(myIsPreselected){
- const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+ const SVTK_TIndexedMapOfVtkId& aMapIndex = myPreHighlightActor->GetMapIndex();
int 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();
if ( anObjId >= 0 ) {
myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId);
if(myIsPreselected){
- const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+ const SVTK_TIndexedMapOfVtkId& aMapIndex = myPreHighlightActor->GetMapIndex();
int 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();
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
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
{
}
-const TColStd_IndexedMapOfInteger&
+const SVTK_TIndexedMapOfVtkId&
SVTK_Actor
::GetMapIndex() 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();
void
SVTK_Actor
::MapEdge(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const SVTK_TIndexedMapOfVtkId& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
//! 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
const SVTK_IndexedMapOfVtkIds& theMapCompositeIndex);
- const TColStd_IndexedMapOfInteger&
+ const SVTK_TIndexedMapOfVtkId&
GetMapIndex() const;
const SVTK_IndexedMapOfVtkIds&
GetMapCompositeIndex() const;
protected:
- TColStd_IndexedMapOfInteger myMapIndex;
+ SVTK_TIndexedMapOfVtkId myMapIndex;
SVTK_IndexedMapOfVtkIds myMapCompositeIndex;
vtkSmartPointer<vtkUnstructuredGrid> myUnstructuredGrid;
#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;
}
};
+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
if ( aVtkId >= 0 ) {
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);
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);
}
}
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
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
struct TIndexedMapOfInteger
{
- TColStd_IndexedMapOfInteger myMap;
+ SVTK_TIndexedMapOfVtkId myMap;
TIndexedMapOfInteger()
{}
TIndexedMapOfInteger(const TIndexedMapOfInteger& theIndexedMapOfInteger)
#include <string>
#include <vector>
+#include <limits>
+
+#include <NCollection_IndexedMap.hxx>
+#include <NCollection_Map.hxx>
#include <vtkLODActor.h>
#include <vtkProperty.h>
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
* 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);