myMapperTable(VISU_LookupTable::New()),
myBarTable(VISU_LookupTable::New()),
myExtractor(VISU_Extractor::New()),
- myFieldTransform(VISU_FieldTransform::New())
+ myFieldTransform(VISU_FieldTransform::New()),
+ myThreshold(vtkThreshold::New()), // RKV
+ myPassFilter(vtkPassThroughFilter::New()), // RKV
+ myIsFiltered(false) // RKV
{
myMapperTable->Delete();
myMapperTable->SetScale(VTK_SCALE_LINEAR);
myExtractor->Delete();
myFieldTransform->Delete();
+
+ myThreshold->AllScalarsOn(); // RKV
+ myThreshold->Delete(); // RKV
+ myPassFilter->Delete(); // RKV
}
aTime = std::max(aTime, myBarTable->GetMTime());
aTime = std::max(aTime, myExtractor->GetMTime());
aTime = std::max(aTime, myFieldTransform->GetMTime());
+ // RKV : Begin
+ if (IsFiltered()) {
+ aTime = std::max(aTime, myThreshold->GetMTime());
+ }
+ aTime = std::max(aTime, myPassFilter->GetMTime());
+ // RKV : End
return aTime;
}
if(VISU_ColoredPL *aPipeLine = dynamic_cast<VISU_ColoredPL*>(thePipeLine)){
if(theIsCopyInput)
- SetScalarRange(aPipeLine->GetScalarRange());
+ SetScalarRange(aPipeLine->GetScalarRange(), aPipeLine->IsFiltered()); // RKV
+// RKV SetScalarRange(aPipeLine->GetScalarRange());
SetScalarMode(aPipeLine->GetScalarMode());
SetNbColors(aPipeLine->GetNbColors());
SetScaling(aPipeLine->GetScaling());
theExtractor->SetScalarMode(theScalarMode);
}
-
//----------------------------------------------------------------------------
void
VISU_ColoredPL
SetScalarMode(theScalarMode, GetInput(), myExtractor);
}
-
//----------------------------------------------------------------------------
+/* RKV
void
VISU_ColoredPL
::SetScalarRange(vtkFloatingPointType theRange[2])
myFieldTransform->SetScalarRange(theRange);
myBarTable->SetRange(theRange);
}
+*/
+// RKV : Begin
+void
+VISU_ColoredPL
+::SetScalarRange(vtkFloatingPointType theRange[2], const bool isFiltered)
+{
+ // isFiltered - if true then drop cells which are not in the scalar range
+ if(theRange[0] > theRange[1])
+ return;
+
+ if(VISU::CheckIsSameRange(GetScalarRange(), theRange) && (myIsFiltered == isFiltered))
+ return;
+
+ myFieldTransform->SetScalarRange(theRange);
+ myBarTable->SetRange(theRange);
+ myIsFiltered = isFiltered;
+ if (IsFiltered()) {
+ // Include threshold filter between the transform and the pass filters.
+ myThreshold->SetInput(myFieldTransform->GetOutput());
+ myThreshold->ThresholdBetween(theRange[0], theRange[1]);
+ myPassFilter->SetInput(myThreshold->GetOutput());
+ } else {
+ // Exclude threshold filter before the pass filter.
+ myPassFilter->SetInput(myFieldTransform->GetOutput());
+ }
+}
+ // RKV : End
//----------------------------------------------------------------------------
vtkFloatingPointType*
VISU_ColoredPL
::GetClippedInput()
{
- if(GetFieldTransformFilter()->GetInput())
+/* RKV if(GetFieldTransformFilter()->GetInput())
GetFieldTransformFilter()->Update();
return GetFieldTransformFilter()->GetUnstructuredGridOutput();
+ */
+ // RKV : Begin
+ // The pass filter is used here for possibility to include/exclude
+ // threshold filter before it.
+ if(myPassFilter->GetInput())
+ myPassFilter->Update();
+ return myPassFilter->GetUnstructuredGridOutput();
+ // RKV : End
}
{
myExtractor->SetInput(Superclass::GetClippedInput());
myFieldTransform->SetInput(myExtractor->GetOutput());
+ // The pass filter is used here for possibility to include/exclude
+ // threshold filter before it.
+ myPassFilter->SetInput(myFieldTransform->GetOutput()); // RKV
GetMapperHolder()->SetLookupTable(GetMapperTable());
GetMapper()->SetUseLookupTableScalarRange(true);
{
vtkFloatingPointType aRange[2];
GetSourceRange(aRange);
- SetScalarRange(aRange);
+// RKV SetScalarRange(aRange);
+ SetScalarRange(aRange, myIsFiltered); // RKV
}
#include "VISU_PipeLine.hxx"
#include <vtkSmartPointer.h>
+#include <vtkThreshold.h> // RKV
+#include <vtkPassThroughFilter.h> // RKV
class VISU_Extractor;
class VISU_FieldTransform;
class VISU_LookupTable;
-
//----------------------------------------------------------------------------
class VISU_ColoredPL : public VISU_PipeLine
{
virtual
void
- SetScalarRange(vtkFloatingPointType theRange[2]);
+ SetScalarRange(vtkFloatingPointType theRange[2], const bool isFiltered); // RKV
+// RKV SetScalarRange(vtkFloatingPointType theRange[2]);
virtual
void
int
GetNbColors();
+// RKV : Begin
+ //----------------------------------------------------------------------------
+ bool IsFiltered() {return myIsFiltered;};
+// RKV : End
//----------------------------------------------------------------------------
public:
virtual
vtkSmartPointer<VISU_LookupTable> myBarTable;
vtkSmartPointer<VISU_Extractor> myExtractor;
vtkSmartPointer<VISU_FieldTransform> myFieldTransform;
-
+ vtkSmartPointer<vtkThreshold> myThreshold; // RKV
+ vtkSmartPointer<vtkPassThroughFilter> myPassFilter; // RKV
+ bool myIsFiltered; // RKV
};
#endif