TTK
Loading...
Searching...
No Matches
ttkArrayEditor.h
Go to the documentation of this file.
1
25
26#pragma once
27
28// VTK Module
29#include <ttkArrayEditorModule.h>
30
31// VTK includes
32#include <ttkAlgorithm.h>
33#include <ttkMacros.h>
34#include <vtkDataObject.h>
35#include <vtkSmartPointer.h>
36
37class vtkDataArraySelection;
38
39class TTKARRAYEDITOR_EXPORT ttkArrayEditor : public ttkAlgorithm {
40public:
41 enum class MODE {
42 ADD_ARRAYS_FROM_STRING = 0,
43 ADD_ARRAYS_FROM_SOURCE = 1,
44 FILTER_ARRAYS_FROM_SOURCE = 2,
45 EDIT_ARRAY = 3
46 };
47
48private:
49 MODE EditorMode{MODE::ADD_ARRAYS_FROM_STRING};
50 std::string DataString{""};
51 bool ReplaceExistingArrays{true};
52
53 std::string TargetArrayName;
54 int TargetAssociation{2};
55 int TargetArrayType;
56 int TargetArrayIndexation[2];
57
59 ArraySelections[vtkDataObject::NUMBER_OF_ASSOCIATIONS];
60
61public:
64
65 ttkSetEnumMacro(EditorMode, MODE);
66 vtkGetEnumMacro(EditorMode, MODE);
67 vtkSetMacro(TargetAssociation, int);
68 vtkGetMacro(TargetAssociation, int);
69 vtkSetMacro(DataString, const std::string &);
70 vtkGetMacro(DataString, std::string);
71 vtkSetMacro(ReplaceExistingArrays, bool);
72 vtkGetMacro(ReplaceExistingArrays, bool);
73
74 vtkSetMacro(TargetArrayName, const std::string &);
75 vtkGetMacro(TargetArrayName, std::string);
76 vtkSetMacro(TargetArrayType, int);
77 vtkGetMacro(TargetArrayType, int);
78 vtkSetVector2Macro(TargetArrayIndexation, int);
79 vtkGetVector2Macro(TargetArrayIndexation, int);
80
81 vtkDataArraySelection *GetArraySelection(int association);
82 vtkDataArraySelection *GetPointDataArraySelection() {
83 return this->GetArraySelection(vtkDataObject::FIELD_ASSOCIATION_POINTS);
84 }
85 vtkDataArraySelection *GetCellDataArraySelection() {
86 return this->GetArraySelection(vtkDataObject::FIELD_ASSOCIATION_CELLS);
87 }
88 vtkDataArraySelection *GetFieldDataArraySelection() {
89 return this->GetArraySelection(vtkDataObject::FIELD_ASSOCIATION_NONE);
90 }
91 vtkDataArraySelection *GetVertexDataArraySelection() {
92 return this->GetArraySelection(vtkDataObject::FIELD_ASSOCIATION_VERTICES);
93 }
94 vtkDataArraySelection *GetEdgeDataArraySelection() {
95 return this->GetArraySelection(vtkDataObject::FIELD_ASSOCIATION_EDGES);
96 }
97 vtkDataArraySelection *GetRowDataArraySelection() {
98 return this->GetArraySelection(vtkDataObject::FIELD_ASSOCIATION_ROWS);
99 }
100
101protected:
103 ~ttkArrayEditor() override;
104
105 int FillInputPortInformation(int port, vtkInformation *info) override;
106 int FillOutputPortInformation(int port, vtkInformation *info) override;
107
108 int RequestData(vtkInformation *request,
109 vtkInformationVector **inputVector,
110 vtkInformationVector *outputVector) override;
111};
Baseclass of all VTK filters that wrap ttk modules.
virtual int RequestData(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 edit arrays of a vtkDataObject.
vtkDataArraySelection * GetCellDataArraySelection()
~ttkArrayEditor() override
static ttkArrayEditor * New()
vtkDataArraySelection * GetRowDataArraySelection()
vtkDataArraySelection * GetVertexDataArraySelection()
vtkDataArraySelection * GetFieldDataArraySelection()
vtkDataArraySelection * GetEdgeDataArraySelection()
vtkDataArraySelection * GetPointDataArraySelection()
#define ttkSetEnumMacro(name, enumType)
Definition ttkMacros.h:38