Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkSMTransferFunctionPresets Class Reference

manages presets for color, opacity, and annotation presets. More...

#include <vtkSMTransferFunctionPresets.h>

Inheritance diagram for vtkSMTransferFunctionPresets:
Inheritance graph
[legend]
Collaboration diagram for vtkSMTransferFunctionPresets:
Collaboration graph
[legend]

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)
 
vtkCommandGetCommand (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)
 
vtkCommandGetCommand (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 vtkSMTransferFunctionPresetsNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSMTransferFunctionPresetsSafeDownCast (vtkObject *o)
 
static vtkSMTransferFunctionPresetsGetInstance ()
 Get singleton instance. More...
 
- Static Public Member Functions inherited from vtkSMObject
static vtkSMObjectNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSMObjectSafeDownCast (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 vtkObjectNew ()
 
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 vtkObjectBaseNew ()
 
static vtkObjectBaseNew ()
 

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
 

Detailed Description

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.

Member Typedef Documentation

◆ Superclass

Definition at line 44 of file vtkSMTransferFunctionPresets.h.

Constructor & Destructor Documentation

◆ vtkSMTransferFunctionPresets()

vtkSMTransferFunctionPresets::vtkSMTransferFunctionPresets ( )
protected

◆ ~vtkSMTransferFunctionPresets()

vtkSMTransferFunctionPresets::~vtkSMTransferFunctionPresets ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkSMTransferFunctionPresets* vtkSMTransferFunctionPresets::New ( )
static

◆ GetClassName()

virtual const char* vtkSMTransferFunctionPresets::GetClassName ( )
virtual

Reimplemented from vtkSMObject.

◆ IsTypeOf()

static int vtkSMTransferFunctionPresets::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual int vtkSMTransferFunctionPresets::IsA ( const char *  type)
virtual

Reimplemented from vtkSMObject.

◆ SafeDownCast()

static vtkSMTransferFunctionPresets* vtkSMTransferFunctionPresets::SafeDownCast ( vtkObject o)
static

◆ PrintSelf()

void vtkSMTransferFunctionPresets::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Reimplemented from vtkSMObject.

◆ GetInstance()

static vtkSMTransferFunctionPresets* vtkSMTransferFunctionPresets::GetInstance ( )
static

Get singleton instance.

◆ GetNumberOfPresets()

unsigned int vtkSMTransferFunctionPresets::GetNumberOfPresets ( )

Returns the number of presets current available (including builtin and custom).

◆ GetPresetAsString()

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.

◆ AddPreset() [1/2]

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.

◆ RemovePreset()

bool vtkSMTransferFunctionPresets::RemovePreset ( unsigned int  index)

Remove a preset.

This has no effect for builtin presets.

◆ GetFirstPresetWithName() [1/2]

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.

◆ GetFirstPresetWithName() [2/2]

const Json::Value& vtkSMTransferFunctionPresets::GetFirstPresetWithName ( const char *  name)

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.

◆ GetPreset()

const Json::Value& vtkSMTransferFunctionPresets::GetPreset ( unsigned int  index)

Returns a preset at a given index.

◆ GetPresetName()

std::string vtkSMTransferFunctionPresets::GetPresetName ( unsigned int  index)

Returns the name for a preset at the given index.

◆ HasPreset()

bool vtkSMTransferFunctionPresets::HasPreset ( const char *  name)

Returns true if a present with given name exists.

◆ GetPresetHasOpacities() [1/2]

bool vtkSMTransferFunctionPresets::GetPresetHasOpacities ( const Json::Value &  preset)

Returns true if the preset has opacities i.e.

values for a piecewise function.

◆ GetPresetHasOpacities() [2/2]

bool vtkSMTransferFunctionPresets::GetPresetHasOpacities ( unsigned int  index)
inline

Definition at line 106 of file vtkSMTransferFunctionPresets.h.

◆ GetPresetHasIndexedColors() [1/2]

bool vtkSMTransferFunctionPresets::GetPresetHasIndexedColors ( const Json::Value &  preset)

Returns true is the preset has indexed colors.

◆ GetPresetHasIndexedColors() [2/2]

bool vtkSMTransferFunctionPresets::GetPresetHasIndexedColors ( unsigned int  index)
inline

Definition at line 115 of file vtkSMTransferFunctionPresets.h.

◆ GetPresetHasAnnotations() [1/2]

bool vtkSMTransferFunctionPresets::GetPresetHasAnnotations ( const Json::Value &  preset)

Returns true is the preset has annotations.

◆ GetPresetHasAnnotations() [2/2]

bool vtkSMTransferFunctionPresets::GetPresetHasAnnotations ( unsigned int  index)
inline

Definition at line 124 of file vtkSMTransferFunctionPresets.h.

◆ SetPreset()

bool vtkSMTransferFunctionPresets::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.

Return true if preset was correctly set, false otherwise.

◆ AddPreset() [2/2]

bool vtkSMTransferFunctionPresets::AddPreset ( const char *  name,
const Json::Value &  preset 
)

Add a preset give the Json::Value object.

◆ AddUniquePreset()

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.

◆ IsPresetBuiltin()

bool vtkSMTransferFunctionPresets::IsPresetBuiltin ( unsigned int  index)

Returns true if the preset is a builtin preset.

The preset is identified by its index.

◆ RenamePreset()

bool vtkSMTransferFunctionPresets::RenamePreset ( unsigned int  index,
const char *  newname 
)

Rename a preset.

◆ ImportPresets() [1/4]

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.

◆ ImportPresets() [2/4]

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.

◆ ImportPresets() [3/4]

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.

◆ ImportPresets() [4/4]

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.

◆ ReloadPresets()

void vtkSMTransferFunctionPresets::ReloadPresets ( )

Reload the presets from the configuration file.


The documentation for this class was generated from the following file: