pqLoadDataReaction.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqLoadDataReaction_h
5 #define pqLoadDataReaction_h
6 
7 #include "pqReaction.h"
8 
9 #include <QList>
10 #include <QStringList>
11 
12 class pqPipelineSource;
13 class pqServer;
14 class vtkSMReaderFactory;
15 
21 {
22  Q_OBJECT
23  typedef pqReaction Superclass;
24 
25 public:
29  pqLoadDataReaction(QAction* parent);
30 
45  static pqPipelineSource* loadData(const QList<QStringList>& files,
46  const QString& readergroup = QString(), const QString& readername = QString(),
47  pqServer* server = nullptr);
48 
61  static pqPipelineSource* loadData(const QStringList& files,
62  const QString& readergroup = QString(), const QString& readername = QString(),
63  pqServer* server = nullptr);
64 
65  typedef QPair<QString, QString> ReaderPair;
66  typedef QSet<ReaderPair> ReaderSet;
67 
69 
77  static QList<pqPipelineSource*> loadData(const ReaderSet& readerSet, bool groupFiles = true);
78  static QList<pqPipelineSource*> loadData(bool groupFiles = true);
80 
86  static QVector<pqPipelineSource*> loadFilesForSupportedTypes(QList<QStringList> files);
87 
88 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
92  void updateEnableState() override;
93 
94 Q_SIGNALS:
98  void loadedData(pqPipelineSource*);
99 
100 protected:
104  void onTriggered() override
105  {
106  QList<pqPipelineSource*> sources = pqLoadDataReaction::loadData();
108  Q_FOREACH (source, sources)
109  {
110  Q_EMIT this->loadedData(source);
111  }
112  }
113 
114  static bool TestFileReadability(
115  const QString& file, pqServer* server, vtkSMReaderFactory* factory);
116 
117  static bool DetermineFileReader(const QString& filename, pqServer* server,
118  vtkSMReaderFactory* factory, QPair<QString, QString>& readerInfo);
119 
120  static pqPipelineSource* LoadFile(
121  const QStringList& files, pqServer* server, const QPair<QString, QString>& readerInfo);
122 
129  static QVector<pqPipelineSource*> loadFilesForAllTypes(
130  QList<QStringList> files, pqServer* server, vtkSMReaderFactory* readerFactory);
131 
136  static void addReaderToDefaults(QString const& readerName, pqServer* server,
137  vtkSMReaderFactory* readerFactory, QString const& customPattern = "");
138 
139 private:
140  Q_DISABLE_COPY(pqLoadDataReaction)
141 };
142 
143 #endif
virtual void updateEnableState()
Definition: pqReaction.h:48
#define PQAPPLICATIONCOMPONENTS_EXPORT
Reaction for open data files.
is a factory for creating a reader proxy based on the filename/extension.
This is a superclass just to make it easier to collect all such reactions.
Definition: pqReaction.h:25
QPair< QString, QString > ReaderPair
source
QSet< ReaderPair > ReaderSet
void onTriggered() override
Called when the action is triggered.
PQ representation for a vtkSMProxy that can be involved in a pipeline.
static pqPipelineSource * loadData(const QList< QStringList > &files, const QString &readergroup=QString(), const QString &readername=QString(), pqServer *server=nullptr)
Loads multiple data files.
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:35