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 
28 class VTKREMOTINGSERVERMANAGER_EXPORT vtkSMProxySelectionModel : public vtkSMRemoteObject
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 
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
vtkSMProxySelectionModel
selects proxies.
Definition: vtkSMProxySelectionModel.h:28
vtkSMProxySelectionModel::Select
void Select(vtkSMProxy *proxy)
Definition: vtkSMProxySelectionModel.h:118
vtkSMRemoteObject::LoadState
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 ...
Definition: vtkSMRemoteObject.h:91
vtkSMProxySelectionModel::Deselect
void Deselect(vtkSMProxy *proxy)
Definition: vtkSMProxySelectionModel.h:119
vtkSMRemoteObject::SetSession
void SetSession(vtkSMSession *) override
Override the SetSession so if the object already have an ID we automatically register it to the assoc...
vtkSMProxySelectionModel::ClearAndSelect
void ClearAndSelect(vtkSMProxy *proxy)
Definition: vtkSMProxySelectionModel.h:120
vtkSmartPointer< vtkSMProxy >
vtkSMProxySelectionModel::SelectionType
std::list< vtkSmartPointer< vtkSMProxy > > SelectionType
Type for selection.
Definition: vtkSMProxySelectionModel.h:53
vtkSMProxy
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
vtkSMProxySelectionModel::ProxySelectionFlag
ProxySelectionFlag
Definition: vtkSMProxySelectionModel.h:56
vtkCollection
vtkSMSession
Definition: vtkSMSession.h:22
vtkSMProxySelectionModel::State
vtkSMMessage * State
Definition: vtkSMProxySelectionModel.h:164
vtkSMRemoteObject
baseclass for all proxy-objects that have counter parts on server as well as client processes.
Definition: vtkSMRemoteObject.h:25
vtkIndent
vtkSMProxySelectionModel::GetSelection
const SelectionType & GetSelection()
Returns the selection set.
Definition: vtkSMProxySelectionModel.h:97
vtkSMMessage
vtkSmartPointer.h
vtkSMProxySelectionModel::Clear
void Clear()
Wrapper friendly methods to doing what Select() can do.
Definition: vtkSMProxySelectionModel.h:117
vtkSMSessionObject::New
static vtkSMSessionObject * New()
vtkSMProxyLocator
is used to locate proxies referred to in state xmls while loading state files.
Definition: vtkSMProxyLocator.h:24
vtkSMRemoteObject::GetFullState
virtual const vtkSMMessage * GetFullState()
This method return the full object state that can be used to create that object from scratch.
Definition: vtkSMRemoteObject.h:81
vtkSMRemoteObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
vtkSMProxySelectionModel::Selection
SelectionType Selection
Definition: vtkSMProxySelectionModel.h:155
vtkSMRemoteObject.h
vtkSMMessageMinimal.h
vtkSMProxySelectionModel::Current
vtkSmartPointer< vtkSMProxy > Current
Definition: vtkSMProxySelectionModel.h:154