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

vtkSMSettings provides the underlying mechanism for setting default property values in ParaView. More...

#include <vtkSMSettings.h>

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

Public Types

typedef vtkObject Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
bool AddCollectionFromString (const std::string &settings, double priority)
 Add settings from a string. More...
 
bool AddCollectionFromFile (const std::string &fileName, double priority)
 The same as AddCollectionFromString, but this method reads the settings string from the named file. More...
 
void ClearAllSettings ()
 Clear out all settings, deleting all collections. More...
 
bool DistributeSettings ()
 Distribute setting collections to all processes if in batch symmetric mode. More...
 
bool SaveSettingsToFile (const std::string &filePath)
 Save highest priority setting collection to file. More...
 
bool HasSetting (const char *settingName)
 Check whether a setting is defined for the requested names. More...
 
bool HasSetting (const char *settingName, double maxPriority)
 Check whether a setting is defined for the requested names at or below a maximum priority level. More...
 
unsigned int GetSettingNumberOfElements (const char *settingName)
 Get the number of elements in a setting. More...
 
bool GetPropertySetting (vtkSMProperty *property)
 Set the property value from the setting collections. More...
 
bool GetPropertySetting (vtkSMProperty *property, double maxPriority)
 Set the property value from the setting collections that have priority at or less than the given priority. More...
 
bool GetPropertySetting (const char *prefix, vtkSMProperty *property)
 Set the property value from the setting collections under the given prefix. More...
 
bool GetPropertySetting (const char *prefix, vtkSMProperty *property, double maxPriority)
 Set the property value from the setting collections under the given prefix. More...
 
bool GetProxySettings (vtkSMProxy *proxy)
 Set the property values in a vtkSMProxy from the setting collections. More...
 
bool GetProxySettings (vtkSMProxy *proxy, double maxPriority)
 Set the property values in a vtkSMProxy from the setting collections that have priority at or less than the given priority. More...
 
bool GetProxySettings (const char *prefix, vtkSMProxy *proxy)
 Set the property values in a vtkSMProxy from the settings collections under the given prefix. More...
 
bool GetProxySettings (const char *prefix, vtkSMProxy *proxy, double maxPriority)
 Set the property values in a vtkSMProxy from the settings collections under the given prefix at or less than the given priority. More...
 
std::string GetSettingDescription (const char *settingName)
 Get description for a setting. More...
 
void SetProxySettings (vtkSMProxy *proxy, vtkSMPropertyIterator *propertyIt=nullptr, bool skipPropertiesWithDynamicDomains=true)
 Save non-default settings in the current user settings. More...
 
void SetProxySettings (const char *prefix, vtkSMProxy *proxy, vtkSMPropertyIterator *propertyIt=nullptr, bool skipPropertiesWithDynamicDomains=true)
 Save non-default settings in the current user settings under the given prefix. More...
 
void SetSettingDescription (const char *settingName, const char *description)
 Set the description of a setting. More...
 
int GetSettingAsInt (const char *settingName, int defaultValue)
 Get a vector setting as a scalar value. More...
 
double GetSettingAsDouble (const char *settingName, double defaultValue)
 Get a vector setting as a scalar value. More...
 
std::string GetSettingAsString (const char *settingName, const std::string &defaultValue)
 Get a vector setting as a scalar value. More...
 
int GetSettingAsInt (const char *settingName, unsigned int index, int defaultValue)
 Get a single element of a vector setting. More...
 
double GetSettingAsDouble (const char *settingName, unsigned int index, double defaultValue)
 Get a single element of a vector setting. More...
 
std::string GetSettingAsString (const char *settingName, unsigned int index, const std::string &defaultValue)
 Get a single element of a vector setting. More...
 
void SetSetting (const char *settingName, int value)
 Set setting of a given name in the highest priority collection. More...
 
void SetSetting (const char *settingName, double value)
 Set setting of a given name in the highest priority collection. More...
 
void SetSetting (const char *settingName, const std::string &value)
 Set setting of a given name in the highest priority collection. More...
 
void SetSetting (const char *settingName, unsigned int index, int value)
 Set element of a vector setting at a location given by the setting name. More...
 
void SetSetting (const char *settingName, unsigned int index, double value)
 Set element of a vector setting at a location given by the setting name. More...
 
void SetSetting (const char *settingName, unsigned int index, const std::string &value)
 Set element of a vector setting at a location given by the setting name. 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 vtkSMSettingsNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSMSettingsSafeDownCast (vtkObject *o)
 
static vtkSMSettingsGetInstance ()
 Get singleton instance. More...
 
static Json::Value SerializeAsJSON (vtkSMProxy *proxy, vtkSMPropertyIterator *iter=nullptr)
 Saves the state of the proxy as JSON. More...
 
static bool DeserializeFromJSON (vtkSMProxy *proxy, const Json::Value &value)
 Restores a proxy state using the JSON equivalent. 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

 vtkSMSettings ()
 
 ~vtkSMSettings () 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

