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 <vtk_jsoncpp_fwd.h> // for forward declarations
38 
39 class vtkPVXMLElement;
41 {
42 public:
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 IsPresetDefault(const Json::Value& preset);
134  bool IsPresetDefault(unsigned int index) { return this->IsPresetDefault(this->GetPreset(index)); }
135 
140  bool SetPreset(const char* name, const Json::Value& preset);
141 
145  bool AddPreset(const char* name, const Json::Value& preset);
146 
151  std::string AddUniquePreset(const Json::Value& preset, const char* prefix = NULL);
152 
157  bool IsPresetBuiltin(unsigned int index);
158 
162  bool RenamePreset(unsigned int index, const char* newname);
163 
165 
171  bool ImportPresets(const char* filename);
172  bool ImportPresets(const Json::Value& presets);
174 
178  void ReloadPresets();
179 
180 protected:
182  ~vtkSMTransferFunctionPresets() override;
183 
184 private:
186  void operator=(const vtkSMTransferFunctionPresets&) = delete;
187 
188  class vtkInternals;
189  vtkInternals* Internals;
190 
192 };
193 
194 #endif
#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: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