vtkSMPVRepresentationProxy.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
22 #ifndef vtkSMPVRepresentationProxy_h
23 #define vtkSMPVRepresentationProxy_h
24 
25 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_12_0
26 #include "vtkRemotingViewsModule.h" //needed for exports
28 #include "vtkSmartPointer.h" // For LastLUTProxy
29 
30 #include <set> // needed for std::set
31 #include <unordered_map> // needed for std::unordered_map
32 
34 
36 {
37 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
47  PARAVIEW_DEPRECATED_IN_5_13_0("Use SetLastLookupTable instead")
48  void SetLastLUTProxy(vtkSMProxy* proxy) { this->SetLastLookupTable(proxy); }
49  void SetLastLookupTable(vtkSMProxy* proxy);
50  PARAVIEW_DEPRECATED_IN_5_13_0("Use GetLastLookupTable instead")
51  vtkSMProxy* GetLastLUTProxy() { return this->GetLastLookupTable(); }
52  vtkSMProxy* GetLastLookupTable();
53  void SetLastBlockLookupTable(const std::string& blockSelector, vtkSMProxy* proxy)
54  {
55  this->SetLastBlocksLookupTable({ blockSelector }, proxy);
56  }
57  void SetLastBlocksLookupTable(const std::vector<std::string>& blockSelectors, vtkSMProxy* proxy);
58  vtkSMProxy* GetLastBlockLookupTable(const std::string& blockSelector)
59  {
60  return this->GetLastBlocksLookupTables({ blockSelector }).front();
61  }
62  std::vector<vtkSMProxy*> GetLastBlocksLookupTables(
63  const std::vector<std::string>& blockSelectors);
65 
67 
72  virtual bool GetUsingScalarColoring();
73  virtual bool GetBlockUsingScalarColoring(const std::string& blockSelector)
74  {
75  return this->GetBlocksUsingScalarColoring({ blockSelector }).front();
76  }
77  virtual std::vector<vtkTypeBool> GetBlocksUsingScalarColoring(
78  const std::vector<std::string>& blockSelectors);
79  virtual bool GetAnyBlockUsingScalarColoring();
81 
83 
87  PARAVIEW_DEPRECATED_IN_5_13_0("Use GetLookupTable instead")
88  vtkSMProxy* GetLUTProxy(vtkSMProxy* view) { return this->GetLookupTable(view); }
89  vtkSMProxy* GetLookupTable(vtkSMProxy* view);
90  vtkSMProxy* GetBlockLookupTable(vtkSMProxy* view, const std::string& blockSelector)
91  {
92  return this->GetBlocksLookupTables(view, { blockSelector }).front();
93  }
94  std::vector<vtkSMProxy*> GetBlocksLookupTables(
95  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
97 
99 
103  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
104  static bool GetUsingScalarColoring(vtkSMProxy* proxy)
105  {
107  return self ? self->GetUsingScalarColoring() : false;
108  }
110 
115  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
116  static void SetupLookupTable(vtkSMProxy* proxy);
117 
119 
126  bool UpdateScalarBarRange(vtkSMProxy* view, bool deleteRange);
127  std::vector<vtkTypeBool> UpdateBlocksScalarBarRange(vtkSMProxy* view, bool deleteRange);
129 
131 
137  virtual bool SetScalarColoring(const char* arrayName, int attributeType);
139  const std::string& blockSelector, const char* arrayName, int attributeType)
140  {
141  return this->SetBlocksScalarColoring({ blockSelector }, arrayName, attributeType).front();
142  }
143  virtual std::vector<vtkTypeBool> SetBlocksScalarColoring(
144  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType);
146 
148 
155  virtual bool SetScalarColoring(const char* arrayName, int attributeType, int component);
157  const std::string& blockSelector, const char* arrayName, int attributeType, int component)
158  {
159  return this->SetBlocksScalarColoring({ blockSelector }, arrayName, attributeType, component)
160  .front();
161  }
162  virtual std::vector<vtkTypeBool> SetBlocksScalarColoring(
163  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
164  int component);
166 
168 
172  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
173  static bool SetScalarColoring(vtkSMProxy* proxy, const char* arrayName, int attributeType)
174  {
176  return self ? self->SetScalarColoring(arrayName, attributeType) : false;
177  }
179 
181 
185  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
186  static bool SetScalarColoring(
187  vtkSMProxy* proxy, const char* arrayName, int attributeType, int component)
188  {
190  return self ? self->SetScalarColoring(arrayName, attributeType, component) : false;
191  }
193 
195 
209  virtual bool RescaleTransferFunctionToDataRange(bool extend = false, bool force = true);
211  const std::string& blockSelector, bool extend = false, bool force = true)
212  {
213  return this->RescaleBlocksTransferFunctionToDataRange({ blockSelector }, extend, force).front();
214  }
215  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(
216  const std::vector<std::string>& blockSelectors, bool extend = false, bool force = true);
218 
220 
237  virtual bool RescaleTransferFunctionToDataRange(
238  const char* arrayName, int attributeType, bool extend = false, bool force = true);
239  virtual bool RescaleBlockTransferFunctionToDataRange(const std::string& blockSelector,
240  const char* arrayName, int attributeType, bool extend = false, bool force = true)
241  {
242  return this
243  ->RescaleBlocksTransferFunctionToDataRange(
244  { blockSelector }, arrayName, attributeType, extend, force)
245  .front();
246  }
247  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(
248  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
249  bool extend = false, bool force = true);
251 
253 
257  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
258  static bool RescaleTransferFunctionToDataRange(
259  vtkSMProxy* proxy, bool extend = false, bool force = true)
260  {
262  return self ? self->RescaleTransferFunctionToDataRange(extend, force) : false;
263  }
265 
267 
271  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
272  static bool RescaleTransferFunctionToDataRange(vtkSMProxy* proxy, const char* arrayName,
273  int attributeType, bool extend = false, bool force = true)
274  {
276  return self ? self->RescaleTransferFunctionToDataRange(arrayName, attributeType, extend, force)
277  : false;
278  }
280 
282 
286  virtual bool RescaleTransferFunctionToDataRangeOverTime();
287  virtual bool RescaleBlockTransferFunctionToDataRangeOverTime(const std::string& blockSelector)
288  {
289  return this->RescaleBlocksTransferFunctionToDataRangeOverTime({ blockSelector }).front();
290  }
291  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
292  const std::vector<std::string>& blockSelectors);
294 
296 
302  virtual bool RescaleTransferFunctionToDataRangeOverTime(const char* arrayName, int attributeType);
304  const std::string& blockSelector, const char* arrayName, int attributeType)
305  {
306  return this
307  ->RescaleBlocksTransferFunctionToDataRangeOverTime(
308  { blockSelector }, arrayName, attributeType)
309  .front();
310  }
311  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
312  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType);
314 
316 
320  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
321  static bool RescaleTransferFunctionToDataRangeOverTime(vtkSMProxy* proxy)
322  {
324  return self ? self->RescaleTransferFunctionToDataRangeOverTime() : false;
325  }
327 
329 
333  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
334  static bool RescaleTransferFunctionToDataRangeOverTime(
335  vtkSMProxy* proxy, const char* arrayName, int attributeType)
336  {
338  return self ? self->RescaleTransferFunctionToDataRangeOverTime(arrayName, attributeType)
339  : false;
340  }
342 
344 
348  virtual bool RescaleTransferFunctionToVisibleRange(vtkSMProxy* view);
349  virtual bool RescaleTransferFunctionToVisibleRange(
350  vtkSMProxy* view, const char* arrayName, int attributeType);
352 
354 
358  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
359  static bool RescaleTransferFunctionToVisibleRange(vtkSMProxy* proxy, vtkSMProxy* view)
360  {
362  return self ? self->RescaleTransferFunctionToVisibleRange(view) : false;
363  }
364  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
365  static bool RescaleTransferFunctionToVisibleRange(
366  vtkSMProxy* proxy, vtkSMProxy* view, const char* arrayName, int attributeType)
367  {
369  return self ? self->RescaleTransferFunctionToVisibleRange(view, arrayName, attributeType)
370  : false;
371  }
373 
375 
379  virtual bool SetScalarBarVisibility(vtkSMProxy* view, bool visible);
380  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
381  static bool SetScalarBarVisibility(vtkSMProxy* proxy, vtkSMProxy* view, bool visible)
382  {
384  return self ? self->SetScalarBarVisibility(view, visible) : false;
385  }
387  vtkSMProxy* view, const std::string& blockSelector, bool visible)
388  {
389  return this->SetBlocksScalarBarVisibility(view, { blockSelector }, visible).front();
390  }
391  virtual std::vector<vtkTypeBool> SetBlocksScalarBarVisibility(
392  vtkSMProxy* view, const std::vector<std::string>& blockSelectors, bool visible);
394 
396 
403  virtual bool HideScalarBarIfNotNeeded(vtkSMProxy* view);
404  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
405  static bool HideScalarBarIfNotNeeded(vtkSMProxy* repr, vtkSMProxy* view)
406  {
408  return self ? self->HideScalarBarIfNotNeeded(view) : false;
409  }
410  virtual bool HideBlocksScalarBarIfNotNeeded(vtkSMProxy* view);
412 
414 
418  virtual bool IsScalarBarVisible(vtkSMProxy* view);
419  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
420  static bool IsScalarBarVisible(vtkSMProxy* repr, vtkSMProxy* view)
421  {
423  return self ? self->IsScalarBarVisible(view) : false;
424  }
425  virtual bool IsBlockScalarBarVisible(vtkSMProxy* view, const std::string& blockSelector)
426  {
427  return this->IsBlocksScalarBarVisible(view, { blockSelector }).front();
428  }
429  virtual std::vector<vtkTypeBool> IsBlocksScalarBarVisible(
430  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
432 
434 
439  virtual vtkPVArrayInformation* GetArrayInformationForColorArray(bool checkRepresentedData = true);
440  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
441  static vtkPVArrayInformation* GetArrayInformationForColorArray(
442  vtkSMProxy* proxy, bool checkRepresentedData = true)
443  {
445  return self ? self->GetArrayInformationForColorArray(checkRepresentedData) : nullptr;
446  }
448  const std::string& blockSelector)
449  {
450  return this->GetBlocksArrayInformationForColorArray({ blockSelector }).front();
451  }
452  virtual std::vector<vtkPVArrayInformation*> GetBlocksArrayInformationForColorArray(
453  const std::vector<std::string>& blockSelectors);
455 
457 
461  virtual vtkPVProminentValuesInformation* GetProminentValuesInformationForColorArray(
462  double uncertaintyAllowed = 1e-6, double fraction = 1e-3, bool force = false);
463  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
464  static vtkPVProminentValuesInformation* GetProminentValuesInformationForColorArray(
465  vtkSMProxy* proxy, double uncertaintyAllowed = 1e-6, double fraction = 1e-3, bool force = false)
466  {
468  return self
469  ? self->GetProminentValuesInformationForColorArray(uncertaintyAllowed, fraction, force)
470  : nullptr;
471  }
473  const std::string& blockSelector, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
474  bool force = false)
475  {
476  return this
477  ->GetBlocksProminentValuesInformationForColorArray(
478  { blockSelector }, uncertaintyAllowed, fraction, force)
479  .front();
480  }
481  virtual std::vector<vtkPVProminentValuesInformation*>
482  GetBlocksProminentValuesInformationForColorArray(const std::vector<std::string>& blockSelectors,
483  double uncertaintyAllowed = 1e-6, double fraction = 1e-3, bool force = false);
485 
487 
490  int GetEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* view);
491  PARAVIEW_DEPRECATED_IN_5_12_0("Use static functions from vtkSMColorMapEditorHelper instead")
492  static int GetEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* proxy, vtkSMProxy* view)
493  {
495  return self ? self->GetEstimatedNumberOfAnnotationsOnScalarBar(view) : -1;
496  }
498  vtkSMProxy* view, const std::string& blockSelector)
499  {
500  return this->GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(view, { blockSelector }).front();
501  }
502  std::vector<int> GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(
503  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
505 
511  bool SetRepresentationType(const char* type) override;
512 
517  bool GetVolumeIndependentRanges();
518 
520 
529  int IsScalarBarStickyVisible(vtkSMProxy* view);
530  int IsBlockScalarBarStickyVisible(vtkSMProxy* view, const std::string& blockSelector)
531  {
532  return this->IsBlocksScalarBarStickyVisible(view, { blockSelector }).front();
533  }
534  std::vector<int> IsBlocksScalarBarStickyVisible(
535  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
537 
541  void ViewUpdated(vtkSMProxy* view) override;
542 
544 
547  std::pair<int, std::string> GetBlockColorArray(const std::string& blockSelector)
548  {
549  return this->GetBlocksColorArrays({ blockSelector }).front();
550  }
551  std::vector<std::pair<int, std::string>> GetBlocksColorArrays(
552  const std::vector<std::string>& blockSelectors);
553  int GetBlockColorArrayAssociation(const std::string& blockSelector)
554  {
555  return this->GetBlockColorArray(blockSelector).first;
556  }
557  std::string GetBlockColorArrayName(const std::string& blockSelector)
558  {
559  return this->GetBlockColorArray(blockSelector).second;
560  }
562 
564 
567  void SetBlockUseSeparateColorMap(const std::string& blockSelector, bool use)
568  {
569  this->SetBlocksUseSeparateColorMap({ blockSelector }, use);
570  }
571  void SetBlocksUseSeparateColorMap(const std::vector<std::string>& blockSelectors, bool use);
572  bool GetBlockUseSeparateColorMap(const std::string& blockSelector)
573  {
574  return this->GetBlocksUseSeparateColorMaps({ blockSelector }).front();
575  }
576  std::vector<vtkTypeBool> GetBlocksUseSeparateColorMaps(
577  const std::vector<std::string>& blockSelectors);
579 
580 protected:
582  ~vtkSMPVRepresentationProxy() override;
583 
587  PARAVIEW_DEPRECATED_IN_5_12_0("Internal logic should be in vtkSMColorMapEditorHelper, use "
588  "exposed functions of the helper instead")
589  virtual bool RescaleTransferFunctionToDataRange(
590  vtkPVArrayInformation* info, bool extend = false, bool force = true);
591 
596  void CreateVTKObjects() override;
597 
598  // Whenever the "Representation" property is modified, we ensure that the
599  // this->InvalidateDataInformation() is called.
600  void OnPropertyUpdated(vtkObject*, unsigned long, void* calldata);
601 
607  void SetPropertyModifiedFlag(const char* name, int flag) override;
608 
612  int ReadXMLAttributes(vtkSMSessionProxyManager* pm, vtkPVXMLElement* element) override;
613 
618  PARAVIEW_DEPRECATED_IN_5_12_0("Internal logic should be in vtkSMColorMapEditorHelper, use "
619  "exposed functions of the helper instead")
620  std::string GetDecoratedArrayName(const std::string& arrayName);
621 
625  PARAVIEW_DEPRECATED_IN_5_12_0("Internal logic should be in vtkSMColorMapEditorHelper, use "
626  "exposed functions of the helper instead")
627  virtual bool SetScalarColoringInternal(
628  const char* arrayName, int attributeType, bool useComponent, int component);
629 
636  std::unordered_map<std::string, vtkSmartPointer<vtkSMProxy>> LastBlocksLookupTables;
637 
638 private:
640  void operator=(const vtkSMPVRepresentationProxy&) = delete;
641 
642  bool InReadXMLAttributes;
643  std::set<std::string> RepresentationSubProxies;
644 };
645 
646 #endif
Proxy for a representations.
virtual bool SetBlockScalarBarVisibility(vtkSMProxy *view, const std::string &blockSelector, bool visible)
Set the scalar bar visibility.
virtual bool IsBlockScalarBarVisible(vtkSMProxy *view, const std::string &blockSelector)
Check scalar bar visibility.
void CreateVTKObjects() override
Call superclass&#39; and then assigns a new executive (vtkCompositeDataPipeline)
component
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
type
virtual bool SetBlockScalarColoring(const std::string &blockSelector, const char *arrayName, int attributeType, int component)
Enable/disable scalar coloring using the specified array.
#define VTKREMOTINGVIEWS_EXPORT
void SetBlockUseSeparateColorMap(const std::string &blockSelector, bool use)
Set/Get if we should use a separate color map for this block.
representation for "Render View" like views in ParaView.
virtual bool RescaleBlockTransferFunctionToDataRange(const std::string &blockSelector, const char *arrayName, int attributeType, bool extend=false, bool force=true)
Rescales the color transfer function and opacity transfer function using the current data range for t...
void SetLastBlockLookupTable(const std::string &blockSelector, vtkSMProxy *proxy)
Set/get last LUT proxy.
info
virtual bool RescaleBlockTransferFunctionToDataRangeOverTime(const std::string &blockSelector, const char *arrayName, int attributeType)
Rescales the color transfer function and opacity transfer function using the current data range over ...
int GetBlockColorArrayAssociation(const std::string &blockSelector)
Set/Get the block color array name.
virtual void SetPropertyModifiedFlag(const char *name, int flag)
Note on property modified flags: The modified flag of each property associated with a proxy is stored...
virtual vtkPVArrayInformation * GetBlockArrayInformationForColorArray(const std::string &blockSelector)
Returns the array information for the data array used for scalar coloring, from input data...
bool GetBlockUseSeparateColorMap(const std::string &blockSelector)
Set/Get if we should use a separate color map for this block.
std::unordered_map< std::string, vtkSmartPointer< vtkSMProxy > > LastBlocksLookupTables
name
#define PARAVIEW_DEPRECATED_IN_5_13_0(reason)
virtual vtkPVProminentValuesInformation * GetBlockProminentValuesInformationForColorArray(const std::string &blockSelector, double uncertaintyAllowed=1e-6, double fraction=1e-3, bool force=false)
Call vtkSMRepresentationProxy::GetProminentValuesInformation() for the array used for scalar color...
int GetBlockEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy *view, const std::string &blockSelector)
Get an estimated number of annotation shown on this representation scalar bar.
virtual bool SetRepresentationType(const char *type)
Set the representation type.
int IsBlockScalarBarStickyVisible(vtkSMProxy *view, const std::string &blockSelector)
Checks if the scalar bar of this representation in view is sticky visible, i.e.
Prominent values a data array takes on.
void PrintSelf(ostream &os, vtkIndent indent) override
vtkSMProxy * GetLastBlockLookupTable(const std::string &blockSelector)
Set/get last LUT proxy.
virtual bool SetBlockScalarColoring(const std::string &blockSelector, const char *arrayName, int attributeType)
Enable/disable scalar coloring using the specified array.
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
std::string GetBlockColorArrayName(const std::string &blockSelector)
Set/Get the block color array name.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
provides meta data about arrays.
vtkSMProxy * GetBlockLookupTable(vtkSMProxy *view, const std::string &blockSelector)
Returns the lut proxy of this representation in the given view.
std::pair< int, std::string > GetBlockColorArray(const std::string &blockSelector)
Set/Get the block color array name.
virtual bool RescaleBlockTransferFunctionToDataRange(const std::string &blockSelector, bool extend=false, bool force=true)
Rescales the color transfer function and opacity transfer function using the current data range...
int ReadXMLAttributes(vtkSMSessionProxyManager *pm, vtkPVXMLElement *element) override
Read attributes from an XML element.
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
#define const
Definition: zconf.h:238
virtual bool GetBlockUsingScalarColoring(const std::string &blockSelector)
Returns true if scalar coloring is enabled.
static vtkSMRepresentationProxy * New()
virtual void ViewUpdated(vtkSMProxy *view)
Called after the view updates.
virtual bool RescaleBlockTransferFunctionToDataRangeOverTime(const std::string &blockSelector)
Rescales the color transfer function and opacity transfer function using the current data range over ...
vtkSmartPointer< vtkSMProxy > LastLookupTable
Used as a memory of what was the last LUT proxy linked to this representation.
static vtkSMPVRepresentationProxy * SafeDownCast(vtkObject *o)