File indexing completed on 2024-12-22 04:17:14

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 FITSIMAGE_H
0015 #define FITSIMAGE_H
0016 
0017 #include <datasource.h>
0018 #include <dataplugin.h>
0019 
0020 //#include <libcfitsio0/fitsio.h>
0021 #include <fitsio.h>
0022 
0023 class DataInterfaceFitsImageMatrix;
0024 class DataInterfaceFitsImageString;
0025 
0026 
0027 class FitsImageSource : public Kst::DataSource {
0028   Q_OBJECT
0029 
0030   public:
0031     FitsImageSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e);
0032 
0033     ~FitsImageSource();
0034 
0035     bool init();
0036     virtual void reset();
0037 
0038     Kst::Object::UpdateType internalDataSourceUpdate();
0039 
0040     bool isEmpty() const;
0041     QString fileType() const;
0042 
0043     void save(QXmlStreamWriter &streamWriter);
0044 
0045     virtual const QString& typeString() const;
0046 
0047     class Config;
0048 
0049   private:
0050     int _frameCount;
0051     fitsfile *_fptr;
0052     mutable Config *_config;
0053 
0054     QMap<QString, QString> _strings;
0055 
0056     DataInterfaceFitsImageString* is;
0057     DataInterfaceFitsImageMatrix* im;
0058 
0059     friend class DataInterfaceFitsImageString;
0060 };
0061 
0062 
0063 class FitsImagePlugin : public QObject, public Kst::DataSourcePluginInterface {
0064     Q_OBJECT
0065     Q_INTERFACES(Kst::DataSourcePluginInterface)
0066     Q_PLUGIN_METADATA(IID "com.kst.DataSourcePluginInterface/2.0")
0067   public:
0068     virtual ~FitsImagePlugin() {}
0069 
0070     virtual QString pluginName() const;
0071     virtual QString pluginDescription() const;
0072 
0073     virtual bool hasConfigWidget() const { return false; }
0074 
0075     virtual Kst::DataSource *create(Kst::ObjectStore *store,
0076                                   QSettings *cfg,
0077                                   const QString &filename,
0078                                   const QString &type,
0079                                   const QDomElement &element) const;
0080 
0081     virtual QStringList matrixList(QSettings *cfg,
0082                                   const QString& filename,
0083                                   const QString& type,
0084                                   QString *typeSuggestion,
0085                                   bool *complete) const;
0086 
0087     virtual QStringList fieldList(QSettings *cfg,
0088                                   const QString& filename,
0089                                   const QString& type,
0090                                   QString *typeSuggestion,
0091                                   bool *complete) const;
0092 
0093     virtual QStringList scalarList(QSettings *cfg,
0094                                   const QString& filename,
0095                                   const QString& type,
0096                                   QString *typeSuggestion,
0097                                   bool *complete) const;
0098 
0099     virtual QStringList stringList(QSettings *cfg,
0100                                   const QString& filename,
0101                                   const QString& type,
0102                                   QString *typeSuggestion,
0103                                   bool *complete) const;
0104 
0105     virtual int understands(QSettings *cfg, const QString& filename) const;
0106 
0107     virtual bool supportsTime(QSettings *cfg, const QString& filename) const;
0108 
0109     virtual QStringList provides() const;
0110 
0111     virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const;
0112 };
0113 
0114 
0115 #endif
0116 // vim: ts=2 sw=2 et