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 
53 
61 class PQCOMPONENTS_EXPORT pqActiveObjects : public QObject
62 {
63  Q_OBJECT
64  typedef QObject Superclass;
65 
66 public:
70  static pqActiveObjects& instance();
71 
75  pqView* activeView() const { return this->ActiveView; }
76 
80  pqPipelineSource* activeSource() const { return this->ActiveSource; }
81 
85  pqOutputPort* activePort() const { return this->ActivePort; }
86 
90  pqServer* activeServer() const { return this->ActiveServer; }
91 
95  pqDataRepresentation* activeRepresentation() const { return this->ActiveRepresentation; }
96 
98  {
99  return this->activeServer() ? this->activeServer()->activeSourcesSelectionModel() : NULL;
100  }
101 
105  const pqProxySelection& selection() const { return this->Selection; }
106 
111  vtkSMSessionProxyManager* proxyManager() const;
112 
116  vtkSMViewLayoutProxy* activeLayout() const;
117 
126  int activeLayoutLocation() const;
127 
128 public slots:
129  void setActiveView(pqView* view);
130  void setActiveSource(pqPipelineSource* source);
131  void setActivePort(pqOutputPort* port);
132  void setActiveServer(pqServer*);
133  void onActiveServerChanged();
134 
141  void setSelection(const pqProxySelection& selection, pqServerManagerModelItem* current);
142 
143 signals:
147  void serverChanged(pqServer*);
148  void viewChanged(pqView* view);
149  void sourceChanged(pqPipelineSource*);
150  void portChanged(pqOutputPort*);
151  void representationChanged(pqDataRepresentation*);
152  void representationChanged(pqRepresentation*);
153  void selectionChanged(const pqProxySelection&);
154 
160  void dataUpdated();
161 
162 private slots:
168  void serverAdded(pqServer*);
169 
174  void serverRemoved(pqServer*);
175 
179  void proxyRemoved(pqServerManagerModelItem*);
180 
184  void updateRepresentation();
185 
186  void sourceSelectionChanged();
187  void viewSelectionChanged();
188 
189 protected:
190  pqActiveObjects();
191  ~pqActiveObjects() override;
192 
197  void triggerSignals();
198 
199 private:
200  Q_DISABLE_COPY(pqActiveObjects)
201 
202 
205  void resetActives();
206 
207  QPointer<pqServer> ActiveServer;
208  QPointer<pqPipelineSource> ActiveSource;
209  QPointer<pqOutputPort> ActivePort;
210  QPointer<pqView> ActiveView;
211  QPointer<pqDataRepresentation> ActiveRepresentation;
212  pqProxySelection Selection;
213 
214  // these are void* maintained to detect when values have changed.
215  void* CachedServer;
216  void* CachedSource;
217  void* CachedPort;
218  void* CachedView;
219  void* CachedRepresentation;
220  pqProxySelection CachedSelection;
221 
222  vtkEventQtSlotConnect* VTKConnector;
223 };
224 
225 #endif
pqView * activeView() const
Returns the active view.
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
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.
pqPipelineSource * activeSource() const
Returns 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.
PQ representation for a vtkSMProxy that can be involved in a pipeline.
pqServer * activeServer() const
Returns the active server.
vtkSMProxySelectionModel * activeSourcesSelectionModel() const
pqOutputPort * activePort() const
Returns the active port.
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:64