Merge pull request #8875 from osmandapp/poi_edit_location_fix_8839

fix edit poi location #8839
This commit is contained in:
vshcherb 2020-05-01 15:44:25 +02:00 committed by GitHub
commit cd4296b27a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -211,6 +211,10 @@ public abstract class MapObject implements Comparable<MapObject> {
location = new LatLon(latitude, longitude); location = new LatLon(latitude, longitude);
} }
public void setLocation(LatLon loc) {
location = loc;
}
@Override @Override
public int compareTo(MapObject o) { public int compareTo(MapObject o) {
return OsmAndCollator.primaryCollator().compare(getName(), o.getName()); return OsmAndCollator.primaryCollator().compare(getName(), o.getName());

View file

@ -467,6 +467,9 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
if (entity != null) { if (entity != null) {
if (!isWay && entity instanceof Node) { if (!isWay && entity instanceof Node) {
// check whether this is node (because id of node could be the same as relation) // check whether this is node (because id of node could be the same as relation)
if (object instanceof NativeLibrary.RenderedObject && object.getLocation() == null) {
object.setLocation(((NativeLibrary.RenderedObject) object).getLabelLatLon());
}
if (MapUtils.getDistance(entity.getLatLon(), object.getLocation()) < 50) { if (MapUtils.getDistance(entity.getLatLon(), object.getLocation()) < 50) {
if (object instanceof Amenity) { if (object instanceof Amenity) {
return replaceEditOsmTags((Amenity) object, entity); return replaceEditOsmTags((Amenity) object, entity);