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 
40 #include "pqDataRepresentation.h"
41 #include "pqOutputPort.h"
42 #include "pqPipelineSource.h"
43 #include "pqProxySelection.h"
44 #include "pqServer.h"
45 #include "pqView.h"
46 
47 class vtkEventQtSlotConnect;
48 class vtkSMProxySelectionModel;
49 class vtkSMSessionProxyManager;
50 
56 class PQCOMPONENTS_EXPORT pqActiveObjects : public QObject
57 {
58  Q_OBJECT
59  typedef QObject Superclass;
60 public:
62  static pqActiveObjects& instance();
63 
65  pqView* activeView() const { return this->ActiveView; }
66 
68  pqPipelineSource* activeSource() const { return this->ActiveSource; }
69 
71  pqOutputPort* activePort() const { return this->ActivePort; }
72 
74  pqServer* activeServer() const { return this->ActiveServer; }
75 
78  { return this->ActiveRepresentation; }
79 
80  vtkSMProxySelectionModel* activeSourcesSelectionModel() const
81  {
82  return this->activeServer()?
83  this->activeServer()->activeSourcesSelectionModel() : NULL;
84  }
85 
87  const pqProxySelection& selection() const
88  { return this->Selection; }
89 
92  vtkSMSessionProxyManager* proxyManager() const;
93 
94 public slots:
95  void setActiveView(pqView * view);
96  void setActiveSource(pqPipelineSource * source);
97  void setActivePort(pqOutputPort * port);
98  void setActiveServer(pqServer*);
99  void onActiveServerChanged();
100 
105  void setSelection(const pqProxySelection& selection,
106  pqServerManagerModelItem* current);
107 
108 signals:
110  void serverChanged(pqServer*);
111  void viewChanged(pqView* view);
112  void sourceChanged(pqPipelineSource*);
113  void portChanged(pqOutputPort*);
114  void representationChanged(pqDataRepresentation*);
115  void representationChanged(pqRepresentation*);
116  void selectionChanged(const pqProxySelection&);
117 
121  void dataUpdated();
122 
123 private slots:
127  void serverAdded(pqServer*);
128 
131  void serverRemoved(pqServer*);
132 
134  void proxyRemoved(pqServerManagerModelItem*);
135 
137  void updateRepresentation();
138 
139  void sourceSelectionChanged();
140  void viewSelectionChanged();
141 
142 protected:
143  pqActiveObjects();
144  ~pqActiveObjects();
145 
148  void triggerSignals();
149 
150 private:
151  Q_DISABLE_COPY(pqActiveObjects)
152 
153 
154  void resetActives();
155 
156  QPointer<pqServer> ActiveServer;
157  QPointer<pqPipelineSource> ActiveSource;
158  QPointer<pqOutputPort> ActivePort;
159  QPointer<pqView> ActiveView;
160  QPointer<pqDataRepresentation> ActiveRepresentation;
161  pqProxySelection Selection;
162 
163  // these are void* maintained to detect when values have changed.
164  void* CachedServer;
165  void* CachedSource;
166  void* CachedPort;
167  void* CachedView;
168  void* CachedRepresentation;
169  pqProxySelection CachedSelection;
170 
171  vtkEventQtSlotConnect* VTKConnector;
172 };
173 
174 #endif
175 
176 
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:55
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:55
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.
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:62