This commit is contained in:
Vitaliy 2021-03-16 10:04:45 +02:00
parent 80e02521d8
commit 2ab0c034c7
7 changed files with 48 additions and 11 deletions

View file

@ -658,6 +658,8 @@ public class MapPoiTypes {
tp.setOsmValue(parser.getAttributeValue("", "value")); tp.setOsmValue(parser.getAttributeValue("", "value"));
tp.setOsmEditTagValue(parser.getAttributeValue("", "edit_tag"), tp.setOsmEditTagValue(parser.getAttributeValue("", "edit_tag"),
parser.getAttributeValue("", "edit_value")); parser.getAttributeValue("", "edit_value"));
tp.setOsmEditTagValue2(parser.getAttributeValue("", "edit_tag2"),
parser.getAttributeValue("", "edit_value2"));
tp.setOsmTag2(parser.getAttributeValue("", "tag2")); tp.setOsmTag2(parser.getAttributeValue("", "tag2"));
tp.setOsmValue2(parser.getAttributeValue("", "value2")); tp.setOsmValue2(parser.getAttributeValue("", "value2"));

View file

@ -16,9 +16,10 @@ public class PoiType extends AbstractPoiType {
private String editTag; private String editTag;
private String editValue; private String editValue;
private String editTag2;
private String editValue2;
private boolean filterOnly; private boolean filterOnly;
private String nameTag; private String nameTag;
private boolean text; private boolean text;
private boolean nameOnly; private boolean nameOnly;
@ -68,27 +69,46 @@ public class PoiType extends AbstractPoiType {
this.editTag = osmTag; this.editTag = osmTag;
this.editValue = editValue; this.editValue = editValue;
} }
public void setOsmEditTagValue2(String osmTag, String editValue) {
this.editTag2 = osmTag;
this.editValue2 = editValue;
}
public String getEditOsmTag() { public String getEditOsmTag() {
if(isReference()) { if (isReference()) {
return referenceType.getEditOsmTag(); return referenceType.getEditOsmTag();
} }
if(editTag == null) { if (editTag == null) {
return getOsmTag(); return getOsmTag();
} }
return editTag; return editTag;
} }
public String getEditOsmValue() { public String getEditOsmValue() {
if(isReference()) { if (isReference()) {
return referenceType.getEditOsmValue(); return referenceType.getEditOsmValue();
} }
if(editValue == null) { if (editValue == null) {
return getOsmValue(); return getOsmValue();
} }
return editValue; return editValue;
} }
public String getEditOsmTag2() {
if (isReference()) {
return referenceType.getEditOsmTag2();
}
return editTag2;
}
public String getEditOsmValue2() {
if (isReference()) {
return referenceType.getEditOsmValue2();
}
return editValue2;
}
public void setOsmTag(String osmTag) { public void setOsmTag(String osmTag) {
this.osmTag = osmTag; this.osmTag = osmTag;
} }

View file

@ -147,6 +147,9 @@ public class AddPOIAction extends QuickAction {
if (poiType.getOsmTag2() != null) { if (poiType.getOsmTag2() != null) {
newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
} }
if (poiType.getEditOsmTag2() != null) {
newNode.putTagNoLC(poiType.getEditOsmTag2(), poiType.getEditOsmValue2());
}
} else if (!Algorithms.isEmpty(tag.getValue())) { } else if (!Algorithms.isEmpty(tag.getValue())) {
PoiCategory category = editPoiData.getPoiCategory(); PoiCategory category = editPoiData.getPoiCategory();
if (category != null) { if (category != null) {

View file

@ -323,7 +323,9 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
if (poiType.getOsmTag2() != null) { if (poiType.getOsmTag2() != null) {
stringSet.add(poiType.getOsmTag2()); stringSet.add(poiType.getOsmTag2());
} }
if (poiType.getEditOsmTag2() != null) {
stringSet.add(poiType.getEditOsmTag2());
}
} }
if (poiType.getEditOsmValue() != null) { if (poiType.getEditOsmValue() != null) {
values.add(poiType.getEditOsmValue()); values.add(poiType.getEditOsmValue());

View file

@ -237,11 +237,13 @@ public class EditPoiData {
private void removeTypeTagWithPrefix(boolean needRemovePrefix) { private void removeTypeTagWithPrefix(boolean needRemovePrefix) {
if (currentPoiType != null) { if (currentPoiType != null) {
if (needRemovePrefix) { if (needRemovePrefix) {
tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag(), REMOVE_TAG_VALUE);
tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2(), REMOVE_TAG_VALUE); tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2(), REMOVE_TAG_VALUE);
tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag(), REMOVE_TAG_VALUE);
tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag2(), REMOVE_TAG_VALUE);
} else { } else {
tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag());
tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2()); tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2());
tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag());
tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag2());
} }
removeCurrentTypeTag(); removeCurrentTypeTag();
} }
@ -249,9 +251,10 @@ public class EditPoiData {
private void removeCurrentTypeTag() { private void removeCurrentTypeTag() {
if (currentPoiType != null) { if (currentPoiType != null) {
tagValues.remove(currentPoiType.getEditOsmTag());
tagValues.remove(currentPoiType.getOsmTag2()); tagValues.remove(currentPoiType.getOsmTag2());
changedTags.removeAll(Arrays.asList(currentPoiType.getEditOsmTag(), currentPoiType.getOsmTag2())); tagValues.remove(currentPoiType.getEditOsmTag());
tagValues.remove(currentPoiType.getEditOsmTag2());
changedTags.removeAll(Arrays.asList(currentPoiType.getEditOsmTag(),currentPoiType.getEditOsmTag2(), currentPoiType.getOsmTag2()));
} }
} }

View file

@ -515,6 +515,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getOsmTag2()); entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getOsmTag2());
} }
if (poiType.getEditOsmTag2() != null) {
entity.putTagNoLC(poiType.getEditOsmTag2(), poiType.getEditOsmValue2());
entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getEditOsmTag2());
}
} else if (!Algorithms.isEmpty(poiTypeTag)) { } else if (!Algorithms.isEmpty(poiTypeTag)) {
PoiCategory category = editPoiData.getPoiCategory(); PoiCategory category = editPoiData.getPoiCategory();
if (category != null) { if (category != null) {

View file

@ -127,6 +127,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
if (poiType.getOsmTag2() != null) { if (poiType.getOsmTag2() != null) {
entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
} }
if (poiType.getEditOsmTag2() != null) {
entity.putTagNoLC(poiType.getEditOsmTag2(), poiType.getEditOsmValue2());
}
} }
if (!Algorithms.isEmpty(mapObject.getName())) { if (!Algorithms.isEmpty(mapObject.getName())) {
entity.putTagNoLC(OSMTagKey.NAME.getValue(), mapObject.getName()); entity.putTagNoLC(OSMTagKey.NAME.getValue(), mapObject.getName());