File indexing completed on 2024-12-22 04:17:05
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 HEALPIX_H 0015 #define HEALPIX_H 0016 0017 #include <datasource.h> 0018 #include <dataplugin.h> 0019 //#include <fitsio.h> 0020 0021 #include "healpix_tools.h" 0022 0023 class HealpixSource : public Kst::DataSource { 0024 Q_OBJECT 0025 0026 public: 0027 HealpixSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e); 0028 0029 ~HealpixSource(); 0030 0031 bool init(); 0032 virtual void reset(); 0033 0034 Kst::Object::UpdateType update(); 0035 0036 bool matrixDimensions( const QString& matrix, int* xDim, int* yDim); 0037 int readMatrix(Kst::MatrixData* data, const QString& matrix, int xStart, int yStart, int xNumSteps, int yNumSteps); 0038 bool isValidMatrix(const QString& field) const; 0039 0040 int readField(double *v, const QString &field, int s, int n); 0041 bool isValidField(const QString &field) const; 0042 0043 int samplesPerFrame(const QString &field); 0044 int frameCount(const QString& field = QString::null) const; 0045 bool isEmpty() const; 0046 QString fileType() const; 0047 0048 void save(QXmlStreamWriter &streamWriter); 0049 void parseProperties(QXmlStreamAttributes &properties); 0050 0051 class Config; 0052 0053 0054 int readScalar(double &S, const QString& scalar); 0055 int readString(QString &S, const QString& string); 0056 0057 private: 0058 mutable Config *_config; 0059 friend class ConfigWidgetHealpix; 0060 0061 // file parameters 0062 int _mapType; 0063 int _mapOrder; 0064 int _mapCoord; 0065 size_t _mapNside; 0066 size_t _nMaps; 0067 size_t _mapNpix; 0068 char _healpixfile[HEALPIX_STRNL]; 0069 healpix_keys *_keys; 0070 char _creator[HEALPIX_STRNL]; 0071 char _extname[HEALPIX_STRNL]; 0072 char **_names; 0073 char **_units; 0074 0075 QMap<QString, QString> _metaData; 0076 }; 0077 0078 0079 class HealpixPlugin : public QObject, public Kst::DataSourcePluginInterface { 0080 Q_OBJECT 0081 Q_INTERFACES(Kst::DataSourcePluginInterface) 0082 public: 0083 virtual ~HealpixPlugin() {} 0084 0085 virtual QString pluginName() const; 0086 virtual QString pluginDescription() const; 0087 0088 virtual bool hasConfigWidget() const { return false; } 0089 0090 virtual Kst::DataSource *create(Kst::ObjectStore *store, 0091 QSettings *cfg, 0092 const QString &filename, 0093 const QString &type, 0094 const QDomElement &element) const; 0095 0096 virtual QStringList matrixList(QSettings *cfg, 0097 const QString& filename, 0098 const QString& type, 0099 QString *typeSuggestion, 0100 bool *complete) const; 0101 0102 virtual QStringList fieldList(QSettings *cfg, 0103 const QString& filename, 0104 const QString& type, 0105 QString *typeSuggestion, 0106 bool *complete) const; 0107 0108 virtual QStringList scalarList(QSettings *cfg, 0109 const QString& filename, 0110 const QString& type, 0111 QString *typeSuggestion, 0112 bool *complete) const; 0113 0114 virtual QStringList stringList(QSettings *cfg, 0115 const QString& filename, 0116 const QString& type, 0117 QString *typeSuggestion, 0118 bool *complete) const; 0119 0120 virtual int understands(QSettings *cfg, const QString& filename) const; 0121 0122 virtual bool supportsTime(QSettings *cfg, const QString& filename) const; 0123 0124 virtual QStringList provides() const; 0125 0126 virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const; 0127 }; 0128 0129 0130 #endif 0131 // vim: ts=2 sw=2 et