[Kst] branches/work/kst/portto4/kst/src/datasources

Peter Kümmel syntheticpp at yahoo.com
Sat Mar 27 09:49:36 CET 2010


SVN commit 1107931 by kuemmel:

at least build with kst2

 M  +8 -0      datasources.pro  
 M  +1 -1      netcdf/kstdata_netcdf.desktop  
 M  +74 -9     netcdf/kstnetcdf.h  


--- branches/work/kst/portto4/kst/src/datasources/datasources.pro #1107930:1107931
@@ -20,3 +20,11 @@
     CONFIG += link_pkgconfig
     PKGCONFIG += getdata
 }
+
+LibExists(netcdf) {
+    message(netCDF configured.  Plugins will be built.)
+    SUBDIRS += netcdf
+    CONFIG += link_pkgconfig
+    PKGCONFIG += netcdf
+}
+
--- branches/work/kst/portto4/kst/src/datasources/netcdf/kstdata_netcdf.desktop #1107930:1107931
@@ -1,4 +1,4 @@
-[Desktop Entry]
+s[Desktop Entry]
 Encoding=UTF-8
 Type=Service
 ServiceTypes=Kst Data Source
--- branches/work/kst/portto4/kst/src/datasources/netcdf/kstnetcdf.h #1107930:1107931
@@ -16,24 +16,30 @@
  *                                                                         *
  ***************************************************************************/
 
-#ifndef NETCDF_H
-#define NETCDF_H
+#ifndef KST_NETCDF_H
+#define KST_NETCDF_H
 
-#include <kstdatasource.h>
+#include "datasource.h"
+#include "dataplugin.h"
+
 #include <netcdf.h>
 #include <netcdfcpp.h>
 
 
-class NetcdfSource : public KstDataSource {
+class NetcdfSource : public Kst::DataSource {
   public:
-    NetcdfSource(KConfig *cfg, const QString& filename, const QString& type);
+    NetcdfSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement &element);
 
     ~NetcdfSource();
 
     bool initFile();
 
-    KstObject::UpdateType update(int = -1);
+    Kst::Object::UpdateType internalDataSourceUpdate();
 
+
+    virtual const QString& typeString() const;
+
+
     int readField(double *v, const QString& field, int s, int n);
 
     bool isValidField(const QString& field) const;
@@ -48,14 +54,73 @@
 
     bool isEmpty() const;
 
-    bool reset();
+    void  reset();
 
   private:
-    QMap<QString,long> _frameCounts;
-    long _maxFrameCount;
+    QMap<QString, int> _frameCounts;
+
+    int _maxFrameCount;
     NcFile *_ncfile;
+
+    QMap<QString, QString> _metaData;
+    QStringList _fieldList;
 };
 
 
+
+class NetCdfPlugin : public QObject, public Kst::DataSourcePluginInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(Kst::DataSourcePluginInterface)
+
+  public:
+    virtual ~NetCdfPlugin() {}
+
+    virtual QString pluginName() const;
+    virtual QString pluginDescription() const;
+
+    virtual bool hasConfigWidget() const { return false; }
+
+    virtual Kst::DataSource *create(Kst::ObjectStore *store,
+                                  QSettings *cfg,
+                                  const QString &filename,
+                                  const QString &type,
+                                  const QDomElement &element) const;
+
+    virtual QStringList matrixList(QSettings *cfg,
+                                  const QString& filename,
+                                  const QString& type,
+                                  QString *typeSuggestion,
+                                  bool *complete) const;
+
+    virtual QStringList fieldList(QSettings *cfg,
+                                  const QString& filename,
+                                  const QString& type,
+                                  QString *typeSuggestion,
+                                  bool *complete) const;
+
+    virtual QStringList scalarList(QSettings *cfg,
+                                  const QString& filename,
+                                  const QString& type,
+                                  QString *typeSuggestion,
+                                  bool *complete) const;
+
+    virtual QStringList stringList(QSettings *cfg,
+                                  const QString& filename,
+                                  const QString& type,
+                                  QString *typeSuggestion,
+                                  bool *complete) const;
+
+    virtual int understands(QSettings *cfg, const QString& filename) const;
+
+    virtual bool supportsTime(QSettings *cfg, const QString& filename) const;
+
+    virtual QStringList provides() const;
+
+    virtual Kst::DataSourceConfigWidget *configWidget(QSettings *cfg, const QString& filename) const;
+};
+
+
+
 #endif
 


More information about the Kst mailing list