use of net.osmand.plus.MapMarkersHelper in project Osmand by osmandapp.
the class MapMarkersLayer method applyNewObjectPosition.
@Override
public void applyNewObjectPosition(@NonNull Object o, @NonNull LatLon position, @Nullable ApplyMovedObjectCallback callback) {
boolean result = false;
MapMarker newObject = null;
if (o instanceof MapMarker) {
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
MapMarker marker = (MapMarker) o;
PointDescription originalDescription = marker.getOriginalPointDescription();
if (originalDescription.isLocation()) {
originalDescription.setName(PointDescription.getSearchAddressStr(map));
}
markersHelper.moveMapMarker(marker, position);
int index = markersHelper.getMapMarkers().indexOf(marker);
if (index != -1) {
newObject = markersHelper.getMapMarkers().get(index);
}
result = true;
}
if (callback != null) {
callback.onApplyMovedObject(result, newObject == null ? o : newObject);
}
}
Aggregations