pqPipelineModel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqPipelineModel.h
5 
6  Copyright (c) 2005-2008 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 =========================================================================*/
51 #ifndef pqPipelineModel_h
52 #define pqPipelineModel_h
53 
54 #include "pqComponentsModule.h" // For export macro
55 #include "pqView.h" // For View
56 
57 #include <QAbstractItemModel>
58 #include <QMap> // For PixmapMap
59 #include <QPointer> // For View
60 
61 class ModifiedLiveInsituLink;
62 class QFont;
63 class QPixmap;
64 class QString;
65 class pqExtractor;
66 class pqPipelineModelDataItem;
67 class pqPipelineModelInternal;
68 class pqPipelineSource;
69 class pqServer;
72 class vtkSession;
73 
83 class PQCOMPONENTS_EXPORT pqPipelineModel : public QAbstractItemModel
84 {
85  Q_OBJECT;
86 
87 public:
88  enum ItemType
89  {
90  Invalid = -1,
91  Server = 0,
95  Link
96  };
97 
98  enum ItemRole
99  {
100  AnnotationFilterRole = 33,
101  SessionFilterRole = 34
102  };
103 
104  pqPipelineModel(QObject* parent = nullptr);
105 
112  pqPipelineModel(const pqPipelineModel& other, QObject* parent = nullptr);
113 
120  pqPipelineModel(const pqServerManagerModel& other, QObject* parent = nullptr);
121 
122  ~pqPipelineModel() override;
123 
135  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
136 
144  int columnCount(const QModelIndex& parent = QModelIndex()) const override;
145 
153  bool hasChildren(const QModelIndex& parent = QModelIndex()) const override;
154 
164  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
165 
173  QModelIndex parent(const QModelIndex& index) const override;
174 
183  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
184 
190  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
191 
202  Qt::ItemFlags flags(const QModelIndex& index) const override;
204 
209 
214  pqServerManagerModelItem* getItemFor(const QModelIndex&) const;
215 
216  QModelIndex getIndexFor(pqServerManagerModelItem* item) const;
217 
225  ItemType getTypeFor(const QModelIndex& index) const;
227 
234  bool isEditable() const { return this->Editable; }
235 
241  void setEditable(bool editable) { this->Editable = editable; }
242 
249  void setSelectable(const QModelIndex& index, bool selectable);
250 
258  bool isSelectable(const QModelIndex& index) const;
259 
266  void setSubtreeSelectable(pqServerManagerModelItem* item, bool selectable);
267 
277  QModelIndex getNextIndex(QModelIndex index, const QModelIndex& root = QModelIndex()) const;
278 
282  pqView* view() const { return this->View; }
283 
289  void setModifiedFont(const QFont& font);
290 
298  void enableFilterAnnotationKey(const QString& expectedAnnotation);
299 
306  void disableFilterAnnotationKey();
307 
311  void setAnnotationFilterMatching(bool matching);
312 
320  void enableFilterSession(vtkSession* session);
321 
328  void disableFilterSession();
329 
330 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
335  void addServer(pqServer* server);
336 
340  void removeServer(pqServer* server);
341 
345  void addSource(pqPipelineSource* source);
346 
350  void removeSource(pqPipelineSource* source);
351 
356  void addConnection(pqPipelineSource* source, pqPipelineSource* sink, int);
357 
362  void removeConnection(pqPipelineSource* source, pqPipelineSource* sink, int);
363 
365 
368  void addConnection(pqServerManagerModelItem* source, pqExtractor* sink);
369  void removeConnection(pqServerManagerModelItem* source, pqExtractor* sink);
371 
373 
376  void addExtractor(pqExtractor*);
377  void removeExtractor(pqExtractor*);
379 
386  void setView(pqView* module);
387 
388 Q_SIGNALS:
389  void firstChildAdded(const QModelIndex& index);
390 
391 private Q_SLOTS:
392  void onInsituConnectionInitiated(pqServer* server);
393 
394  void serverDataChanged();
395 
399  void updateVisibility(pqPipelineSource*, ItemType type = Proxy);
400 
405  void delayedUpdateVisibility(pqPipelineSource*);
406  void delayedUpdateVisibilityTimeout();
407 
411  void updateData(pqServerManagerModelItem*, ItemType type = Proxy);
412  void updateDataServer(pqServer* server);
413 
414 private: // NOLINT(readability-redundant-access-specifiers)
415  friend class pqPipelineModelDataItem;
416 
417  // Add an item as a child under the parent at the given index.
418  // Note that this method does not actually change the underlying
419  // pqServerManagerModel, it merely signals that such an addition
420  // has taken place.
421  void addChild(pqPipelineModelDataItem* parent, pqPipelineModelDataItem* child);
422 
423  // Remove a child item from under the parent.
424  // Note that this method does not actually change the underlying
425  // pqServerManagerModel, it merely signals that such an addition
426  // has taken place.
427  void removeChildFromParent(pqPipelineModelDataItem* child);
428 
429  // Returns the pqPipelineModelDataItem for the given pqServerManagerModelItem.
430  pqPipelineModelDataItem* getDataItem(pqServerManagerModelItem* item,
431  pqPipelineModelDataItem* subtreeRoot, ItemType type = Invalid) const;
432 
433  // called by pqPipelineModelDataItem to indicate that the data for the item
434  // may have changed.
435  void itemDataChanged(pqPipelineModelDataItem*);
439  void setSubtreeSelectable(pqPipelineModelDataItem* item, bool selectable);
440 
441  QModelIndex getIndex(pqPipelineModelDataItem* item) const;
442 
450  bool checkAndLoadPipelinePixmap(const QString& iconType);
451 
452  pqPipelineModelInternal* Internal;
453  QMap<QString, QPixmap> PixmapMap;
454  QPointer<pqView> View;
455  bool Editable;
456  bool FilterAnnotationMatching;
457  QString FilterRoleAnnotationKey;
458  vtkSession* FilterRoleSession;
459  ModifiedLiveInsituLink* LinkCallback;
460  void constructor();
461 
462  friend class ModifiedLiveInsituLink;
463 };
464 
465 #endif
data
void setEditable(bool editable)
Sets whether or not the model indexes are editable.
type
#define PQCOMPONENTS_EXPORT
pqView * view() const
Provides access to the view.
pqServerManagerModelItem is a element maintained by pqServerManagerModel.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:54
bool isEditable() const
Gets whether or not the model indexes are editable.
This class is the model for the PipelineLine browser tree view.
source
pqServerManagerModel is the model for the Server Manager.
PQ representation for a vtkSMProxy that can be involved in a pipeline.
vtkSession defines a session i.e.
Definition: vtkSession.h:29
index
pqProxy subclass for extractors
Definition: pqExtractor.h:49
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:63