manages presets for color, opacity, and annotation presets. More...
#include <vtkSMTransferFunctionPresets.h>
Classes | |
struct | ImportedPreset |
Public Types | |
typedef vtkSMObject | Superclass |
Public Types inherited from vtkSMObject | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) override |
unsigned int | GetNumberOfPresets () |
Returns the number of presets current available (including builtin and custom). More... | |
std::string | GetPresetAsString (unsigned int index) |
Gets the raw text for a preset given its index. More... | |
bool | AddPreset (const char *name, const std::string &preset) |
Add a new preset. More... | |
bool | RemovePreset (unsigned int index) |
Remove a preset. More... | |
const Json::Value & | GetPreset (unsigned int index) |
Returns a preset at a given index. More... | |
std::string | GetPresetName (unsigned int index) |
Returns the name for a preset at the given index. More... | |
bool | HasPreset (const char *name) |
Returns true if a present with given name exists. More... | |
bool | GetPresetHasOpacities (const Json::Value &preset) |
Returns true if the preset has opacities i.e. More... | |
bool | GetPresetHasOpacities (unsigned int index) |
bool | GetPresetHasIndexedColors (const Json::Value &preset) |
Returns true is the preset has indexed colors. More... | |
bool | GetPresetHasIndexedColors (unsigned int index) |
bool | GetPresetHasAnnotations (const Json::Value &preset) |
Returns true is the preset has annotations. More... | |
bool | GetPresetHasAnnotations (unsigned int index) |
bool | SetPreset (const char *name, const Json::Value &preset) |
Set the Json::Value object for preset 'name' if such a preset was found in the custom presets. More... | |
bool | AddPreset (const char *name, const Json::Value &preset) |
Add a preset give the Json::Value object. More... | |
std::string | AddUniquePreset (const Json::Value &preset, const char *prefix=nullptr) |
Same as AddPreset() expect it create a unique name using the prefix provided. More... | |
bool | IsPresetBuiltin (unsigned int index) |
Returns true if the preset is a builtin preset. More... | |
bool | RenamePreset (unsigned int index, const char *newname) |
Rename a preset. More... | |
void | ReloadPresets () |
Reload the presets from the configuration file. More... | |
const Json::Value & | GetFirstPresetWithName (const char *name, int &idx) |
Returns a preset JSON given the name. More... | |
const Json::Value & | GetFirstPresetWithName (const char *name) |
Returns a preset JSON given the name. More... | |
bool | ImportPresets (const char *filename, vtkTypeUInt32 location=0x10) |
Load presets from a file. More... | |
bool | ImportPresets (const char *filename, std::vector< ImportedPreset > *importedPresets, vtkTypeUInt32 location=0x10) |
Load presets from a file. More... | |
bool | ImportPresets (const Json::Value &presets) |
Load presets from a file. More... | |
bool | ImportPresets (const Json::Value &presets, std::vector< ImportedPreset > *importedPresets) |
Load presets from a file. More... | |
Public Member Functions inherited from vtkObject | |
vtkBaseTypeMacro (vtkObject, vtkObjectBase) | |
virtual void | DebugOn () |
virtual void | DebugOff () |
bool | GetDebug () |
void | SetDebug (bool debugFlag) |
virtual void | Modified () |
virtual vtkMTimeType | GetMTime () |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
int | HasObserver (unsigned long event) |
int | HasObserver (const char *event) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
virtual void | Delete () |
virtual void | FastDelete () |
void | Print (ostream &os) |
virtual void | Register (vtkObjectBase *o) |
virtual void | UnRegister (vtkObjectBase *o) |
void | SetReferenceCount (int) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
void | PrintRevisions (ostream &) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
void | PrintRevisions (ostream &) |
Static Public Member Functions | |
static vtkSMTransferFunctionPresets * | New () |
static int | IsTypeOf (const char *type) |
static vtkSMTransferFunctionPresets * | SafeDownCast (vtkObject *o) |
static vtkSMTransferFunctionPresets * | GetInstance () |
Get singleton instance. More... | |
Static Public Member Functions inherited from vtkSMObject | |
static vtkSMObject * | New () |
static int | IsTypeOf (const char *type) |
static vtkSMObject * | SafeDownCast (vtkObject *o) |
static std::string | CreatePrettyLabel (const std::string &name) |
Return a well-formated label using provided name by adding spaces between lower cases and upper cases: More... | |
Static Public Member Functions inherited from vtkObject | |
static vtkObject * | New () |
static void | BreakOnError () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
Static Public Member Functions inherited from vtkObjectBase | |
static vtkTypeBool | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
static vtkObjectBase * | New () |
Protected Member Functions | |
vtkSMTransferFunctionPresets () | |
~vtkSMTransferFunctionPresets () override | |
Protected Member Functions inherited from vtkSMObject | |
vtkSMObject () | |
~vtkSMObject () override | |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
virtual | ~vtkObject () |
void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE |
void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | CollectRevisions (ostream &) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Additional Inherited Members | |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
Protected Attributes inherited from vtkObjectBase | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
manages presets for color, opacity, and annotation presets.
vtkSMTransferFunctionPresets is a manager to manage all color, opacity, and annotation presets. It also uses vtkSMSettings to support persistent customizations besides hard-coded/builtin presets.
vtkSMTransferFunctionPresets is designed as a singleton, accessible through the GetInstance()
static method. Public API ensure that presets are loaded, but a reload can be explictly asked (see ReloadPresets()
).
Definition at line 29 of file vtkSMTransferFunctionPresets.h.
Definition at line 44 of file vtkSMTransferFunctionPresets.h.
|
protected |
|
overrideprotected |
|
static |
|
virtual |
Reimplemented from vtkSMObject.
Reimplemented from vtkSMObject.
|
static |
|
overridevirtual |
Reimplemented from vtkSMObject.
|
static |
Get singleton instance.
unsigned int vtkSMTransferFunctionPresets::GetNumberOfPresets | ( | ) |
Returns the number of presets current available (including builtin and custom).
std::string vtkSMTransferFunctionPresets::GetPresetAsString | ( | unsigned int | index | ) |
Gets the raw text for a preset given its index.
The preset is provided as a JSON string. Returns an empty string when not available.
bool vtkSMTransferFunctionPresets::AddPreset | ( | const char * | name, |
const std::string & | preset | ||
) |
Add a new preset.
This will get saved across sessions using vtkSMSettings, as appropriate. If name provided already exists, this will override the existing preset (even for builtin presets). preset
must be a valid JSON string. If not, this will return failure.
bool vtkSMTransferFunctionPresets::RemovePreset | ( | unsigned int | index | ) |
Remove a preset.
This has no effect for builtin presets.
const Json::Value& vtkSMTransferFunctionPresets::GetFirstPresetWithName | ( | const char * | name, |
int & | idx | ||
) |
Returns a preset JSON given the name.
Since multiple presets can have the same name, this returns the 'first' preset with the specified name. idx is set to the index of the found preset,-1 if none.
Returns a preset JSON given the name.
Since multiple presets can have the same name, this returns the 'first' preset with the specified name. idx is set to the index of the found preset,-1 if none.
Returns a preset at a given index.
std::string vtkSMTransferFunctionPresets::GetPresetName | ( | unsigned int | index | ) |
Returns the name for a preset at the given index.
bool vtkSMTransferFunctionPresets::HasPreset | ( | const char * | name | ) |
Returns true if a present with given name exists.
bool vtkSMTransferFunctionPresets::GetPresetHasOpacities | ( | const Json::Value & | preset | ) |
Returns true if the preset has opacities i.e.
values for a piecewise function.
|
inline |
Definition at line 106 of file vtkSMTransferFunctionPresets.h.
bool vtkSMTransferFunctionPresets::GetPresetHasIndexedColors | ( | const Json::Value & | preset | ) |
Returns true is the preset has indexed colors.
|
inline |
Definition at line 115 of file vtkSMTransferFunctionPresets.h.
bool vtkSMTransferFunctionPresets::GetPresetHasAnnotations | ( | const Json::Value & | preset | ) |
Returns true is the preset has annotations.
|
inline |
Definition at line 124 of file vtkSMTransferFunctionPresets.h.
Set the Json::Value object for preset 'name' if such a preset was found in the custom presets.
Return true if preset was correctly set, false otherwise.
Add a preset give the Json::Value object.
std::string vtkSMTransferFunctionPresets::AddUniquePreset | ( | const Json::Value & | preset, |
const char * | prefix = nullptr |
||
) |
Same as AddPreset() expect it create a unique name using the prefix provided.
If no prefix is specified, "Preset" will be used as the prefix.
bool vtkSMTransferFunctionPresets::IsPresetBuiltin | ( | unsigned int | index | ) |
Returns true if the preset is a builtin preset.
The preset is identified by its index.
Rename a preset.
bool vtkSMTransferFunctionPresets::ImportPresets | ( | const char * | filename, |
vtkTypeUInt32 | location = 0x10 |
||
) |
Load presets from a file.
All presets are added to "custom" presets list and are considered as non-builtin. If the filename ends with a .xml, it's assumed to be a legacy color map XML and will be converted to the new format before processing.
bool vtkSMTransferFunctionPresets::ImportPresets | ( | const char * | filename, |
std::vector< ImportedPreset > * | importedPresets, | ||
vtkTypeUInt32 | location = 0x10 |
||
) |
Load presets from a file.
All presets are added to "custom" presets list and are considered as non-builtin. If the filename ends with a .xml, it's assumed to be a legacy color map XML and will be converted to the new format before processing.
bool vtkSMTransferFunctionPresets::ImportPresets | ( | const Json::Value & | presets | ) |
Load presets from a file.
All presets are added to "custom" presets list and are considered as non-builtin. If the filename ends with a .xml, it's assumed to be a legacy color map XML and will be converted to the new format before processing.
bool vtkSMTransferFunctionPresets::ImportPresets | ( | const Json::Value & | presets, |
std::vector< ImportedPreset > * | importedPresets | ||
) |
Load presets from a file.
All presets are added to "custom" presets list and are considered as non-builtin. If the filename ends with a .xml, it's assumed to be a legacy color map XML and will be converted to the new format before processing.
void vtkSMTransferFunctionPresets::ReloadPresets | ( | ) |
Reload the presets from the configuration file.