/usr/include/paraview/vtkSMTransferFunctionProxy.h is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | /*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkSMTransferFunctionProxy
// .SECTION Description
// vtkSMTransferFunctionProxy is the proxy used for "PVLookupTable",
// "ColorTransferFunction" and "PiecewiseFunction".
// It provides utility API to update lookup-table ranges, invert transfer
// function, etc. that can be used from C++ as well as Python layers.
#ifndef vtkSMTransferFunctionProxy_h
#define vtkSMTransferFunctionProxy_h
#include "vtkSMProxy.h"
#include "vtkPVServerManagerRenderingModule.h" // needed for export macro
namespace Json
{
class Value;
}
class vtkPVArrayInformation;
class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMTransferFunctionProxy : public vtkSMProxy
{
public:
static vtkSMTransferFunctionProxy* New();
vtkTypeMacro(vtkSMTransferFunctionProxy, vtkSMProxy);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Rescale the "RGBPoints" for the transfer function to match the new range.
// Returns true if rescale was successful.
// If \c extend is true (false by default), the transfer function range will
// only be extended as needed to fit the data range.
virtual bool RescaleTransferFunction(const double range[2], bool extend=false)
{ return this->RescaleTransferFunction(range[0], range[1], extend); }
virtual bool RescaleTransferFunction(double rangeMin, double rangeMax, bool extend=false);
// Description:
// Safely call RescaleTransferFunction() after casting the proxy to
// appropriate type.
static bool RescaleTransferFunction(vtkSMProxy* proxy,
double rangeMin, double rangeMax, bool extend=false);
static bool RescaleTransferFunction(vtkSMProxy* proxy,
const double range[2], bool extend=false)
{
return vtkSMTransferFunctionProxy::RescaleTransferFunction(
proxy, range[0], range[1], extend);
}
// Description:
// Locates all representations that are currently using this transfer function
// and then rescales the transfer function scalar range to exactly match the
// combined valid scalar ranges obtained from them all.
virtual bool RescaleTransferFunctionToDataRange(bool extend=false);
static bool RescaleTransferFunctionToDataRange(vtkSMProxy* proxy, bool extend=false)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->RescaleTransferFunctionToDataRange(extend) : false;
}
// Description:
// Invert the transfer function. Returns true if successful.
virtual bool InvertTransferFunction();
// Description:
// Safely call InvertTransferFunction() after casting the proxy to the
// appropriate type.
static bool InvertTransferFunction(vtkSMProxy*);
// Description:
// Remaps control points by normalizing in linear-space and then interpolating
// in log-space. This is useful when converting the transfer function from
// linear- to log-mode. If \c inverse is true, the operation is reversed i.e.
// the control points are normalized in log-space and interpolated in
// linear-space, useful when converting from log- to linear-mode.
virtual bool MapControlPointsToLogSpace(bool inverse=false);
virtual bool MapControlPointsToLinearSpace()
{ return this->MapControlPointsToLogSpace(true); }
// Description:
// Safely call MapControlPointsToLogSpace() after casting the proxy to the
// appropriate type.
static bool MapControlPointsToLogSpace(vtkSMProxy* proxy, bool inverse=false)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->MapControlPointsToLogSpace(inverse) : false;
}
// Description:
// Safely call MapControlPointsToLinearSpace() after casting the proxy to the
// appropriate type.
static bool MapControlPointsToLinearSpace(vtkSMProxy* proxy)
{
return vtkSMTransferFunctionProxy::MapControlPointsToLogSpace(proxy, true);
}
// Description:
// Apply a preset. If \c rescale is true (default), then apply loading the
// preset, the transfer function range will be preserved (if originally
// valid). If not valid, or \c rescale is false, then the range provided by
// the preset is used. When using indexed color maps, the \c rescale implies
// loading of annotations since the "range" for indexed color maps is
// described by the annotations.
virtual bool ApplyPreset(const Json::Value& value, bool rescale=true);
static bool ApplyPreset(vtkSMProxy* proxy, const Json::Value& value, bool rescale=true)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->ApplyPreset(value, rescale) : false;
}
virtual bool ApplyPreset(const char* presetname, bool rescale=true);
static bool ApplyPreset(vtkSMProxy* proxy, const char* presetname, bool rescale=true)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->ApplyPreset(presetname, rescale) : false;
}
// Description:
// Saves the transfer function state as a preset. This is simply a subset of the
// state of the transfer function proxy.
virtual Json::Value GetStateAsPreset();
static Json::Value GetStateAsPreset(vtkSMProxy* proxy);
// Description:
// Load a ColorMap XML. This will update a transfer function using the
// ColorMap XML. Currently, this is only supported for color transfer
// functions. Returns true on success.
virtual bool ApplyColorMap(const char* text);
virtual bool ApplyColorMap(vtkPVXMLElement* xml);
// Description:
// Safely call ApplyColorMap(..) after casting the proxy to the appropriate
// type.
static bool ApplyColorMap(vtkSMProxy* proxy, const char* text)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->ApplyColorMap(text) : false;
}
// Description:
// Safely call ApplyColorMap(..) after casting the proxy to the appropriate
// type.
static bool ApplyColorMap(vtkSMProxy* proxy, vtkPVXMLElement* xml)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->ApplyColorMap(xml) : false;
}
// Description:
// Save to ColorMap XML. Currently, this is only supported for color transfer
// functions. Returns true on success.
virtual bool SaveColorMap(vtkPVXMLElement* xml);
// Description:
// Safely call ApplyColorMap(..) after casting the proxy to the appropriate
// type.
static bool SaveColorMap(vtkSMProxy* proxy, vtkPVXMLElement* xml)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->SaveColorMap(xml) : false;
}
// Description:
// Return true if the representation corresponding to the transfer function
// for the view is showing a Scalar-Bar (Color Legend). Otherwise return
// false.
virtual bool IsScalarBarVisible(vtkSMProxy* view);
// Description:
// Safely call IsScalarBarVisible(..) after casting the proxy to the
// appropriate type.
static bool IsScalarBarVisible(vtkSMProxy* proxy, vtkSMProxy* view)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->IsScalarBarVisible(view) : false;
}
// Description:
// Find and return the Scalar-Bar (Color Legend) representation corresponding
// to the transfer function for the view, if any. This returns the proxy if
// one exists, it won't create a new one.
virtual vtkSMProxy* FindScalarBarRepresentation(vtkSMProxy* view);
// Description:
// Safely call FindScalarBarRepresentation(..) after casting the proxy to the
// appropriate type.
static vtkSMProxy* FindScalarBarRepresentation(
vtkSMProxy* proxy, vtkSMProxy* view)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->FindScalarBarRepresentation(view) : NULL;
}
// Description:
// Update component titles for all scalar bars connected to this transfer
// function proxy. The arrayInfo is used to determine component names, if
// possible.
virtual bool UpdateScalarBarsComponentTitle(vtkPVArrayInformation* arrayInfo);
static bool UpdateScalarBarsComponentTitle(vtkSMProxy* proxy,
vtkPVArrayInformation* arrayInfo)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->UpdateScalarBarsComponentTitle(arrayInfo) : false;
}
// Description:
// Helper method used by RescaleTransferFunctionToDataRange() to compute range
// from all visible representations using the transfer function.
// Returns true if a valid range was determined.
virtual bool ComputeDataRange(double range[2]);
static bool ComputeDataRange(vtkSMProxy* proxy, double range[2])
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->ComputeDataRange(range) : false;
}
// Description:
// Helper method to compute the active annotated values in visible
// representations that use the transfer function.
virtual bool ComputeAvailableAnnotations(bool extend=false);
static bool ComputeAvailableAnnotations(vtkSMProxy* proxy, bool extend=false)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self ? self->ComputeAvailableAnnotations(extend) : false;
}
// Description:
// Helper method to reset a transfer function proxy to its XML defaults. By
// passing in preserve_range, you can make this method preserve the current
// transfer function range.
virtual void ResetPropertiesToXMLDefaults(bool preserve_range);
static void ResetPropertiesToXMLDefaults(vtkSMProxy* proxy, bool preserve_range=false)
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
if (self)
{
self->ResetPropertiesToXMLDefaults(preserve_range);
}
}
using Superclass::ResetPropertiesToXMLDefaults;
// Description:
// Method to convert legacy color map preset XML to JSON. Use this to convert
// a single ColorMap xml. To convert a collection of color maps, use
// ConvertMultipleLegacyColorMapXMLToJSON().
static Json::Value ConvertLegacyColorMapXMLToJSON(vtkPVXMLElement* xml);
static Json::Value ConvertLegacyColorMapXMLToJSON(const char* xmlcontents);
// Description:
// Method to convert legacy "ColorMaps" preset XML to JSON. This converts all
// colormaps in the XML.
static Json::Value ConvertMultipleLegacyColorMapXMLToJSON(vtkPVXMLElement* xml);
static Json::Value ConvertMultipleLegacyColorMapXMLToJSON(const char* xmlcontents);
// Description:
// Converts legacy xml file to json.
static bool ConvertLegacyColorMapsToJSON(const char* inxmlfile, const char* outjsonfile);
// Description:
// Returns current transfer function data range. Returns false is a valid
// range could not be determined.
virtual bool GetRange(double range[2]);
static bool GetRange(vtkSMProxy* proxy, double range[2])
{
vtkSMTransferFunctionProxy* self =
vtkSMTransferFunctionProxy::SafeDownCast(proxy);
return self? self->GetRange(range) : false;
}
//BTX
protected:
vtkSMTransferFunctionProxy();
~vtkSMTransferFunctionProxy();
private:
vtkSMTransferFunctionProxy(const vtkSMTransferFunctionProxy&); // Not implemented
void operator=(const vtkSMTransferFunctionProxy&); // Not implemented
//ETX
};
#endif
|