Skip to content

Commit

Permalink
-Fix missed api updates in the unit tests
Browse files Browse the repository at this point in the history
-Patched minor debug error in WMS provider
-Added ability to set transparency for WMS layer, closes ticket #1348. This patch needs to be reviewed on other platforms however as there seems to be a slight bug with QImage::setAlphaChannel

git-svn-id: http://svn.osgeo.org/qgis/trunk@9561 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts committed Nov 1, 2008
1 parent 5cf0e49 commit 785dd83
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 196 deletions.
68 changes: 0 additions & 68 deletions python/core/qgscolortable.sip

This file was deleted.

4 changes: 2 additions & 2 deletions python/core/qgsrasterbandstats.sip
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class QgsRasterBandStats
typedef QVector<int> HistogramVector;
//HistogramVector * histogramVector;
/** \brief whteher histogram values are estimated or completely calculated */
bool histogramEstimated;
bool isHistogramEstimated;
/** whehter histogram compuation should include out of range values */
bool histogramOutOfRange;
bool isHistogramOutOfRange;
/** Color table */
//QList<QgsColorRampShader::ColorRampItem> colorTable;
};
Expand Down
3 changes: 2 additions & 1 deletion src/app/qgsrasterlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ void QgsRasterLayerProperties::sync()
tabBar->setCurrentIndex( tabBar->indexOf( tabPageMetadata ) );
tabBar->removeTab( tabBar->indexOf( tabPageColormap ) );
tabBar->removeTab( tabBar->indexOf( tabPageSymbology ) );
tabBar->removeTab( tabBar->indexOf( tabPageTransparency ) );
gboxNoDataValue->setEnabled( false );
gboxCustomTransparency->setEnabled( false );
tabBar->removeTab( tabBar->indexOf( tabPageHistogram ) );
tabBar->removeTab( tabBar->indexOf( tabPagePyramids ) );
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/raster/qgsrasterbandstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class CORE_EXPORT QgsRasterBandStats
stdDev = 0.0;
sum = 0.0;
elementCount = 0;
histogramEstimated = false;
histogramOutOfRange = false;
isHistogramEstimated = false;
isHistogramOutOfRange = false;
}

/** \brief The name of the band that these stats belong to. */
Expand All @@ -64,10 +64,10 @@ class CORE_EXPORT QgsRasterBandStats
int elementCount;

/** \brief whteher histogram values are estimated or completely calculated */
bool histogramEstimated;
bool isHistogramEstimated;

/** whehter histogram compuation should include out of range values */
bool histogramOutOfRange;
bool isHistogramOutOfRange;

/** \brief Store the histogram for a given layer */
HistogramVector * histogramVector;
Expand Down
14 changes: 9 additions & 5 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,10 +1136,14 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )
QgsDebugMsg( QString( "origin y: %1" ).arg( myRasterViewPort->topLeftPoint.y() ) );
QgsDebugMsg( QString( "(int)origin y: %1" ).arg( static_cast<int>( myRasterViewPort->topLeftPoint.y() ) ) );

//Set the transparency for the whole layer
QImage myAlphaChannel( image->width(), image->height(), QImage::Format_Indexed8 );
myAlphaChannel.fill( ( uint ) mTransparencyLevel );
image->setAlphaChannel( myAlphaChannel );

// Since GDAL's RasterIO can't handle floating point, we have to round to
// the nearest pixel. Add 0.5 to get rounding instead of truncation
// out of static_cast<int>.

theQPainter->drawImage( static_cast<int>(
myRasterViewPort->topLeftPoint.x()
+ 0.5 // try simulating rounding instead of truncation, to avoid off-by-one errors
Expand Down Expand Up @@ -4516,12 +4520,12 @@ void QgsRasterLayer::populateHistogram( int theBandNo, int theBinCount, bool the
//i.e if the histogram has never previously been generated or the user has
//selected a new number of bins.
if ( myRasterBandStats.histogramVector->size() != theBinCount ||
theIgnoreOutOfRangeFlag != myRasterBandStats.histogramOutOfRange ||
theHistogramEstimatedFlag != myRasterBandStats.histogramEstimated )
theIgnoreOutOfRangeFlag != myRasterBandStats.isHistogramOutOfRange ||
theHistogramEstimatedFlag != myRasterBandStats.isHistogramEstimated )
{
myRasterBandStats.histogramVector->clear();
myRasterBandStats.histogramEstimated = theHistogramEstimatedFlag;
myRasterBandStats.histogramOutOfRange = theIgnoreOutOfRangeFlag;
myRasterBandStats.isHistogramEstimated = theHistogramEstimatedFlag;
myRasterBandStats.isHistogramOutOfRange = theIgnoreOutOfRangeFlag;
int *myHistogramArray = new int[theBinCount];


Expand Down
4 changes: 2 additions & 2 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ QImage* QgsWmsProvider::draw( QgsRect const & viewExtent, int pixelWidth, int p
{
QgsDebugMsg( "Entering." );

QgsDebugMsg( "pixelWidth = " + QString( pixelWidth ) );
QgsDebugMsg( "pixelHeight = " + QString( pixelHeight ) );
QgsDebugMsg( "pixelWidth = " + QString::number( pixelWidth ) );
QgsDebugMsg( "pixelHeight = " + QString::number( pixelHeight ) );
QgsDebugMsg( "viewExtent: " + viewExtent.toString() );

// Can we reuse the previously cached image?
Expand Down
Loading

0 comments on commit 785dd83

Please sign in to comment.