This commit is contained in:
PavelRatushny 2017-05-26 22:42:17 +03:00 committed by Alexey Kulish
parent 92a11cf1b4
commit 25bee8896e
2 changed files with 8 additions and 11 deletions

View file

@ -222,14 +222,8 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
for (String k : n.getTagKeySet()) { for (String k : n.getTagKeySet()) {
String val = n.getTag(k); String val = n.getTag(k);
boolean valLengthZero = val.length() == 0; if (val.length() == 0 || k.length() == 0 || EditPoiData.POI_TYPE_TAG.equals(k) ||
boolean kLengthZero = k.length() == 0; k.startsWith(EditPoiData.REMOVE_TAG_PREFIX) || k.contains(EditPoiData.REMOVE_TAG_PREFIX))
boolean poiTypeTag = EditPoiData.POI_TYPE_TAG.equals(k);
boolean kStartsWithRemoveTagPrefix = k.startsWith(EditPoiData.REMOVE_TAG_PREFIX);
String removeTagPrefixK = EditPoiData.REMOVE_TAG_PREFIX + k;
// boolean tagWithRemoveTagPrefix = n.getTag(EditPoiData.REMOVE_TAG_PREFIX + k) != null;
boolean tagWithRemoveTagPrefix = k.contains(EditPoiData.REMOVE_TAG_PREFIX);
if (valLengthZero || kLengthZero || poiTypeTag || kStartsWithRemoveTagPrefix || tagWithRemoveTagPrefix)
continue; continue;
ser.startTag(null, "tag"); //$NON-NLS-1$ ser.startTag(null, "tag"); //$NON-NLS-1$
ser.attribute(null, "k", k); //$NON-NLS-1$ ser.attribute(null, "k", k); //$NON-NLS-1$

View file

@ -48,7 +48,6 @@ import net.osmand.plus.osmedit.OsmPoint;
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment; import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
import net.osmand.plus.quickaction.CreateEditActionDialog; import net.osmand.plus.quickaction.CreateEditActionDialog;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionFactory;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@ -540,9 +539,13 @@ public class AddPOIAction extends QuickAction {
} }
private void setTagsIntoParams(Map<String, String> tags) { private void setTagsIntoParams(Map<String, String> tags) {
HashMap<String, String> padrams = getParams(); if (!tags.containsKey(POI_TYPE_TAG)) {
Map<String, String> additionalTags = new HashMap<>(tags);
tags.clear();
tags.put(POI_TYPE_TAG, getTagsFromParams().get(POI_TYPE_TAG));
tags.putAll(additionalTags);
}
getParams().put(KEY_TAG, new Gson().toJson(tags)); getParams().put(KEY_TAG, new Gson().toJson(tags));
padrams = getParams();
} }
private void putTagIntoParams(String tag, String value) { private void putTagIntoParams(String tag, String value) {