Skip to content

Commit

Permalink
copy/paste: do not transform if layer has unknown geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 3, 2014
1 parent 1d8faf2 commit 9c5c065
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5624,23 +5624,23 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
if ( featureIt->geometry() )
{
// convert geometry to match destination layer
QgsGeometry* newGeometry = featureIt->geometry()->convertToType( pasteVectorLayer->geometryType(), QGis::isMultiType( pasteVectorLayer->wkbType() ) );
if ( newGeometry )
QGis::GeometryType destType = pasteVectorLayer->geometryType();
bool destIsMulti = QGis::isMultiType( pasteVectorLayer->wkbType() );
if ( destType != QGis::UnknownGeometry )
{
// avoid intersection if enabled in digitize settings
QgsGeometry* newGeometry = featureIt->geometry()->convertToType( destType, destIsMulti );
if ( !newGeometry )
{
featureIt = features.erase( featureIt );
continue;
}
featureIt->setGeometry( newGeometry );
featureIt->geometry()->avoidIntersections();
++featureIt;
}
else
{
featureIt = features.erase( featureIt );
}
// avoid intersection if enabled in digitize settings
featureIt->geometry()->avoidIntersections();
}
else
{
++featureIt;
}

++featureIt;
}

pasteVectorLayer->addFeatures( features );
Expand Down

0 comments on commit 9c5c065

Please sign in to comment.