Changeset 16008 in josm for trunk


Ignore:
Timestamp:
2020-03-03T08:00:14+01:00 (5 years ago)
Author:
GerdP
Message:

fix #18835: unexpected full recursive download of children relations makes some edits impossible

  • This is a partly revert of r15811 which changed the meaning of "download members" to "download complete members". Now - as before r15811 - only way and node members are completed. This also applies when overpass api is used. For some relations, e.g. 1311341 (the boundary of Spain), the full recursion has to download thousands of sub relations, which is likely to fail.
  • Cancel button did not work while relation members were downloaded.
Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/MultiFetchOverpassObjectReader.java

    r15811 r16008  
    3535                case MULTIPOLYGON:
    3636                case RELATION:
    37                     sb.append(list);
    38                     if (recurseDownRelations)
    39                         sb.append(">>;");
     37                    if (recurseDownRelations) {
     38                        sb.append('(').append(list);
     39                        sb.setLength(sb.length()-1); // remove semicolon
     40                        //recurse down only one level, see #18835
     41                        sb.append("->.r;.r;rel(r);.r;way(r);>;.r;node(r););");
     42                    } else {
     43                        sb.append(list);
     44                    }
    4045                    break;
    4146                case CLOSEDWAY:
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r15846 r16008  
    446446            return;
    447447        }
    448         // OSM multi-fetch api may return invisible objects
     448        // OSM multi-fetch api may return invisible objects, we don't try to get details for them
    449449        for (Relation r : outputDataSet.getRelations()) {
    450450            if (!r.isVisible())
    451451                toDownload.remove(r.getUniqueId());
    452452        }
    453         while (!toDownload.isEmpty()) {
     453        // fetch full info for all visible relations
     454        for (long id : toDownload) {
    454455            if (isCanceled())
    455456                return;
    456             final Set<Long> addedRelations = new LinkedHashSet<>();
    457 
    458             for (long id : toDownload) {
    459                 OsmServerObjectReader reader = new OsmServerObjectReader(id, OsmPrimitiveType.RELATION, true /* full*/);
    460                 DataSet ds = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false));
    461                 if (ds != null) {
    462                     ds.getRelations().stream().map(OsmPrimitive::getUniqueId).filter(uid -> uid != id)
    463                             .forEach(addedRelations::add);
    464                 }
    465                 merge(ds);
    466             }
    467             if (addedRelations.isEmpty())
    468                 break;
    469             toDownload = addedRelations;
     457            OsmServerObjectReader reader = new OsmServerObjectReader(id, OsmPrimitiveType.RELATION, true/* full*/);
     458            DataSet ds = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false));
     459            merge(ds);
    470460        }
    471461    }
     
    484474    /**
    485475     * Should downloaded relations be complete?
    486      * @param recurseDownRelations true: yes, recurse down to retrieve the complete relation
     476     * @param recurseDownRelations true: yes, recurse down to retrieve the members of the relation
     477     * This will download sub relations, complete way members and nodes. Members of sub relations are not
     478     * retrieved unless they are also members of the relations. See #18835.
    487479     * @return this
    488480     * @since 15811
Note: See TracChangeset for help on using the changeset viewer.