Ignore:
Timestamp:
2018-03-04T15:18:05+01:00 (23 months ago)
Author:
Don-vip
Message:

fix #16051, see #8039, see #10456 - more fixes for download/upload policies and locked status (merge of layers)

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r13453 r13497  
    329329            version = copyFrom.version;
    330330            uploadPolicy = copyFrom.uploadPolicy;
     331            downloadPolicy = copyFrom.downloadPolicy;
    331332            isReadOnly.set(copyFrom.isReadOnly.get());
    332333        } finally {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r11374 r13497  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.geom.Area;
    67import java.util.ArrayList;
    78import java.util.Collection;
     
    1415import java.util.Set;
    1516
     17import org.openstreetmap.josm.data.DataSource;
    1618import org.openstreetmap.josm.data.conflict.Conflict;
    1719import org.openstreetmap.josm.data.conflict.ConflictCollection;
     
    432434            candidates.clear();
    433435            fixReferences();
     436
     437            Area a = targetDataSet.getDataSourceArea();
     438
     439            // copy the merged layer's data source info.
     440            // only add source rectangles if they are not contained in the layer already.
     441            for (DataSource src : sourceDataSet.getDataSources()) {
     442                if (a == null || !a.contains(src.bounds.asRect())) {
     443                    targetDataSet.addDataSource(src);
     444                }
     445            }
     446
     447            // copy the merged layer's API version
     448            if (targetDataSet.getVersion() == null) {
     449                targetDataSet.setVersion(sourceDataSet.getVersion());
     450            }
     451
     452            // copy the merged layer's policies and locked status
     453            if (sourceDataSet.getUploadPolicy() != null && (targetDataSet.getUploadPolicy() == null
     454                    || sourceDataSet.getUploadPolicy().compareTo(targetDataSet.getUploadPolicy()) > 0)) {
     455                targetDataSet.setUploadPolicy(sourceDataSet.getUploadPolicy());
     456            }
     457            if (sourceDataSet.getDownloadPolicy() != null && (targetDataSet.getDownloadPolicy() == null
     458                    || sourceDataSet.getDownloadPolicy().compareTo(targetDataSet.getDownloadPolicy()) > 0)) {
     459                targetDataSet.setDownloadPolicy(sourceDataSet.getDownloadPolicy());
     460            }
     461            if (sourceDataSet.isLocked() && !targetDataSet.isLocked()) {
     462                targetDataSet.lock();
     463            }
    434464        } finally {
    435465            targetDataSet.endUpdate();
Note: See TracChangeset for help on using the changeset viewer.