vtkSMSettings provides the underlying mechanism for setting default property values in ParaView.

This class is a singleton class. Instances should be retrieved with the GetInstance() method.

This class provides the facilities for defining a linear hierarchy of setting collections. A setting collection is a group of not-necessarily-related settings defined in a string or text file. The text defining a setting collection is formatted in JSON. Collections can be added using the methods AddSettingsFromString() and AddSettingsFromFile().

Each setting collection has an associated priority. The priority is used to select the collection from which a setting should be retrieved when more than one collection has the same definition. A setting in a collection with a higher priority than another collection with the same setting has precedence and will be returned by the "Get*" methods in this class.

Settings for proxies and proxy properties are defined by specifying the XML names of the proxy group, proxies, and properties in a three-level hierarchy. For example, the Sphere Source settings can be defined by the following:

Precondition
{

"sources" : "SphereSource" : "Radius" : 2.5, "Center" : [0.0, 1.0, 0.0]

Definition at line 76 of file vtkSMSettings.h.

Member Typedef Documentation

◆ Superclass

Definition at line 80 of file vtkSMSettings.h.

Constructor & Destructor Documentation

◆ vtkSMSettings()

vtkSMSettings::vtkSMSettings ( )
protected

◆ ~vtkSMSettings()

vtkSMSettings::~vtkSMSettings ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkSMSettings* vtkSMSettings::New ( )
static

◆ GetClassName()

virtual const char* vtkSMSettings::GetClassName ( )
virtual

◆ IsTypeOf()

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

◆ IsA()

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

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

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

◆ PrintSelf()

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

Reimplemented from vtkObject.

◆ GetInstance()

static vtkSMSettings* vtkSMSettings::GetInstance ( )
static

Get singleton instance.

◆ AddCollectionFromString()

bool vtkSMSettings::AddCollectionFromString ( const std::string settings,
double  priority 
)

Add settings from a string.

The string should contain valid JSON-formatted text. The "priority" indicates how to treat a setting that has definitions in more than one setting collections. If two setting collections contain values for the same setting, then the setting from the collection with higher priority will be used.

◆ AddCollectionFromFile()

bool vtkSMSettings::AddCollectionFromFile ( const std::string fileName,
double  priority 
)

The same as AddCollectionFromString, but this method reads the settings string from the named file.

The fileName should be a full path.

◆ ClearAllSettings()

void vtkSMSettings::ClearAllSettings ( )

Clear out all settings, deleting all collections.

◆ DistributeSettings()

bool vtkSMSettings::DistributeSettings ( )

Distribute setting collections to all processes if in batch symmetric mode.

◆ SaveSettingsToFile()

bool vtkSMSettings::SaveSettingsToFile ( const std::string filePath)

Save highest priority setting collection to file.

◆ HasSetting() [1/2]

bool vtkSMSettings::HasSetting ( const char *  settingName)

Check whether a setting is defined for the requested names.

◆ HasSetting() [2/2]

bool vtkSMSettings::HasSetting ( const char *  settingName,
double  maxPriority 
)

Check whether a setting is defined for the requested names at or below a maximum priority level.

◆ GetSettingNumberOfElements()

unsigned int vtkSMSettings::GetSettingNumberOfElements ( const char *  settingName)

Get the number of elements in a setting.

◆ GetSettingAsInt() [1/2]

int vtkSMSettings::GetSettingAsInt ( const char *  settingName,
int  defaultValue 
)

Get a vector setting as a scalar value.

Shortcut for GetSettingAs...(settingName, 0, defaultValue)

◆ GetSettingAsDouble() [1/2]

double vtkSMSettings::GetSettingAsDouble ( const char *  settingName,
double  defaultValue 
)

Get a vector setting as a scalar value.

Shortcut for GetSettingAs...(settingName, 0, defaultValue)

◆ GetSettingAsString() [1/2]

std::string vtkSMSettings::GetSettingAsString ( const char *  settingName,
const std::string defaultValue 
)

Get a vector setting as a scalar value.

Shortcut for GetSettingAs...(settingName, 0, defaultValue)

◆ GetSettingAsInt() [2/2]

int vtkSMSettings::GetSettingAsInt ( const char *  settingName,
unsigned int  index,
int  defaultValue 
)

Get a single element of a vector setting.

◆ GetSettingAsDouble() [2/2]

double vtkSMSettings::GetSettingAsDouble ( const char *  settingName,
unsigned int  index,
double  defaultValue 
)

Get a single element of a vector setting.

◆ GetSettingAsString() [2/2]

std::string vtkSMSettings::GetSettingAsString ( const char *  settingName,
unsigned int  index,
const std::string defaultValue 
)

Get a single element of a vector setting.

◆ GetPropertySetting() [1/4]

bool vtkSMSettings::GetPropertySetting ( vtkSMProperty property)

Set the property value from the setting collections.

◆ GetPropertySetting() [2/4]

bool vtkSMSettings::GetPropertySetting ( vtkSMProperty property,
double  maxPriority 
)

Set the property value from the setting collections that have priority at or less than the given priority.

◆ GetPropertySetting() [3/4]

bool vtkSMSettings::GetPropertySetting ( const char *  prefix,
vtkSMProperty property 
)

Set the property value from the setting collections under the given prefix.

◆ GetPropertySetting() [4/4]

bool vtkSMSettings::GetPropertySetting ( const char *  prefix,
vtkSMProperty property,
double  maxPriority 
)

Set the property value from the setting collections under the given prefix.

that have priority at or less than the given priority.

◆ GetProxySettings() [1/4]

bool vtkSMSettings::GetProxySettings ( vtkSMProxy proxy)

Set the property values in a vtkSMProxy from the setting collections.

◆ GetProxySettings() [2/4]

bool vtkSMSettings::GetProxySettings ( vtkSMProxy proxy,
double  maxPriority 
)

Set the property values in a vtkSMProxy from the setting collections that have priority at or less than the given priority.

◆ GetProxySettings() [3/4]

bool vtkSMSettings::GetProxySettings ( const char *  prefix,
vtkSMProxy proxy 
)

Set the property values in a vtkSMProxy from the settings collections under the given prefix.

◆ GetProxySettings() [4/4]

bool vtkSMSettings::GetProxySettings ( const char *  prefix,
vtkSMProxy proxy,
double  maxPriority 
)

Set the property values in a vtkSMProxy from the settings collections under the given prefix at or less than the given priority.

◆ GetSettingDescription()

std::string vtkSMSettings::GetSettingDescription ( const char *  settingName)

Get description for a setting.

◆ SetSetting() [1/6]

void vtkSMSettings::SetSetting ( const char *  settingName,
int  value 
)

Set setting of a given name in the highest priority collection.

Shortcut for SetSetting(settingName, 0, value). Useful for setting scalar values.

◆ SetSetting() [2/6]

void vtkSMSettings::SetSetting ( const char *  settingName,
double  value 
)

Set setting of a given name in the highest priority collection.

Shortcut for SetSetting(settingName, 0, value). Useful for setting scalar values.

◆ SetSetting() [3/6]

void vtkSMSettings::SetSetting ( const char *  settingName,
const std::string value 
)

Set setting of a given name in the highest priority collection.

Shortcut for SetSetting(settingName, 0, value). Useful for setting scalar values.

◆ SetSetting() [4/6]

void vtkSMSettings::SetSetting ( const char *  settingName,
unsigned int  index,
int  value 
)

Set element of a vector setting at a location given by the setting name.

◆ SetSetting() [5/6]

void vtkSMSettings::SetSetting ( const char *  settingName,
unsigned int  index,
double  value 
)

Set element of a vector setting at a location given by the setting name.

◆ SetSetting() [6/6]

void vtkSMSettings::SetSetting ( const char *  settingName,
unsigned int  index,
const std::string value 
)

Set element of a vector setting at a location given by the setting name.

◆ SetProxySettings() [1/2]

void vtkSMSettings::SetProxySettings ( vtkSMProxy proxy,
vtkSMPropertyIterator propertyIt = nullptr,
bool  skipPropertiesWithDynamicDomains = true 
)

Save non-default settings in the current user settings.

Use the optional 'propertyIt' to limit the serialization to a subset of properties (typically using vtkSMPropertyIterator subclasses like vtkSMNamedPropertyIterator). skipPropertiesWithDynamicDomains when true (default) ensures that we skip serializing properties that have domains whose values change at runtime.

◆ SetProxySettings() [2/2]

void vtkSMSettings::SetProxySettings ( const char *  prefix,
vtkSMProxy proxy,
vtkSMPropertyIterator propertyIt = nullptr,
bool  skipPropertiesWithDynamicDomains = true 
)

Save non-default settings in the current user settings under the given prefix.

Use the optional 'propertyIt' to limit the serialization to a subset of properties (typically using vtkSMPropertyIterator subclasses like vtkSMNamedPropertyIterator). skipPropertiesWithDynamicDomains when true (default) ensures that we skip serializing properties that have domains whose values change at runtime.

◆ SetSettingDescription()

void vtkSMSettings::SetSettingDescription ( const char *  settingName,
const char *  description 
)

Set the description of a setting.

◆ SerializeAsJSON()

static Json::Value vtkSMSettings::SerializeAsJSON ( vtkSMProxy proxy,
vtkSMPropertyIterator iter = nullptr 
)
static

Saves the state of the proxy as JSON.

The implementation simply converts the state XML to JSON.

◆ DeserializeFromJSON()

static bool vtkSMSettings::DeserializeFromJSON ( vtkSMProxy proxy,
const Json::Value &  value 
)
static

Restores a proxy state using the JSON equivalent.

The implementation converts JSON to XML state for the proxy and then attempts to restore the XML state.


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