Ignore:
Timestamp:
2017-10-18T11:37:34+02:00 (7 years ago)
Author:
bastiK
Message:

fixed #15374 - problem deleting multilevel relations

File:
1 edited

Legend:

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

    r12865 r13018  
    213213
    214214        RelationUploadDependencyGraph graph = new RelationUploadDependencyGraph(relationsToAdd, true);
    215         newToAdd.addAll(graph.computeUploadOrder());
     215        newToAdd.addAll(graph.computeUploadOrder(false));
    216216        toAdd = newToAdd;
    217217
    218218        List<OsmPrimitive> newToDelete = new LinkedList<>();
    219219        graph = new RelationUploadDependencyGraph(Utils.filteredCollection(toDelete, Relation.class), false);
    220         newToDelete.addAll(graph.computeUploadOrder());
     220        newToDelete.addAll(graph.computeUploadOrder(true));
    221221        newToDelete.addAll(Utils.filteredCollection(toDelete, Way.class));
    222222        newToDelete.addAll(Utils.filteredCollection(toDelete, Node.class));
     
    305305        }
    306306
    307         public List<Relation> computeUploadOrder() throws CyclicUploadDependencyException {
     307        public List<Relation> computeUploadOrder(boolean reverse) throws CyclicUploadDependencyException {
    308308            visited = new HashSet<>();
    309309            uploadOrder = new LinkedList<>();
     
    313313            }
    314314            List<Relation> ret = new ArrayList<>(relations);
    315             ret.sort(Comparator.comparingInt(uploadOrder::indexOf));
     315            Comparator<? super Relation> cmpr = Comparator.comparingInt(uploadOrder::indexOf);
     316            if (reverse) {
     317                cmpr = cmpr.reversed();
     318            }
     319            ret.sort(cmpr);
    316320            return ret;
    317321        }
Note: See TracChangeset for help on using the changeset viewer.