Skip to content

Commit b6aee93

Browse files
committedApr 8, 2016
Align raster code improvements
* Fix x/y mismatch * Improve strings for translation * Remove unrequired cast
1 parent a6aa855 commit b6aee93

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎src/analysis/raster/qgsalignraster.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ bool QgsAlignRaster::setParametersFromRaster( const RasterInfo& rasterInfo, cons
193193
else
194194
{
195195
mGridOffsetX = customGridOffset.x();
196-
mGridOffsetY = customGridOffset.x();
196+
mGridOffsetY = customGridOffset.y();
197197
}
198198
}
199199
else
@@ -253,8 +253,7 @@ bool QgsAlignRaster::checkInputParameters()
253253
}
254254

255255
mXSize = mYSize = 0;
256-
for ( int i = 0; i < 6; ++i )
257-
mGeoTransform[i] = 0;
256+
std::fill( &mGeoTransform[0], &mGeoTransform[5], 0 );
Code has comments. Press enter to view.
258257

259258
double finalExtent[4] = { 0, 0, 0, 0 };
260259

@@ -432,7 +431,7 @@ bool QgsAlignRaster::createAndWarp( const Item& raster )
432431
GDALDatasetH hSrcDS = GDALOpen( raster.inputFilename.toLocal8Bit().constData(), GA_ReadOnly );
433432
if ( !hSrcDS )
434433
{
435-
mErrorMessage = QObject::tr( "Unable to open input file: " ) + raster.inputFilename;
434+
mErrorMessage = QObject::tr( "Unable to open input file: %1" ).arg( raster.inputFilename );
436435
return false;
437436
}
438437

@@ -448,13 +447,13 @@ bool QgsAlignRaster::createAndWarp( const Item& raster )
448447
if ( !hDstDS )
449448
{
450449
GDALClose( hSrcDS );
451-
mErrorMessage = QObject::tr( "Unable to create output file: " ) + raster.outputFilename;
450+
mErrorMessage = QObject::tr( "Unable to create output file: %1" ).arg( raster.outputFilename );
452451
return false;
453452
}
454453

455454
// Write out the projection definition.
456455
GDALSetProjection( hDstDS, mCrsWkt.toAscii().constData() );
457-
GDALSetGeoTransform( hDstDS, ( double* )mGeoTransform );
456+
GDALSetGeoTransform( hDstDS, mGeoTransform );
458457

459458
// Copy the color table, if required.
460459
GDALColorTableH hCT = GDALGetRasterColorTable( GDALGetRasterBand( hSrcDS, 1 ) );

0 commit comments

Comments
 (0)
Please sign in to comment.