vtkSMSettings provides the underlying mechanism for setting default property values in ParaView. More...
#include <vtkSMSettings.h>
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) |
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 vtkSMSettings * | New () |
static int | IsTypeOf (const char *type) |
static vtkSMSettings * | SafeDownCast (vtkObject *o) |
static vtkSMSettings * | GetInstance () |
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 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 | |
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 |
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:
"sources" : "SphereSource" : "Radius" : 2.5, "Center" : [0.0, 1.0, 0.0]
Definition at line 76 of file vtkSMSettings.h.
typedef vtkObject vtkSMSettings::Superclass |
Definition at line 80 of file vtkSMSettings.h.
|
protected |
|
overrideprotected |
|
static |
|
virtual |
Reimplemented from vtkObjectBase.
|
static |
|
overridevirtual |
Reimplemented from vtkObject.
|
static |
Get singleton instance.
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.
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.
void vtkSMSettings::ClearAllSettings | ( | ) |
Clear out all settings, deleting all collections.
bool vtkSMSettings::DistributeSettings | ( | ) |
Distribute setting collections to all processes if in batch symmetric mode.
bool vtkSMSettings::SaveSettingsToFile | ( | const std::string & | filePath | ) |
Save highest priority setting collection to file.
bool vtkSMSettings::HasSetting | ( | const char * | settingName | ) |
Check whether a setting is defined for the requested names.
Check whether a setting is defined for the requested names at or below a maximum priority level.
Get the number of elements in a setting.
Get a vector setting as a scalar value.
Shortcut for GetSettingAs...(settingName, 0, defaultValue)
Get a vector setting as a scalar value.
Shortcut for GetSettingAs...(settingName, 0, defaultValue)
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)
int vtkSMSettings::GetSettingAsInt | ( | const char * | settingName, |
unsigned int | index, | ||
int | defaultValue | ||
) |
Get a single element of a vector setting.
double vtkSMSettings::GetSettingAsDouble | ( | const char * | settingName, |
unsigned int | index, | ||
double | defaultValue | ||
) |
Get a single element of a vector setting.
std::string vtkSMSettings::GetSettingAsString | ( | const char * | settingName, |
unsigned int | index, | ||
const std::string & | defaultValue | ||
) |
Get a single element of a vector setting.
bool vtkSMSettings::GetPropertySetting | ( | vtkSMProperty * | property | ) |
Set the property value from the setting collections.
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.
bool vtkSMSettings::GetPropertySetting | ( | const char * | prefix, |
vtkSMProperty * | property | ||
) |
Set the property value from the setting collections under the given prefix.
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.
bool vtkSMSettings::GetProxySettings | ( | vtkSMProxy * | proxy | ) |
Set the property values in a vtkSMProxy from the setting collections.
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.
bool vtkSMSettings::GetProxySettings | ( | const char * | prefix, |
vtkSMProxy * | proxy | ||
) |
Set the property values in a vtkSMProxy from the settings collections under the given prefix.
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.
std::string vtkSMSettings::GetSettingDescription | ( | const char * | settingName | ) |
Get description for a setting.
Set setting of a given name in the highest priority collection.
Shortcut for SetSetting(settingName, 0, value). Useful for setting scalar values.
Set setting of a given name in the highest priority collection.
Shortcut for SetSetting(settingName, 0, value). Useful for setting scalar values.
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.
Set element of a vector setting at a location given by the setting name.
Set element of a vector setting at a location given by the setting name.
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.
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.
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.
Set the description of a setting.
|
static |
Saves the state of the proxy as JSON.
The implementation simply converts the state XML to JSON.
|
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.