public static List<PrimitiveData> copyObjects(DataSet sourceDataSet, Collection<OsmPrimitive> primitives) {
Collection<OsmPrimitive> origSelection = sourceDataSet.getSelected();
sourceDataSet.setSelected(primitives);
MergeSourceBuildingVisitor builder = new MergeSourceBuildingVisitor(sourceDataSet);
DataSet newDataSet = builder.build();
//restore selection
sourceDataSet.setSelected(origSelection);
List<PrimitiveData> newObjects = new ArrayList<PrimitiveData>();
for (OsmPrimitive p : newDataSet.allPrimitives()) {