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_13_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 
106  bool UpdateScalarBarRange(vtkSMProxy* view, bool deleteRange);
107  std::vector<vtkTypeBool> UpdateBlocksScalarBarRange(vtkSMProxy* view, bool deleteRange);
109 
111 
117  virtual bool SetScalarColoring(const char* arrayName, int attributeType);
119  const std::string& blockSelector, const char* arrayName, int attributeType)
120  {
121  return this->SetBlocksScalarColoring({ blockSelector }, arrayName, attributeType).front();
122  }
123  virtual std::vector<vtkTypeBool> SetBlocksScalarColoring(
124  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType);
126 
128 
135  virtual bool SetScalarColoring(const char* arrayName, int attributeType, int component);
137  const std::string& blockSelector, const char* arrayName, int attributeType, int component)
138  {
139  return this->SetBlocksScalarColoring({ blockSelector }, arrayName, attributeType, component)
140  .front();
141  }
142  virtual std::vector<vtkTypeBool> SetBlocksScalarColoring(
143  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
144  int component);
146 
148 
162  virtual bool RescaleTransferFunctionToDataRange(bool extend = false, bool force = true);
164  const std::string& blockSelector, bool extend = false, bool force = true)
165  {
166  return this->RescaleBlocksTransferFunctionToDataRange({ blockSelector }, extend, force).front();
167  }
168  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(
169  const std::vector<std::string>& blockSelectors, bool extend = false, bool force = true);
171 
173 
190  virtual bool RescaleTransferFunctionToDataRange(
191  const char* arrayName, int attributeType, bool extend = false, bool force = true);
192  virtual bool RescaleBlockTransferFunctionToDataRange(const std::string& blockSelector,
193  const char* arrayName, int attributeType, bool extend = false, bool force = true)
194  {
195  return this
196  ->RescaleBlocksTransferFunctionToDataRange(
197  { blockSelector }, arrayName, attributeType, extend, force)
198  .front();
199  }
200  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(
201  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
202  bool extend = false, bool force = true);
204 
206 
210  virtual bool RescaleTransferFunctionToDataRangeOverTime();
211  virtual bool RescaleBlockTransferFunctionToDataRangeOverTime(const std::string& blockSelector)
212  {
213  return this->RescaleBlocksTransferFunctionToDataRangeOverTime({ blockSelector }).front();
214  }
215  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
216  const std::vector<std::string>& blockSelectors);
218 
220 
226  virtual bool RescaleTransferFunctionToDataRangeOverTime(const char* arrayName, int attributeType);
228  const std::string& blockSelector, const char* arrayName, int attributeType)
229  {
230  return this
231  ->RescaleBlocksTransferFunctionToDataRangeOverTime(
232  { blockSelector }, arrayName, attributeType)
233  .front();
234  }
235  virtual std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
236  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType);
238 
240 
244  virtual bool RescaleTransferFunctionToVisibleRange(vtkSMProxy* view);
245  virtual bool RescaleTransferFunctionToVisibleRange(
246  vtkSMProxy* view, const char* arrayName, int attributeType);
248 
250 
254  virtual bool SetScalarBarVisibility(vtkSMProxy* view, bool visible);
256  vtkSMProxy* view, const std::string& blockSelector, bool visible)
257  {
258  return this->SetBlocksScalarBarVisibility(view, { blockSelector }, visible).front();
259  }
260  virtual std::vector<vtkTypeBool> SetBlocksScalarBarVisibility(
261  vtkSMProxy* view, const std::vector<std::string>& blockSelectors, bool visible);
263 
265 
272  virtual bool HideScalarBarIfNotNeeded(vtkSMProxy* view);
273  virtual bool HideBlocksScalarBarIfNotNeeded(vtkSMProxy* view);
275 
277 
281  virtual bool IsScalarBarVisible(vtkSMProxy* view);
282  virtual bool IsBlockScalarBarVisible(vtkSMProxy* view, const std::string& blockSelector)
283  {
284  return this->IsBlocksScalarBarVisible(view, { blockSelector }).front();
285  }
286  virtual std::vector<vtkTypeBool> IsBlocksScalarBarVisible(
287  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
289 
291 
296  virtual vtkPVArrayInformation* GetArrayInformationForColorArray(bool checkRepresentedData = true);
298  const std::string& blockSelector)
299  {
300  return this->GetBlocksArrayInformationForColorArray({ blockSelector }).front();
301  }
302  virtual std::vector<vtkPVArrayInformation*> GetBlocksArrayInformationForColorArray(
303  const std::vector<std::string>& blockSelectors);
305 
307 
311  virtual vtkPVProminentValuesInformation* GetProminentValuesInformationForColorArray(
312  double uncertaintyAllowed = 1e-6, double fraction = 1e-3, bool force = false);
314  const std::string& blockSelector, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
315  bool force = false)
316  {
317  return this
318  ->GetBlocksProminentValuesInformationForColorArray(
319  { blockSelector }, uncertaintyAllowed, fraction, force)
320  .front();
321  }
322  virtual std::vector<vtkPVProminentValuesInformation*>
323  GetBlocksProminentValuesInformationForColorArray(const std::vector<std::string>& blockSelectors,
324  double uncertaintyAllowed = 1e-6, double fraction = 1e-3, bool force = false);
326 
328 
331  int GetEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* view);
333  vtkSMProxy* view, const std::string& blockSelector)
334  {
335  return this->GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(view, { blockSelector }).front();
336  }
337  std::vector<int> GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(
338  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
340 
346  bool SetRepresentationType(const char* type) override;
347 
352  bool GetVolumeIndependentRanges();
353 
355 
364  int IsScalarBarStickyVisible(vtkSMProxy* view);
365  int IsBlockScalarBarStickyVisible(vtkSMProxy* view, const std::string& blockSelector)
366  {
367  return this->IsBlocksScalarBarStickyVisible(view, { blockSelector }).front();
368  }
369  std::vector<int> IsBlocksScalarBarStickyVisible(
370  vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
372 
376  void ViewUpdated(vtkSMProxy* view) override;
377 
379 
382  std::pair<int, std::string> GetBlockColorArray(const std::string& blockSelector)
383  {
384  return this->GetBlocksColorArrays({ blockSelector }).front();
385  }
386  std::vector<std::pair<int, std::string>> GetBlocksColorArrays(
387  const std::vector<std::string>& blockSelectors);
388  int GetBlockColorArrayAssociation(const std::string& blockSelector)
389  {
390  return this->GetBlockColorArray(blockSelector).first;
391  }
392  std::string GetBlockColorArrayName(const std::string& blockSelector)
393  {
394  return this->GetBlockColorArray(blockSelector).second;
395  }
397 
399 
402  void SetBlockUseSeparateColorMap(const std::string& blockSelector, bool use)
403  {
404  this->SetBlocksUseSeparateColorMap({ blockSelector }, use);
405  }
406  void SetBlocksUseSeparateColorMap(const std::vector<std::string>& blockSelectors, bool use);
407  bool GetBlockUseSeparateColorMap(const std::string& blockSelector)
408  {
409  return this->GetBlocksUseSeparateColorMaps({ blockSelector }).front();
410  }
411  std::vector<vtkTypeBool> GetBlocksUseSeparateColorMaps(
412  const std::vector<std::string>& blockSelectors);
414 
415 protected:
417  ~vtkSMPVRepresentationProxy() override;
418 
423  void CreateVTKObjects() override;
424 
425  // Whenever the "Representation" property is modified, we ensure that the
426  // this->InvalidateDataInformation() is called.
427  void OnPropertyUpdated(vtkObject*, unsigned long, void* calldata);
428 
434  void SetPropertyModifiedFlag(const char* name, int flag) override;
435 
439  int ReadXMLAttributes(vtkSMSessionProxyManager* pm, vtkPVXMLElement* element) override;
440 
447  std::unordered_map<std::string, vtkSmartPointer<vtkSMProxy>> LastBlocksLookupTables;
448 
449 private:
451  void operator=(const vtkSMPVRepresentationProxy&) = delete;
452 
453  bool InReadXMLAttributes;
454  std::set<std::string> RepresentationSubProxies;
455 };
456 
457 #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
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.
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.
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.