[QGIS Commit] r11763 - trunk/qgis/src/providers/ogr
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Oct 7 07:58:29 EDT 2009
Author: jef
Date: 2009-10-07 07:58:29 -0400 (Wed, 07 Oct 2009)
New Revision: 11763
Modified:
trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
Log:
ogr provider: shapes that can't RandomWrite can't DeleteFeature either
Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2009-10-06 22:05:52 UTC (rev 11762)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2009-10-07 11:58:29 UTC (rev 11763)
@@ -1075,20 +1075,23 @@
#endif
// OGR doesn't handle shapefiles without attributes, ie. missing DBFs well, fixes #803
- if ( ogrDriverName.startsWith( "ESRI" ) && mAttributeFields.size() == 0 )
+ if ( ogrDriverName.startsWith( "ESRI" ) )
{
- QgsDebugMsg( "OGR doesn't handle shapefile without attributes well, ie. missing DBFs" );
- ability &= ~( AddFeatures | DeleteFeatures | ChangeAttributeValues | AddAttributes | DeleteAttributes );
+ if ( mAttributeFields.size() == 0 )
+ {
+ QgsDebugMsg( "OGR doesn't handle shapefile without attributes well, ie. missing DBFs" );
+ ability &= ~( AddFeatures | DeleteFeatures | ChangeAttributeValues | AddAttributes | DeleteAttributes );
+ }
+
+ if (( ability & ChangeAttributeValues ) == 0 )
+ {
+ // on readonly shapes OGR reports that it can delete features although it can't RandomWrite
+ ability &= ~( AddAttributes | DeleteFeatures );
+ }
}
}
return ability;
-
- /*
- return (QgsVectorDataProvider::AddFeatures
- | QgsVectorDataProvider::ChangeAttributeValues
- | QgsVectorDataProvider::CreateSpatialIndex);
- */
}
More information about the QGIS-commit
mailing list