vtkSMTransferFunctionPresets.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkSMTransferFunctionPresets_h
19 #define vtkSMTransferFunctionPresets_h
20 
21 #include "vtkSMObject.h"
22 
23 #include "vtkRemotingViewsModule.h" // needed for exports
24 #include "vtkSmartPointer.h" // for ivars
25 #include <vector> // for vector
26 #include <vtk_jsoncpp_fwd.h> // for forward declarations
27 
28 class vtkPVXMLElement;
30 {
31 public:
32  // Used to return information about the imported presets to the caller of ImportPresets
34  {
35  std::string name;
36  struct
37  {
38  bool isValid = false;
39  std::vector<std::string> groups;
40  } potentialGroups;
41  };
42 
43  static vtkSMTransferFunctionPresets* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  static vtkSMTransferFunctionPresets* GetInstance();
51 
56  unsigned int GetNumberOfPresets();
57 
62  std::string GetPresetAsString(unsigned int index);
63 
70  bool AddPreset(const char* name, const std::string& preset);
71 
75  bool RemovePreset(unsigned int index);
76 
78 
83  const Json::Value& GetFirstPresetWithName(const char* name, int& idx);
84  const Json::Value& GetFirstPresetWithName(const char* name);
86 
90  const Json::Value& GetPreset(unsigned int index);
91 
95  std::string GetPresetName(unsigned int index);
96 
100  bool HasPreset(const char* name);
101 
105  bool GetPresetHasOpacities(const Json::Value& preset);
106  bool GetPresetHasOpacities(unsigned int index)
107  {
108  return this->GetPresetHasOpacities(this->GetPreset(index));
109  }
110 
114  bool GetPresetHasIndexedColors(const Json::Value& preset);
115  bool GetPresetHasIndexedColors(unsigned int index)
116  {
117  return this->GetPresetHasIndexedColors(this->GetPreset(index));
118  }
119 
123  bool GetPresetHasAnnotations(const Json::Value& preset);
124  bool GetPresetHasAnnotations(unsigned int index)
125  {
126  return this->GetPresetHasAnnotations(this->GetPreset(index));
127  }
128 
133  bool SetPreset(const char* name, const Json::Value& preset);
134 
138  bool AddPreset(const char* name, const Json::Value& preset);
139 
144  std::string AddUniquePreset(const Json::Value& preset, const char* prefix = nullptr);
145 
150  bool IsPresetBuiltin(unsigned int index);
151 
155  bool RenamePreset(unsigned int index, const char* newname);
156 
158 
164  bool ImportPresets(const char* filename, vtkTypeUInt32 location = 0x10 /*vtkPVSession::CLIENT*/);
165  bool ImportPresets(const char* filename, std::vector<ImportedPreset>* importedPresets,
166  vtkTypeUInt32 location = 0x10 /*vtkPVSession::CLIENT*/);
167  bool ImportPresets(const Json::Value& presets);
168  bool ImportPresets(const Json::Value& presets, std::vector<ImportedPreset>* importedPresets);
170 
174  void ReloadPresets();
175 
176 protected:
178  ~vtkSMTransferFunctionPresets() override;
179 
180 private:
182  void operator=(const vtkSMTransferFunctionPresets&) = delete;
183 
184  class vtkInternals;
185  vtkInternals* Internals;
186 
188 };
189 
190 #endif
location
#define VTKREMOTINGVIEWS_EXPORT
bool GetPresetHasOpacities(unsigned int index)
manages presets for color, opacity, and annotation presets.
name
superclass for most server manager classes
Definition: vtkSMObject.h:17
bool GetPresetHasIndexedColors(unsigned int index)
bool GetPresetHasAnnotations(unsigned int index)
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
index