TTK
Loading...
Searching...
No Matches
ttkPointDataSelector.h
Go to the documentation of this file.
1
21
22#pragma once
23
24#include <array>
25#include <limits>
26#include <string>
27#include <vtkDataArraySelection.h>
28
29// VTK Module
30#include <ttkPointDataSelectorModule.h>
31
32// ttk code includes
33#include <ttkAlgorithm.h>
34
35class vtkDataSet;
36
37class TTKPOINTDATASELECTOR_EXPORT ttkPointDataSelector : public ttkAlgorithm {
38
39public:
42
43 vtkSetMacro(RegexpString, const std::string &);
44
45 void SetRangeId(int data0, int data1) {
46 RangeId[0] = data0;
47 RangeId[1] = data1;
48 Modified();
49 }
50 int *GetRangeId() {
51 return RangeId.data();
52 }
53
54 vtkSetMacro(RenameSelected, bool);
55 vtkGetMacro(RenameSelected, bool);
56
57 vtkSetMacro(SelectedFieldName, const std::string &);
58 vtkGetMacro(SelectedFieldName, std::string);
59
60 void AddScalarField(const std::string &s) {
61 SelectedFields.emplace_back(s);
62 Modified();
63 }
64
66 SelectedFields.clear();
67 Modified();
68 }
69
70 vtkDataArraySelection *GetRangeIds() {
71 vtkDataArraySelection *arr = vtkDataArraySelection::New();
72 arr->SetArraySetting("0", true);
73 arr->SetArraySetting(
74 std::to_string(AvailableFields.size() - 1).c_str(), true);
75 return arr;
76 }
77
78protected:
80
81 int RequestInformation(vtkInformation *request,
82 vtkInformationVector **inputVector,
83 vtkInformationVector *outputVector) override;
84
85 int FillInputPortInformation(int port, vtkInformation *info) override;
86 int FillOutputPortInformation(int port, vtkInformation *info) override;
87 int RequestData(vtkInformation *request,
88 vtkInformationVector **inputVector,
89 vtkInformationVector *outputVector) override;
90
91 void FillAvailableFields(vtkDataSet *input);
92
93private:
94 bool RenameSelected{false};
95 std::string SelectedFieldName{"SelectedField"};
96 std::vector<std::string> SelectedFields{};
97 std::vector<std::string> AvailableFields{};
98 std::string RegexpString{".*"};
99 std::array<int, 2> RangeId{0, std::numeric_limits<int>::max()};
100};
Baseclass of all VTK filters that wrap ttk modules.
virtual int RequestData(vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
virtual int RequestInformation(vtkInformation *ttkNotUsed(request), vtkInformationVector **ttkNotUsed(inputVectors), vtkInformationVector *ttkNotUsed(outputVector))
int FillInputPortInformation(int ttkNotUsed(port), vtkInformation *ttkNotUsed(info)) override
int FillOutputPortInformation(int ttkNotUsed(port), vtkInformation *ttkNotUsed(info)) override
TTK VTK-filter that selects scalar fields on input with shallow copy.
void AddScalarField(const std::string &s)
void SetRangeId(int data0, int data1)
static ttkPointDataSelector * New()
vtkDataArraySelection * GetRangeIds()