vtkSMSelectionHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkSMSelectionHelper_h
12 #define vtkSMSelectionHelper_h
13 
14 #include "vtkRemotingViewsModule.h" //needed for exports
15 #include "vtkSMObject.h"
16 
17 class vtkCollection;
18 class vtkSelection;
19 class vtkSelectionNode;
20 class vtkSMProxy;
21 class vtkSMSession;
22 class vtkSMSourceProxy;
23 
25 {
26 public:
27  static vtkSMSelectionHelper* New();
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
34  static vtkSMProxy* NewAppendSelectionsFromSelectionSource(vtkSMSourceProxy* selectionSource);
35 
36  enum class CombineOperation
37  {
38  DEFAULT = 0,
39  ADDITION = 1,
40  SUBTRACTION = 2,
41  TOGGLE = 3
42  };
43 
45 
59  static bool CombineSelection(vtkSMSourceProxy* appendSelections1,
60  vtkSMSourceProxy* appendSelections2, CombineOperation operation, bool deepCopy = false);
61  static bool IgnoreSelection(
62  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
63  {
64  return CombineSelection(
65  appendSelections1, appendSelections2, CombineOperation::DEFAULT, deepCopy);
66  }
67  static bool AddSelection(
68  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
69  {
70  return CombineSelection(
71  appendSelections1, appendSelections2, CombineOperation::ADDITION, deepCopy);
72  }
73  static bool SubtractSelection(
74  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
75  {
76  return CombineSelection(
77  appendSelections1, appendSelections2, CombineOperation::SUBTRACTION, deepCopy);
78  }
79  static bool ToggleSelection(
80  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
81  {
82  return CombineSelection(
83  appendSelections1, appendSelections2, CombineOperation::TOGGLE, deepCopy);
84  }
86 
97  static vtkSMProxy* NewSelectionSourceFromSelection(
98  vtkSMSession* session, vtkSelection* selection, bool ignore_composite_keys = false);
99 
100  static void NewSelectionSourcesFromSelection(vtkSelection* selection, vtkSMProxy* view,
101  vtkCollection* selSources, vtkCollection* selRepresentations);
102 
108  static vtkSMProxy* ConvertAppendSelections(int outputType, vtkSMSourceProxy* appendSelections,
109  vtkSMSourceProxy* dataSource, int dataPort, bool& selectionChanged);
110 
116  static vtkSMProxy* ConvertSelectionSource(int outputType, vtkSMSourceProxy* selectionSourceProxy,
117  vtkSMSourceProxy* dataSource, int dataPort);
118 
119 protected:
120  vtkSMSelectionHelper() = default;
121  ~vtkSMSelectionHelper() override = default;
122 
123 private:
125  void operator=(const vtkSMSelectionHelper&) = delete;
126 
127  static vtkSMProxy* NewSelectionSourceFromSelectionInternal(
128  vtkSMSession*, vtkSelectionNode* selection, vtkSMProxy* selSource, bool ignore_composite_keys);
129 
130  static vtkSMProxy* ConvertInternal(
131  vtkSMSourceProxy* inSource, vtkSMSourceProxy* dataSource, int dataPort, int outputType);
132 
133  static const std::string SubSelectionBaseName;
134 };
135 
136 #endif
static bool AddSelection(vtkSMSourceProxy *appendSelections1, vtkSMSourceProxy *appendSelections2, bool deepCopy=false)
Combine appendSelections1 with appendSelections2 using a combine operation and store the result into ...
#define VTKREMOTINGVIEWS_EXPORT
static bool IgnoreSelection(vtkSMSourceProxy *appendSelections1, vtkSMSourceProxy *appendSelections2, bool deepCopy=false)
Combine appendSelections1 with appendSelections2 using a combine operation and store the result into ...
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:22
superclass for most server manager classes
Definition: vtkSMObject.h:17
proxy for a VTK source on a server
static vtkSMObject * New()
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
Utility class to help with selection tasks.
static bool SubtractSelection(vtkSMSourceProxy *appendSelections1, vtkSMSourceProxy *appendSelections2, bool deepCopy=false)
Combine appendSelections1 with appendSelections2 using a combine operation and store the result into ...
static bool ToggleSelection(vtkSMSourceProxy *appendSelections1, vtkSMSourceProxy *appendSelections2, bool deepCopy=false)
Combine appendSelections1 with appendSelections2 using a combine operation and store the result into ...
void PrintSelf(ostream &os, vtkIndent indent) override