src/main/java/de/blau/android/osm/StorageDelegator.java
/**
     * Reverses a way (reverses the order of its nodes)
     * 
     * @param way to reverse
     * @return a List of Results, if not empty something had to be reversed
     */
Reverses a way (reverses the order of its nodes)

@param way to reverse
@return a List of Results, if not empty something had to be reversed
Reverses a way ( reverses the order of its nodes ) @param way to reverse @return a List of Results if not empty something had to be reversed
@NonNull
    public List<Result> reverseWay(@NonNull final Way way) {
        List<Result> result = new ArrayList<>();
        dirty = true;
        undo.save(way);
        Map<String, String> dirTags = Reverse.getDirectionDependentTags(way);
        if (dirTags != null) {
            Result wayResult = new Result();
            wayResult.setElement(way);
            wayResult.addIssue(ReverseIssue.TAGSREVERSED);
            wayResult.addTags(dirTags);
            result.add(wayResult);
            Reverse.reverseDirectionDependentTags(way, dirTags, false);
        }
        result.addAll(reverseWayNodeTags(way.getNodes()));
        way.reverse();
        List<Relation> dirRelations = Reverse.getRelationsWithDirectionDependentRoles(way);
        if (!dirRelations.isEmpty()) {
            Reverse.reverseRoleDirection(way, dirRelations);
            for (Relation r : dirRelations) {
                Result relationResult = new Result();
                relationResult.setElement(r);
                relationResult.addIssue(ReverseIssue.ROLEREVERSED);
                result.add(relationResult);
                r.updateState(OsmElement.STATE_MODIFIED);
                try {
                    apiStorage.insertElementSafe(r);
                } catch (StorageException e) {
                    Log.e(DEBUG_TAG, "reverseWay got " + e.getMessage());
                }
            }
        }
        way.updateState(OsmElement.STATE_MODIFIED);
        try {
            apiStorage.insertElementSafe(way);
            onElementChanged(null, way);
        } catch (StorageException e) {
            Log.e(DEBUG_TAG, "reverseWay got " + e.getMessage());
        }
        return result;
    }
@ NonNull public List < Result > reverseWay ( @ NonNull final Way way ) { List < Result > result = new ArrayList < > ( ) ; dirty = true ; undo . save ( way ) ; Map < String , String > dirTags = Reverse . getDirectionDependentTags ( way ) ; if ( dirTags != null ) { Result wayResult = new Result ( ) ; wayResult . setElement ( way ) ; wayResult . addIssue ( ReverseIssue . TAGSREVERSED ) ; wayResult . addTags ( dirTags ) ; result . add ( wayResult ) ; Reverse . reverseDirectionDependentTags ( way , dirTags , false ) ; } result . addAll ( reverseWayNodeTags ( way . getNodes ( ) ) ) ; way . reverse ( ) ; List < Relation > dirRelations = Reverse . getRelationsWithDirectionDependentRoles ( way ) ; if ( ! dirRelations . isEmpty ( ) ) { Reverse . reverseRoleDirection ( way , dirRelations ) ; for ( Relation r : dirRelations ) { Result relationResult = new Result ( ) ; relationResult . setElement ( r ) ; relationResult . addIssue ( ReverseIssue . ROLEREVERSED ) ; result . add ( relationResult ) ; r . updateState ( OsmElement . STATE_MODIFIED ) ; try { apiStorage . insertElementSafe ( r ) ; } catch ( StorageException e ) { Log . e ( DEBUG_TAG , "reverseWay got " + e . getMessage ( ) ) ; } } } way . updateState ( OsmElement . STATE_MODIFIED ) ; try { apiStorage . insertElementSafe ( way ) ; onElementChanged ( null , way ) ; } catch ( StorageException e ) { Log . e ( DEBUG_TAG , "reverseWay got " + e . getMessage ( ) ) ; } return result ; }
Reverses a way (reverses the order of its nodes)
Reverses a way ( reverses the order of its nodes )
// check for direction dependent tags // TODO handle OOM // TODO handle OOM