Signals | Public Member Functions | List of all members
pqPresetGroupsManager Class Reference

pqPresetGroupsManager is an object to manage the groups of color map presets displayed in the pqPresetDialog. More...

#include <pqPresetGroupsManager.h>

Inherits QObject.

Signals

void groupsUpdated ()
 Fired whenever loadGroups or replaceGroups is called and new group information is available. More...
 

Public Member Functions

 pqPresetGroupsManager (QObject *p)
 Create a new groups manager. More...
 
 ~pqPresetGroupsManager ()
 
int numberOfGroups ()
 Returns the number of groups the manager knows of. More...
 
int numberOfPresetsInGroup (const QString &groupName)
 Returns the number of presets in the given group. More...
 
int presetRankInGroup (const QString &presetName, const QString &groupName)
 Returns the rank (index) of the given preset in the given group. More...
 
QList< QString > groupNames ()
 Returns a list of the group names the manager knows of. More...
 
QString groupName (int i)
 Returns the name of the ith group in the manager's list of groups. More...
 
void loadGroups (const QString &json)
 Load groups from the given JSON string (for the format see the class documentation) and add the groups to the groups in the manager. More...
 
void replaceGroups (const QString &json)
 Clears all groups in the manager and then loads groups from the given JSON string (see loadGroups). More...
 

Detailed Description

pqPresetGroupsManager is an object to manage the groups of color map presets displayed in the pqPresetDialog.

A pqPresetGroupsManager is created by the pqPVApplicationCore and registered as a manager. To get it:

auto groupManager = qobject_cast<pqPresetGroupsManager*>(
pqApplicationCore::instance()->manager("PRESET_GROUP_MANAGER"));

The group manager loads the groups of presets from a json file with this format:

[
{
"groupName": "default",
"presets": [
"Cool to Warm",
"Cool to Warm (Extended)",
"Black-Body Radiation",
"X Ray",
"Inferno (matplotlib)",
"Black, Blue and White",
"Blue Orange (divergent)",
"Viridis (matplotlib)",
"Gray and Red",
"Linear Green (Gr4L)",
"Cold and Hot",
"Blue - Green - Orange",
"Rainbow Desaturated",
"Yellow - Gray - Blue",
"Rainbow Uniform",
"jet"
]
},
{
"groupName": "myTestGroup",
"presets": [
"Reds",
"Blues",
"Greens",
"Oranges",
"Br0rYl",
"erdc_blue2yellow"
]
}
]

Definition at line 91 of file pqPresetGroupsManager.h.

Constructor & Destructor Documentation

◆ pqPresetGroupsManager()

pqPresetGroupsManager::pqPresetGroupsManager ( QObject *  p)

Create a new groups manager.

Custom applications should use the one created by pqPVApplicationCore (see class description).

◆ ~pqPresetGroupsManager()

pqPresetGroupsManager::~pqPresetGroupsManager ( )

Member Function Documentation

◆ numberOfGroups()

int pqPresetGroupsManager::numberOfGroups ( )

Returns the number of groups the manager knows of.

◆ numberOfPresetsInGroup()

int pqPresetGroupsManager::numberOfPresetsInGroup ( const QString &  groupName)

Returns the number of presets in the given group.

◆ presetRankInGroup()

int pqPresetGroupsManager::presetRankInGroup ( const QString &  presetName,
const QString &  groupName 
)

Returns the rank (index) of the given preset in the given group.

Returns -1 if the preset is not in the group (the preset dialog relies on this).

◆ groupNames()

QList<QString> pqPresetGroupsManager::groupNames ( )

Returns a list of the group names the manager knows of.

◆ groupName()

QString pqPresetGroupsManager::groupName ( int  i)

Returns the name of the ith group in the manager's list of groups.

◆ loadGroups()

void pqPresetGroupsManager::loadGroups ( const QString &  json)

Load groups from the given JSON string (for the format see the class documentation) and add the groups to the groups in the manager.

This is an append operation so the groups already in the manager will not be removed. If the json string has a group with the same name as one already in the manager, then the color maps in that group will be appended to the existing group.

◆ replaceGroups()

void pqPresetGroupsManager::replaceGroups ( const QString &  json)

Clears all groups in the manager and then loads groups from the given JSON string (see loadGroups).

This is an override operation instead of the append provided by loadGroups.

◆ groupsUpdated

void pqPresetGroupsManager::groupsUpdated ( )
signal

Fired whenever loadGroups or replaceGroups is called and new group information is available.


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