[QGIS Commit] r9401 - in trunk/external_plugins/cdp2/src: lib tests

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Sep 24 07:13:57 EDT 2008


Author: timlinux
Date: 2008-09-24 07:13:56 -0400 (Wed, 24 Sep 2008)
New Revision: 9401

Modified:
   trunk/external_plugins/cdp2/src/lib/climatedataprocessorcontroller.cpp
   trunk/external_plugins/cdp2/src/lib/filewriter.cpp
   trunk/external_plugins/cdp2/src/tests/cdptest.cpp
Log:
More tweaks for unit test

Modified: trunk/external_plugins/cdp2/src/lib/climatedataprocessorcontroller.cpp
===================================================================
--- trunk/external_plugins/cdp2/src/lib/climatedataprocessorcontroller.cpp	2008-09-24 09:13:29 UTC (rev 9400)
+++ trunk/external_plugins/cdp2/src/lib/climatedataprocessorcontroller.cpp	2008-09-24 11:13:56 UTC (rev 9401)
@@ -1031,19 +1031,14 @@
         // Warning: this assumes a GLOBAL dataset
         // Warning: this screws up cellsizes that are not square
         // Warning: this only works for integers at present
-        QString myHeader=
-            QString ("ncols         ") +
-            QString::number (myXDimInt) + 
-            QString ("\n")+
-            QString ("nrows         ") + 
-            QString::number (myYDimInt) + 
-            QString ("\n")+
-            QString ("xllcorner     -180\n")+
-            QString ("yllcorner     -90\n")+
-            QString ("cellsize      ") + 
-            QString::number (360/static_cast<float>(myXDimInt)) +
-            QString ("\n")+
-            QString ("nodata_value  -9999.5\n");
+        QString myHeader(
+            "ncols         " + QString::number (myXDimInt) + "\n" +
+            "nrows         " + QString::number (myYDimInt) + "\n" +
+            "xllcorner     -180\n" +
+            "yllcorner     -90\n"+
+            "cellsize      " + QString::number (360/static_cast<float>(myXDimInt)) + "\n" +
+            "nodata_value  -9999.5\n");
+	qDebug("Header:" + myHeader.toLocal8Bit());
         myFileWriter->writeString(myHeader);
         // Formerly this was fixed to the following
         //QString myHeader=

Modified: trunk/external_plugins/cdp2/src/lib/filewriter.cpp
===================================================================
--- trunk/external_plugins/cdp2/src/lib/filewriter.cpp	2008-09-24 09:13:29 UTC (rev 9400)
+++ trunk/external_plugins/cdp2/src/lib/filewriter.cpp	2008-09-24 11:13:56 UTC (rev 9401)
@@ -66,6 +66,7 @@
 
 FileWriter::~FileWriter()
 {
+  close();
 }
 
 bool FileWriter::writeElement(float theElementFloat)

Modified: trunk/external_plugins/cdp2/src/tests/cdptest.cpp
===================================================================
--- trunk/external_plugins/cdp2/src/tests/cdptest.cpp	2008-09-24 09:13:29 UTC (rev 9400)
+++ trunk/external_plugins/cdp2/src/tests/cdptest.cpp	2008-09-24 11:13:56 UTC (rev 9401)
@@ -19,6 +19,7 @@
  ***************************************************************************/
 #include <QtTest/QtTest>
 #include <climatedataprocessorcontroller.h>
+#include <climatefilereader.h>
 #include <QImage>
 #include <QList>
 
@@ -71,7 +72,7 @@
   myController.setTotalSolarRadFileName(mSolarRadFile);
   myController.setFrostDaysFileName(mFrostDaysFile);
 
-  myController.setOutputPath( QDir::tempPath() );
+  myController.setOutputPath( QDir::tempPath() + QDir::separator() );
 
   //specify which of the available calcs we want to actually do
   if (! myController.makeAvailableCalculationsMap() )
@@ -86,6 +87,8 @@
     QString myKey = myMapIterator.key();
     myController.addUserCalculation(myKey);
   }
+  myController.setInputFileType(ClimateFileReader::GDAL);
+  myController.setOutputFileType(FileWriter::ESRI_ASCII);
   // Show a summary of the controller state (for debug purposes only)  
   qDebug(myController.description().toLocal8Bit());
   if (! myController.makeFileGroups() )



More information about the QGIS-commit mailing list