Search in sources :

Example 1 with AvoidSpecificRoadsCallback

use of net.osmand.plus.helpers.AvoidSpecificRoads.AvoidSpecificRoadsCallback in project Osmand by osmandapp.

the class ImpassableRoadsLayer method applyNewObjectPosition.

@Override
public void applyNewObjectPosition(@NonNull Object o, @NonNull LatLon position, @Nullable final ApplyMovedObjectCallback callback) {
    if (o instanceof RouteDataObject) {
        final RouteDataObject object = (RouteDataObject) o;
        final OsmandApplication application = activity.getMyApplication();
        application.getAvoidSpecificRoads().replaceImpassableRoad(activity, object, position, false, new AvoidSpecificRoadsCallback() {

            @Override
            public void onAddImpassableRoad(boolean success, RouteDataObject newObject) {
                if (callback != null) {
                    callback.onApplyMovedObject(success, newObject);
                }
            }

            @Override
            public boolean isCancelled() {
                return callback != null && callback.isCancelled();
            }
        });
    }
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) AvoidSpecificRoadsCallback(net.osmand.plus.helpers.AvoidSpecificRoads.AvoidSpecificRoadsCallback) RouteDataObject(net.osmand.binary.RouteDataObject)

Aggregations

RouteDataObject (net.osmand.binary.RouteDataObject)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 AvoidSpecificRoadsCallback (net.osmand.plus.helpers.AvoidSpecificRoads.AvoidSpecificRoadsCallback)1