Ticket #17724: 17724.patch

File 17724.patch, 1.7 KB (added by taylor.smock, 5 years ago)

Overload the DataSet.merge() method to have another variable about whether or not the DataSet bounds should be merged. This should probably only ever be used when downloading with Overpass without the user entering in the query themselves.

  • src/org/openstreetmap/josm/data/osm/DataSetMerger.java

     
    405405     * @param progressMonitor The progress monitor
    406406     */
    407407    public void merge(ProgressMonitor progressMonitor) {
     408        merge(progressMonitor, true);
     409    }
     410
     411    /**
     412     * Runs the merge operation. Successfully merged {@link OsmPrimitive}s are in
     413     * {@link #getTargetDataSet()}.
     414     *
     415     * See {@link #getConflicts()} for a map of conflicts after the merge operation.
     416     * @param progressMonitor The progress monitor
     417     * @param mergeBounds Whether or not to merge the bounds of the new DataSet to
     418     * the existing DataSet
     419     * @since xxx
     420     */
     421    public void merge(ProgressMonitor progressMonitor, boolean mergeBounds) {
    408422        if (sourceDataSet == null)
    409423            return;
    410424        if (progressMonitor != null) {
     
    442456
    443457            // copy the merged layer's data source info.
    444458            // only add source rectangles if they are not contained in the layer already.
    445             for (DataSource src : sourceDataSet.getDataSources()) {
    446                 if (a == null || !a.contains(src.bounds.asRect())) {
    447                     targetDataSet.addDataSource(src);
     459            if (mergeBounds) {
     460                for (DataSource src : sourceDataSet.getDataSources()) {
     461                    if (a == null || !a.contains(src.bounds.asRect())) {
     462                        targetDataSet.addDataSource(src);
     463                    }
    448464                }
    449465            }
    450466