aSelEntIter.Value()->SetActiveForSelection();
}
- theSelection->SetSelectionState (SelectMgr_SOS_Activated);
-
- myTolerances.Add (theSelection->Sensitivity());
- myToUpdateTolerance = Standard_True;
+ if (theSelection->GetSelectionState() != SelectMgr_SOS_Activated)
+ {
+ theSelection->SetSelectionState (SelectMgr_SOS_Activated);
+ myTolerances.Add (theSelection->Sensitivity());
+ myToUpdateTolerance = Standard_True;
+ }
}
//============================================================================
aSelEntIter.Value()->ResetSelectionActiveStatus();
}
- theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);
-
- myTolerances.Decrement (theSelection->Sensitivity());
- myToUpdateTolerance = Standard_True;
+ if (theSelection->GetSelectionState() == SelectMgr_SOS_Activated)
+ {
+ theSelection->SetSelectionState (SelectMgr_SOS_Deactivated);
+ myTolerances.Decrement (theSelection->Sensitivity());
+ myToUpdateTolerance = Standard_True;
+ }
}
#include <vtkCellData.h>
#include <vtkDoubleArray.h>
#include <vtkIdList.h>
-#include <vtkIdTypeArray.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#ifdef _MSC_VER
{
vtkIdType aPointIdVTK = thePointId;
myPolyData->InsertNextCell (VTK_VERTEX, 1, &aPointIdVTK);
- const vtkIdType aShapeIDVTK = theShapeID;
- mySubShapeIDs->InsertNextTupleValue (&aShapeIDVTK);
- const vtkIdType aType = theMeshType;
- myMeshTypes->InsertNextTupleValue (&aType);
+ insertNextSubShapeId (theShapeID, theMeshType);
}
//================================================================
{
vtkIdType aPoints[2] = { thePointId1, thePointId2 };
myPolyData->InsertNextCell (VTK_LINE, 2, aPoints);
- const vtkIdType aShapeIDVTK = theShapeID;
- mySubShapeIDs->InsertNextTupleValue (&aShapeIDVTK);
- const vtkIdType aType = theMeshType;
- myMeshTypes->InsertNextTupleValue (&aType);
+ insertNextSubShapeId (theShapeID, theMeshType);
}
//================================================================
}
myPolyData->InsertNextCell (VTK_POLY_LINE, anIdList);
- const vtkIdType aShapeIDVTK = theShapeID;
- mySubShapeIDs->InsertNextTupleValue (&aShapeIDVTK);
- const vtkIdType aType = theMeshType;
- myMeshTypes->InsertNextTupleValue (&aType);
+ insertNextSubShapeId (theShapeID, theMeshType);
}
}
{
vtkIdType aPoints[3] = { thePointId1, thePointId2, thePointId3 };
myPolyData->InsertNextCell (VTK_TRIANGLE, 3, aPoints);
- const vtkIdType aShapeIDVTK = theShapeID;
- mySubShapeIDs->InsertNextTupleValue (&aShapeIDVTK);
- const vtkIdType aType = theMeshType;
- myMeshTypes->InsertNextTupleValue (&aType);
+ insertNextSubShapeId (theShapeID, theMeshType);
}
#endif
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
+#include <vtkIdTypeArray.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
vtkPolyData* getVtkPolyData() const
{ return myPolyData; }
+private:
+
+ //! Wrapper over vtkGenericDataArray::InsertNextTypedTuple().
+ void insertNextSubShapeId (IVtk_IdType theShapeID,
+ IVtk_MeshType theMeshType)
+ {
+ const vtkIdType aShapeIDVTK = theShapeID;
+ const vtkIdType aType = theMeshType;
+ #if (VTK_MAJOR_VERSION > 7) || (VTK_MAJOR_VERSION == 7 && VTK_MINOR_VERSION >= 1)
+ mySubShapeIDs->InsertNextTypedTuple (&aShapeIDVTK);
+ myMeshTypes->InsertNextTypedTuple (&aType);
+ #else
+ mySubShapeIDs->InsertNextTupleValue (&aShapeIDVTK);
+ myMeshTypes->InsertNextTupleValue (&aType);
+ #endif
+ }
+
private:
vtkSmartPointer< vtkPolyData > myPolyData; //!< Shape geometry as vtkPolyData
vtkSmartPointer< vtkIdTypeArray > mySubShapeIDs; //!< Array of sub-shapes ids