68 changes: 34 additions & 34 deletions src/plugins/georeferencer/qgsrasterchangecoords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,64 +28,64 @@

QgsRasterChangeCoords::QgsRasterChangeCoords()
{
mHasCrs = false;
mHasCrs = false;
}

void QgsRasterChangeCoords::setRaster( const QString &fileRaster )
{
GDALAllRegister();
GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly );
double adfGeoTransform[6];
if( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform(hDS, adfGeoTransform) == CE_None)
GDALAllRegister();
GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly );
double adfGeoTransform[6];
if ( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform( hDS, adfGeoTransform ) == CE_None )
//if ( false )
{
mHasCrs = true;
mUL_X = adfGeoTransform[0];
mUL_Y = adfGeoTransform[3];
mResX = adfGeoTransform[1];
mResY = adfGeoTransform[5];
}
else
{
mHasCrs = false;
}
GDALClose( hDS );
{
mHasCrs = true;
mUL_X = adfGeoTransform[0];
mUL_Y = adfGeoTransform[3];
mResX = adfGeoTransform[1];
mResY = adfGeoTransform[5];
}
else
{
mHasCrs = false;
}
GDALClose( hDS );
}

std::vector<QgsPoint> QgsRasterChangeCoords::getPixelCoords(const std::vector<QgsPoint> &mapCoords)
std::vector<QgsPoint> QgsRasterChangeCoords::getPixelCoords( const std::vector<QgsPoint> &mapCoords )
{
const int size = mapCoords.size();
std::vector<QgsPoint> pixelCoords( size );
for ( int i = 0; i < size; i++ )
{
pixelCoords[i] = toColumnLine( mapCoords.at( i ) );
}
return pixelCoords;
const int size = mapCoords.size();
std::vector<QgsPoint> pixelCoords( size );
for ( int i = 0; i < size; i++ )
{
pixelCoords[i] = toColumnLine( mapCoords.at( i ) );
}
return pixelCoords;
}

QgsRectangle QgsRasterChangeCoords::getBoundingBox(const QgsRectangle &rect, bool toPixel)
QgsRectangle QgsRasterChangeCoords::getBoundingBox( const QgsRectangle &rect, bool toPixel )
{
QgsRectangle rectReturn;
QgsPoint p1( rect.xMinimum(), rect.yMinimum() );
QgsPoint p2( rect.xMaximum(), rect.yMaximum() );
QgsPoint ( QgsRasterChangeCoords::* func )( const QgsPoint & );
QgsPoint( QgsRasterChangeCoords::* func )( const QgsPoint & );

func = toPixel ? &QgsRasterChangeCoords::toColumnLine : &QgsRasterChangeCoords::toXY;
rectReturn.set( ( this->*func ) (p1), ( this->*func )(p2) );
rectReturn.set(( this->*func )( p1 ), ( this->*func )( p2 ) );

return rectReturn;
}

QgsPoint QgsRasterChangeCoords::toColumnLine(const QgsPoint &pntMap)
QgsPoint QgsRasterChangeCoords::toColumnLine( const QgsPoint &pntMap )
{
double col = ( pntMap.x() - mUL_X ) / mResX;
double line = ( mUL_Y - pntMap.y() ) / mResY;
return QgsPoint(col, line);
double col = ( pntMap.x() - mUL_X ) / mResX;
double line = ( mUL_Y - pntMap.y() ) / mResY;
return QgsPoint( col, line );
}

QgsPoint QgsRasterChangeCoords::toXY(const QgsPoint &pntPixel)
QgsPoint QgsRasterChangeCoords::toXY( const QgsPoint &pntPixel )
{
double x = mUL_X + ( pntPixel.x() * mResX );
double y = mUL_Y + ( pntPixel.y() * -mResY );
return QgsPoint(x, y);
return QgsPoint( x, y );
}
8 changes: 4 additions & 4 deletions src/plugins/georeferencer/qgsrasterchangecoords.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class QgsRasterChangeCoords
QgsRasterChangeCoords( );
void setRaster( const QString &fileRaster );
bool hasCrs() const { return mHasCrs; }
std::vector<QgsPoint> getPixelCoords(const std::vector<QgsPoint> &mapCoords);
QgsRectangle getBoundingBox(const QgsRectangle &rect, bool toPixel);
QgsPoint toColumnLine(const QgsPoint &pntMap);
QgsPoint toXY(const QgsPoint &pntPixel);
std::vector<QgsPoint> getPixelCoords( const std::vector<QgsPoint> &mapCoords );
QgsRectangle getBoundingBox( const QgsRectangle &rect, bool toPixel );
QgsPoint toColumnLine( const QgsPoint &pntMap );
QgsPoint toXY( const QgsPoint &pntPixel );

private:
bool mHasCrs;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ bool QgsPostgresProvider::loadFields()
QString attnum = tresult.PQgetvalue( 0, 0 );
formattedFieldType = tresult.PQgetvalue( 0, 1 );

if( !attnum.isEmpty() )
if ( !attnum.isEmpty() )
{
sql = QString( "SELECT description FROM pg_description WHERE objoid=%1 AND objsubid=%2" )
.arg( tableoid ).arg( attnum );
Expand Down
8 changes: 4 additions & 4 deletions tests/src/core/testqgsdiagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class TestQgsDiagram: public QObject
QString myPointsFileName = mTestDataDir + "points.shp";
QFileInfo myPointFileInfo( myPointsFileName );
mPointsLayer = new QgsVectorLayer( myPointFileInfo.filePath(),
myPointFileInfo.completeBaseName(), "ogr" );
myPointFileInfo.completeBaseName(), "ogr" );

// Register the layer with the registry
QgsMapLayerRegistry::instance()->addMapLayers(
Expand Down Expand Up @@ -159,14 +159,14 @@ class TestQgsDiagram: public QObject
dls.placement = QgsDiagramLayerSettings::OverPoint;
dls.renderer = dr;

dynamic_cast<QgsPalLabeling*> (mMapRenderer->labelingEngine())->setShowingAllLabels( true );
dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() )->setShowingAllLabels( true );

mPointsLayer->setDiagramLayerSettings( dls );

mComposerMap->setNewExtent( QgsRectangle( -122, -79, -70, 47 ) );
QgsCompositionChecker checker( "Composer map render", mComposition, QString( QString( TEST_DATA_DIR )
+ QDir::separator() + "control_images" + QDir::separator() + "expected_diagram" + QDir::separator()
+ "expected_piediagram.png" ) );
+ QDir::separator() + "control_images" + QDir::separator() + "expected_diagram" + QDir::separator()
+ "expected_piediagram.png" ) );

QVERIFY( checker.testComposition() );

Expand Down
6 changes: 3 additions & 3 deletions tests/src/gui/testprojectionissues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestProjectionIssues: public QObject
void cleanupTestCase();// will be called after the last testfunction was executed.
void init();// will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.
void issue5895();// test for #5895
void issue5895();// test for #5895
private:
QgsRasterLayer* mRasterLayer;
QgsMapCanvas* mMapCanvas;
Expand All @@ -50,8 +50,8 @@ void TestProjectionIssues::initTestCase()
// Set to WGS84
QgsCoordinateReferenceSystem sourceCRS;
sourceCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
mRasterLayer->setCrs( sourceCRS, false);
mRasterLayer->setCrs( sourceCRS, false );

QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer->dataProvider(), 2, 3, 4 );
mRasterLayer->setRenderer( rasterRenderer );

Expand Down