pqActiveObjects.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqActiveObjects.h
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqActiveObjects_h
33 #define pqActiveObjects_h
34 
35 #include "pqComponentsModule.h"
36 #include <QObject>
37 #include <QPointer>
38 
42 #include "pqDataRepresentation.h"
43 #include "pqOutputPort.h"
44 #include "pqPipelineSource.h"
45 #include "pqProxySelection.h"
46 #include "pqServer.h"
47 #include "pqView.h"
48 #include "vtkNew.h"
49 
54 
62 class PQCOMPONENTS_EXPORT pqActiveObjects : public QObject
63 {
64  Q_OBJECT
65  typedef QObject Superclass;
66 
67 public:
71  static pqActiveObjects& instance();
72 
76  pqView* activeView() const { return this->ActiveView; }
77 
79 
92  pqProxy* activePipelineProxy() const { return this->ActivePipelineProxy; }
93  pqPipelineSource* activeSource() const;
95 
99  pqOutputPort* activePort() const;
100 
104  pqServer* activeServer() const { return this->ActiveServer; }
105 
109  pqDataRepresentation* activeRepresentation() const { return this->ActiveRepresentation; }
110 
112  {
113  return this->activeServer() ? this->activeServer()->activeSourcesSelectionModel() : nullptr;
114  }
115 
119  const pqProxySelection& selection() const { return this->Selection; }
120 
125  vtkSMSessionProxyManager* proxyManager() const;
126 
130  vtkSMViewLayoutProxy* activeLayout() const;
131 
140  int activeLayoutLocation() const;
141 
142 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
147  void setActiveView(pqView* view);
148 
150 
157  void setActivePipelineProxy(pqProxy* proxy);
158  void setActiveSource(pqPipelineSource* source) { this->setActivePipelineProxy(source); }
159  void setActivePort(pqOutputPort* port) { this->setActivePipelineProxy(port); }
161 
166  void setActiveServer(pqServer*);
167 
174  void setSelection(const pqProxySelection& selection, pqServerManagerModelItem* current);
175 
176 Q_SIGNALS:
180  void serverChanged(pqServer*);
181  void viewChanged(pqView* view);
182  void pipelineProxyChanged(pqProxy*);
183  void sourceChanged(pqPipelineSource*);
184  void portChanged(pqOutputPort*);
185  void representationChanged(pqDataRepresentation*);
186  void representationChanged(pqRepresentation*);
187  void selectionChanged(const pqProxySelection&);
188 
194  void dataUpdated();
195 
201  void representationUpdated();
202 
208  void viewUpdated();
209 
210 private Q_SLOTS:
216  void serverAdded(pqServer*);
217 
222  void serverRemoved(pqServer*);
223 
227  void proxyRemoved(pqServerManagerModelItem*);
228 
232  void updateRepresentation();
233 
234  void sourceSelectionChanged();
235  void viewSelectionChanged();
236  void onActiveServerChanged();
237 
238 protected:
239  pqActiveObjects();
240  ~pqActiveObjects() override;
241 
246  void triggerSignals();
247 
248 private:
249  Q_DISABLE_COPY(pqActiveObjects)
250 
251 
254  void resetActives();
255 
256  QPointer<pqServer> ActiveServer;
257  QPointer<pqProxy> ActivePipelineProxy;
258  QPointer<pqView> ActiveView;
259  QPointer<pqDataRepresentation> ActiveRepresentation;
260  pqProxySelection Selection;
261 
262  // these are void* maintained to detect when values have changed.
263  void* CachedServer;
264  void* CachedPipelineProxy;
265  void* CachedSource;
266  void* CachedPort;
267  void* CachedView;
268  void* CachedRepresentation;
269  pqProxySelection CachedSelection;
270 
271  vtkNew<vtkEventQtSlotConnect> VTKConnector;
272 };
273 
274 #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:57
#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:54
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:56
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:63