18 #include <vtkCellData.h>
19 #include <vtkDoubleArray.h>
20 #include <vtkInformation.h>
21 #include <vtkInformationVector.h>
22 #include <vtkLookupTable.h>
23 #include <vtkObjectFactory.h>
24 #include <vtkPointData.h>
25 #include <vtkPolyData.h>
26 #include <vtkSmartPointer.h>
27 #include <vtkStreamingDemandDrivenPipeline.h>
43 this->Superclass::PrintSelf(os, indent);
47 os << indent <<
"== VtkColorByHeightFilter ==" << endl;
48 os << indent <<
"Range: " << range[0] <<
"-" << range[1] << endl;
49 os << indent <<
"Interpolation Type:"
55 vtkMTimeType t1 = this->Superclass::GetMTime();
59 return std::max(t1, t2);
64 vtkInformationVector** inputVector,
65 vtkInformationVector* outputVector)
67 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
69 vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
71 vtkSmartPointer<vtkDoubleArray> colors =
72 vtkSmartPointer<vtkDoubleArray>::New();
73 colors->SetNumberOfComponents(1);
74 std::size_t nPoints = input->GetNumberOfPoints();
75 colors->SetNumberOfValues(nPoints);
76 colors->SetName(
"Colors");
79 for (std::size_t i = 0; i < nPoints; i++)
82 input->GetPoint(i,
p);
83 colors->SetValue(i,
p[2]);
86 vtkInformation* outInfo = outputVector->GetInformationObject(0);
88 vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
89 output->CopyStructure(input);
90 output->GetPointData()->PassData(input->GetPointData());
91 output->GetCellData()->PassData(input->GetCellData());
92 output->GetPointData()->AddArray(colors);
93 output->GetPointData()->SetActiveScalars(
"Colors");
108 ERR(
"VtkColorByHeightFilter::SetLimits(min, max) - Limits not changed "
109 "because min value > max value.");
void ERR(char const *fmt, Args const &... args)
vtkStandardNewMacro(VtkColorByHeightFilter)
Definition of the VtkColorByHeightFilter class.
Definition of the VtkColorLookupTable class.
VTK filter object for colouring vtkPolyData objects based on z-coordinates.
void SetTableRangeScaling(double scale)
Sets the scaling of the color look-up table boundaries. This is used in VtkVisTabWidget when a parent...
double _tableRangeScaling
~VtkColorByHeightFilter() override
vtkMTimeType GetMTime() override
This filter gets updated when the color look-up table was modified.
void PrintSelf(ostream &os, vtkIndent indent) override
Prints the mesh data to an output stream.
void SetTableRange(double min, double max)
Sets the boundaries for the color look-up table.
VtkColorLookupTable * ColorLookupTable
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
The filter logic.
Calculates and stores a colour lookup table.
DataHolderLib::LUTType getInterpolationType() const
Returns the type of interpolation used.
void scale(PETScVector &x, double const a)