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 "vtkObject.h" // Superclass
16 #include "vtkParaViewDeprecation.h" // For PARAVIEW_DEPRECATED_IN_5_13_0
17 #include "vtkRemotingViewsModule.h" // needed for exports
18 #include "vtkSmartPointer.h" // For LastLUTProxy
19 
20 #include <array> // For array
21 #include <cstdint> // For int
22 #include <map> // For map
23 #include <string> // For string
24 #include <vector> // For vector
25 
28 class vtkSMProperty;
29 class vtkSMProxy;
31 
32 // template <bool UseBlockProperties = false>
34 {
35 public:
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41  {
42  Representation = 0,
43  Blocks = 1
44  };
45 
46  enum BlockPropertyState : std::uint8_t
47  {
48  // Property is disabled because it can not be edited
49  Disabled = 0x0,
50  // Property is inherited from the representation
51  RepresentationInherited = 0x1,
52  // Property is inherited from a block
53  BlockInherited = 0x2,
54  // Property is inherited from a block and the representation
55  MixedInherited = 0x3,
56  // Property is set in all blocks
57  Set = 0x4,
58  // Property is set in some blocks and representation inherited
59  SetAndRepresentationInherited = 0x5,
60  // Property is set in some blocks and block inherited
61  SetAndBlockInherited = 0x6,
62  // Property is set in some blocks and mixed inherited
63  SetAndMixedInherited = 0x7,
64  // Number of possible states
65  NumberOfStates = 0x8
66  };
67 
69 
78  vtkSetClampMacro(SelectedPropertiesType, int, SelectedPropertiesTypes::Representation,
79  SelectedPropertiesTypes::Blocks);
81  {
82  this->SetSelectedPropertiesType(SelectedPropertiesTypes::Representation);
83  }
85  {
86  this->SetSelectedPropertiesType(SelectedPropertiesTypes::Blocks);
87  }
88  vtkGetMacro(SelectedPropertiesType, int);
90 
94  static SelectedPropertiesTypes GetPropertyType(vtkSMProperty* property);
95 
97 
109  static std::pair<std::string, BlockPropertyState> HasBlockProperty(
110  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& propertyName);
111  static std::pair<std::string, BlockPropertyState> GetBlockPropertyStateFromBlockPropertyStates(
112  const std::vector<std::pair<std::string, BlockPropertyState>>& states);
113  static std::pair<std::string, BlockPropertyState> HasBlockProperty(vtkSMProxy* proxy,
114  const std::vector<std::string>& blockSelectors, const std::string& propertyName);
115  static std::pair<std::string, BlockPropertyState> HasBlockProperties(vtkSMProxy* proxy,
116  const std::string& blockSelector, const std::vector<std::string>& propertyNames);
117  static std::pair<std::string, BlockPropertyState> HasBlocksProperties(vtkSMProxy* proxy,
118  const std::vector<std::string>& blockSelectors, const std::vector<std::string>& propertyNames);
120 
124  static std::vector<std::string> GetSelectedBlockSelectors(vtkSMProxy* proxy);
125 
129  static std::vector<std::string> GetColorArraysBlockSelectors(vtkSMProxy* proxy);
130 
132 
137  PARAVIEW_DEPRECATED_IN_5_13_0("Use GetLookupTable instead")
138  static vtkSMProxy* GetLUTProxy(vtkSMProxy* proxy, vtkSMProxy* view)
139  {
140  return vtkSMColorMapEditorHelper::GetLookupTable(proxy, view);
141  }
142  static vtkSMProxy* GetLookupTable(vtkSMProxy* proxy);
143  static vtkSMProxy* GetLookupTable(vtkSMProxy* proxy, vtkSMProxy* view);
144  static vtkSMProxy* GetBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector)
145  {
146  return vtkSMColorMapEditorHelper::GetBlocksLookupTables(proxy, { blockSelector }).front();
147  }
148  static std::vector<vtkSMProxy*> GetBlocksLookupTables(
149  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
151  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector)
152  {
153  return vtkSMColorMapEditorHelper::GetBlocksLookupTables(proxy, view, { blockSelector }).front();
154  }
155  static std::vector<vtkSMProxy*> GetBlocksLookupTables(
156  vtkSMProxy* proxy, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
157  std::vector<vtkSMProxy*> GetSelectedLookupTables(vtkSMProxy* proxy);
158  std::vector<vtkSMProxy*> GetSelectedLookupTables(vtkSMProxy* proxy, vtkSMProxy* view);
160 
162 
167  static bool GetUsingScalarColoring(vtkSMProxy* proxy);
168  static bool GetBlockUsingScalarColoring(vtkSMProxy* proxy, const std::string& blockSelector)
169  {
170  return vtkSMColorMapEditorHelper::GetBlocksUsingScalarColoring(proxy, { blockSelector })
171  .front();
172  }
173  static std::vector<vtkTypeBool> GetBlocksUsingScalarColoring(
174  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
175  static bool GetAnyBlockUsingScalarColoring(vtkSMProxy* proxy);
176  std::vector<vtkTypeBool> GetSelectedUsingScalarColorings(vtkSMProxy* proxy);
177  bool GetAnySelectedUsingScalarColoring(vtkSMProxy* proxy);
179 
181 
185  static void SetupLookupTable(vtkSMProxy* proxy);
186  static void SetupBlocksLookupTables(vtkSMProxy* proxy);
188 
190 
197  static bool UpdateScalarBarRange(vtkSMProxy* proxy, vtkSMProxy* view, bool deleteRange);
198  static std::vector<vtkTypeBool> UpdateBlocksScalarBarRange(
199  vtkSMProxy* proxy, vtkSMProxy* view, bool deleteRange);
201 
203 
209  static bool SetScalarColoring(vtkSMProxy* proxy, const char* arrayName, int attributeType);
211  vtkSMProxy* proxy, const std::string& blockSelector, const char* arrayName, int attributeType)
212  {
214  proxy, { blockSelector }, arrayName, attributeType)
215  .front();
216  }
217  static std::vector<vtkTypeBool> SetBlocksScalarColoring(vtkSMProxy* proxy,
218  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType);
219  std::vector<vtkTypeBool> SetSelectedScalarColoring(
220  vtkSMProxy* proxy, const char* arrayName, int attributeType);
222 
224 
232  static bool SetScalarColoring(
233  vtkSMProxy* proxy, const char* arrayName, int attributeType, int component);
234  static bool SetBlockScalarColoring(vtkSMProxy* proxy, const std::string& blockSelector,
235  const char* arrayName, int attributeType, int component)
236  {
238  proxy, { blockSelector }, arrayName, attributeType, component)
239  .front();
240  }
241  static std::vector<vtkTypeBool> SetBlocksScalarColoring(vtkSMProxy* proxy,
242  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
243  int component);
244  std::vector<vtkTypeBool> SetSelectedScalarColoring(
245  vtkSMProxy* proxy, const char* arrayName, int attributeType, int component);
247 
249 
257  static bool RescaleTransferFunctionToDataRange(
258  vtkSMProxy* proxy, bool extend = false, bool force = true);
260  vtkSMProxy* proxy, const std::string& blockSelector, bool extend = false, bool force = true)
261  {
263  proxy, { blockSelector }, extend, force)
264  .front();
265  }
266  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(vtkSMProxy* proxy,
267  const std::vector<std::string>& blockSelectors, bool extend = false, bool force = true);
268  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRange(
269  vtkSMProxy* proxy, bool extend = false, bool force = true);
271 
273 
283  static bool RescaleTransferFunctionToDataRange(vtkSMProxy* proxy, const char* arrayName,
284  int attributeType, bool extend = false, bool force = true);
286  const std::string& blockSelector, const char* arrayName, int attributeType, bool extend = false,
287  bool force = true)
288  {
290  proxy, { blockSelector }, arrayName, attributeType, extend, force)
291  .front();
292  }
293  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(vtkSMProxy* proxy,
294  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
295  bool extend = false, bool force = true);
296  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRange(vtkSMProxy* proxy,
297  const char* arrayName, int attributeType, bool extend = false, bool force = true);
299 
301 
305  static bool RescaleTransferFunctionToDataRangeOverTime(vtkSMProxy* proxy);
307  vtkSMProxy* proxy, const std::string& blockSelector)
308  {
310  proxy, { blockSelector })
311  .front();
312  }
313  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
314  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
315  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRangeOverTime(vtkSMProxy* proxy);
317 
319 
325  static bool RescaleTransferFunctionToDataRangeOverTime(
326  vtkSMProxy* proxy, const char* arrayName, int attributeType);
328  vtkSMProxy* proxy, const std::string& blockSelector, const char* arrayName, int attributeType)
329  {
331  proxy, { blockSelector }, arrayName, attributeType)
332  .front();
333  }
334  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
335  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, const char* arrayName,
336  int attributeType);
337  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRangeOverTime(
338  vtkSMProxy* proxy, const char* arrayName, int attributeType);
340 
342 
346  static bool RescaleTransferFunctionToVisibleRange(vtkSMProxy* proxy, vtkSMProxy* view);
347  static bool RescaleTransferFunctionToVisibleRange(
348  vtkSMProxy* proxy, vtkSMProxy* view, const char* arrayName, int attributeType);
350 
352 
356  static bool SetScalarBarVisibility(vtkSMProxy* proxy, vtkSMProxy* view, bool visible);
358  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector, bool visible)
359  {
361  proxy, view, { blockSelector }, visible)
362  .front();
363  }
364  static std::vector<vtkTypeBool> SetBlocksScalarBarVisibility(vtkSMProxy* proxy, vtkSMProxy* view,
365  const std::vector<std::string>& blockSelectors, bool visible);
366  std::vector<vtkTypeBool> SetSelectedScalarBarVisibility(
367  vtkSMProxy* proxy, vtkSMProxy* view, bool visible);
369 
371 
378  static bool HideScalarBarIfNotNeeded(vtkSMProxy* repr, vtkSMProxy* view);
379  static bool HideBlocksScalarBarIfNotNeeded(vtkSMProxy* repr, vtkSMProxy* view);
381 
383 
387  static bool IsScalarBarVisible(vtkSMProxy* repr, vtkSMProxy* view);
389  vtkSMProxy* repr, vtkSMProxy* view, const std::string& blockSelector)
390  {
391  return vtkSMColorMapEditorHelper::IsBlocksScalarBarVisible(repr, view, { blockSelector })
392  .front();
393  }
394  static std::vector<vtkTypeBool> IsBlocksScalarBarVisible(
395  vtkSMProxy* repr, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
397 
399 
404  static vtkPVArrayInformation* GetArrayInformationForColorArray(
405  vtkSMProxy* proxy, bool checkRepresentedData = true);
407  vtkSMProxy* proxy, const std::string& blockSelector)
408  {
410  proxy, { blockSelector })
411  .front();
412  }
413  static std::vector<vtkPVArrayInformation*> GetBlocksArrayInformationForColorArray(
414  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
416 
418 
422  static std::string GetDecoratedArrayName(vtkSMProxy* proxy, const std::string& arrayName);
423  static std::string GetBlockDecoratedArrayName(
424  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& arrayName)
425  {
427  proxy, { blockSelector }, arrayName)
428  .front();
429  }
430  static std::vector<std::string> GetBlocksDecoratedArrayNames(vtkSMProxy* proxy,
431  const std::vector<std::string>& blockSelectors, const std::string& arrayName);
433 
435 
439  static vtkPVProminentValuesInformation* GetProminentValuesInformationForColorArray(
440  vtkSMProxy* proxy, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
441  bool force = false);
443  vtkSMProxy* proxy, const std::string& blockSelector, double uncertaintyAllowed = 1e-6,
444  double fraction = 1e-3, bool force = false)
445  {
447  proxy, { blockSelector }, uncertaintyAllowed, fraction, force)
448  .front();
449  }
450  static std::vector<vtkPVProminentValuesInformation*>
451  GetBlocksProminentValuesInformationForColorArray(vtkSMProxy* proxy,
452  const std::vector<std::string>& blockSelectors, double uncertaintyAllowed = 1e-6,
453  double fraction = 1e-3, bool force = false);
455 
457 
462  static int GetEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* proxy, vtkSMProxy* view);
464  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector)
465  {
467  proxy, view, { blockSelector })
468  .front();
469  }
470  static std::vector<int> GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(
471  vtkSMProxy* proxy, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
472  std::vector<int> GetSelectedEstimatedNumberOfAnnotationsOnScalarBars(
473  vtkSMProxy* proxy, vtkSMProxy* view);
474  int GetAnySelectedEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* proxy, vtkSMProxy* view);
476 
478 
487  static int IsScalarBarStickyVisible(vtkSMProxy* proxy, vtkSMProxy* view);
489  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector)
490  {
491  return vtkSMColorMapEditorHelper::IsBlocksScalarBarStickyVisible(proxy, view, { blockSelector })
492  .front();
493  }
494  static std::vector<int> IsBlocksScalarBarStickyVisible(
495  vtkSMProxy* proxy, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
497 
498  using Color = std::array<double, 3>;
500 
505  static bool IsColorValid(Color color);
506  static void SetColor(vtkSMProxy* proxy, Color color);
507  static void SetBlockColor(vtkSMProxy* proxy, const std::string& blockSelector, Color color)
508  {
509  vtkSMColorMapEditorHelper::SetBlocksColor(proxy, { blockSelector }, color);
510  }
511  static void SetBlocksColor(
512  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, Color color);
513  static void RemoveBlockColor(vtkSMProxy* proxy, const std::string& blockSelector)
514  {
515  vtkSMColorMapEditorHelper::RemoveBlocksColors(proxy, { blockSelector });
516  }
517  static void RemoveBlocksColors(vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
518  void SetSelectedColor(vtkSMProxy* proxy, Color color);
519  static Color GetColor(vtkSMProxy* proxy);
520  static Color GetBlockColor(vtkSMProxy* proxy, const std::string& blockSelector)
521  {
522  return vtkSMColorMapEditorHelper::GetBlocksColors(proxy, { blockSelector }).front();
523  }
524  static std::vector<Color> GetBlocksColors(
525  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
526  std::vector<Color> GetSelectedColors(vtkSMProxy* proxy);
528 
530 
533  static vtkSMProperty* GetColorArrayProperty(vtkSMProxy* proxy);
534  static vtkSMProperty* GetBlockColorArrayProperty(vtkSMProxy* proxy);
535  vtkSMProperty* GetSelectedColorArrayProperty(vtkSMProxy* proxy);
537 
538  using ColorArray = std::pair<int, std::string>;
540 
545  static bool IsColorArrayValid(const ColorArray& array);
546  static std::vector<ColorArray> GetBlocksColorArrays(
547  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
548  static int GetBlockColorArrayAssociation(vtkSMProxy* proxy, const std::string& blockSelector)
549  {
550  return vtkSMColorMapEditorHelper::GetBlockColorArray(proxy, blockSelector).first;
551  }
552  static std::string GetBlockColorArrayName(vtkSMProxy* proxy, const std::string& blockSelector)
553  {
554  return vtkSMColorMapEditorHelper::GetBlockColorArray(proxy, blockSelector).second;
555  }
556  static std::map<ColorArray, std::vector<std::string>> GetCommonColorArraysBlockSelectors(
557  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
558  std::vector<ColorArray> GetSelectedColorArrays(vtkSMProxy* proxy);
560 
562 
565  static vtkSMProperty* GetUseSeparateColorMapProperty(vtkSMProxy* proxy);
566  static vtkSMProperty* GetBlockUseSeparateColorMapProperty(vtkSMProxy* proxy);
567  vtkSMProperty* GetSelectedUseSeparateColorMapProperty(vtkSMProxy* proxy);
569 
571 
576  static bool IsUseSeparateColorMapValid(int useSeparateColorMap);
577  static void SetUseSeparateColorMap(vtkSMProxy* proxy, bool use);
579  vtkSMProxy* proxy, const std::string& blockSelector, bool use)
580  {
581  vtkSMColorMapEditorHelper::SetBlocksUseSeparateColorMap(proxy, { blockSelector }, use);
582  }
583  static void SetBlocksUseSeparateColorMap(
584  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, bool use);
585  static void RemoveBlockUseSeparateColorMap(vtkSMProxy* proxy, const std::string& blockSelector)
586  {
588  }
589  static void RemoveBlocksUseSeparateColorMaps(
590  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
591  void SetSelectedUseSeparateColorMap(vtkSMProxy* proxy, bool use);
592  static bool GetUseSeparateColorMap(vtkSMProxy* proxy);
593  static int GetBlockUseSeparateColorMap(vtkSMProxy* proxy, const std::string& blockSelector)
594  {
595  return vtkSMColorMapEditorHelper::GetBlocksUseSeparateColorMaps(proxy, { blockSelector })
596  .front();
597  }
598  static std::vector<int> GetBlocksUseSeparateColorMaps(
599  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
600  std::vector<int> GetSelectedUseSeparateColorMaps(vtkSMProxy* proxy);
601  bool GetAnySelectedUseSeparateColorMap(vtkSMProxy* proxy);
603 
605 
610  static bool IsMapScalarsValid(int mapScalars);
611  static void SetMapScalars(vtkSMProxy* proxy, bool mapScalars);
612  static void SetBlockMapScalars(
613  vtkSMProxy* proxy, const std::string& blockSelector, bool mapScalars)
614  {
615  vtkSMColorMapEditorHelper::SetBlocksMapScalars(proxy, { blockSelector }, mapScalars);
616  }
617  static void SetBlocksMapScalars(
618  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, bool mapScalars);
619  static void RemoveBlockMapScalars(vtkSMProxy* proxy, const std::string& blockSelector)
620  {
621  vtkSMColorMapEditorHelper::RemoveBlocksMapScalars(proxy, { blockSelector });
622  }
623  static void RemoveBlocksMapScalars(
624  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
625  void SetSelectedMapScalars(vtkSMProxy* proxy, bool mapScalars);
626  static bool GetMapScalars(vtkSMProxy* proxy);
627  static int GetBlockMapScalars(vtkSMProxy* proxy, const std::string& blockSelector)
628  {
629  return vtkSMColorMapEditorHelper::GetBlocksMapScalars(proxy, { blockSelector }).front();
630  }
631  static std::vector<int> GetBlocksMapScalars(
632  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
633  std::vector<int> GetSelectedMapScalars(vtkSMProxy* proxy);
634  bool GetAnySelectedMapScalars(vtkSMProxy* proxy);
636 
638 
643  static bool IsInterpolateScalarsBeforeMappingValid(int interpolate);
644  static void SetInterpolateScalarsBeforeMapping(vtkSMProxy* proxy, bool interpolate);
646  vtkSMProxy* proxy, const std::string& blockSelector, bool interpolate)
647  {
649  proxy, { blockSelector }, interpolate);
650  }
651  static void SetBlocksInterpolateScalarsBeforeMapping(
652  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, bool interpolate);
654  vtkSMProxy* proxy, const std::string& blockSelector)
655  {
657  proxy, { blockSelector });
658  }
659  static void RemoveBlocksInterpolateScalarsBeforeMappings(
660  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
661  void SetSelectedInterpolateScalarsBeforeMapping(vtkSMProxy* proxy, bool interpolate);
662  static bool GetInterpolateScalarsBeforeMapping(vtkSMProxy* proxy);
664  vtkSMProxy* proxy, const std::string& blockSelector)
665  {
667  proxy, { blockSelector })
668  .front();
669  }
670  static std::vector<int> GetBlocksInterpolateScalarsBeforeMappings(
671  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
672  std::vector<int> GetSelectedInterpolateScalarsBeforeMappings(vtkSMProxy* proxy);
673  bool GetAnySelectedInterpolateScalarsBeforeMapping(vtkSMProxy* proxy);
675 
677 
682  static bool IsOpacityValid(double opacity);
683  static void SetOpacity(vtkSMProxy* proxy, double opacity);
684  static void SetBlockOpacity(vtkSMProxy* proxy, const std::string& blockSelector, double opacity)
685  {
686  return vtkSMColorMapEditorHelper::SetBlocksOpacity(proxy, { blockSelector }, opacity);
687  }
688  static void SetBlocksOpacity(
689  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, double opacity);
690  static void RemoveBlockOpacity(vtkSMProxy* proxy, const std::string& blockSelector)
691  {
692  return vtkSMColorMapEditorHelper::RemoveBlocksOpacities(proxy, { blockSelector });
693  }
694  static void RemoveBlocksOpacities(
695  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
696  void SetSelectedOpacity(vtkSMProxy* proxy, double opacity);
697  static double GetOpacity(vtkSMProxy* proxy);
698  static double GetBlockOpacity(vtkSMProxy* proxy, const std::string& blockSelector)
699  {
700  return vtkSMColorMapEditorHelper::GetBlocksOpacities(proxy, { blockSelector }).front();
701  }
702  static std::vector<double> GetBlocksOpacities(
703  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
704  std::vector<double> GetSelectedOpacities(vtkSMProxy* proxy);
706 
708 
711  static void ResetBlockProperty(
712  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& propertyName)
713  {
714  vtkSMColorMapEditorHelper::ResetBlocksProperty(proxy, { blockSelector }, propertyName);
715  }
716  static void RemoveBlockProperties(vtkSMProxy* proxy, const std::string& blockSelector,
717  const std::vector<std::string>& propertyNames)
718  {
719  vtkSMColorMapEditorHelper::ResetBlocksProperties(proxy, { blockSelector }, propertyNames);
720  }
721  static void ResetBlocksProperty(vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors,
722  const std::string& propertyName)
723  {
724  vtkSMColorMapEditorHelper::ResetBlocksProperties(proxy, blockSelectors, { propertyName });
725  }
726  static void ResetBlocksProperties(vtkSMProxy* proxy,
727  const std::vector<std::string>& blockSelectors, const std::vector<std::string>& propertyNames);
729 
730 protected:
732  ~vtkSMColorMapEditorHelper() override;
733 
735 
738  // Add proxy parameter?
739  static bool RescaleTransferFunctionToDataRange(
740  vtkSMProxy* proxy, vtkPVArrayInformation* info, bool extend = false, bool force = true);
742  const std::string& blockSelector, vtkPVArrayInformation* info, bool extend = false,
743  bool force = true)
744  {
746  proxy, { blockSelector }, { info }, extend, force)
747  .front();
748  }
749  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(vtkSMProxy* proxy,
750  const std::vector<std::string>& blockSelectors, std::vector<vtkPVArrayInformation*> infos,
751  bool extend = false, bool force = true);
753 
755 
758  static void SetColorArray(vtkSMProxy* proxy, int attributeType, std::string arrayName);
759  static void SetBlockColorArray(
760  vtkSMProxy* proxy, const std::string& blockSelector, int attributeType, std::string arrayName)
761  {
763  proxy, { blockSelector }, attributeType, arrayName);
764  }
765  static void SetBlocksColorArray(vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors,
766  int attributeType, std::string arrayName);
767  static void RemoveBlockColorArray(vtkSMProxy* proxy, const std::string& blockSelector)
768  {
769  vtkSMColorMapEditorHelper::RemoveBlocksColorArrays(proxy, { blockSelector });
770  }
771  static void RemoveBlocksColorArrays(
772  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
773  static ColorArray GetColorArray(vtkSMProxy* proxy);
774  static ColorArray GetBlockColorArray(vtkSMProxy* proxy, const std::string& blockSelector)
775  {
776  return vtkSMColorMapEditorHelper::GetBlocksColorArrays(proxy, { blockSelector }).front();
777  }
779 
781 
784  static void SetBlockLookupTable(
785  vtkSMProxy* proxy, const std::string& blockSelector, vtkSMProxy* lutProxy)
786  {
787  vtkSMColorMapEditorHelper::SetBlocksLookupTable(proxy, { blockSelector }, lutProxy);
788  }
789  static void SetBlocksLookupTable(
790  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, vtkSMProxy* lutProxy);
791  static void RemoveBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector)
792  {
793  vtkSMColorMapEditorHelper::RemoveBlocksLookupTables(proxy, { blockSelector });
794  }
795  static void RemoveBlocksLookupTables(
796  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
798 
802  static bool SetScalarColoringInternal(
803  vtkSMProxy* proxy, const char* arrayName, int attributeType, bool useComponent, int component);
804  static std::vector<vtkTypeBool> SetBlocksScalarColoringInternal(vtkSMProxy* proxy,
805  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
806  bool useComponent, int component);
807  std::vector<vtkTypeBool> SetSelectedScalarColoringInternal(
808  vtkSMProxy* proxy, const char* arrayName, int attributeType, bool useComponent, int component);
810 
812 
817  static vtkSMProxy* GetLastLookupTable(vtkSMProxy* proxy);
818  static void SetLastLookupTable(vtkSMProxy* proxy, vtkSMProxy* lutProxy);
819  static vtkSMProxy* GetLastBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector)
820  {
821  return vtkSMColorMapEditorHelper::GetLastBlocksLookupTables(proxy, { blockSelector }).front();
822  }
823  static std::vector<vtkSMProxy*> GetLastBlocksLookupTables(
824  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
826  vtkSMProxy* proxy, const std::string& blockSelector, vtkSMProxy* lutProxy)
827  {
828  vtkSMColorMapEditorHelper::SetLastBlocksLookupTable(proxy, { blockSelector }, lutProxy);
829  }
830  static void SetLastBlocksLookupTable(
831  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, vtkSMProxy* lutProxy);
833 
835 
836 private:
838  void operator=(const vtkSMColorMapEditorHelper&) = delete;
839 
840  int SelectedPropertiesType = SelectedPropertiesTypes::Representation;
841 };
842 
843 #endif
static void SetBlockLookupTable(vtkSMProxy *proxy, const std::string &blockSelector, vtkSMProxy *lutProxy)
Set the block lookup table proxy.
std::pair< int, std::string > ColorArray
color
static std::string GetBlockColorArrayName(vtkSMProxy *proxy, const std::string &blockSelector)
Get the color array name.
static vtkPVProminentValuesInformation * GetBlockProminentValuesInformationForColorArray(vtkSMProxy *proxy, 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...
static ColorArray GetBlockColorArray(vtkSMProxy *proxy, const std::string &blockSelector)
Set the color array name.
component
static bool RescaleBlockTransferFunctionToDataRange(vtkSMProxy *proxy, 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...
static void RemoveBlockMapScalars(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the map scalars of the representation.
static int GetBlockColorArrayAssociation(vtkSMProxy *proxy, const std::string &blockSelector)
Get the color array name.
static void SetBlocksInterpolateScalarsBeforeMapping(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, bool interpolate)
Set/Get the map scalars of the representation.
static void RemoveBlocksInterpolateScalarsBeforeMappings(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the map scalars of the representation.
static std::vector< ColorArray > GetBlocksColorArrays(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Get the color array name.
#define VTKREMOTINGVIEWS_EXPORT
static void ResetBlockProperty(vtkSMProxy *proxy, const std::string &blockSelector, const std::string &propertyName)
Reset a block property.
static void RemoveBlocksOpacities(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the opacity of the representation.
static void ResetBlocksProperty(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, const std::string &propertyName)
Reset a block property.
static void SetBlockUseSeparateColorMap(vtkSMProxy *proxy, const std::string &blockSelector, bool use)
Set/Get if we should use a separate color map.
static std::vector< vtkPVArrayInformation * > GetBlocksArrayInformationForColorArray(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Returns the array information for the data array used for scalar coloring, from input data...
representation for "Render View" like views in ParaView.
static void RemoveBlocksLookupTables(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set the block lookup table proxy.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
static Color GetBlockColor(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the color of the representation.
static void SetLastBlockLookupTable(vtkSMProxy *proxy, const std::string &blockSelector, vtkSMProxy *lutProxy)
Used as a memory of what was the last LUT proxy linked to this representation.
static std::vector< int > IsBlocksScalarBarStickyVisible(vtkSMProxy *proxy, vtkSMProxy *view, const std::vector< std::string > &blockSelectors)
Checks if the scalar bar of this representation in view is sticky visible, i.e.
info
static std::vector< std::string > GetBlocksDecoratedArrayNames(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, const std::string &arrayName)
In case of UseSeparateColorMap enabled, this function prefix the given arrayName with unique identifi...
static void RemoveBlockLookupTable(vtkSMProxy *proxy, const std::string &blockSelector)
Set the block lookup table proxy.
superclass for all SM properties
static std::vector< Color > GetBlocksColors(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the color of the representation.
static std::vector< vtkSMProxy * > GetBlocksLookupTables(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Returns the lut proxy of this representation in the given view.
static bool RescaleBlockTransferFunctionToDataRange(vtkSMProxy *proxy, const std::string &blockSelector, vtkPVArrayInformation *info, bool extend=false, bool force=true)
Rescales transfer function ranges using the array information provided.
static std::vector< vtkPVProminentValuesInformation * > GetBlocksProminentValuesInformationForColorArray(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, double uncertaintyAllowed=1e-6, double fraction=1e-3, bool force=false)
Call vtkSMRepresentationProxy::GetProminentValuesInformation() for the array used for scalar color...
static vtkSMProxy * GetLastBlockLookupTable(vtkSMProxy *proxy, const std::string &blockSelector)
Used as a memory of what was the last LUT proxy linked to this representation.
static void SetBlockMapScalars(vtkSMProxy *proxy, const std::string &blockSelector, bool mapScalars)
Set/Get the map scalars of the representation.
static std::string GetBlockDecoratedArrayName(vtkSMProxy *proxy, const std::string &blockSelector, const std::string &arrayName)
In case of UseSeparateColorMap enabled, this function prefix the given arrayName with unique identifi...
static int GetBlockMapScalars(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the map scalars of the representation.
static void SetBlockInterpolateScalarsBeforeMapping(vtkSMProxy *proxy, const std::string &blockSelector, bool interpolate)
Set/Get the map scalars of the representation.
#define PARAVIEW_DEPRECATED_IN_5_13_0(reason)
static void SetBlockColor(vtkSMProxy *proxy, const std::string &blockSelector, Color color)
Set/Get the color of the representation.
static vtkSMProxy * GetLookupTable(vtkSMProxy *proxy)
Returns the lut proxy of this representation in the given view.
static bool IsBlockScalarBarVisible(vtkSMProxy *repr, vtkSMProxy *view, const std::string &blockSelector)
Check scalar bar visibility.
static void SetLastBlocksLookupTable(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, vtkSMProxy *lutProxy)
Used as a memory of what was the last LUT proxy linked to this representation.
static void RemoveBlockColor(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the color of the representation.
static void RemoveBlocksColors(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the color of the representation.
static std::vector< double > GetBlocksOpacities(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the opacity of the representation.
static bool RescaleBlockTransferFunctionToDataRangeOverTime(vtkSMProxy *proxy, const std::string &blockSelector, const char *arrayName, int attributeType)
Rescales the color transfer function and opacity transfer function using the current data range over ...
static void SetBlocksUseSeparateColorMap(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, bool use)
Set/Get if we should use a separate color map.
Prominent values a data array takes on.
static std::vector< int > GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(vtkSMProxy *proxy, vtkSMProxy *view, const std::vector< std::string > &blockSelectors)
Get an estimated number of annotation shown on this representation scalar bar.
static int IsBlockScalarBarStickyVisible(vtkSMProxy *proxy, vtkSMProxy *view, const std::string &blockSelector)
Checks if the scalar bar of this representation in view is sticky visible, i.e.
static int GetBlockEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy *proxy, vtkSMProxy *view, const std::string &blockSelector)
Get an estimated number of annotation shown on this representation scalar bar.
static int GetBlockUseSeparateColorMap(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get if we should use a separate color map.
static std::vector< int > GetBlocksInterpolateScalarsBeforeMappings(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the map scalars of the representation.
static vtkSMProxy * GetBlockLookupTable(vtkSMProxy *proxy, const std::string &blockSelector)
Returns the lut proxy of this representation in the given view.
static std::vector< int > GetBlocksMapScalars(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the map scalars of the representation.
static void RemoveBlockUseSeparateColorMap(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get if we should use a separate color map.
static void RemoveBlockProperties(vtkSMProxy *proxy, const std::string &blockSelector, const std::vector< std::string > &propertyNames)
Reset a block property.
static void SetBlocksMapScalars(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, bool mapScalars)
Set/Get the map scalars of the representation.
static std::vector< vtkTypeBool > SetBlocksScalarColoring(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, const char *arrayName, int attributeType)
Enable/disable scalar coloring using the specified array.
static void RemoveBlocksColorArrays(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set the color array name.
static void ResetBlocksProperties(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, const std::vector< std::string > &propertyNames)
Reset a block property.
void SetSelectedPropertiesTypeToBlocks()
Set/Get the selected properties type.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
static std::vector< vtkTypeBool > RescaleBlocksTransferFunctionToDataRange(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, bool extend=false, bool force=true)
Rescales the color transfer function and opacity transfer function using the current data range...
provides meta data about arrays.
static vtkSMProxy * GetBlockLookupTable(vtkSMProxy *proxy, vtkSMProxy *view, const std::string &blockSelector)
Returns the lut proxy of this representation in the given view.
static void SetBlocksLookupTable(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, vtkSMProxy *lutProxy)
Set the block lookup table proxy.
static bool SetBlockScalarColoring(vtkSMProxy *proxy, const std::string &blockSelector, const char *arrayName, int attributeType)
Enable/disable scalar coloring using the specified array.
static void RemoveBlockColorArray(vtkSMProxy *proxy, const std::string &blockSelector)
Set the color array name.
static std::vector< vtkTypeBool > SetBlocksScalarBarVisibility(vtkSMProxy *proxy, vtkSMProxy *view, const std::vector< std::string > &blockSelectors, bool visible)
Set the scalar bar visibility.
static std::vector< int > GetBlocksUseSeparateColorMaps(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get if we should use a separate color map.
static void SetBlocksOpacity(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, double opacity)
Set/Get the opacity of the representation.
static void SetBlocksColor(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, Color color)
Set/Get the color of the representation.
static double GetBlockOpacity(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the opacity of the representation.
static void SetBlocksColorArray(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors, int attributeType, std::string arrayName)
Set the color array name.
static void RemoveBlocksMapScalars(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get the map scalars of the representation.
static void RemoveBlocksUseSeparateColorMaps(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Set/Get if we should use a separate color map.
static std::vector< vtkTypeBool > GetBlocksUsingScalarColoring(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Returns true if scalar coloring is enabled.
static vtkPVArrayInformation * GetBlockArrayInformationForColorArray(vtkSMProxy *proxy, const std::string &blockSelector)
Returns the array information for the data array used for scalar coloring, from input data...
static void RemoveBlockOpacity(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the opacity of the representation.
static vtkObject * New()
static bool SetBlockScalarBarVisibility(vtkSMProxy *proxy, vtkSMProxy *view, const std::string &blockSelector, bool visible)
Set the scalar bar visibility.
static int GetBlockInterpolateScalarsBeforeMapping(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the map scalars of the representation.
static std::vector< vtkTypeBool > IsBlocksScalarBarVisible(vtkSMProxy *repr, vtkSMProxy *view, const std::vector< std::string > &blockSelectors)
Check scalar bar visibility.
void operator=(const vtkObjectBase &)
static void RemoveBlockInterpolateScalarsBeforeMapping(vtkSMProxy *proxy, const std::string &blockSelector)
Set/Get the map scalars of the representation.
helper for color map editor handling
static void SetBlockColorArray(vtkSMProxy *proxy, const std::string &blockSelector, int attributeType, std::string arrayName)
Set the color array name.
static bool RescaleBlockTransferFunctionToDataRange(vtkSMProxy *proxy, const std::string &blockSelector, bool extend=false, bool force=true)
Rescales the color transfer function and opacity transfer function using the current data range...
static bool GetBlockUsingScalarColoring(vtkSMProxy *proxy, const std::string &blockSelector)
Returns true if scalar coloring is enabled.
static bool SetBlockScalarColoring(vtkSMProxy *proxy, const std::string &blockSelector, const char *arrayName, int attributeType, int component)
Enable/disable scalar coloring using the specified array.
static bool RescaleBlockTransferFunctionToDataRangeOverTime(vtkSMProxy *proxy, const std::string &blockSelector)
Rescales the color transfer function and opacity transfer function using the current data range over ...
void SetSelectedPropertiesTypeToRepresentation()
Set/Get the selected properties type.
static void SetBlockOpacity(vtkSMProxy *proxy, const std::string &blockSelector, double opacity)
Set/Get the opacity of the representation.
static std::vector< vtkSMProxy * > GetLastBlocksLookupTables(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Used as a memory of what was the last LUT proxy linked to this representation.
static std::vector< vtkTypeBool > RescaleBlocksTransferFunctionToDataRangeOverTime(vtkSMProxy *proxy, const std::vector< std::string > &blockSelectors)
Rescales the color transfer function and opacity transfer function using the current data range over ...