fix windows build

git-svn-id: http://svn.osgeo.org/qgis/trunk@15426 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2011-03-11 06:16:25 +00:00
parent 9724f79ab6
commit eeceed42a3
3 changed files with 94 additions and 99 deletions

View File

@ -4,5 +4,6 @@ SET OSGEO4W_ROOT=@osgeo4w@
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\bin\grass-env.bat call "%OSGEO4W_ROOT%"\bin\grass-env.bat
@echo off @echo off
SET GDAL_DRIVER_PATH=%OSGEO4W_ROOT%\bin\gdalplugins\1.8
path %PATH%;%GISBASE%\bin path %PATH%;%GISBASE%\bin
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\apps\@package@\bin\qgis.exe %* start "Quantum GIS" /B "%OSGEO4W_ROOT%"\apps\@package@\bin\qgis.exe %*

View File

@ -22,8 +22,6 @@
#include "qgsgdalprovider.h" #include "qgsgdalprovider.h"
#include "qgsconfig.h" #include "qgsconfig.h"
#include <math.h>
#include "qgsapplication.h" #include "qgsapplication.h"
#include "qgscoordinatetransform.h" #include "qgscoordinatetransform.h"
#include "qgsrectangle.h" #include "qgsrectangle.h"
@ -302,7 +300,7 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
// This block of code was in old version in QgsRasterLayer::bandStatistics // This block of code was in old version in QgsRasterLayer::bandStatistics
//ifdefs below to remove compiler warning about unused vars //ifdefs below to remove compiler warning about unused vars
#ifdef QGISDEBUG #ifdef QGISDEBUG
/* #if 0
int success; int success;
double GDALminimum = GDALGetRasterMinimum( myGdalBand, &success ); double GDALminimum = GDALGetRasterMinimum( myGdalBand, &success );
@ -341,7 +339,7 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
QgsLogger::debug( "exactly computed GDALmaximum:", GDALrange[1] ); QgsLogger::debug( "exactly computed GDALmaximum:", GDALrange[1] );
QgsDebugMsg( "starting manual stat computation" ); QgsDebugMsg( "starting manual stat computation" );
*/ #endif
#endif #endif
mValid = true; mValid = true;
@ -559,20 +557,20 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
if ( myRasterExtent.yMaximum() < theExtent.yMaximum() ) if ( myRasterExtent.yMaximum() < theExtent.yMaximum() )
{ {
top = static_cast<int> ( round( ( theExtent.yMaximum() - myRasterExtent.yMaximum() ) / yRes ) ); top = qRound(( theExtent.yMaximum() - myRasterExtent.yMaximum() ) / yRes );
} }
if ( myRasterExtent.yMinimum() > theExtent.yMinimum() ) if ( myRasterExtent.yMinimum() > theExtent.yMinimum() )
{ {
bottom = static_cast<int> ( round( ( theExtent.yMaximum() - myRasterExtent.yMinimum() ) / yRes ) - 1 ); bottom = qRound(( theExtent.yMaximum() - myRasterExtent.yMinimum() ) / yRes ) - 1;
} }
if ( myRasterExtent.xMinimum() > theExtent.xMinimum() ) if ( myRasterExtent.xMinimum() > theExtent.xMinimum() )
{ {
left = static_cast<int> ( round( ( myRasterExtent.xMinimum() - theExtent.xMinimum() ) / xRes ) ); left = qRound(( myRasterExtent.xMinimum() - theExtent.xMinimum() ) / xRes );
} }
if ( myRasterExtent.xMaximum() < theExtent.xMaximum() ) if ( myRasterExtent.xMaximum() < theExtent.xMaximum() )
{ {
right = static_cast<int> ( round( ( myRasterExtent.xMaximum() - theExtent.xMinimum() ) / xRes ) - 1 ); right = qRound(( myRasterExtent.xMaximum() - theExtent.xMinimum() ) / xRes ) - 1;
} }
QgsDebugMsg( QString( "top = %1 bottom = %2 left = %3 right = %4" ).arg( top ).arg( bottom ).arg( left ).arg( right ) ); QgsDebugMsg( QString( "top = %1 bottom = %2 left = %3 right = %4" ).arg( top ).arg( bottom ).arg( left ).arg( right ) );
@ -653,21 +651,17 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
QgsDebugMsg( QString( "width = %1 height = %2 rasterWidth = %3 rasterHeight = %4" ).arg( width ).arg( height ).arg( rasterWidth ).arg( rasterHeight ) ); QgsDebugMsg( QString( "width = %1 height = %2 rasterWidth = %3 rasterHeight = %4" ).arg( width ).arg( height ).arg( rasterWidth ).arg( rasterHeight ) );
double rasterXRes = extent().width() / xSize();
double rasterYRes = extent().height() / ySize();
// TODO: what is better floor/ceil, can be negative? // TODO: what is better floor/ceil, can be negative?
// should be similar // should be similar
//double xAdd = rasterWidth*rasterXRes - width*xRes; //double xAdd = rasterWidth*rasterXRes - width*xRes;
double xAdd = leftSpace + rightSpace; double xAdd = leftSpace + rightSpace;
int xAddPixels = static_cast<int> ( round( xAdd / xRes ) ); int xAddPixels = qRound( xAdd / xRes );
int leftAddPixels = static_cast<int> ( round( leftSpace / xRes ) ); int leftAddPixels = qRound( leftSpace / xRes );
//double leftAdd = rasterWidth*rasterXRes - width*xRes; //double leftAdd = rasterWidth*rasterXRes - width*xRes;
double yAdd = topSpace + bottomSpace; double yAdd = topSpace + bottomSpace;
int yAddPixels = static_cast<int> ( round( yAdd / yRes ) ); int yAddPixels = qRound( yAdd / yRes );
int topAddPixels = static_cast<int> ( round( topSpace / yRes ) ); int topAddPixels = qRound( topSpace / yRes );
QgsDebugMsg( QString( "xAddPixels = %1 yAddPixels = %2 leftAddPixels = %3 topAddPixels = %4" ).arg( xAddPixels ).arg( yAddPixels ).arg( leftAddPixels ).arg( topAddPixels ) ); QgsDebugMsg( QString( "xAddPixels = %1 yAddPixels = %2 leftAddPixels = %3 topAddPixels = %4" ).arg( xAddPixels ).arg( yAddPixels ).arg( leftAddPixels ).arg( topAddPixels ) );
// Currently only positive allowed, verify if negative has sense and check following use // Currently only positive allowed, verify if negative has sense and check following use
@ -708,7 +702,8 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
// Cal nLineSpace if raster does not cover whole extent // Cal nLineSpace if raster does not cover whole extent
int nLineSpace = size * thePixelWidth; int nLineSpace = size * thePixelWidth;
if ( left != 0 ) { if ( left != 0 )
{
block += size * left; block += size * left;
} }
CPLErr err = GDALRasterIO( gdalBand, GF_Read, CPLErr err = GDALRasterIO( gdalBand, GF_Read,
@ -736,7 +731,8 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
return; return;
} }
for ( int i = 0; i < height; i++ ) { for ( int i = 0; i < height; i++ )
{
int r = i + topAddPixels; int r = i + topAddPixels;
char *src = ( char * )tmpBlock + size * r * totalWidth + size * leftAddPixels; char *src = ( char * )tmpBlock + size * r * totalWidth + size * leftAddPixels;
char *dst = ( char * )theBlock + size * ( top + i ) * thePixelWidth + size * ( left ); char *dst = ( char * )theBlock + size * ( top + i ) * thePixelWidth + size * ( left );
@ -846,7 +842,7 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
+ QString::fromUtf8( CPLGetLastErrorMsg() ) ); + QString::fromUtf8( CPLGetLastErrorMsg() ) );
return; return;
}; }
//CPLAssert( myWarpOptions->pTransformerArg != NULL ); //CPLAssert( myWarpOptions->pTransformerArg != NULL );
myWarpOptions->pfnTransformer = GDALGenImgProjTransform; myWarpOptions->pfnTransformer = GDALGenImgProjTransform;
@ -877,7 +873,7 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
+ QString::fromUtf8( CPLGetLastErrorMsg() ) ); + QString::fromUtf8( CPLGetLastErrorMsg() ) );
return; return;
}; }
CPLErrorReset(); CPLErrorReset();
CPLErr myErr; CPLErr myErr;
myErr = myOperation.ChunkAndWarpImage( 0, 0, thePixelWidth, thePixelHeight ); myErr = myOperation.ChunkAndWarpImage( 0, 0, thePixelWidth, thePixelHeight );
@ -1615,7 +1611,7 @@ QGISEXTERN void buildSupportedRasterFileFilter( QString & theFileFiltersString )
{ {
QgsDebugMsg( "Entered" ); QgsDebugMsg( "Entered" );
// first get the GDAL driver manager // first get the GDAL driver manager
//registerGdalDrivers(); QgsGdalProvider::registerGdalDrivers();
// then iterate through all of the supported drivers, adding the // then iterate through all of the supported drivers, adding the
// corresponding file filter // corresponding file filter
@ -1785,7 +1781,7 @@ QGISEXTERN bool isValidRasterFileName( QString const & theFileNameQString, QStri
{ {
GDALDatasetH myDataset; GDALDatasetH myDataset;
GDALAllRegister(); QgsGdalProvider::registerGdalDrivers();
CPLErrorReset(); CPLErrorReset();

View File

@ -23,8 +23,6 @@
#include "qgsgrassrasterprovider.h" #include "qgsgrassrasterprovider.h"
#include "qgsconfig.h" #include "qgsconfig.h"
#include <cmath>
#include "qgsapplication.h" #include "qgsapplication.h"
#include "qgscoordinatetransform.h" #include "qgscoordinatetransform.h"
#include "qgsrectangle.h" #include "qgsrectangle.h"