OGS
VtkCompositeGeoObjectFilter.cpp
Go to the documentation of this file.
1
15// ** INCLUDES **
17
18#include <vtkAlgorithmOutput.h>
19#include <vtkDataSetSurfaceFilter.h>
20#include <vtkPointData.h>
21#include <vtkSmartPointer.h>
22#include <vtkThreshold.h>
23
26#include "VtkPolylinesSource.h"
27#include "VtkStationSource.h"
28#include "VtkSurfacesSource.h"
29
31 vtkAlgorithm* inputAlgorithm)
32 : VtkCompositeFilter(inputAlgorithm),
33 _type(GeoLib::GEOTYPE::POINT),
34 _threshold(vtkThreshold::New())
35{
36 if (inputAlgorithm->GetNumberOfInputPorts() &&
37 inputAlgorithm->GetNumberOfInputConnections(0))
38 {
39 vtkAlgorithmOutput* ao = inputAlgorithm->GetInputConnection(0, 0);
40
41 if (ao)
42 {
43 vtkAlgorithm* parentAlg = ao->GetProducer();
44
45 if (dynamic_cast<VtkPolylinesSource*>(parentAlg) != nullptr)
46 {
47 _type = GeoLib::GEOTYPE::POLYLINE;
48 }
49 else if (dynamic_cast<VtkSurfacesSource*>(parentAlg) != nullptr)
50 {
51 _type = GeoLib::GEOTYPE::SURFACE;
52 }
53 else if (dynamic_cast<VtkStationSource*>(parentAlg) != nullptr)
54 {
55 /* TODO
56 if (dynamic_cast<VtkStationSource*>(parentAlg)->getType() ==
57 GeoLib::Station::StationType::BOREHOLE) _type =
58 GeoLib::GEOTYPE::POLYLINE;
59 */
60 }
61 }
62 this->init();
63 }
64}
65
67
69{
70 this->_inputDataObjectType = VTK_POLY_DATA;
71 this->_outputDataObjectType = VTK_POLY_DATA;
72
73 _threshold->SetInputConnection(_inputAlgorithm->GetOutputPort());
74 _threshold->SetSelectedComponent(0);
75 _threshold->SetThresholdFunction(
76 vtkThreshold::ThresholdType::THRESHOLD_BETWEEN);
77 _threshold->SetLowerThreshold(0);
78 _threshold->SetUpperThreshold(0);
79
80 vtkDataSetSurfaceFilter* surface = vtkDataSetSurfaceFilter::New();
81 surface->SetInputConnection(_threshold->GetOutputPort());
82
83 VtkCompositeFilter* composite;
85 {
86 composite = new VtkCompositePointToGlyphFilter(surface);
87 composite->SetUserProperty("Radius", this->GetInitialRadius());
89 }
91 {
92 composite = new VtkCompositeLineToTubeFilter(surface);
93 composite->SetUserProperty("Radius", this->GetInitialRadius());
95 }
96 else
97 {
98 _outputAlgorithm = surface;
99 }
100}
101
103{
104 double const d_idx = static_cast<double>(idx);
105 _threshold->SetThresholdFunction(
106 vtkThreshold::ThresholdType::THRESHOLD_BETWEEN);
107 _threshold->SetLowerThreshold(d_idx);
108 _threshold->SetUpperThreshold(d_idx);
109}
Definition of the VtkCompositeGeoObjectFilter class.
Definition of the VtkCompositeLineToTubeFilter class.
Definition of the VtkCompositePointToGlyphFilter class.
Definition of the VtkPolylinesSource class.
Definition of the VtkStationSource class.
Definition of the VtkSurfacesSource 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...
virtual void init()=0
vtkAlgorithm * GetOutputAlgorithm() const
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
VtkCompositeGeoObjectFilter(vtkAlgorithm *inputAlgorithm)
~VtkCompositeGeoObjectFilter() override
Converts lines to tube-objects.
Converts point data to scalar-scaled spheres.