Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
vector file writer: scan shape file geometries instead of just assumi…
…ng multi geometry types (followup 528c4ca, refs #10584, fixes #11542, fixes #11597)
  • Loading branch information
jef-n committed Nov 18, 2014
1 parent a6650e4 commit 881e25b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/core/qgsvectorfilewriter.cpp
Expand Up @@ -1869,7 +1869,20 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
// Shapefiles might contain multi types although wkbType() only reports singles
if ( layer->storageType() == "ESRI Shapefile" )
{
wkbType = QGis::multiType( wkbType );
const QgsFeatureIds &ids = layer->selectedFeaturesIds();
QgsFeatureIterator fit = layer->getFeatures();
QgsFeature fet;
while ( fit.nextFeature( fet ) )
{
if ( onlySelected && !ids.contains( fet.id() ) )
continue;

if ( fet.geometry() && fet.geometry()->wkbType() == QGis::multiType( wkbType ) )
{
wkbType = QGis::multiType( wkbType );
break;
}
}
}
}

Expand Down

0 comments on commit 881e25b

Please sign in to comment.