mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Wired up different gdal subsampling algorithms for pyramid building to raster props dialog.
git-svn-id: http://svn.osgeo.org/qgis/trunk@1689 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
093db91552
commit
1f5e6cc19f
@ -966,7 +966,7 @@ void QgsRasterLayer::drawSingleBandGray(QPainter * theQPainter, RasterViewPort *
|
||||
RasterBandStats myRasterBandStats = getRasterBandStats(theBandNoInt);
|
||||
#ifdef QGISDEBUG
|
||||
|
||||
std::cout << "draw gray band Git stats" << std::endl;
|
||||
std::cout << "draw gray band Get stats" << std::endl;
|
||||
#endif
|
||||
|
||||
double myRangeDouble = myRasterBandStats.rangeDouble;
|
||||
@ -2789,7 +2789,7 @@ QString QgsRasterLayer::getMetadata()
|
||||
return myMetadataQString;
|
||||
}
|
||||
|
||||
void QgsRasterLayer::buildPyramids(RasterPyramidList theRasterPyramidList)
|
||||
void QgsRasterLayer::buildPyramids(RasterPyramidList theRasterPyramidList, QString theResamplingMethod)
|
||||
{
|
||||
emit setProgress(0,0);
|
||||
//first test if the file is writeable
|
||||
@ -2846,11 +2846,38 @@ void QgsRasterLayer::buildPyramids(RasterPyramidList theRasterPyramidList)
|
||||
*/
|
||||
#ifdef QGISDEBUG
|
||||
//build the pyramid and show progress to console
|
||||
gdalDataset->BuildOverviews( "NEAREST", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
if(theResamplingMethod==tr("Average Magphase"))
|
||||
{
|
||||
gdalDataset->BuildOverviews( "MODE", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
GDALTermProgress, NULL );
|
||||
}
|
||||
else if(theResamplingMethod==tr("Average"))
|
||||
|
||||
{
|
||||
gdalDataset->BuildOverviews( "AVERAGE", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
GDALTermProgress, NULL );
|
||||
}
|
||||
else // fall back to nearest neighbor
|
||||
{
|
||||
gdalDataset->BuildOverviews( "NEAREST", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
GDALTermProgress, NULL );
|
||||
}
|
||||
#else
|
||||
//build the pyramid and suppress progress to console
|
||||
gdalDataset->BuildOverviews( "NEAREST", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
//build the pyramid and show progress to console
|
||||
if(theResamplingMethod==tr("Average Magphase"))
|
||||
{
|
||||
gdalDataset->BuildOverviews( "MODE", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
GDALDummyProgress, NULL );
|
||||
}
|
||||
else if(theResamplingMethod==tr("Average"))
|
||||
|
||||
{
|
||||
gdalDataset->BuildOverviews( "AVERAGE", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
GDALDummyProgress, NULL );
|
||||
}
|
||||
else // fall back to nearest neighbor
|
||||
{
|
||||
gdalDataset->BuildOverviews( "NEAREST", 1, myOverviewLevelsIntArray, 0, NULL,
|
||||
GDALDummyProgress, NULL );
|
||||
#endif
|
||||
myCountInt++;
|
||||
|
@ -754,8 +754,8 @@ public slots:
|
||||
/** \brief Create gdal pyramid overviews for this layer.
|
||||
* This will speed up performance at the expense of hard drive space.
|
||||
* Also, write access to the file is required. If no paramter is passed in
|
||||
* it will default to the class member pyramid list. */
|
||||
void buildPyramids(RasterPyramidList);
|
||||
* it will default to nearest neighbor resampling. */
|
||||
void buildPyramids(RasterPyramidList,QString theResamplingMethod="NEAREST");
|
||||
/** \brief Used at the moment by the above function but hopefully will later
|
||||
be useable by any operation that needs to notify the user of its progress. */
|
||||
/*
|
||||
|
@ -769,7 +769,7 @@ void QgsRasterLayerProperties::buttonBuildPyramids_clicked()
|
||||
//
|
||||
// Ask raster layer to build the pyramids
|
||||
//
|
||||
rasterLayer->buildPyramids(myPyramidList);
|
||||
rasterLayer->buildPyramids(myPyramidList,cboResamplingMethod->currentText());
|
||||
//
|
||||
// repopulate the pyramids list
|
||||
//
|
||||
|
@ -8,8 +8,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>636</width>
|
||||
<height>458</height>
|
||||
<width>637</width>
|
||||
<height>478</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
@ -400,7 +400,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style="font-size:12pt;font-family:Arial">
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style="font-size:11pt;font-family:Andale Sans UI">
|
||||
<p style="margin-top:14px"><span style="font-weight:600">Notes</span></p>
|
||||
</body></html>
|
||||
</string>
|
||||
@ -987,11 +987,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Average Magphase</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Average</string>
|
||||
@ -1002,6 +997,11 @@
|
||||
<string>Nearest Neighbour</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Average Magphase</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>cboResamplingMethod</cstring>
|
||||
</property>
|
||||
@ -1029,8 +1029,8 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style="font-size:12pt;font-family:Arial">
|
||||
<p style="margin-top:18px"><span style="font-size:24pt;font-weight:600">Description</span></p>
|
||||
<string><html><head><meta name="qrichtext" content="1" /></head><body style="font-size:11pt;font-family:Andale Sans UI">
|
||||
<p style="margin-top:18px"><span style="font-size:21pt;font-weight:600">Description</span></p>
|
||||
<p>Large resolution raster layers can slow navigation in QGIS. By creating lower resolution copies of the data (pyramids) performance can be considerably improved as QGIS selects the most suitable resolution to use depending on the level of zoom. You must have write access in the directory where the original data is stored to build pyramids. </p>
|
||||
<p><span style="color:#ff0000">Please note that building pyramids may alter the original data file and once created they cannot be removed.</span></p>
|
||||
</body></html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user