vtkSMTransferFunctionPresets.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMTransferFunctionPresets.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkSMTransferFunctionPresets_h
31 #define vtkSMTransferFunctionPresets_h
32 
33 #include "vtkSMObject.h"
34 
35 #include "vtkRemotingViewsModule.h" // needed for exports
36 #include "vtkSmartPointer.h"
37 #include "vtkStdString.h" // needed for vtkStdString.
38 #include <vtk_jsoncpp_fwd.h> // for forward declarations
39 
40 class vtkPVXMLElement;
41 class VTKREMOTINGVIEWS_EXPORT vtkSMTransferFunctionPresets : public vtkSMObject
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  static vtkSMTransferFunctionPresets* GetInstance();
52 
57  unsigned int GetNumberOfPresets();
58 
63  vtkStdString GetPresetAsString(unsigned int index);
64 
71  bool AddPreset(const char* name, const vtkStdString& preset);
72 
76  bool RemovePreset(unsigned int index);
77 
82  const Json::Value& GetFirstPresetWithName(const char* name);
83 
87  const Json::Value& GetPreset(unsigned int index);
88 
92  vtkStdString GetPresetName(unsigned int index);
93 
97  bool HasPreset(const char* name);
98 
102  bool GetPresetHasOpacities(const Json::Value& preset);
103  bool GetPresetHasOpacities(unsigned int index)
104  {
105  return this->GetPresetHasOpacities(this->GetPreset(index));
106  }
107 
111  bool GetPresetHasIndexedColors(const Json::Value& preset);
112  bool GetPresetHasIndexedColors(unsigned int index)
113  {
114  return this->GetPresetHasIndexedColors(this->GetPreset(index));
115  }
116 
120  bool GetPresetHasAnnotations(const Json::Value& preset);
121  bool GetPresetHasAnnotations(unsigned int index)
122  {
123  return this->GetPresetHasAnnotations(this->GetPreset(index));
124  }
125 
130  bool IsPresetDefault(const Json::Value& preset);
131  bool IsPresetDefault(unsigned int index) { return this->IsPresetDefault(this->GetPreset(index)); }
132 
136  bool AddPreset(const char* name, const Json::Value& preset);
137 
142  vtkStdString AddUniquePreset(const Json::Value& preset, const char* prefix = NULL);
143 
148  bool IsPresetBuiltin(unsigned int index);
149 
153  bool RenamePreset(unsigned int index, const char* newname);
154 
156 
162  bool ImportPresets(const char* filename);
163  bool ImportPresets(const Json::Value& presets);
165 
169  void ReloadPresets();
170 
171 protected:
173  ~vtkSMTransferFunctionPresets() override;
174 
175 private:
177  void operator=(const vtkSMTransferFunctionPresets&) = delete;
178 
179  class vtkInternals;
180  vtkInternals* Internals;
181 
183 };
184 
185 #endif
bool GetPresetHasOpacities(unsigned int index)
manages presets for color, opacity, and annotation presets.
superclass for most server manager classes
Definition: vtkSMObject.h:29
bool GetPresetHasIndexedColors(unsigned int index)
bool GetPresetHasAnnotations(unsigned int index)
static vtkSMObject * New()
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
index
void PrintSelf(ostream &os, vtkIndent indent) override