vtkSMColorMapEditorHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkSMColorMapEditorHelper_h
13 #define vtkSMColorMapEditorHelper_h
14 
15 #include "vtkRemotingViewsModule.h" //needed for exports
16 #include "vtkSmartPointer.h" // For LastLUTProxy
17 
20 class vtkSMProxy;
22 
24 {
25 public:
27 
31  static vtkSMProxy* GetLUTProxy(vtkSMProxy* proxy, vtkSMProxy* view);
32  static vtkSMProxy* GetBlockLUTProxy(
33  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector);
35 
37 
42  static bool GetUsingScalarColoring(vtkSMProxy* proxy);
43  static bool GetBlockUsingScalarColoring(vtkSMProxy* proxy, const std::string& blockSelector);
44  static bool GetAnyBlockUsingScalarColoring(vtkSMProxy* proxy);
46 
48 
52  static void SetupLookupTable(vtkSMProxy* proxy);
53  static void SetupBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector);
55 
57 
64  static bool UpdateScalarBarRange(vtkSMProxy* proxy, vtkSMProxy* view, bool deleteRange);
65  static bool UpdateBlockScalarBarRange(
66  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector, bool deleteRange);
68 
70 
76  static bool SetScalarColoring(vtkSMProxy* proxy, const char* arrayName, int attributeType);
77  static bool SetBlockScalarColoring(
78  vtkSMProxy* proxy, const std::string& blockSelector, const char* arrayName, int attributeType);
80 
82 
90  static bool SetScalarColoring(
91  vtkSMProxy* proxy, const char* arrayName, int attributeType, int component);
92  static bool SetBlockScalarColoring(vtkSMProxy* proxy, const std::string& blockSelector,
93  const char* arrayName, int attributeType, int component);
95 
97 
105  static bool RescaleTransferFunctionToDataRange(
106  vtkSMProxy* proxy, bool extend = false, bool force = true);
107  static bool RescaleBlockTransferFunctionToDataRange(
108  vtkSMProxy* proxy, const std::string& blockSelector, bool extend = false, bool force = true);
110 
112 
122  static bool RescaleTransferFunctionToDataRange(vtkSMProxy* proxy, const char* arrayName,
123  int attributeType, bool extend = false, bool force = true);
124  static bool RescaleBlockTransferFunctionToDataRange(vtkSMProxy* proxy,
125  const std::string& blockSelector, const char* arrayName, int attributeType, bool extend = false,
126  bool force = true);
128 
130 
134  static bool RescaleTransferFunctionToDataRangeOverTime(vtkSMProxy* proxy);
135  static bool RescaleBlockTransferFunctionToDataRangeOverTime(
136  vtkSMProxy* proxy, const std::string& blockSelector);
138 
140 
146  static bool RescaleTransferFunctionToDataRangeOverTime(
147  vtkSMProxy* proxy, const char* arrayName, int attributeType);
148  static bool RescaleBlockTransferFunctionToDataRangeOverTime(
149  vtkSMProxy* proxy, const std::string& blockSelector, const char* arrayName, int attributeType);
151 
153 
157  static bool RescaleTransferFunctionToVisibleRange(vtkSMProxy* proxy, vtkSMProxy* view);
158  static bool RescaleTransferFunctionToVisibleRange(
159  vtkSMProxy* proxy, vtkSMProxy* view, const char* arrayName, int attributeType);
160  static bool RescaleBlockTransferFunctionToVisibleRange(
161  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector);
162  static bool RescaleBlockTransferFunctionToVisibleRange(vtkSMProxy* proxy, vtkSMProxy* view,
163  const std::string& blockSelector, const char* arrayName, int attributeType);
165 
167 
171  static bool SetScalarBarVisibility(vtkSMProxy* proxy, vtkSMProxy* view, bool visible);
172  static bool SetBlockScalarBarVisibility(
173  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector, bool visible);
175 
183  static bool HideScalarBarIfNotNeeded(vtkSMProxy* repr, vtkSMProxy* view);
184 
186 
190  static bool IsScalarBarVisible(vtkSMProxy* repr, vtkSMProxy* view);
191  static bool IsBlockScalarBarVisible(
192  vtkSMProxy* repr, vtkSMProxy* view, const std::string& blockSelector);
194 
196 
201  static vtkPVArrayInformation* GetArrayInformationForColorArray(
202  vtkSMProxy* proxy, bool checkRepresentedData = true);
203  static vtkPVArrayInformation* GetBlockArrayInformationForColorArray(
204  vtkSMProxy* proxy, const std::string& blockSelector, bool checkRepresentedData = true);
206 
208 
212  static std::string GetDecoratedArrayName(vtkSMProxy* proxy, const std::string& arrayName);
213  static std::string GetBlockDecoratedArrayName(
214  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& arrayName);
216 
218 
222  static vtkPVProminentValuesInformation* GetProminentValuesInformationForColorArray(
223  vtkSMProxy* proxy, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
224  bool force = false);
225  static vtkPVProminentValuesInformation* GetBlockProminentValuesInformationForColorArray(
226  vtkSMProxy* proxy, const std::string& blockSelector, double uncertaintyAllowed = 1e-6,
227  double fraction = 1e-3, bool force = false);
229 
231 
234  static int GetEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* proxy, vtkSMProxy* view);
235  static int GetBlockEstimatedNumberOfAnnotationsOnScalarBar(
236  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector);
238 
240 
249  static int IsScalarBarStickyVisible(vtkSMProxy* proxy, vtkSMProxy* view);
250  static int IsBlockScalarBarStickyVisible(
251  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector);
252 
254 
257  static void SetBlockColorArray(
258  vtkSMProxy* proxy, const std::string& blockSelector, int attributeType, std::string arrayName);
259  static std::pair<int, std::string> GetBlockColorArray(
260  vtkSMProxy* proxy, const std::string& blockSelector);
261  static int GetBlockColorArrayAssociation(vtkSMProxy* proxy, const std::string& blockSelector)
262  {
263  return vtkSMColorMapEditorHelper::GetBlockColorArray(proxy, blockSelector).first;
264  }
265  static std::string GetBlockColorArrayName(vtkSMProxy* proxy, const std::string& blockSelector)
266  {
267  return vtkSMColorMapEditorHelper::GetBlockColorArray(proxy, blockSelector).second;
268  }
270 
272 
275  static void SetBlockUseSeparateColorMap(
276  vtkSMProxy* proxy, const std::string& blockSelector, bool use);
277  static bool GetBlockUseSeparateColorMap(vtkSMProxy* proxy, const std::string& blockSelector);
279 
280 protected:
282 
285  // Add proxy parameter?
286  static bool RescaleTransferFunctionToDataRange(
287  vtkSMProxy* proxy, vtkPVArrayInformation* info, bool extend = false, bool force = true);
288  static bool RescaleBlockTransferFunctionToDataRange(vtkSMProxy* proxy,
289  const std::string& blockSelector, vtkPVArrayInformation* info, bool extend = false,
290  bool force = true);
292 
294 
297  static void SetBlockLookupTable(
298  vtkSMProxy* proxy, const std::string& blockSelector, vtkSMProxy* lutProxy);
299  static vtkSMProxy* GetBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector);
300  static void RemoveBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector);
302 
305  static bool SetScalarColoringInternal(
306  vtkSMProxy* proxy, const char* arrayName, int attributeType, bool useComponent, int component);
307  static bool SetBlockScalarColoringInternal(vtkSMProxy* proxy, const std::string& blockSelector,
308  const char* arrayName, int attributeType, bool useComponent, int component);
310 
312 
317  static vtkSMProxy* GetLastLUTProxy(vtkSMProxy* proxy);
318  static void SetLastLUTProxy(vtkSMProxy* proxy, vtkSMProxy* lutProxy);
319  static vtkSMProxy* GetLastBlockLUTProxy(vtkSMProxy* proxy, const std::string& blockSelector);
320  static void SetLastBlockLUTProxy(
321  vtkSMProxy* proxy, const std::string& blockSelector, vtkSMProxy* lutProxy);
323 
325 
326 private:
327  vtkSMColorMapEditorHelper() = delete;
329  ~vtkSMColorMapEditorHelper() = delete;
330  void operator=(const vtkSMColorMapEditorHelper&) = delete;
331 };
332 
333 #endif
static std::string GetBlockColorArrayName(vtkSMProxy *proxy, const std::string &blockSelector)
Checks if the scalar bar of this representation in view is sticky visible, i.e.
component
static int GetBlockColorArrayAssociation(vtkSMProxy *proxy, const std::string &blockSelector)
Checks if the scalar bar of this representation in view is sticky visible, i.e.
#define VTKREMOTINGVIEWS_EXPORT
representation for "Render View" like views in ParaView.
info
Prominent values a data array takes on.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
provides meta data about arrays.
static std::pair< int, std::string > GetBlockColorArray(vtkSMProxy *proxy, const std::string &blockSelector)
Checks if the scalar bar of this representation in view is sticky visible, i.e.
helper for color map editor handling