Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/Quantum-GIS

  • Loading branch information
timlinux committed Sep 20, 2012
2 parents 8fd7805 + 5243423 commit 05ae00de29303e41b115234a4c556b59ecb328b9
Showing with 1,202 additions and 496 deletions.
  1. +1 −1 python/core/qgsrasterinterface.sip
  2. +4 −4 python/core/qgsrasterlayer.sip
  3. +1 −1 python/gui/qgsrasterformatsaveoptionswidget.sip
  4. +16 −9 src/app/qgsrasterlayerproperties.cpp
  5. +12 −12 src/core/qgsgeometry.cpp
  6. +28 −8 src/core/qgsrasterdataprovider.cpp
  7. +38 −18 src/core/qgsrasterdataprovider.h
  8. +2 −1 src/core/raster/qgsrasterchecker.cpp
  9. +8 −6 src/core/raster/qgsrasterfilewriter.cpp
  10. +2 −0 src/core/raster/qgsrasterinterface.cpp
  11. +6 −4 src/core/raster/qgsrasterinterface.h
  12. +20 −13 src/core/raster/qgsrasterlayer.cpp
  13. +7 −7 src/core/raster/qgsrasterlayer.h
  14. +2 −1 src/core/raster/qgsrasterrenderer.cpp
  15. +0 −44 src/core/raster/qgsrasterrenderer.h
  16. +1 −0 src/core/raster/qgsrastertransparency.cpp
  17. +77 −45 src/gui/qgsrasterformatsaveoptionswidget.cpp
  18. +6 −1 src/gui/qgsrasterformatsaveoptionswidget.h
  19. +12 −0 src/gui/qgsrasterlayersaveasdialog.cpp
  20. +4 −0 src/gui/qgsrasterlayersaveasdialog.h
  21. +171 −13 src/mapserver/qgswfsserver.cpp
  22. +3 −1 src/mapserver/qgswfsserver.h
  23. +144 −40 src/providers/gdal/qgsgdalprovider.cpp
  24. +4 −2 src/providers/gdal/qgsgdalprovider.h
  25. +16 −5 src/providers/grass/qgis.d.rast.c
  26. +12 −13 src/providers/grass/qgsgrassrasterprovider.cpp
  27. +2 −2 src/providers/grass/qgsgrassrasterprovider.h
  28. +47 −31 src/providers/wcs/qgswcscapabilities.cpp
  29. +12 −3 src/providers/wcs/qgswcscapabilities.h
  30. +54 −53 src/providers/wcs/qgswcsprovider.cpp
  31. +2 −2 src/providers/wcs/qgswcsprovider.h
  32. +1 −1 src/providers/wfs/qgswfsutils.cpp
  33. +5 −2 src/ui/qgsrasterlayerpropertiesbase.ui
  34. +1 −1 tests/src/core/testqgsrasterfilewriter.cpp
  35. +3 −0 tests/src/providers/CMakeLists.txt
  36. +378 −151 tests/src/providers/testqgswcspublicservers.cpp
  37. +19 −1 tests/src/providers/testqgswcspublicservers.h
  38. +81 −0 tests/src/providers/wcs-servers.json
@@ -82,7 +82,7 @@ class QgsRasterInterface

virtual int bandCount() const;

virtual double noDataValue() const;
virtual double noDataValue( int bandNo ) const;

virtual void * block( int bandNo, const QgsRectangle & extent, int width, int height );

@@ -172,7 +172,7 @@ public:
int height();

/** \brief Is the NoDataValue Valid */
bool isNoDataValueValid() const;
//bool isNoDataValueValid() const;

/** \brief Accessor for mGrayMinimumMaximumEstimated */
//bool isGrayMinimumMaximumEstimated() const; //removed with raster redesign
@@ -181,7 +181,7 @@ public:
//bool isRGBMinimumMaximumEstimated() const; //removed with raster redesign

/** \brief Accessor that returns the NO_DATA entry for this raster */
double noDataValue( bool* isValid = 0 );
//double noDataValue( bool* isValid = 0 );

/** \brief Returns a pointer to the transparency object */
//QgsRasterTransparency* rasterTransparency(); //removed with raster redesign
@@ -385,7 +385,7 @@ public:
//bool readColorTable( int theBandNumber, QList<QgsColorRampShader::ColorRampItem>* theList );

