OGS
VtkCompositeLineToTubeFilter.cpp
Go to the documentation of this file.
1
15// ** INCLUDES **
17
18#include <vtkCleanPolyData.h>
19#include <vtkSmartPointer.h>
20#include <vtkTubeFilter.h>
21
23 vtkAlgorithm* inputAlgorithm)
24 : VtkCompositeFilter(inputAlgorithm)
25{
26 this->init();
27}
28
30
32{
33 this->_inputDataObjectType = VTK_DATA_SET;
34 this->_outputDataObjectType = VTK_POLY_DATA;
35
36 // collapse coincident points
37 vtkSmartPointer<vtkCleanPolyData> mergePoints =
38 vtkSmartPointer<vtkCleanPolyData>::New();
39 mergePoints->SetInputConnection(0, _inputAlgorithm->GetOutputPort(0));
40 mergePoints->SetTolerance(0.0);
41 mergePoints->ConvertLinesToPointsOn();
42
43 double default_radius(GetInitialRadius());
44 int default_number_of_sides(8);
45 vtkTubeFilter* tubes = vtkTubeFilter::New();
46 tubes->SetInputConnection(0, mergePoints->GetOutputPort(0));
47
48 // tubes->SetInputArrayToProcess(1,0,0,vtkDataObject::FIELD_ASSOCIATION_CELLS,"StationValue");
49 // tubes->SetVaryRadiusToVaryRadiusByScalar(); // KR radius changes with
50 // scalar
51
52 tubes->SetInputArrayToProcess(
53 1, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "Stratigraphies");
54 tubes->SetRadius(default_radius);
55 tubes->SetNumberOfSides(default_number_of_sides);
56 tubes->SetCapping(1);
57
58 (*_algorithmUserProperties)["Radius"] = default_radius;
59 (*_algorithmUserProperties)["NumberOfSides"] = default_number_of_sides;
60 (*_algorithmUserProperties)["Capping"] = true;
61
62 _outputAlgorithm = tubes;
63}
64
65void VtkCompositeLineToTubeFilter::SetUserProperty(QString name, QVariant value)
66{
68
69 if (name.compare("Radius") == 0)
70 {
71 static_cast<vtkTubeFilter*>(_outputAlgorithm)
72 ->SetRadius(value.toDouble());
73 }
74 else if (name.compare("NumberOfSides") == 0)
75 {
76 static_cast<vtkTubeFilter*>(_outputAlgorithm)
77 ->SetNumberOfSides(value.toInt());
78 }
79 else if (name.compare("Capping") == 0)
80 {
81 static_cast<vtkTubeFilter*>(_outputAlgorithm)
82 ->SetCapping(value.toBool());
83 }
84}
Definition of the VtkCompositeLineToTubeFilter class.
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
double GetInitialRadius() const
Calculates a 1/200th of the largest extension of the bounding box (this is used as default radius for...
vtkAlgorithm * _inputAlgorithm
void SetUserProperty(QString name, QVariant value) override
Sets a user property. This should be implemented by subclasses.
VtkCompositeLineToTubeFilter(vtkAlgorithm *inputAlgorithm)
~VtkCompositeLineToTubeFilter() override