OGS
VtkCompositeImageToPointCloudFilter.cpp
Go to the documentation of this file.
1
12
13#include <vtkPointData.h>
14#include <vtkSmartPointer.h>
15
16#include <QMap>
17#include <QString>
18#include <QVariant>
19
21
23 vtkAlgorithm* inputAlgorithm)
24 : VtkCompositeFilter(inputAlgorithm)
25{
26 init();
27}
28
30{
31 _inputDataObjectType = VTK_IMAGE_DATA;
32 _outputDataObjectType = VTK_POLY_DATA;
33
34 VtkImageDataToPointCloudFilter* point_cloud_filter =
36 point_cloud_filter->SetInputConnection(_inputAlgorithm->GetOutputPort());
37 _inputAlgorithm->Update();
38
39 QList<QVariant> n_points_range_list;
40 n_points_range_list.push_back(
41 point_cloud_filter->GetMinNumberOfPointsPerCell());
42 n_points_range_list.push_back(
43 point_cloud_filter->GetMaxNumberOfPointsPerCell());
44 (*_algorithmUserVectorProperties)["Number of points range"] =
45 n_points_range_list;
46 QList<QVariant> vertical_extent_list;
47 vertical_extent_list.push_back(point_cloud_filter->GetMinHeight());
48 vertical_extent_list.push_back(point_cloud_filter->GetMaxHeight());
49 (*_algorithmUserVectorProperties)["Vertical extent"] = vertical_extent_list;
50 (*_algorithmUserProperties)["Logarithmic interpolation"] =
51 !point_cloud_filter->GetIsLinear();
52 (*_algorithmUserProperties)["Gamma value"] = point_cloud_filter->GetGamma();
53
54 point_cloud_filter->Update();
55 _outputAlgorithm = point_cloud_filter;
56}
57
59 QVariant value)
60{
62
63 if ((name == "Gamma value") && (value.toDouble() > 0))
64 {
66 ->SetGamma(value.toDouble());
67 }
68 if (name == "Logarithmic interpolation")
69 {
70 if (value.toBool())
71 {
72 double const gamma =
74 .toDouble();
75 if (gamma > 0)
76 {
78 ->useLogarithmicInterpolation(gamma);
79 }
80 }
81 else
82 {
84 ->useLinearInterpolation();
85 }
86 }
87}
88
90 QString name, QList<QVariant> values)
91{
93
94 if (name == "Number of points range")
95 {
96 if (values[0].toInt() >= 0 && values[1].toInt() >= 0 &&
97 values[0].toInt() <= values[1].toInt())
98 {
100 ->SetMinNumberOfPointsPerCell(values[0].toInt());
102 ->SetMaxNumberOfPointsPerCell(values[1].toInt());
103 }
104 }
105 else if (name == "Vertical extent")
106 {
107 if (values[0].toDouble() <= values[1].toDouble())
108 {
110 ->SetMinHeight(values[0].toDouble());
112 ->SetMaxHeight(values[1].toDouble());
113 }
114 }
115}
virtual void SetUserVectorProperty(QString name, QList< QVariant > values)
Sets a vector user property. This should be implemented by subclasses.
QVariant GetUserProperty(QString name) const
Returns the value of a user property.
virtual void SetUserProperty(QString name, QVariant value)
Sets a user property. This should be implemented by subclasses.
Is used to combine several filter in one VtkVisPipelineItem. You can use vtk filter and custom filter...
vtkAlgorithm * _outputAlgorithm
vtkAlgorithm * _inputAlgorithm
VtkCompositeImageToPointCloudFilter(vtkAlgorithm *inputAlgorithm)
void SetUserVectorProperty(QString name, QList< QVariant > values) override
Sets a vector user property. This should be implemented by subclasses.
void SetUserProperty(QString name, QVariant value) override
Sets a user property. This should be implemented by subclasses.
static VtkImageDataToPointCloudFilter * New()
Create a new objects (required because of VTKs reference counting)