#include "SMESH_ControlsDef.hxx"
#include "SMESH_ActorUtils.h"
-#include "SALOME_Transform.h"
-#include "SALOME_TransformFilter.h"
-#include "SALOME_PassThroughFilter.h"
-#include "SALOME_ExtractUnstructuredGrid.h"
+#include <VTKViewer_Transform.h>
+#include <VTKViewer_TransformFilter.h>
+#include <VTKViewer_PassThroughFilter.h>
+#include <VTKViewer_ExtractUnstructuredGrid.h>
// VTK Includes
#include <vtkObjectFactory.h>
vtkStandardNewMacro(SMESH_DeviceActor);
-SMESH_DeviceActor::SMESH_DeviceActor(){
+SMESH_DeviceActor::SMESH_DeviceActor()
+{
+ if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<<this);
+
myIsShrunk = false;
myIsShrinkable = false;
myRepresentation = eSurface;
myShrinkFilter = vtkShrinkFilter::New();
+ myStoreClippingMapping = false;
+
myExtractGeometry = SMESH_ExtractGeometry::New();
myExtractGeometry->SetReleaseDataFlag(true);
- myExtractGeometry->SetStoreMapping(true);
myIsImplicitFunctionUsed = false;
- myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New();
- myExtractUnstructuredGrid->SetStoreMapping(true);
-
+ myExtractUnstructuredGrid = VTKViewer_ExtractUnstructuredGrid::New();
+
myMergeFilter = vtkMergeFilter::New();
- myStoreMapping = false;
- myGeomFilter = SALOME_GeometryFilter::New();
+ myGeomFilter = VTKViewer_GeometryFilter::New();
- myTransformFilter = SALOME_TransformFilter::New();
+ myTransformFilter = VTKViewer_TransformFilter::New();
for(int i = 0; i < 6; i++)
- myPassFilter.push_back(SALOME_PassThroughFilter::New());
+ myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
}
SMESH_DeviceActor::~SMESH_DeviceActor(){
- if(MYDEBUG) MESSAGE("~SMESH_DeviceActor");
+ if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
+
myProperty->Delete();
- myMapper->RemoveAllInputs();
myMapper->Delete();
- myShrinkFilter->UnRegisterAllOutputs();
myShrinkFilter->Delete();
- myExtractUnstructuredGrid->UnRegisterAllOutputs();
myExtractUnstructuredGrid->Delete();
- myMergeFilter->UnRegisterAllOutputs();
myMergeFilter->Delete();
- myGeomFilter->UnRegisterAllOutputs();
myGeomFilter->Delete();
- myExtractGeometry->UnRegisterAllOutputs();
myExtractGeometry->Delete();
- myTransformFilter->UnRegisterAllOutputs();
myTransformFilter->Delete();
for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){
- myPassFilter[i]->UnRegisterAllOutputs();
myPassFilter[i]->Delete();
}
}
-void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){
- if (myStoreMapping == theStoreMapping)
- return;
- myStoreMapping = theStoreMapping;
- myGeomFilter->SetStoreMapping( myStoreMapping );
- Modified();
+void
+SMESH_DeviceActor::
+SetStoreGemetryMapping(bool theStoreMapping)
+{
+ myGeomFilter->SetStoreMapping(theStoreMapping);
+ SetStoreClippingMapping(theStoreMapping);
+}
+
+
+void
+SMESH_DeviceActor::
+SetStoreClippingMapping(bool theStoreMapping)
+{
+ myStoreClippingMapping = theStoreMapping;
+ myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
+ SetStoreIDMapping(theStoreMapping);
+}
+
+
+void
+SMESH_DeviceActor::
+SetStoreIDMapping(bool theStoreMapping)
+{
+ myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping);
}
SMESH_DeviceActor::
SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
{
- if(myIsImplicitFunctionUsed == theIsImplicitFunctionUsed)
- return;
-
int anId = 0;
if(theIsImplicitFunctionUsed)
myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() );
myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
myIsImplicitFunctionUsed = theIsImplicitFunctionUsed;
+ SetStoreClippingMapping(myStoreClippingMapping);
}
myExtractGeometry->SetInput(myMergeFilter->GetOutput());
int anId = 0;
- myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() );
+ SetImplicitFunctionUsed(myIsImplicitFunctionUsed);
myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 1
- myGeomFilter->SetStoreMapping( myStoreMapping );
myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() );
anId++; // 2
}
-SALOME_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
+VTKViewer_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){
return myExtractUnstructuredGrid;
}
bool anIsInitialized = theFunctor;
if(anIsInitialized){
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+
+ SetStoreIDMapping(true);
+ myExtractUnstructuredGrid->Update();
vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
+
aDataSet->ShallowCopy(aGrid);
vtkDoubleArray *aScalars = vtkDoubleArray::New();
}
void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
- SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
myExtractUnstructuredGrid->ClearRegisteredCells();
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
- myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
+ myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
theScalarBarActor->SetVisibility(anIsInitialized);
}
-void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
- SMESH_DeviceActor* theDeviceActor)
+void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor)
{
myExtractUnstructuredGrid->ClearRegisteredCells();
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
- myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll);
+ myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
- myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
+ myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
for( vtkIdType i = 0; i < aNbCells; i++ ){
}
-void SMESH_DeviceActor::SetTransform(SALOME_Transform* theTransform){
+void SMESH_DeviceActor::SetTransform(VTKViewer_Transform* theTransform){
myTransformFilter->SetTransform(theTransform);
}
void SMESH_DeviceActor::SetVisibility(int theMode){
- if(!myExtractUnstructuredGrid->GetInput() || GetUnstructuredGrid()->GetNumberOfCells()){
+ if(!myExtractUnstructuredGrid->GetInput() ||
+ GetUnstructuredGrid()->GetNumberOfCells())
+ {
vtkLODActor::SetVisibility(theMode);
}else{
vtkLODActor::SetVisibility(false);
anID = myExtractGeometry->GetNodeObjId(theVtkID);
vtkIdType aRetID = myVisualObj->GetNodeObjId(anID);
- if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; aRetID = "<<aRetID);
+ if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<<theVtkID<<"; anID = "<<anID<<"; aRetID = "<<aRetID);
return aRetID;
}