Merge osm changes
This commit is contained in:
parent
2f66485e4f
commit
41ae394384
4 changed files with 12 additions and 3 deletions
|
@ -305,6 +305,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
|
||||
private void save() {
|
||||
Node original = editPoiData.getEntity();
|
||||
final boolean offlineEdit = mOpenstreetmapUtil instanceof OpenstreetmapLocalUtil;
|
||||
Node node = new Node(original.getLatitude(), original.getLongitude(), original.getId());
|
||||
OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||
for (Map.Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
|
||||
|
@ -319,6 +320,9 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
node.putTag(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue());
|
||||
|
||||
}
|
||||
if(offlineEdit && !Algorithms.isEmpty(tag.getValue())) {
|
||||
node.putTag(tag.getKey(), tag.getValue());
|
||||
}
|
||||
} else if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue())) {
|
||||
node.putTag(tag.getKey(), tag.getValue());
|
||||
}
|
||||
|
@ -330,7 +334,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
@Override
|
||||
public void run() {
|
||||
OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
if (plugin != null && mOpenstreetmapUtil instanceof OpenstreetmapLocalUtil) {
|
||||
if (plugin != null && offlineEdit) {
|
||||
List<OpenstreetmapPoint> points = plugin.getDBPOI().getOpenstreetmapPoints();
|
||||
if (getActivity() instanceof MapActivity && points.size() > 0) {
|
||||
OsmPoint point = points.get(points.size() - 1);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
|||
Node entity = new Node(n.getLocation().getLatitude(),
|
||||
n.getLocation().getLongitude(),
|
||||
nodeId);
|
||||
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue());
|
||||
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getTranslation());
|
||||
if(poiType.getOsmTag2() != null) {
|
||||
entity.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
|||
if (entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50) {
|
||||
PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType());
|
||||
entity.removeTag(poiType.getOsmTag());
|
||||
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getOsmValue());
|
||||
entity.putTag(EditPoiData.POI_TYPE_TAG, poiType.getTranslation());
|
||||
return entity;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -570,6 +570,8 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
sz.endTag("", "create");
|
||||
sz.startTag("", "modify");
|
||||
writeContent(sz, points, OsmPoint.Action.MODIFY);
|
||||
writeContent(sz, points, OsmPoint.Action.REOPEN);
|
||||
|
||||
sz.endTag("", "modify");
|
||||
sz.startTag("", "delete");
|
||||
writeContent(sz, points, OsmPoint.Action.DELETE);
|
||||
|
@ -601,6 +603,9 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
sz.attribute("", "version", "1");
|
||||
for (String tag : p.getEntity().getTagKeySet()) {
|
||||
String val = p.getEntity().getTag(tag);
|
||||
if (val == null || val.length() == 0 || tag.length() == 0 || "poi_type_tag".equals(tag)) {
|
||||
continue;
|
||||
}
|
||||
sz.startTag("", "tag");
|
||||
sz.attribute("", "k", tag);
|
||||
sz.attribute("", "v", val);
|
||||
|
|
Loading…
Reference in a new issue