/** \brief Simple reset function that set the noDataValue back to the value stored in the first raster band */
void resetNoDataValue();
//void resetNoDataValue();

/** \brief Mutator for blue band name mapping */
void setBlueBandName( const QString & theBandName );
@@ -431,7 +431,7 @@ public:
void setMinimumValue( QString theBand, double theValue, bool theGenerateLookupTableFlag = true );

/** \brief Mutator that allows the NO_DATA entry for this raster to be overridden */
void setNoDataValue( double theNoData );
//void setNoDataValue( double theNoData );

/** \brief Set the raster shader function to a user defined function
\note ownership of the shader function is transfered to raster shader */
@@ -29,7 +29,7 @@ class QgsRasterFormatSaveOptionsWidget : QWidget

void apply();
void helpOptions();
bool validateOptions( bool gui = true );
QString validateOptions( bool gui = true, bool reportOk = true );

private slots:

@@ -546,13 +546,20 @@ void QgsRasterLayerProperties::sync()
// TODO: no data ranges
if ( mRasterLayer->dataProvider()->srcHasNoDataValue( 1 ) )
{
lblSrcNoDataValue->setText( QgsRasterInterface::printValue( mRasterLayer->dataProvider()->noDataValue( 1 ) ) );
lblSrcNoDataValue->setText( QgsRasterInterface::printValue( mRasterLayer->dataProvider()->srcNoDataValue( 1 ) ) );
}
else
{
lblSrcNoDataValue->setText( tr( "not defined" ) );
}

mSrcNoDataValueCheckBox->setChecked( mRasterLayer->dataProvider()->useSrcNoDataValue( 1 ) );

bool enableSrcNoData = mRasterLayer->dataProvider()->srcHasNoDataValue( 1 ) && !qIsNaN( mRasterLayer->dataProvider()->srcNoDataValue( 1 ) );

mSrcNoDataValueCheckBox->setEnabled( enableSrcNoData );
lblSrcNoDataValue->setEnabled( enableSrcNoData );

