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 "vtkRemotingViewsModule.h" // needed for exports
17 #include "vtkSmartPointer.h" // For LastLUTProxy
18 
19 #include <array> // For array
20 #include <cstdint> // For int
21 #include <map> // For map
22 #include <string> // For string
23 #include <vector> // For vector
24 
27 class vtkSMProperty;
28 class vtkSMProxy;
30 
31 // template <bool UseBlockProperties = false>
33 {
34 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40  {
41  Representation = 0,
42  Blocks = 1
43  };
44 
45  enum BlockPropertyState : std::uint8_t
46  {
47  // Property is disabled because it can not be edited
48  Disabled = 0x0,
49  // Property is inherited from the representation
50  RepresentationInherited = 0x1,
51  // Property is inherited from a block
52  BlockInherited = 0x2,
53  // Property is inherited from a block and the representation
54  MixedInherited = 0x3,
55  // Property is set in all blocks
56  Set = 0x4,
57  // Property is set in some blocks and representation inherited
58  SetAndRepresentationInherited = 0x5,
59  // Property is set in some blocks and block inherited
60  SetAndBlockInherited = 0x6,
61  // Property is set in some blocks and mixed inherited
62  SetAndMixedInherited = 0x7,
63  // Number of possible states
64  NumberOfStates = 0x8
65  };
66 
68 
77  vtkSetClampMacro(SelectedPropertiesType, int, SelectedPropertiesTypes::Representation,
78  SelectedPropertiesTypes::Blocks);
80  {
81  this->SetSelectedPropertiesType(SelectedPropertiesTypes::Representation);
82  }
84  {
85  this->SetSelectedPropertiesType(SelectedPropertiesTypes::Blocks);
86  }
87  vtkGetMacro(SelectedPropertiesType, int);
89 
93  static SelectedPropertiesTypes GetPropertyType(vtkSMProperty* property);
94 
96 
108  static std::pair<std::string, BlockPropertyState> HasBlockProperty(
109  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& propertyName);
110  static std::pair<std::string, BlockPropertyState> GetBlockPropertyStateFromBlockPropertyStates(
111  const std::vector<std::pair<std::string, BlockPropertyState>>& states);
112  static std::pair<std::string, BlockPropertyState> HasBlockProperty(vtkSMProxy* proxy,
113  const std::vector<std::string>& blockSelectors, const std::string& propertyName);
114  static std::pair<std::string, BlockPropertyState> HasBlockProperties(vtkSMProxy* proxy,
115  const std::string& blockSelector, const std::vector<std::string>& propertyNames);
116  static std::pair<std::string, BlockPropertyState> HasBlocksProperties(vtkSMProxy* proxy,
117  const std::vector<std::string>& blockSelectors, const std::vector<std::string>& propertyNames);
119 
123  static std::vector<std::string> GetSelectedBlockSelectors(vtkSMProxy* proxy);
124 
128  static std::vector<std::string> GetColorArraysBlockSelectors(vtkSMProxy* proxy);
129  static vtkSMProxy* GetLookupTable(vtkSMProxy* proxy);
130  static vtkSMProxy* GetLookupTable(vtkSMProxy* proxy, vtkSMProxy* view);
131  static vtkSMProxy* GetBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector)
132  {
133  return vtkSMColorMapEditorHelper::GetBlocksLookupTables(proxy, { blockSelector }).front();
134  }
135  static std::vector<vtkSMProxy*> GetBlocksLookupTables(
136  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
138  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector)
139  {
140  return vtkSMColorMapEditorHelper::GetBlocksLookupTables(proxy, view, { blockSelector }).front();
141  }
142  static std::vector<vtkSMProxy*> GetBlocksLookupTables(
143  vtkSMProxy* proxy, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
144  std::vector<vtkSMProxy*> GetSelectedLookupTables(vtkSMProxy* proxy);
145  std::vector<vtkSMProxy*> GetSelectedLookupTables(vtkSMProxy* proxy, vtkSMProxy* view);
147 
149 
154  static bool GetUsingScalarColoring(vtkSMProxy* proxy);
155  static bool GetBlockUsingScalarColoring(vtkSMProxy* proxy, const std::string& blockSelector)
156  {
157  return vtkSMColorMapEditorHelper::GetBlocksUsingScalarColoring(proxy, { blockSelector })
158  .front();
159  }
160  static std::vector<vtkTypeBool> GetBlocksUsingScalarColoring(
161  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
162  static bool GetAnyBlockUsingScalarColoring(vtkSMProxy* proxy);
163  std::vector<vtkTypeBool> GetSelectedUsingScalarColorings(vtkSMProxy* proxy);
164  bool GetAnySelectedUsingScalarColoring(vtkSMProxy* proxy);
166 
168 
172  static void SetupLookupTable(vtkSMProxy* proxy);
173  static void SetupBlocksLookupTables(vtkSMProxy* proxy);
175 
177 
184  static bool UpdateScalarBarRange(vtkSMProxy* proxy, vtkSMProxy* view, bool deleteRange);
185  static std::vector<vtkTypeBool> UpdateBlocksScalarBarRange(
186  vtkSMProxy* proxy, vtkSMProxy* view, bool deleteRange);
188 
190 
196  static bool SetScalarColoring(vtkSMProxy* proxy, const char* arrayName, int attributeType);
198  vtkSMProxy* proxy, const std::string& blockSelector, const char* arrayName, int attributeType)
199  {
201  proxy, { blockSelector }, arrayName, attributeType)
202  .front();
203  }
204  static std::vector<vtkTypeBool> SetBlocksScalarColoring(vtkSMProxy* proxy,
205  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType);
206  std::vector<vtkTypeBool> SetSelectedScalarColoring(
207  vtkSMProxy* proxy, const char* arrayName, int attributeType);
209 
211 
219  static bool SetScalarColoring(
220  vtkSMProxy* proxy, const char* arrayName, int attributeType, int component);
221  static bool SetBlockScalarColoring(vtkSMProxy* proxy, const std::string& blockSelector,
222  const char* arrayName, int attributeType, int component)
223  {
225  proxy, { blockSelector }, arrayName, attributeType, component)
226  .front();
227  }
228  static std::vector<vtkTypeBool> SetBlocksScalarColoring(vtkSMProxy* proxy,
229  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
230  int component);
231  std::vector<vtkTypeBool> SetSelectedScalarColoring(
232  vtkSMProxy* proxy, const char* arrayName, int attributeType, int component);
234 
236 
244  static bool RescaleTransferFunctionToDataRange(
245  vtkSMProxy* proxy, bool extend = false, bool force = true);
247  vtkSMProxy* proxy, const std::string& blockSelector, bool extend = false, bool force = true)
248  {
250  proxy, { blockSelector }, extend, force)
251  .front();
252  }
253  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(vtkSMProxy* proxy,
254  const std::vector<std::string>& blockSelectors, bool extend = false, bool force = true);
255  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRange(
256  vtkSMProxy* proxy, bool extend = false, bool force = true);
258 
260 
270  static bool RescaleTransferFunctionToDataRange(vtkSMProxy* proxy, const char* arrayName,
271  int attributeType, bool extend = false, bool force = true);
273  const std::string& blockSelector, const char* arrayName, int attributeType, bool extend = false,
274  bool force = true)
275  {
277  proxy, { blockSelector }, arrayName, attributeType, extend, force)
278  .front();
279  }
280  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(vtkSMProxy* proxy,
281  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
282  bool extend = false, bool force = true);
283  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRange(vtkSMProxy* proxy,
284  const char* arrayName, int attributeType, bool extend = false, bool force = true);
286 
288 
292  static bool RescaleTransferFunctionToDataRangeOverTime(vtkSMProxy* proxy);
294  vtkSMProxy* proxy, const std::string& blockSelector)
295  {
297  proxy, { blockSelector })
298  .front();
299  }
300  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
301  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
302  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRangeOverTime(vtkSMProxy* proxy);
304 
306 
312  static bool RescaleTransferFunctionToDataRangeOverTime(
313  vtkSMProxy* proxy, const char* arrayName, int attributeType);
315  vtkSMProxy* proxy, const std::string& blockSelector, const char* arrayName, int attributeType)
316  {
318  proxy, { blockSelector }, arrayName, attributeType)
319  .front();
320  }
321  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRangeOverTime(
322  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, const char* arrayName,
323  int attributeType);
324  std::vector<vtkTypeBool> RescaleSelectedTransferFunctionToDataRangeOverTime(
325  vtkSMProxy* proxy, const char* arrayName, int attributeType);
327 
329 
333  static bool RescaleTransferFunctionToVisibleRange(vtkSMProxy* proxy, vtkSMProxy* view);
334  static bool RescaleTransferFunctionToVisibleRange(
335  vtkSMProxy* proxy, vtkSMProxy* view, const char* arrayName, int attributeType);
337 
339 
343  static bool SetScalarBarVisibility(vtkSMProxy* proxy, vtkSMProxy* view, bool visible);
345  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector, bool visible)
346  {
348  proxy, view, { blockSelector }, visible)
349  .front();
350  }
351  static std::vector<vtkTypeBool> SetBlocksScalarBarVisibility(vtkSMProxy* proxy, vtkSMProxy* view,
352  const std::vector<std::string>& blockSelectors, bool visible);
353  std::vector<vtkTypeBool> SetSelectedScalarBarVisibility(
354  vtkSMProxy* proxy, vtkSMProxy* view, bool visible);
356 
358 
365  static bool HideScalarBarIfNotNeeded(vtkSMProxy* repr, vtkSMProxy* view);
366  static bool HideBlocksScalarBarIfNotNeeded(vtkSMProxy* repr, vtkSMProxy* view);
368 
370 
374  static bool IsScalarBarVisible(vtkSMProxy* repr, vtkSMProxy* view);
376  vtkSMProxy* repr, vtkSMProxy* view, const std::string& blockSelector)
377  {
378  return vtkSMColorMapEditorHelper::IsBlocksScalarBarVisible(repr, view, { blockSelector })
379  .front();
380  }
381  static std::vector<vtkTypeBool> IsBlocksScalarBarVisible(
382  vtkSMProxy* repr, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
384 
386 
391  static vtkPVArrayInformation* GetArrayInformationForColorArray(
392  vtkSMProxy* proxy, bool checkRepresentedData = true);
394  vtkSMProxy* proxy, const std::string& blockSelector)
395  {
397  proxy, { blockSelector })
398  .front();
399  }
400  static std::vector<vtkPVArrayInformation*> GetBlocksArrayInformationForColorArray(
401  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
403 
405 
409  static std::string GetDecoratedArrayName(vtkSMProxy* proxy, const std::string& arrayName);
410  static std::string GetBlockDecoratedArrayName(
411  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& arrayName)
412  {
414  proxy, { blockSelector }, arrayName)
415  .front();
416  }
417  static std::vector<std::string> GetBlocksDecoratedArrayNames(vtkSMProxy* proxy,
418  const std::vector<std::string>& blockSelectors, const std::string& arrayName);
420 
422 
426  static vtkPVProminentValuesInformation* GetProminentValuesInformationForColorArray(
427  vtkSMProxy* proxy, double uncertaintyAllowed = 1e-6, double fraction = 1e-3,
428  bool force = false);
430  vtkSMProxy* proxy, const std::string& blockSelector, double uncertaintyAllowed = 1e-6,
431  double fraction = 1e-3, bool force = false)
432  {
434  proxy, { blockSelector }, uncertaintyAllowed, fraction, force)
435  .front();
436  }
437  static std::vector<vtkPVProminentValuesInformation*>
438  GetBlocksProminentValuesInformationForColorArray(vtkSMProxy* proxy,
439  const std::vector<std::string>& blockSelectors, double uncertaintyAllowed = 1e-6,
440  double fraction = 1e-3, bool force = false);
442 
444 
449  static int GetEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* proxy, vtkSMProxy* view);
451  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector)
452  {
454  proxy, view, { blockSelector })
455  .front();
456  }
457  static std::vector<int> GetBlocksEstimatedNumberOfAnnotationsOnScalarBars(
458  vtkSMProxy* proxy, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
459  std::vector<int> GetSelectedEstimatedNumberOfAnnotationsOnScalarBars(
460  vtkSMProxy* proxy, vtkSMProxy* view);
461  int GetAnySelectedEstimatedNumberOfAnnotationsOnScalarBar(vtkSMProxy* proxy, vtkSMProxy* view);
463 
465 
474  static int IsScalarBarStickyVisible(vtkSMProxy* proxy, vtkSMProxy* view);
476  vtkSMProxy* proxy, vtkSMProxy* view, const std::string& blockSelector)
477  {
478  return vtkSMColorMapEditorHelper::IsBlocksScalarBarStickyVisible(proxy, view, { blockSelector })
479  .front();
480  }
481  static std::vector<int> IsBlocksScalarBarStickyVisible(
482  vtkSMProxy* proxy, vtkSMProxy* view, const std::vector<std::string>& blockSelectors);
484 
485  using Color = std::array<double, 3>;
487 
492  static bool IsColorValid(Color color);
493  static void SetColor(vtkSMProxy* proxy, Color color);
494  static void SetBlockColor(vtkSMProxy* proxy, const std::string& blockSelector, Color color)
495  {
496  vtkSMColorMapEditorHelper::SetBlocksColor(proxy, { blockSelector }, color);
497  }
498  static void SetBlocksColor(
499  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, Color color);
500  static void RemoveBlockColor(vtkSMProxy* proxy, const std::string& blockSelector)
501  {
502  vtkSMColorMapEditorHelper::RemoveBlocksColors(proxy, { blockSelector });
503  }
504  static void RemoveBlocksColors(vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
505  void SetSelectedColor(vtkSMProxy* proxy, Color color);
506  static Color GetColor(vtkSMProxy* proxy);
507  static Color GetBlockColor(vtkSMProxy* proxy, const std::string& blockSelector)
508  {
509  return vtkSMColorMapEditorHelper::GetBlocksColors(proxy, { blockSelector }).front();
510  }
511  static std::vector<Color> GetBlocksColors(
512  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
513  std::vector<Color> GetSelectedColors(vtkSMProxy* proxy);
515 
517 
520  static vtkSMProperty* GetColorArrayProperty(vtkSMProxy* proxy);
521  static vtkSMProperty* GetBlockColorArrayProperty(vtkSMProxy* proxy);
522  vtkSMProperty* GetSelectedColorArrayProperty(vtkSMProxy* proxy);
524 
525  using ColorArray = std::pair<int, std::string>;
527 
532  static bool IsColorArrayValid(const ColorArray& array);
533  static std::vector<ColorArray> GetBlocksColorArrays(
534  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
535  static int GetBlockColorArrayAssociation(vtkSMProxy* proxy, const std::string& blockSelector)
536  {
537  return vtkSMColorMapEditorHelper::GetBlockColorArray(proxy, blockSelector).first;
538  }
539  static std::string GetBlockColorArrayName(vtkSMProxy* proxy, const std::string& blockSelector)
540  {
541  return vtkSMColorMapEditorHelper::GetBlockColorArray(proxy, blockSelector).second;
542  }
543  static std::map<ColorArray, std::vector<std::string>> GetCommonColorArraysBlockSelectors(
544  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
545  std::vector<ColorArray> GetSelectedColorArrays(vtkSMProxy* proxy);
547 
549 
552  static vtkSMProperty* GetUseSeparateColorMapProperty(vtkSMProxy* proxy);
553  static vtkSMProperty* GetBlockUseSeparateColorMapProperty(vtkSMProxy* proxy);
554  vtkSMProperty* GetSelectedUseSeparateColorMapProperty(vtkSMProxy* proxy);
556 
558 
563  static bool IsUseSeparateColorMapValid(int useSeparateColorMap);
564  static void SetUseSeparateColorMap(vtkSMProxy* proxy, bool use);
566  vtkSMProxy* proxy, const std::string& blockSelector, bool use)
567  {
568  vtkSMColorMapEditorHelper::SetBlocksUseSeparateColorMap(proxy, { blockSelector }, use);
569  }
570  static void SetBlocksUseSeparateColorMap(
571  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, bool use);
572  static void RemoveBlockUseSeparateColorMap(vtkSMProxy* proxy, const std::string& blockSelector)
573  {
575  }
576  static void RemoveBlocksUseSeparateColorMaps(
577  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
578  void SetSelectedUseSeparateColorMap(vtkSMProxy* proxy, bool use);
579  static bool GetUseSeparateColorMap(vtkSMProxy* proxy);
580  static int GetBlockUseSeparateColorMap(vtkSMProxy* proxy, const std::string& blockSelector)
581  {
582  return vtkSMColorMapEditorHelper::GetBlocksUseSeparateColorMaps(proxy, { blockSelector })
583  .front();
584  }
585  static std::vector<int> GetBlocksUseSeparateColorMaps(
586  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
587  std::vector<int> GetSelectedUseSeparateColorMaps(vtkSMProxy* proxy);
588  bool GetAnySelectedUseSeparateColorMap(vtkSMProxy* proxy);
590 
592 
597  static bool IsMapScalarsValid(int mapScalars);
598  static void SetMapScalars(vtkSMProxy* proxy, bool mapScalars);
599  static void SetBlockMapScalars(
600  vtkSMProxy* proxy, const std::string& blockSelector, bool mapScalars)
601  {
602  vtkSMColorMapEditorHelper::SetBlocksMapScalars(proxy, { blockSelector }, mapScalars);
603  }
604  static void SetBlocksMapScalars(
605  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, bool mapScalars);
606  static void RemoveBlockMapScalars(vtkSMProxy* proxy, const std::string& blockSelector)
607  {
608  vtkSMColorMapEditorHelper::RemoveBlocksMapScalars(proxy, { blockSelector });
609  }
610  static void RemoveBlocksMapScalars(
611  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
612  void SetSelectedMapScalars(vtkSMProxy* proxy, bool mapScalars);
613  static bool GetMapScalars(vtkSMProxy* proxy);
614  static int GetBlockMapScalars(vtkSMProxy* proxy, const std::string& blockSelector)
615  {
616  return vtkSMColorMapEditorHelper::GetBlocksMapScalars(proxy, { blockSelector }).front();
617  }
618  static std::vector<int> GetBlocksMapScalars(
619  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
620  std::vector<int> GetSelectedMapScalars(vtkSMProxy* proxy);
621  bool GetAnySelectedMapScalars(vtkSMProxy* proxy);
623 
625 
630  static bool IsInterpolateScalarsBeforeMappingValid(int interpolate);
631  static void SetInterpolateScalarsBeforeMapping(vtkSMProxy* proxy, bool interpolate);
633  vtkSMProxy* proxy, const std::string& blockSelector, bool interpolate)
634  {
636  proxy, { blockSelector }, interpolate);
637  }
638  static void SetBlocksInterpolateScalarsBeforeMapping(
639  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, bool interpolate);
641  vtkSMProxy* proxy, const std::string& blockSelector)
642  {
644  proxy, { blockSelector });
645  }
646  static void RemoveBlocksInterpolateScalarsBeforeMappings(
647  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
648  void SetSelectedInterpolateScalarsBeforeMapping(vtkSMProxy* proxy, bool interpolate);
649  static bool GetInterpolateScalarsBeforeMapping(vtkSMProxy* proxy);
651  vtkSMProxy* proxy, const std::string& blockSelector)
652  {
654  proxy, { blockSelector })
655  .front();
656  }
657  static std::vector<int> GetBlocksInterpolateScalarsBeforeMappings(
658  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
659  std::vector<int> GetSelectedInterpolateScalarsBeforeMappings(vtkSMProxy* proxy);
660  bool GetAnySelectedInterpolateScalarsBeforeMapping(vtkSMProxy* proxy);
662 
664 
669  static bool IsOpacityValid(double opacity);
670  static void SetOpacity(vtkSMProxy* proxy, double opacity);
671  static void SetBlockOpacity(vtkSMProxy* proxy, const std::string& blockSelector, double opacity)
672  {
673  vtkSMColorMapEditorHelper::SetBlocksOpacity(proxy, { blockSelector }, opacity);
674  }
675  static void SetBlocksOpacity(
676  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, double opacity);
677  static void RemoveBlockOpacity(vtkSMProxy* proxy, const std::string& blockSelector)
678  {
679  vtkSMColorMapEditorHelper::RemoveBlocksOpacities(proxy, { blockSelector });
680  }
681  static void RemoveBlocksOpacities(
682  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
683  void SetSelectedOpacity(vtkSMProxy* proxy, double opacity);
684  static double GetOpacity(vtkSMProxy* proxy);
685  static double GetBlockOpacity(vtkSMProxy* proxy, const std::string& blockSelector)
686  {
687  return vtkSMColorMapEditorHelper::GetBlocksOpacities(proxy, { blockSelector }).front();
688  }
689  static std::vector<double> GetBlocksOpacities(
690  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
691  std::vector<double> GetSelectedOpacities(vtkSMProxy* proxy);
693 
695 
698  static void ResetBlockProperty(
699  vtkSMProxy* proxy, const std::string& blockSelector, const std::string& propertyName)
700  {
701  vtkSMColorMapEditorHelper::ResetBlocksProperty(proxy, { blockSelector }, propertyName);
702  }
703  static void RemoveBlockProperties(vtkSMProxy* proxy, const std::string& blockSelector,
704  const std::vector<std::string>& propertyNames)
705  {
706  vtkSMColorMapEditorHelper::ResetBlocksProperties(proxy, { blockSelector }, propertyNames);
707  }
708  static void ResetBlocksProperty(vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors,
709  const std::string& propertyName)
710  {
711  vtkSMColorMapEditorHelper::ResetBlocksProperties(proxy, blockSelectors, { propertyName });
712  }
713  static void ResetBlocksProperties(vtkSMProxy* proxy,
714  const std::vector<std::string>& blockSelectors, const std::vector<std::string>& propertyNames);
716 
717 protected:
719  ~vtkSMColorMapEditorHelper() override;
720 
722 
725  // Add proxy parameter?
726  static bool RescaleTransferFunctionToDataRange(
727  vtkSMProxy* proxy, vtkPVArrayInformation* info, bool extend = false, bool force = true);
729  const std::string& blockSelector, vtkPVArrayInformation* info, bool extend = false,
730  bool force = true)
731  {
733  proxy, { blockSelector }, { info }, extend, force)
734  .front();
735  }
736  static std::vector<vtkTypeBool> RescaleBlocksTransferFunctionToDataRange(vtkSMProxy* proxy,
737  const std::vector<std::string>& blockSelectors, std::vector<vtkPVArrayInformation*> infos,
738  bool extend = false, bool force = true);
740 
742 
745  static void SetColorArray(vtkSMProxy* proxy, int attributeType, std::string arrayName);
746  static void SetBlockColorArray(
747  vtkSMProxy* proxy, const std::string& blockSelector, int attributeType, std::string arrayName)
748  {
750  proxy, { blockSelector }, attributeType, arrayName);
751  }
752  static void SetBlocksColorArray(vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors,
753  int attributeType, std::string arrayName);
754  static void RemoveBlockColorArray(vtkSMProxy* proxy, const std::string& blockSelector)
755  {
756  vtkSMColorMapEditorHelper::RemoveBlocksColorArrays(proxy, { blockSelector });
757  }
758  static void RemoveBlocksColorArrays(
759  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
760  static ColorArray GetColorArray(vtkSMProxy* proxy);
761  static ColorArray GetBlockColorArray(vtkSMProxy* proxy, const std::string& blockSelector)
762  {
763  return vtkSMColorMapEditorHelper::GetBlocksColorArrays(proxy, { blockSelector }).front();
764  }
766 
768 
771  static void SetBlockLookupTable(
772  vtkSMProxy* proxy, const std::string& blockSelector, vtkSMProxy* lutProxy)
773  {
774  vtkSMColorMapEditorHelper::SetBlocksLookupTable(proxy, { blockSelector }, lutProxy);
775  }
776  static void SetBlocksLookupTable(
777  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, vtkSMProxy* lutProxy);
778  static void RemoveBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector)
779  {
780  vtkSMColorMapEditorHelper::RemoveBlocksLookupTables(proxy, { blockSelector });
781  }
782  static void RemoveBlocksLookupTables(
783  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
785 
789  static bool SetScalarColoringInternal(
790  vtkSMProxy* proxy, const char* arrayName, int attributeType, bool useComponent, int component);
791  static std::vector<vtkTypeBool> SetBlocksScalarColoringInternal(vtkSMProxy* proxy,
792  const std::vector<std::string>& blockSelectors, const char* arrayName, int attributeType,
793  bool useComponent, int component);
794  std::vector<vtkTypeBool> SetSelectedScalarColoringInternal(
795  vtkSMProxy* proxy, const char* arrayName, int attributeType, bool useComponent, int component);
797 
799 
804  static vtkSMProxy* GetLastLookupTable(vtkSMProxy* proxy);
805  static void SetLastLookupTable(vtkSMProxy* proxy, vtkSMProxy* lutProxy);
806  static vtkSMProxy* GetLastBlockLookupTable(vtkSMProxy* proxy, const std::string& blockSelector)
807  {
808  return vtkSMColorMapEditorHelper::GetLastBlocksLookupTables(proxy, { blockSelector }).front();
809  }
810  static std::vector<vtkSMProxy*> GetLastBlocksLookupTables(
811  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors);
813  vtkSMProxy* proxy, const std::string& blockSelector, vtkSMProxy* lutProxy)
814  {
815  vtkSMColorMapEditorHelper::SetLastBlocksLookupTable(proxy, { blockSelector }, lutProxy);
816  }
817  static void SetLastBlocksLookupTable(
818  vtkSMProxy* proxy, const std::vector<std::string>& blockSelectors, vtkSMProxy* lutProxy);
820 
822 
823 private:
825  void operator=(const vtkSMColorMapEditorHelper&) = delete;
826 
827  int SelectedPropertiesType = SelectedPropertiesTypes::Representation;
828 };
829 
830 #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)
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.
static void SetBlockColor(vtkSMProxy *proxy, const std::string &blockSelector, Color color)
Set/Get the color of the representation.
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)
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)
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 ...