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
|
/*=========================================================================
Program: ParaView
Module: vtkSMTransferFunctionManager.h
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.
=========================================================================*/
/**
* @class vtkSMTransferFunctionManager
* @brief manages transfer functions i.e. color
* lookuptables and opacity piecewise functions for ParaView applications.
*
* vtkSMTransferFunctionManager manages transfer functions i.e. color
* lookuptables and opacity piecewise functions for ParaView applications.
* vtkSMTransferFunctionManager implements the ParaView specific mechanism for
* managing such transfer function proxies where there's one transfer function
* created and maintained per data array name.
*
* vtkSMTransferFunctionManager has no state. You can create as many instances as
* per your choosing to call the methods. It uses the session proxy manager to
* locate proxies registered using specific names under specific groups. Thus,
* the state is maintained by the proxy manager itself.
*/
#ifndef vtkSMTransferFunctionManager_h
#define vtkSMTransferFunctionManager_h
#include "vtkPVServerManagerRenderingModule.h" // needed for export macro
#include "vtkSMObject.h"
class vtkSMProxy;
class vtkSMSessionProxyManager;
class VTKPVSERVERMANAGERRENDERING_EXPORT vtkSMTransferFunctionManager : public vtkSMObject
{
public:
static vtkSMTransferFunctionManager* New();
vtkTypeMacro(vtkSMTransferFunctionManager, vtkSMObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Returns a color transfer function proxy instance for mapping a data array
* with the given name. If none exists in the given
* session, a new instance will be created and returned.
*/
virtual vtkSMProxy* GetColorTransferFunction(
const char* arrayName, vtkSMSessionProxyManager* pxm);
/**
* Returns a opacity transfer function proxy (aka Piecewise Function) instance
* for mapping a data array with the given name. If
* none exists in the given session, a new instance will be created and
* returned.
*/
virtual vtkSMProxy* GetOpacityTransferFunction(
const char* arrayName, vtkSMSessionProxyManager* pxm);
/**
* Returns the scalar-bar (color-legend) representation corresponding to the
* transfer function for the view (currently only render-views are supported).
* Thus returns an existing proxy, if present, otherwise a new one is created,
* if possible.
*/
virtual vtkSMProxy* GetScalarBarRepresentation(
vtkSMProxy* colorTransferFunctionProxy, vtkSMProxy* view);
/**
* Iterates over all "known" transfer function proxies and request each one of
* them to update its range using data information currently available.
* If \c extend is true, the transfer function is expanded to accommodate
* current data range rather then resetting it to the range.
*/
void ResetAllTransferFunctionRangesUsingCurrentData(
vtkSMSessionProxyManager* pxm, bool extend = false);
enum UpdateScalarBarsMode
{
HIDE_UNUSED_SCALAR_BARS = 0x01,
SHOW_USED_SCALAR_BARS = 0x02
};
/**
* Updates the scalar bar visibility in the view. Based on the specified mode,
* scalars bars representing non-represented arrays can be automatically hidden;
* and those corresponding to arrays used for coloring can be automatically shown.
*/
virtual bool UpdateScalarBars(vtkSMProxy* viewProxy, unsigned int mode);
/**
* Updates all scalar bars using provided lutProxy, the representation
* is used to recover the component title
*/
virtual bool UpdateScalarBarsComponentTitle(vtkSMProxy* lutProxy, vtkSMProxy* representation);
/**
* Hides the scalar bar, if any, for the lutProxy in the view if it's not
* being used. Returns true if the scalar bar visibility was changed.
*/
virtual bool HideScalarBarIfNotNeeded(vtkSMProxy* lutProxy, vtkSMProxy* view);
protected:
vtkSMTransferFunctionManager();
~vtkSMTransferFunctionManager();
private:
vtkSMTransferFunctionManager(const vtkSMTransferFunctionManager&) VTK_DELETE_FUNCTION;
void operator=(const vtkSMTransferFunctionManager&) VTK_DELETE_FUNCTION;
};
#endif
|