File indexing completed on 2024-12-22 04:17:13
0001 /*************************************************************************** 0002 * * 0003 * copyright : (C) 2007 The University of Toronto * 0004 * netterfield@astro.utoronto.ca * 0005 * * 0006 * This program is free software; you can redistribute it and/or modify * 0007 * it under the terms of the GNU General Public License as published by * 0008 * the Free Software Foundation; either version 2 of the License, or * 0009 * (at your option) any later version. * 0010 * * 0011 ***************************************************************************/ 0012 0013 0014 #ifndef BISDATASOURCE_H 0015 #define BISDATASOURCE_H 0016 0017 #include <datasource.h> 0018 #include <dataplugin.h> 0019 0020 #include "bis.h" 0021 0022 class DataInterfaceBISMatrix; 0023 class DataInterfaceBISVector; 0024 0025 class BISSource : public Kst::DataSource { 0026 Q_OBJECT 0027 0028 public: 0029 BISSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e); 0030 0031 ~BISSource(); 0032 0033 friend class DataInterfaceBISMatrix; 0034 friend class DataInterfaceBISVector; 0035 0036 bool init(); 0037 virtual void reset(); 0038 0039 Kst::Object::UpdateType internalDataSourceUpdate(); 0040 0041 0042 QString fileType() const; 0043 0044 void save(QXmlStreamWriter &streamWriter); 0045 0046 class Config; 0047 0048 virtual bool isImageStream(QString field) {Q_UNUSED(field) return true;} 0049 0050 private: 0051 mutable Config *_config; 0052 0053 DataInterfaceBISMatrix* im; 0054 DataInterfaceBISVector* iv; 0055 0056 QHash<QString, int> _matrixHash; 0057 QStringList _vectorList; 0058 0059 BISfile *_bisfile; 0060 0061 int _nframes; 0062 0063 BISimage _bisImage; 0064 }; 0065 0066 0067 class BISSourcePlugin : public QObject, public Kst::DataSourcePluginInterface { 0068 Q_OBJECT 0069 Q_INTERFACES(Kst::DataSourcePluginInterface) 0070 Q_PLUGIN_METADATA(IID "com.kst.DataSourcePluginInterface/2.0") 0071 public: 0072 virtual ~BISSourcePlugin() {} 0073 0074 virtual QString pluginName() const; 0075 virtual QString pluginDescription() const; 0076 0077 virtual bool hasConfigWidget() const { return false; } 0078 0079 virtual Kst::DataSource *create(Kst::ObjectStore *store, 0080 QSettings *cfg, 0081 const QString &filename, 0082 const QString &type, 0083 const QDomElement &element) const; 0084 0085 virtual QStringList matrixList(QSettings *cfg, 0086 const QString& filename, 0087 const QString& type, 0088 QString *typeSuggestion, 0089 bool *complete) const; 0090 0091 virtual QStringList fieldList(QSettings *cfg, 0092 const QString& filename, 0093 const QString& type, 0094 QString *typeSuggestion, 0095 bool *complete) const; 0096 0097 virtual QStringList scalarList(QSettings *cfg, 0098 const QString& filename, 0099 const QString& type, 0100 QString *typeSuggestion, 0101 bool *complete) const; 0102 0103 virtual QStringList stringList(QSettings *cfg, 0104 const QString& filename, 0105 const QString& type, 0106 QString *typeSuggestion, 0107 bool *complete) const; 0108 0109 virtual int understands(QSettings *cfg, const QString& filename) const; 0110 0111 virtual bool supportsTime(QSettings *cfg, const QString& filename) const; 0112 0113 virtual QStringList provides() const; 0114 0115 virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const; 0116 }; 0117 0118 0119 #endif 0120 // vim: ts=2 sw=2 et