Skip to content
Permalink
Browse files
indentation update
  • Loading branch information
jef-n committed May 15, 2014
1 parent 38fba0c commit 57c7b8ac50570371dc4d1589770f0bcdf1379bdc
@@ -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(*.*)'
@@ -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 );
@@ -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();
@@ -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;

@@ -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 );
@@ -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
@@ -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
@@ -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();
@@ -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
{
@@ -424,7 +424,7 @@ void TestQgsRasterLayer::checkScaleOffset()
else
{
delete myRasterLayer;
QVERIFY ( false );
QVERIFY( false );
}

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

0 comments on commit 57c7b8a

Please sign in to comment.