TTK
Loading...
Searching...
No Matches
ttkTableDataSelector.h
Go to the documentation of this file.
1
16#pragma once
17
18#include <limits>
19
20// VTK includes
21#include <vtkDataArray.h>
22#include <vtkDataArraySelection.h>
23#include <vtkDataSetAttributes.h>
24#include <vtkInformation.h>
25#include <vtkSmartPointer.h>
26#include <vtkTable.h>
27
28// VTK Module
29#include <ttkTableDataSelectorModule.h>
30
31// ttk code includes
32#include <ttkAlgorithm.h>
33
34class TTKTABLEDATASELECTOR_EXPORT ttkTableDataSelector : public ttkAlgorithm {
35
36public:
39
40 // default ttk setters
41
42 vtkSetMacro(RegexpString, const std::string &);
43
44 vtkGetVector2Macro(RangeId, int);
45 vtkSetVector2Macro(RangeId, int);
46
47 // end of default ttk setters
48
49 void AddCol(const std::string &s) {
50 SelectedCols.push_back(s);
51 Modified();
52 }
53
54 void ClearCols() {
55 SelectedCols.clear();
56 Modified();
57 }
58
59 vtkDataArraySelection *GetRangeIds() {
60 vtkDataArraySelection *arr = vtkDataArraySelection::New();
61 arr->SetArraySetting("0", true);
62 arr->SetArraySetting(
63 std::to_string(AvailableCols.size() - 1).c_str(), true);
64 return arr;
65 }
66
67protected:
69 this->setDebugMsgPrefix("TableDataSelector");
70
71 this->SetNumberOfInputPorts(1);
72 this->SetNumberOfOutputPorts(1);
73
74 RegexpString = ".*";
75
76 RangeId[0] = 0;
77 RangeId[1] = std::numeric_limits<int>::max();
78 }
79
80 ~ttkTableDataSelector() override = default;
81 ;
82
83 int RequestInformation(vtkInformation *request,
84 vtkInformationVector **inputVector,
85 vtkInformationVector *outputVector) override;
86
87 int RequestData(vtkInformation *request,
88 vtkInformationVector **inputVector,
89 vtkInformationVector *outputVector) override;
90
91 int FillInputPortInformation(int port, vtkInformation *info) override;
92
93 int FillOutputPortInformation(int port, vtkInformation *info) override;
94
95 void FillAvailableCols(vtkTable *input);
96
97private:
98 std::vector<std::string> SelectedCols;
99 std::vector<std::string> AvailableCols;
100 std::string RegexpString;
101 int RangeId[2];
102};
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.
~ttkTableDataSelector() override=default
void AddCol(const std::string &s)
vtkDataArraySelection * GetRangeIds()
static ttkTableDataSelector * New()
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364