vtkSMSelectionHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMSelectionHelper.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkSMSelectionHelper_h
24 #define vtkSMSelectionHelper_h
25 
26 #include "vtkRemotingViewsModule.h" //needed for exports
27 #include "vtkSMObject.h"
28 
29 class vtkCollection;
30 class vtkSelection;
31 class vtkSelectionNode;
32 class vtkSMProxy;
33 class vtkSMSession;
34 class vtkSMSourceProxy;
35 
37 {
38 public:
39  static vtkSMSelectionHelper* New();
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  static vtkSMProxy* NewAppendSelectionsFromSelectionSource(vtkSMSourceProxy* selectionSource);
47 
48  enum class CombineOperation
49  {
50  DEFAULT = 0,
51  ADDITION = 1,
52  SUBTRACTION = 2,
53  TOGGLE = 3
54  };
55 
57 
71  static bool CombineSelection(vtkSMSourceProxy* appendSelections1,
72  vtkSMSourceProxy* appendSelections2, CombineOperation operation, bool deepCopy = false);
73  static bool IgnoreSelection(
74  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
75  {
76  return CombineSelection(
77  appendSelections1, appendSelections2, CombineOperation::DEFAULT, deepCopy);
78  }
79  static bool AddSelection(
80  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
81  {
82  return CombineSelection(
83  appendSelections1, appendSelections2, CombineOperation::ADDITION, deepCopy);
84  }
85  static bool SubtractSelection(
86  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
87  {
88  return CombineSelection(
89  appendSelections1, appendSelections2, CombineOperation::SUBTRACTION, deepCopy);
90  }
91  static bool ToggleSelection(
92  vtkSMSourceProxy* appendSelections1, vtkSMSourceProxy* appendSelections2, bool deepCopy = false)
93  {
94  return CombineSelection(
95  appendSelections1, appendSelections2, CombineOperation::TOGGLE, deepCopy);
96  }
98 
109  static vtkSMProxy* NewSelectionSourceFromSelection(
110  vtkSMSession* session, vtkSelection* selection, bool ignore_composite_keys = false);
111 
112  static void NewSelectionSourcesFromSelection(vtkSelection* selection, vtkSMProxy* view,
113  vtkCollection* selSources, vtkCollection* selRepresentations);
114 
120  static vtkSMProxy* ConvertAppendSelections(int outputType, vtkSMSourceProxy* appendSelections,
121  vtkSMSourceProxy* dataSource, int dataPort, bool& selectionChanged);
122 
128  static vtkSMProxy* ConvertSelectionSource(int outputType, vtkSMSourceProxy* selectionSourceProxy,
129  vtkSMSourceProxy* dataSource, int dataPort);
130 
131 protected:
132  vtkSMSelectionHelper() = default;
133  ~vtkSMSelectionHelper() override = default;
134 
135 private:
137  void operator=(const vtkSMSelectionHelper&) = delete;
138 
139  static vtkSMProxy* NewSelectionSourceFromSelectionInternal(
140  vtkSMSession*, vtkSelectionNode* selection, vtkSMProxy* selSource, bool ignore_composite_keys);
141 
142  static vtkSMProxy* ConvertInternal(
143  vtkSMSourceProxy* inSource, vtkSMSourceProxy* dataSource, int dataPort, int outputType);
144 
145  static const std::string SubSelectionBaseName;
146 };
147 
148 #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:35
superclass for most server manager classes
Definition: vtkSMObject.h:29
proxy for a VTK source on a server
static vtkSMObject * New()
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
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