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