src/main/java/de/blau/android/osm/StorageDelegator.java
/**
     * Remove downloaded element from any relations it is a member of
     * 
     * Note the element does not need to have its state changed or be stored in the API storage since the parent
     * relation back link is just internal.
     * 
     * @param element to remove from any relations it is a member of
     */
Remove downloaded element from any relations it is a member of

Note the element does not need to have its state changed or be stored in the API storage since the parent
relation back link is just internal.

@param element to remove from any relations it is a member of
Remove downloaded element from any relations it is a member of Note the element does not need to have its state changed or be stored in the API storage since the parent relation back link is just internal . @param element to remove from any relations it is a member of
private void removeElementFromRelations(@NonNull final OsmElement element) {
        try {
            if (element.hasParentRelations()) {
                List<Relation> relations = new ArrayList<>(element.getParentRelations()); 
                List<OsmElement> changedElements = new ArrayList<>();
                for (Relation r : relations) {
                    Log.i(DEBUG_TAG, "removing " + element.getName() + " #" + element.getOsmId() + " from relation #" + r.getOsmId());
                    dirty = true;
                    undo.save(r);
                    r.removeMember(r.getMember(element));
                    r.updateState(OsmElement.STATE_MODIFIED);
                    apiStorage.insertElementSafe(r);
                    changedElements.add(r);
                    undo.save(element);
                    element.removeParentRelation(r);
                    Log.i(DEBUG_TAG, "... done");
                }
                onElementChanged(null, changedElements);
                onParentRelationChanged(element);
            }
        } catch (StorageException e) {
            Log.e(DEBUG_TAG, "removeElementFromRelations got " + e.getMessage());
        }
    }
private void removeElementFromRelations ( @ NonNull final OsmElement element ) { try { if ( element . hasParentRelations ( ) ) { List < Relation > relations = new ArrayList < > ( element . getParentRelations ( ) ) ; List < OsmElement > changedElements = new ArrayList < > ( ) ; for ( Relation r : relations ) { Log . i ( DEBUG_TAG , "removing " + element . getName ( ) + " #" + element . getOsmId ( ) + " from relation #" + r . getOsmId ( ) ) ; dirty = true ; undo . save ( r ) ; r . removeMember ( r . getMember ( element ) ) ; r . updateState ( OsmElement . STATE_MODIFIED ) ; apiStorage . insertElementSafe ( r ) ; changedElements . add ( r ) ; undo . save ( element ) ; element . removeParentRelation ( r ) ; Log . i ( DEBUG_TAG , "... done" ) ; } onElementChanged ( null , changedElements ) ; onParentRelationChanged ( element ) ; } } catch ( StorageException e ) { Log . e ( DEBUG_TAG , "removeElementFromRelations got " + e . getMessage ( ) ) ; } }
Remove downloaded element from any relations it is a member of
Remove downloaded element from any relations it is a member of
// need copy! // TODO handle OOM