ParaView
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 
49 class vtkEventQtSlotConnect;
52 
60 class PQCOMPONENTS_EXPORT pqActiveObjects : public QObject
61 {
62  Q_OBJECT
63  typedef QObject Superclass;
64 
65 public:
69  static pqActiveObjects& instance();
70 
74  pqView* activeView() const { return this->ActiveView; }
75 
79  pqPipelineSource* activeSource() const { return this->ActiveSource; }
80 
84  pqOutputPort* activePort() const { return this->ActivePort; }
85 
89  pqServer* activeServer() const { return this->ActiveServer; }
90 
94  pqDataRepresentation* activeRepresentation() const { return this->ActiveRepresentation; }
95 
97  {
98  return this->activeServer() ? this->activeServer()->activeSourcesSelectionModel() : NULL;
99  }
100 
104  const pqProxySelection& selection() const { return this->Selection; }
105 
110  vtkSMSessionProxyManager* proxyManager() const;
111 
112 public slots:
113  void setActiveView(pqView* view);
114  void setActiveSource(pqPipelineSource* source);
115  void setActivePort(pqOutputPort* port);
116  void setActiveServer(pqServer*);
117  void onActiveServerChanged();
118 
125  void setSelection(const pqProxySelection& selection, pqServerManagerModelItem* current);
126 
127 signals:
131  void serverChanged(pqServer*);
132  void viewChanged(pqView* view);
133  void sourceChanged(pqPipelineSource*);
134  void portChanged(pqOutputPort*);
135  void representationChanged(pqDataRepresentation*);
136  void representationChanged(pqRepresentation*);
137  void selectionChanged(const pqProxySelection&);
138 
144  void dataUpdated();
145 
146 private slots:
152  void serverAdded(pqServer*);
153 
158  void serverRemoved(pqServer*);
159 
163  void proxyRemoved(pqServerManagerModelItem*);
164 
168  void updateRepresentation();
169 
170  void sourceSelectionChanged();
171  void viewSelectionChanged();
172 
173 protected:
174  pqActiveObjects();
175  ~pqActiveObjects();
176 
181  void triggerSignals();
182 
183 private:
184  Q_DISABLE_COPY(pqActiveObjects)
185 
186 
189  void resetActives();
190 
191  QPointer<pqServer> ActiveServer;
192  QPointer<pqPipelineSource> ActiveSource;
193  QPointer<pqOutputPort> ActivePort;
194  QPointer<pqView> ActiveView;
195  QPointer<pqDataRepresentation> ActiveRepresentation;
196  pqProxySelection Selection;
197 
198  // these are void* maintained to detect when values have changed.
199  void* CachedServer;
200  void* CachedSource;
201  void* CachedPort;
202  void* CachedView;
203  void* CachedRepresentation;
204  pqProxySelection CachedSelection;
205 
206  vtkEventQtSlotConnect* VTKConnector;
207 };
208 
209 #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.
pqProxySelection is used to specify a selection comprising proxies.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:56
pqActiveObjects is a singleton that keeps track of "active objects" including active view...
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...
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