MCPcopy Create free account
hub / github.com/Kitware/ParaView / GetColorTransferFunction

Method GetColorTransferFunction

Remoting/Views/vtkSMTransferFunctionManager.cxx:62–144  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

60
61//----------------------------------------------------------------------------
62vtkSMProxy* vtkSMTransferFunctionManager::GetColorTransferFunction(
63 const char* arrayName, vtkSMSessionProxyManager* pxm)
64{
65 assert(arrayName != nullptr && pxm != nullptr);
66
67 // sanitize the arrayName. This is necessary since sometimes array names have
68 // characters that can mess up regular expressions.
69 std::string sanitizedArrayName = vtkSMCoreUtilities::SanitizeName(arrayName);
70 arrayName = sanitizedArrayName.c_str();
71
72 vtkSMProxy* proxy = FindProxy("lookup_tables", arrayName, pxm);
73 if (proxy)
74 {
75 return proxy;
76 }
77
78 // Create a new one.
79 proxy = pxm->NewProxy("lookup_tables", "PVLookupTable");
80 if (!proxy)
81 {
82 vtkErrorMacro("Failed to create PVLookupTable proxy.");
83 return nullptr;
84 }
85
86 proxy->SetLogName((std::string("lut-for-") + std::string(arrayName)).c_str());
87
88 vtkNew<vtkSMParaViewPipelineController> controller;
89 controller->PreInitializeProxy(proxy);
90
91 vtkSMSettings* settings = vtkSMSettings::GetInstance();
92
93 // Load array-specific preset, if specified.
94 std::string stdPresetsKey = ".standard_presets.";
95 stdPresetsKey += arrayName;
96 if (settings->HasSetting(stdPresetsKey.c_str()))
97 {
98 const auto stdPreset = settings->GetSettingAsString(stdPresetsKey.c_str(), 0, "");
99 vtkSMTransferFunctionProxy::ApplyPreset(proxy, stdPreset.c_str(), /*usePresetRange=*/false);
100 }
101
102 // Look up array-specific transfer function
103 std::ostringstream prefix;
104 prefix << ".array_" << proxy->GetXMLGroup() << "." << arrayName;
105
106 settings->GetProxySettings(prefix.str().c_str(), proxy);
107
108 std::ostringstream proxyName;
109 proxyName << arrayName << ".PVLookupTable";
110 if (proxy->GetProperty("ScalarOpacityFunction"))
111 {
112 vtkSMProxy* sof = this->GetOpacityTransferFunction(arrayName, pxm);
113 if (sof)
114 {
115 sof->UpdateVTKObjects();
116 vtkSMPropertyHelper(proxy, "ScalarOpacityFunction").Set(sof);
117
118 // Since this function is initializing defaults for the lookup tables,
119 // including defaults for the proxy property transfer functions, get the

Callers 15

getRgbPointsMethod · 0.80
setRgbPointsMethod · 0.80
SetupLookupTableMethod · 0.80
WriteInternalMethod · 0.80

Calls 15

GetTransferFunction2DMethod · 0.95
SanitizeNameFunction · 0.85
FindProxyFunction · 0.85
ApplyPresetFunction · 0.85
PreInitializeProxyMethod · 0.80
GetSettingAsStringMethod · 0.80
NewProxyMethod · 0.45
SetLogNameMethod · 0.45
HasSettingMethod · 0.45
GetProxySettingsMethod · 0.45

Tested by 2

TestScalarBarPlacementFunction · 0.64