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() : NULL;
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:
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 
196 private Q_SLOTS:
202  void serverAdded(pqServer*);
203 
208  void serverRemoved(pqServer*);
209 
213  void proxyRemoved(pqServerManagerModelItem*);
214 
218  void updateRepresentation();
219 
220  void sourceSelectionChanged();
221  void viewSelectionChanged();
222  void onActiveServerChanged();
223 
224 protected:
225  pqActiveObjects();
226  ~pqActiveObjects() override;
227 
232  void triggerSignals();
233 
234 private:
235  Q_DISABLE_COPY(pqActiveObjects)
236 
237 
240  void resetActives();
241 
242  QPointer<pqServer> ActiveServer;
243  QPointer<pqProxy> ActivePipelineProxy;
244  QPointer<pqView> ActiveView;
245  QPointer<pqDataRepresentation> ActiveRepresentation;
246  pqProxySelection Selection;
247 
248  // these are void* maintained to detect when values have changed.
249  void* CachedServer;
250  void* CachedPipelineProxy;
251  void* CachedSource;
252  void* CachedPort;
253  void* CachedView;
254  void* CachedRepresentation;
255  pqProxySelection CachedSelection;
256 
257  vtkNew<vtkEventQtSlotConnect> VTKConnector;
258 };
259 
260 #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:58
#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:64