vtkSMProxySelectionModel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkSMProxySelectionModel_h
15 #define vtkSMProxySelectionModel_h
16 
17 #include "vtkRemotingServerManagerModule.h" //needed for exports
18 #include "vtkSMMessageMinimal.h" // Needed for vtkSMMessage*
19 #include "vtkSMRemoteObject.h"
20 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
21 
22 class vtkSMProxySelectionModelInternal;
23 class vtkCollection;
24 class vtkSMProxy;
25 
26 #include <list> // needed for vtkset::list.
27 
29 {
30 public:
31  static vtkSMProxySelectionModel* New();
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
39  void SetSession(vtkSMSession*) override;
40 
42 
46  void SetFollowingMaster(bool following);
47  bool IsFollowingMaster();
49 
53  typedef std::list<vtkSmartPointer<vtkSMProxy>> SelectionType;
54 
55  // vtkSMProxy selection flags
57  {
58  NO_UPDATE = 0,
59  CLEAR = 1,
60  SELECT = 2,
61  DESELECT = 4,
62  CLEAR_AND_SELECT = CLEAR | SELECT
63  };
64 
68  vtkSMProxy* GetCurrentProxy();
69 
79  void SetCurrentProxy(vtkSMProxy* proxy, int command);
80 
84  bool IsSelected(vtkSMProxy* proxy);
85 
86  // Returns the number of selected proxies.
87  unsigned int GetNumberOfSelectedProxies();
88 
92  vtkSMProxy* GetSelectedProxy(unsigned int index);
93 
97  const SelectionType& GetSelection() { return this->Selection; }
98 
110  void Select(const SelectionType& proxies, int command);
111 
112  void Select(vtkSMProxy* proxy, int command);
113 
117  void Clear() { this->Select(nullptr, CLEAR); }
118  void Select(vtkSMProxy* proxy) { this->Select(proxy, SELECT); }
119  void Deselect(vtkSMProxy* proxy) { this->Select(proxy, DESELECT); }
120  void ClearAndSelect(vtkSMProxy* proxy) { this->Select(proxy, CLEAR_AND_SELECT); }
121 
128  bool GetSelectionDataBounds(double bounds[6]);
129 
136  const vtkSMMessage* GetFullState() override;
137 
145  void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator) override;
146 
147 protected:
149  ~vtkSMProxySelectionModel() override;
150 
151  void InvokeCurrentChanged(vtkSMProxy* proxy);
152  void InvokeSelectionChanged();
153 
155  SelectionType Selection;
156 
161  void PushStateToSession();
162 
163  // Cached version of State
165 
166 private:
168  void operator=(const vtkSMProxySelectionModel&) = delete;
169 
170  class vtkInternal;
171  friend class vtkInternal;
172  vtkInternal* Internal;
173 };
174 
175 #endif
void SetSession(vtkSMSession *) override
Override the SetSession so if the object already have an ID we automatically register it to the assoc...
virtual void LoadState(const vtkSMMessage *msg, vtkSMProxyLocator *locator)
This method is used to initialise the object to the given state If the definitionOnly Flag is set to ...
#define VTKREMOTINGSERVERMANAGER_EXPORT
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:22
const SelectionType & GetSelection()
Returns the selection set.
std::list< vtkSmartPointer< vtkSMProxy > > SelectionType
Type for selection.
void Clear()
Wrapper friendly methods to doing what Select() can do.
vtkSmartPointer< vtkSMProxy > Current
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
void Deselect(vtkSMProxy *proxy)
void ClearAndSelect(vtkSMProxy *proxy)
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
is used to locate proxies referred to in state xmls while loading state files.
virtual const vtkSMMessage * GetFullState()
This method return the full object state that can be used to create that object from scratch...
baseclass for all proxy-objects that have counter parts on server as well as client processes...
void Select(vtkSMProxy *proxy)
static vtkSMSessionObject * New()
void PrintSelf(ostream &os, vtkIndent indent) override