pqActiveObjects.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqActiveObjects_h
5 #define pqActiveObjects_h
6 
7 #include "pqComponentsModule.h"
8 #include <QObject>
9 #include <QPointer>
10 
14 #include "pqDataRepresentation.h"
15 #include "pqOutputPort.h"
16 #include "pqPipelineSource.h"
17 #include "pqProxySelection.h"
18 #include "pqServer.h"
19 #include "pqView.h"
20 #include "vtkNew.h"
21 
26 
34 class PQCOMPONENTS_EXPORT pqActiveObjects : public QObject
35 {
36  Q_OBJECT
37  typedef QObject Superclass;
38 
39 public:
43  static pqActiveObjects& instance();
44 
48  pqView* activeView() const { return this->ActiveView; }
49 
51 
64  pqProxy* activePipelineProxy() const { return this->ActivePipelineProxy; }
65  pqPipelineSource* activeSource() const;
67 
71  pqOutputPort* activePort() const;
72 
76  pqServer* activeServer() const { return this->ActiveServer; }
77 
81  pqDataRepresentation* activeRepresentation() const { return this->ActiveRepresentation; }
82 
84  {
85  return this->activeServer() ? this->activeServer()->activeSourcesSelectionModel() : nullptr;
86  }
87 
91  const pqProxySelection& selection() const { return this->Selection; }
92 
97  vtkSMSessionProxyManager* proxyManager() const;
98 
102  vtkSMViewLayoutProxy* activeLayout() const;
103 
112  int activeLayoutLocation() const;
113 
114 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
119  void setActiveView(pqView* view);
120 
122 
129  void setActivePipelineProxy(pqProxy* proxy);
130  void setActiveSource(pqPipelineSource* source) { this->setActivePipelineProxy(source); }
131  void setActivePort(pqOutputPort* port) { this->setActivePipelineProxy(port); }
133 
138  void setActiveServer(pqServer*);
139 
146  void setSelection(const pqProxySelection& selection, pqServerManagerModelItem* current);
147 
148 Q_SIGNALS:
152  void serverChanged(pqServer*);
153  void viewChanged(pqView* view);
154  void pipelineProxyChanged(pqProxy*);
155  void sourceChanged(pqPipelineSource*);
156  void portChanged(pqOutputPort*);
157  void representationChanged(pqDataRepresentation*);
158  void representationChanged(pqRepresentation*);
159  void selectionChanged(const pqProxySelection&);
160 
166  void dataUpdated();
167 
173  void representationUpdated();
174 
180  void viewUpdated();
181 
182 private Q_SLOTS:
188  void serverAdded(pqServer*);
189 
194  void serverRemoved(pqServer*);
195 
199  void proxyRemoved(pqServerManagerModelItem*);
200 
204  void updateRepresentation();
205 
206  void sourceSelectionChanged();
207  void viewSelectionChanged();
208  void onActiveServerChanged();
209 
210 protected:
211  pqActiveObjects();
212  ~pqActiveObjects() override;
213 
218  void triggerSignals();
219 
220 private:
221  Q_DISABLE_COPY(pqActiveObjects)
222 
223 
226  void resetActives();
227 
228  QPointer<pqServer> ActiveServer;
229  QPointer<pqProxy> ActivePipelineProxy;
230  QPointer<pqView> ActiveView;
231  QPointer<pqDataRepresentation> ActiveRepresentation;
232  pqProxySelection Selection;
233 
234  // these are void* maintained to detect when values have changed.
235  void* CachedServer;
236  void* CachedPipelineProxy;
237  void* CachedSource;
238  void* CachedPort;
239  void* CachedView;
240  void* CachedRepresentation;
241  pqProxySelection CachedSelection;
242 
243  vtkNew<vtkEventQtSlotConnect> VTKConnector;
244 };
245 
246 #endif
pqView * activeView() const
Returns the active view.
pqProxy * activePipelineProxy() const
Returns the active pipeline proxy e.g.
pqDataRepresentation is the superclass for a display for a pqPipelineSource i.e.
pqOutputPort is a server manager model item for an output port of any pqPipelineSource item...
Definition: pqOutputPort.h:29
#define PQCOMPONENTS_EXPORT
This is PQ representation for a single representation.
const pqProxySelection & selection() const
Returns the current source selection.
pqServerManagerModelItem is a element maintained by pqServerManagerModel.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:26
pqActiveObjects is a singleton that keeps track of "active objects" including active view...
QList< pqServerManagerModelItem * > pqProxySelection
pqProxySelection is used to specify a selection comprising proxies.
void setActiveSource(pqPipelineSource *source)
Set the active source.
pqDataRepresentation * activeRepresentation() const
Returns the active representation.
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
vtkSMViewLayoutProxy is used by ParaView to layout multiple views in a 2D KD-Tree layout...
This class represents any registered Server Manager proxy.
Definition: pqProxy.h:28
PQ representation for a vtkSMProxy that can be involved in a pipeline.
pqServer * activeServer() const
Returns the active server.
vtkSMProxySelectionModel * activeSourcesSelectionModel() const
void setActivePort(pqOutputPort *port)
Set the active source.
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:35