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