src/main/java/de/blau/android/presets/PresetItem.java
/**
     * For taginfo.openstreetmap.org Projects
     * 
     * @param presetName the name of the PresetItem
     * @param key tag key
     * @param value tag value
     * @return JSON representation of a single tag
     */


@param presetName the name of the PresetItem
@param key tag key
@param value tag value
@return JSON representation of a single tag
@param presetName the name of the PresetItem @param key tag key @param value tag value @return JSON representation of a single tag
@NonNull
    private String tagToJSON(@NonNull String presetName, @NonNull String key, @Nullable StringWithDescription value) {
        StringBuilder result = new StringBuilder(
                "{\"description\":\"" + presetName + "\",\"key\": \"" + key + "\"" + (value == null ? "" : ",\"value\": \"" + value.getValue() + "\""));
        result.append(",\"object_types\": [");
        boolean first = true;
        if (appliesToNode) {
            result.append("\"node\"");
            first = false;
        }
        if (appliesToWay) {
            if (!first) {
                result.append(",");
            }
            result.append("\"way\"");
            first = false;
        }
        if (appliesToRelation) {
            if (!first) {
                result.append(",");
            }
            result.append("\"relation\"");
            first = false;
        }
        if (appliesToClosedway || appliesToArea) {
            if (!first) {
                result.append(",");
            }
            result.append("\"area\"");
        }
        return result.append("]}").toString();
    }
@ NonNull private String tagToJSON ( @ NonNull String presetName , @ NonNull String key , @ Nullable StringWithDescription value ) { StringBuilder result = new StringBuilder ( "{\"description\":\"" + presetName + "\",\"key\": \"" + key + "\"" + ( value == null ? "" : ",\"value\": \"" + value . getValue ( ) + "\"" ) ) ; result . append ( ",\"object_types\": [" ) ; boolean first = true ; if ( appliesToNode ) { result . append ( "\"node\"" ) ; first = false ; } if ( appliesToWay ) { if ( ! first ) { result . append ( "," ) ; } result . append ( "\"way\"" ) ; first = false ; } if ( appliesToRelation ) { if ( ! first ) { result . append ( "," ) ; } result . append ( "\"relation\"" ) ; first = false ; } if ( appliesToClosedway || appliesToArea ) { if ( ! first ) { result . append ( "," ) ; } result . append ( "\"area\"" ) ; } return result . append ( "]}" ) . toString ( ) ; }
For taginfo.openstreetmap.org Projects
For taginfo . openstreetmap . org Projects