#include "VISU_MergeFilter.hxx"
#include "VISU_ElnoDisassembleFilter.hxx"
#include "VISU_PipeLineUtils.hxx"
+#include "SALOME_ExtractGeometry.h"
+#include <vtkPlane.h>
#include <vtkWarpVector.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCellDataToPointData.h>
#include <vtkPointDataToCellData.h>
+#include <vtkImplicitFunctionCollection.h>
//----------------------------------------------------------------------------
myCellDataToPointData = vtkCellDataToPointData::New();
myScalarsElnoDisassembleFilter = VISU_ElnoDisassembleFilter::New();
+
+ vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+ anImplicitBoolean->SetOperationTypeToIntersection();
+
+ myExtractGeometry = SALOME_ExtractGeometry::New();
+ myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
}
//----------------------------------------------------------------------------
{
vtkDataSet* aScalars = GetScalars();
myScalarsElnoDisassembleFilter->SetInput(aScalars);
- myScalarsExtractor->SetInput(myScalarsElnoDisassembleFilter->GetOutput());
+ myExtractGeometry->SetInput(myScalarsElnoDisassembleFilter->GetOutput());
+ myScalarsExtractor->SetInput(myExtractGeometry->GetOutput());
if(VISU::IsDataOnCells(myScalarsElnoDisassembleFilter->GetOutput()))
GetMapper()->SetScalarModeToUseCellData();
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
if(VISU_DeformedShapeAndScalarMapPL *aPipeLine = dynamic_cast<VISU_DeformedShapeAndScalarMapPL*>(thePipeLine)){
+ SetImplicitFunction(aPipeLine->GetImplicitFunction());
SetScale(aPipeLine->GetScale());
SetScalars(aPipeLine->GetScalars());
}
return myScalars.GetPointer();
}
+//----------------------------------------------------------------------------
+/*!
+ * Removes all clipping planes (for myScalars)
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::RemoveAllClippingPlanes()
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->RemoveAllItems();
+ aBoolean->Modified();
+ }
+ Superclass::RemoveAllClippingPlanes();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Removes a clipping plane (for myScalars)
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::RemoveClippingPlane(vtkIdType theID)
+{
+ if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ if(theID >= 0 && theID < aFunction->GetNumberOfItems())
+ aFunction->RemoveItem(theID);
+ aBoolean->Modified();
+ }
+ Superclass::RemoveClippingPlane(theID);
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Adds a clipping plane (for myScalars)
+ */
+bool
+VISU_DeformedShapeAndScalarMapPL
+::AddClippingPlane(vtkPlane* thePlane)
+{
+ if (thePlane) {
+ if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
+ vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+ aFunction->AddItem(thePlane);
+
+ // Check, that at least one cell present after clipping.
+ // This check was introduced because of bug IPAL8849.
+ vtkDataSet* aClippedDataSet = GetClippedInput();
+ if(aClippedDataSet->GetNumberOfCells() < 1)
+ return false;
+ }
+ }
+ return Superclass::AddClippingPlane(thePlane);
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Sets implicit function of clipping
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+ myExtractGeometry->SetImplicitFunction(theFunction);
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Gets implicit function of clipping
+ */
+vtkImplicitFunction *
+VISU_DeformedShapeAndScalarMapPL
+::GetImplicitFunction()
+{
+ return myExtractGeometry->GetImplicitFunction();
+}
+
//----------------------------------------------------------------------------
/*!
* Sets scale for deformed shape
class vtkCellDataToPointData;
class vtkPointDataToCellData;
class VISU_ElnoDisassembleFilter;
+class SALOME_ExtractGeometry;
+class vtkImplicitFunction;
//----------------------------------------------------------------------------
vtkDataSet*
GetScalars();
+ virtual
+ void
+ RemoveAllClippingPlanes();
+
+ virtual
+ void
+ RemoveClippingPlane(vtkIdType theID);
+
+ virtual
+ bool
+ AddClippingPlane(vtkPlane* thePlane);
+
+ virtual
+ void
+ SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+ virtual
+ vtkImplicitFunction*
+ GetImplicitFunction();
+
public:
//! Redefined method for initialization of the pipeline.
virtual
VISU_FieldTransform* myScalarsFieldTransform;
VISU_Extractor* myScalarsExtractor;
VISU_ElnoDisassembleFilter* myScalarsElnoDisassembleFilter;
+ SALOME_ExtractGeometry* myExtractGeometry;
};
#endif