Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 15, 2014
1 parent 38fba0c commit 57c7b8a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/outputs/OutputFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, name='', description='', ext = None):
self.name = name
self.description = description
self.ext = ext

def getFileFilter(self, alg):
if self.ext is None:
return 'All files(*.*)'
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ void QgsRasterBlock::applyScaleOffset( double scale, double offset )
if ( !typeIsNumeric( mDataType ) ) return;
if ( scale == 1.0 && offset == 0.0 ) return;

qgssize size = (qgssize) mWidth * mHeight;
qgssize size = ( qgssize ) mWidth * mHeight;
for ( qgssize i = 0; i < size; ++i )
{
if ( !isNoData( i ) ) setValue( i, value( i ) * scale + offset );
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgssymbolv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ QgsMapUnitScale QgsSymbolV2::mapUnitScale() const
}

QgsSymbolLayerV2List::const_iterator it = mLayers.constBegin();
if( it == mLayers.constEnd() )
if ( it == mLayers.constEnd() )
return QgsMapUnitScale();

QgsMapUnitScale scale = ( *it )->mapUnitScale();
Expand Down
52 changes: 26 additions & 26 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ QgsRasterHistogram QgsGdalProvider::histogram( int theBandNo,

// Min/max, if not specified, are set by histogramDefaults, it does not
// set however min/max shifted to avoid rounding errors

double myMinVal = myHistogram.minimum;
double myMaxVal = myHistogram.maximum;

Expand All @@ -1388,8 +1388,8 @@ QgsRasterHistogram QgsGdalProvider::histogram( int theBandNo,
double myOffset = bandOffset( theBandNo );
if ( myScale != 1.0 || myOffset != 0. )
{
myMinVal = (myHistogram.minimum - myOffset) / myScale;
myMaxVal = (myHistogram.maximum - myOffset) / myScale;
myMinVal = ( myHistogram.minimum - myOffset ) / myScale;
myMaxVal = ( myHistogram.maximum - myOffset ) / myScale;
}

double dfHalfBucket = ( myMaxVal - myMinVal ) / ( 2 * myHistogram.binCount );
Expand Down Expand Up @@ -2385,34 +2385,34 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo, int theStats,
myRasterBandStats.statsGathered = QgsRasterBandStats::Min | QgsRasterBandStats::Max
| QgsRasterBandStats::Range | QgsRasterBandStats::Mean
| QgsRasterBandStats::StdDev;

// define if the band has scale and offset to apply
double myScale = bandScale( theBandNo );
double myOffset = bandOffset( theBandNo );
if ( myScale != 1.0 || myOffset != 0.0 )
{
if ( myScale < 0.0 )
{
// update Min and Max value
myRasterBandStats.minimumValue = pdfMax * myScale + myOffset;
myRasterBandStats.maximumValue = pdfMin * myScale + myOffset;
// update the range
myRasterBandStats.range = (pdfMin - pdfMax) * myScale;
// update standard deviation
myRasterBandStats.stdDev = -1.0 * pdfStdDev * myScale;
}
else
{
// update Min and Max value
myRasterBandStats.minimumValue = pdfMin * myScale + myOffset;
myRasterBandStats.maximumValue = pdfMax * myScale + myOffset;
// update the range
myRasterBandStats.range = (pdfMax - pdfMin) * myScale;
// update standard deviation
myRasterBandStats.stdDev = pdfStdDev * myScale;
}
// update the mean
myRasterBandStats.mean = pdfMean * myScale + myOffset;
if ( myScale < 0.0 )
{
// update Min and Max value
myRasterBandStats.minimumValue = pdfMax * myScale + myOffset;
myRasterBandStats.maximumValue = pdfMin * myScale + myOffset;
// update the range
myRasterBandStats.range = ( pdfMin - pdfMax ) * myScale;
// update standard deviation
myRasterBandStats.stdDev = -1.0 * pdfStdDev * myScale;
}
else
{
// update Min and Max value
myRasterBandStats.minimumValue = pdfMin * myScale + myOffset;
myRasterBandStats.maximumValue = pdfMax * myScale + myOffset;
// update the range
myRasterBandStats.range = ( pdfMax - pdfMin ) * myScale;
// update standard deviation
myRasterBandStats.stdDev = pdfStdDev * myScale;
}
// update the mean
myRasterBandStats.mean = pdfMean * myScale + myOffset;
}

#ifdef QGISDEBUG
Expand Down
16 changes: 8 additions & 8 deletions tests/src/core/testqgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,17 @@ void TestQgsRasterLayer::checkScaleOffset()
{
mReport += "<h2>Check Stats with scale/offset</h2>\n";

QFileInfo myRasterFileInfo( mTestDataDir + "scaleoffset.tif" );
QFileInfo myRasterFileInfo( mTestDataDir + "scaleoffset.tif" );
QgsRasterLayer * myRasterLayer;
myRasterLayer = new QgsRasterLayer( myRasterFileInfo.filePath(),
myRasterFileInfo.completeBaseName() );
QVERIFY ( myRasterLayer );
QVERIFY( myRasterLayer );
if ( ! myRasterLayer->isValid() )
{
qDebug() << QString( "raster layer %1 invalid" ).arg( myRasterFileInfo.filePath() ) ;
mReport += QString( "raster layer %1 invalid" ).arg( myRasterFileInfo.filePath() ) ;
delete myRasterLayer;
QVERIFY ( false );
QVERIFY( false );
}

QFile::remove( myRasterFileInfo.filePath() + ".aux.xml" ); // remove cached stats
Expand All @@ -393,10 +393,10 @@ void TestQgsRasterLayer::checkScaleOffset()
QVERIFY( fabs( myStatistics.stdDev - stdDev ) < 0.0000001 );

QgsRasterDataProvider* myProvider = myRasterLayer->dataProvider();
QgsPoint myPoint(1535030, 5083350);
QgsRectangle myRect(1535030-5, 5083350-5, 1535030+5, 5083350+5);
QgsPoint myPoint( 1535030, 5083350 );
QgsRectangle myRect( 1535030 - 5, 5083350 - 5, 1535030 + 5, 5083350 + 5 );
QgsRasterIdentifyResult identifyResult = myProvider->identify( myPoint, QgsRaster::IdentifyFormatValue, myRect, 1, 1 );

if ( identifyResult.isValid() )
{
QMap<int, QVariant> values = identifyResult.results();
Expand All @@ -408,7 +408,7 @@ void TestQgsRasterLayer::checkScaleOffset()
valueString = tr( "no data" );
mReport += QString( " %1 = %2 <br>\n" ).arg( myProvider->generateBandName( bandNo ) ).arg( valueString );
delete myRasterLayer;
QVERIFY ( false );
QVERIFY( false );
}
else
{
Expand All @@ -424,7 +424,7 @@ void TestQgsRasterLayer::checkScaleOffset()
else
{
delete myRasterLayer;
QVERIFY ( false );
QVERIFY( false );
}

mReport += "<p>Passed</p>";
Expand Down

0 comments on commit 57c7b8a

Please sign in to comment.