QList<QgsRasterInterface::Range> noDataRangeList = mRasterLayer->dataProvider()->userNoDataValue( 1 );
QgsDebugMsg( QString( "noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) );
if ( noDataRangeList.size() > 0 )
@@ -600,13 +607,14 @@ void QgsRasterLayerProperties::sync()
}
else
{
if ( mRasterLayer->isNoDataValueValid() )
// TODO: all bands
if ( mRasterLayer->dataProvider()->srcHasNoDataValue( 1 ) )
{
lblNoData->setText( tr( "No-Data Value: %1" ).arg( mRasterLayer->noDataValue() ) );
lblNoData->setText( tr( "No-Data Value: %1" ).arg( mRasterLayer->dataProvider()->noDataValue( 1 ) ) );
}
else
{
lblNoData->setText( tr( "No-Data Value: Not Set" ) );
lblNoData->setText( tr( "No-Data Value: " ) + tr( "n/a" ) );
}
}

@@ -678,6 +686,7 @@ void QgsRasterLayerProperties::apply()
for ( int bandNo = 1; bandNo <= mRasterLayer->dataProvider()->bandCount(); bandNo++ )
{
mRasterLayer->dataProvider()->setUserNoDataValue( bandNo, myNoDataRangeList );
mRasterLayer->dataProvider()->setUseSrcNoDataValue( bandNo, mSrcNoDataValueCheckBox->isChecked() );
}

//set renderer from widget
@@ -992,32 +1001,30 @@ void QgsRasterLayerProperties::on_pbnDefaultValues_clicked()

setupTransparencyTable( nBands );

// I don't think that noDataValue should be added to transparency list
#if 0
if ( nBands == 3 )
{
if ( mRasterLayer->isNoDataValueValid() )
{
// I don't think that noDataValue should be added to transparency list
#if 0
tableTransparency->insertRow( tableTransparency->rowCount() );
setTransparencyCell( 0, 0, mRasterLayer->noDataValue() );
setTransparencyCell( 0, 1, mRasterLayer->noDataValue() );
setTransparencyCell( 0, 2, mRasterLayer->noDataValue() );
setTransparencyCell( 0, 1, 100 );
#endif
}
}
else //1 band
{
if ( mRasterLayer->isNoDataValueValid() )
{
#if 0
tableTransparency->insertRow( tableTransparency->rowCount() );
setTransparencyCell( 0, 0, mRasterLayer->noDataValue() );
setTransparencyCell( 0, 1, mRasterLayer->noDataValue() );
setTransparencyCell( 0, 1, 100 );
#endif
}
}
#endif

tableTransparency->resizeColumnsToContents(); // works only with values
tableTransparency->resizeRowsToContents();
@@ -4226,10 +4226,10 @@ QString QgsGeometry::exportToGeoJSON()
{
mWkt += "{ \"type\": \"Point\", \"coordinates\": [";
x = ( double * )( mGeometry + 5 );
mWkt += QString::number( *x, 'f', 6 );
mWkt += QString::number( *x, 'f' );
mWkt += ", ";
y = ( double * )( mGeometry + 5 + sizeof( double ) );
mWkt += QString::number( *y, 'f', 6 );
mWkt += QString::number( *y, 'f' );
mWkt += "] }";
return mWkt;
}
@@ -4256,11 +4256,11 @@ QString QgsGeometry::exportToGeoJSON()
}
mWkt += "[";
x = ( double * ) ptr;
mWkt += QString::number( *x, 'f', 6 );
mWkt += QString::number( *x, 'f' );
mWkt += ", ";
ptr += sizeof( double );
y = ( double * ) ptr;
mWkt += QString::number( *y, 'f', 6 );
mWkt += QString::number( *y, 'f' );
ptr += sizeof( double );
if ( hasZValue )
{
@@ -4313,11 +4313,11 @@ QString QgsGeometry::exportToGeoJSON()
}
mWkt += "[";
x = ( double * ) ptr;
mWkt += QString::number( *x, 'f', 6 );
mWkt += QString::number( *x, 'f' );
mWkt += ", ";
ptr += sizeof( double );
y = ( double * ) ptr;
mWkt += QString::number( *y, 'f', 6 );
mWkt += QString::number( *y, 'f' );
ptr += sizeof( double );
if ( hasZValue )
{
@@ -4353,11 +4353,11 @@ QString QgsGeometry::exportToGeoJSON()
}
mWkt += "[";
x = ( double * )( ptr );
mWkt += QString::number( *x, 'f', 6 );
mWkt += QString::number( *x, 'f' );
mWkt += ", ";
ptr += sizeof( double );
y = ( double * )( ptr );
mWkt += QString::number( *y, 'f', 6 );
mWkt += QString::number( *y, 'f' );
ptr += sizeof( double );
if ( hasZValue )
{
@@ -4399,11 +4399,11 @@ QString QgsGeometry::exportToGeoJSON()
}
mWkt += "[";
x = ( double * ) ptr;
mWkt += QString::number( *x, 'f', 6 );
mWkt += QString::number( *x, 'f' );
ptr += sizeof( double );
mWkt += ", ";
y = ( double * ) ptr;
mWkt += QString::number( *y, 'f', 6 );
mWkt += QString::number( *y, 'f' );
ptr += sizeof( double );
if ( hasZValue )
{
@@ -4457,11 +4457,11 @@ QString QgsGeometry::exportToGeoJSON()
}
mWkt += "[";
x = ( double * ) ptr;
mWkt += QString::number( *x, 'f', 6 );
mWkt += QString::number( *x, 'f' );
ptr += sizeof( double );
mWkt += ", ";
y = ( double * ) ptr;
mWkt += QString::number( *y, 'f', 6 );
mWkt += QString::number( *y, 'f' );
ptr += sizeof( double );
if ( hasZValue )
{
@@ -25,6 +25,27 @@

#include <qmath.h>

void QgsRasterDataProvider::setUseSrcNoDataValue( int bandNo, bool use )
{
if ( mUseSrcNoDataValue.size() < bandNo )
{
for ( int i = mUseSrcNoDataValue.size(); i < bandNo; i++ )
{
mUseSrcNoDataValue.append( false );
}
}
mUseSrcNoDataValue[bandNo-1] = use;
}

double QgsRasterDataProvider::noDataValue( int bandNo ) const
{
if ( mSrcHasNoDataValue.value( bandNo - 1 ) && mUseSrcNoDataValue.value( bandNo - 1 ) )
{
return mSrcNoDataValue.value( bandNo -1 );
}
return mInternalNoDataValue.value( bandNo -1 );
}

void QgsRasterDataProvider::readBlock( int bandNo, QgsRectangle
const & viewExtent, int width,
int height,
@@ -289,7 +310,7 @@ QByteArray QgsRasterDataProvider::noValueBytes( int theBandNo )
QByteArray ba;
ba.resize(( int )size );
char * data = ba.data();
double noval = mNoDataValue[theBandNo-1];
double noval = noDataValue( theBandNo - 1 );
unsigned char uc;
unsigned short us;
short s;
@@ -616,7 +637,6 @@ QgsRasterBandStats QgsRasterDataProvider::bandStatistics( int theBandNo,
int myWidth = myRasterBandStats.width;
int myHeight = myRasterBandStats.height;

double myNoDataValue = noDataValue();
int myDataType = dataType( theBandNo );

int myXBlockSize = xBlockSize();
@@ -669,7 +689,8 @@ QgsRasterBandStats QgsRasterDataProvider::bandStatistics( int theBandNo,
double myValue = readValue( myData, myDataType, myX + ( myY * myBlockWidth ) );
//QgsDebugMsg ( QString ( "%1 %2 value %3" ).arg (myX).arg(myY).arg( myValue ) );

if ( mValidNoDataValue && ( qAbs( myValue - myNoDataValue ) <= TINY_VALUE ) )
// TODO: user nodata
if ( isNoDataValue( theBandNo, myValue ) )
{
continue; // NULL
}
@@ -718,7 +739,6 @@ QgsRasterBandStats QgsRasterDataProvider::bandStatistics( int theBandNo,
myRasterBandStats.stdDev = sqrt( mySumOfSquares / ( myRasterBandStats.elementCount - 1 ) );

QgsDebugMsg( "************ STATS **************" );
QgsDebugMsg( QString( "VALID NODATA %1" ).arg( mValidNoDataValue ) );
QgsDebugMsg( QString( "MIN %1" ).arg( myRasterBandStats.minimumValue ) );
QgsDebugMsg( QString( "MAX %1" ).arg( myRasterBandStats.maximumValue ) );
QgsDebugMsg( QString( "RANGE %1" ).arg( myRasterBandStats.range ) );
@@ -893,7 +913,6 @@ QgsRasterHistogram QgsRasterDataProvider::histogram( int theBandNo,
QgsRectangle myExtent = myHistogram.extent;
myHistogram.histogramVector.resize( myBinCount );

double myNoDataValue = noDataValue();
int myDataType = dataType( theBandNo );

int myXBlockSize = xBlockSize();
@@ -953,7 +972,8 @@ QgsRasterHistogram QgsRasterDataProvider::histogram( int theBandNo,
double myValue = readValue( myData, myDataType, myX + ( myY * myBlockWidth ) );
//QgsDebugMsg ( QString ( "%1 %2 value %3" ).arg (myX).arg(myY).arg( myValue ) );

if ( mValidNoDataValue && ( qAbs( myValue - myNoDataValue ) <= TINY_VALUE ) )
// TODO: user defined nodata values
if ( isNoDataValue( theBandNo, myValue ) )
{
continue; // NULL
}
@@ -1034,7 +1054,7 @@ void QgsRasterDataProvider::cumulativeCut( int theBandNo,
double QgsRasterDataProvider::readValue( void *data, int type, int index )
{
if ( !data )
return mValidNoDataValue ? noDataValue() : 0.0;
return std::numeric_limits<double>::quiet_NaN();

switch ( type )
{
@@ -1063,7 +1083,7 @@ double QgsRasterDataProvider::readValue( void *data, int type, int index )
QgsLogger::warning( "GDAL data type is not supported" );
}

return mValidNoDataValue ? noDataValue() : 0.0;
return std::numeric_limits<double>::quiet_NaN();
}

void QgsRasterDataProvider::setUserNoDataValue( int bandNo, QList<QgsRasterInterface::Range> noData )

0 comments on commit 05ae00d

Please sign in to comment.
You can’t perform that action at this time.