[SCM] qgis branch, master, updated. a2ee769957385f4e084c5e8b6ba178a8c877d1db
Marco Hugentobler
marco.hugentobler at sourcepole.ch
Tue Mar 20 13:43:44 UTC 2012
The following commit has been merged in the master branch:
commit 9f57650eafec1bfa2d66c76e174d0a6b90a0726a
Author: Marco Hugentobler <marco.hugentobler at sourcepole.ch>
Date: Sun Mar 18 09:13:18 2012 +0100
Fix for zonal statistics (ticket #4972)
diff --git a/src/analysis/vector/qgszonalstatistics.cpp b/src/analysis/vector/qgszonalstatistics.cpp
index 02734a8..d94c6a0 100644
--- a/src/analysis/vector/qgszonalstatistics.cpp
+++ b/src/analysis/vector/qgszonalstatistics.cpp
@@ -109,9 +109,9 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
//add the new count, sum, mean fields to the provider
QList<QgsField> newFieldList;
- QgsField countField( mAttributePrefix + "count", QVariant::Double );
- QgsField sumField( mAttributePrefix + "sum", QVariant::Double );
- QgsField meanField( mAttributePrefix + "mean", QVariant::Double );
+ QgsField countField( mAttributePrefix + "count", QVariant::Double, "double precision" );
+ QgsField sumField( mAttributePrefix + "sum", QVariant::Double, "double precision" );
+ QgsField meanField( mAttributePrefix + "mean", QVariant::Double, "double precision" );
newFieldList.push_back( countField );
newFieldList.push_back( sumField );
newFieldList.push_back( meanField );
diff --git a/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp b/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
index 95c6539..db63971 100644
--- a/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
+++ b/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
@@ -68,7 +68,11 @@ void QgsZonalStatisticsDialog::insertAvailableLayers()
QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer_it.value() );
if ( vl && vl->geometryType() == QGis::Polygon )
{
- mPolygonLayerComboBox->addItem( vl->name(), QVariant( vl->id() ) );
+ QgsVectorDataProvider* provider = vl->dataProvider();
+ if ( provider->capabilities() & QgsVectorDataProvider::AddAttributes )
+ {
+ mPolygonLayerComboBox->addItem( vl->name(), QVariant( vl->id() ) );
+ }
}
}
}
--
The Quantum GIS in Debian project
More information about the Pkg-grass-devel
mailing list