Skip to content

Commit

Permalink
fix #2819
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13808 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 26, 2010
1 parent f9c984e commit 49dc996
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -4490,14 +4490,34 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
if ( pasteVectorLayer != 0 )
{
pasteVectorLayer->beginEditCommand( tr( "Features pasted" ) );
QgsFeatureList features;
if ( mMapCanvas->mapRenderer()->hasCrsTransformEnabled() )
{
pasteVectorLayer->addFeatures( clipboard()->transformedCopyOf( pasteVectorLayer->srs() ) );
features = clipboard()->transformedCopyOf( pasteVectorLayer->srs() );
}
else
{
pasteVectorLayer->addFeatures( clipboard()->copyOf() );
features = clipboard()->copyOf();
}

QgsAttributeList dstAttr = pasteVectorLayer->pendingAllAttributesList();

for ( int i = 0; i < features.size(); i++ )
{
QgsFeature &f = features[i];
QgsAttributeMap srcMap = f.attributeMap();
QgsAttributeMap dstMap;

int j = 0;
foreach( int id, srcMap.keys() )
{
dstMap[ dstAttr[j++] ] = srcMap[id];
}

f.setAttributeMap( dstMap );
}

pasteVectorLayer->addFeatures( features );
pasteVectorLayer->endEditCommand();
mMapCanvas->refresh();
}
Expand Down

0 comments on commit 49dc996

Please sign in to comment.