Search in sources :

Example 11 with Point

use of com.yandex.mapkit.geometry.Point in project react-native-yamap by volga-volga.

the class YamapCircleManager method setCenter.

// props
@ReactProp(name = "center")
public void setCenter(YamapCircle view, ReadableMap center) {
    if (center != null) {
        double lon = center.getDouble("lon");
        double lat = center.getDouble("lat");
        Point point = new Point(lat, lon);
        view.setCenter(point);
    }
}
Also used : Point(com.yandex.mapkit.geometry.Point) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Example 12 with Point

use of com.yandex.mapkit.geometry.Point in project react-native-yamap by volga-volga.

the class YamapMarkerManager method setPoint.

// props
@ReactProp(name = "point")
public void setPoint(View view, ReadableMap markerPoint) {
    if (markerPoint != null) {
        double lon = markerPoint.getDouble("lon");
        double lat = markerPoint.getDouble("lat");
        Point point = new Point(lat, lon);
        castToMarkerView(view).setPoint(point);
    }
}
Also used : Point(com.yandex.mapkit.geometry.Point) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Example 13 with Point

use of com.yandex.mapkit.geometry.Point in project react-native-yamap by volga-volga.

the class YamapMarkerManager method receiveCommand.

@Override
public void receiveCommand(@NonNull YamapMarker view, String commandType, @Nullable ReadableArray args) {
    switch(commandType) {
        case "animatedMoveTo":
            ReadableMap markerPoint = args.getMap(0);
            int moveDuration = args.getInt(1);
            float lon = (float) markerPoint.getDouble("lon");
            float lat = (float) markerPoint.getDouble("lat");
            Point point = new Point(lat, lon);
            castToMarkerView(view).animatedMoveTo(point, moveDuration);
            return;
        case "animatedRotateTo":
            int angle = args.getInt(0);
            int rotateDuration = args.getInt(1);
            castToMarkerView(view).animatedRotateTo(angle, rotateDuration);
            return;
        default:
            throw new IllegalArgumentException(String.format("Unsupported command %d received by %s.", commandType, getClass().getSimpleName()));
    }
}
Also used : ReadableMap(com.facebook.react.bridge.ReadableMap) Point(com.yandex.mapkit.geometry.Point) Point(com.yandex.mapkit.geometry.Point)

Example 14 with Point

use of com.yandex.mapkit.geometry.Point in project react-native-yamap by volga-volga.

the class YamapPolylineManager method setPoints.

// props
@ReactProp(name = "points")
public void setPoints(View view, ReadableArray points) {
    if (points != null) {
        ArrayList<Point> parsed = new ArrayList<>();
        for (int i = 0; i < points.size(); ++i) {
            ReadableMap markerMap = points.getMap(i);
            if (markerMap != null) {
                double lon = markerMap.getDouble("lon");
                double lat = markerMap.getDouble("lat");
                Point point = new Point(lat, lon);
                parsed.add(point);
            }
        }
        castToPolylineView(view).setPolygonPoints(parsed);
    }
}
Also used : ArrayList(java.util.ArrayList) ReadableMap(com.facebook.react.bridge.ReadableMap) Point(com.yandex.mapkit.geometry.Point) Point(com.yandex.mapkit.geometry.Point) ReactProp(com.facebook.react.uimanager.annotations.ReactProp)

Example 15 with Point

use of com.yandex.mapkit.geometry.Point in project react-native-yamap by volga-volga.

the class YamapViewManager method findRoutes.

private void findRoutes(View view, ReadableArray jsPoints, ReadableArray jsVehicles, String id) {
    if (jsPoints != null) {
        ArrayList<Point> points = new ArrayList<>();
        for (int i = 0; i < jsPoints.size(); ++i) {
            ReadableMap point = jsPoints.getMap(i);
            if (point != null) {
                points.add(new Point(point.getDouble("lat"), point.getDouble("lon")));
            }
        }
        ArrayList<String> vehicles = new ArrayList<>();
        if (jsVehicles != null) {
            for (int i = 0; i < jsVehicles.size(); ++i) {
                vehicles.add(jsVehicles.getString(i));
            }
        }
        castToYaMapView(view).findRoutes(points, vehicles, id);
    }
}
Also used : ArrayList(java.util.ArrayList) ReadableMap(com.facebook.react.bridge.ReadableMap) Point(com.yandex.mapkit.geometry.Point) Point(com.yandex.mapkit.geometry.Point)

Aggregations

Point (com.yandex.mapkit.geometry.Point)15 ArrayList (java.util.ArrayList)8 ReadableMap (com.facebook.react.bridge.ReadableMap)5 ReactProp (com.facebook.react.uimanager.annotations.ReactProp)5 RequestPoint (com.yandex.mapkit.RequestPoint)5 WritableMap (com.facebook.react.bridge.WritableMap)4 WritableArray (com.facebook.react.bridge.WritableArray)3 WritableNativeArray (com.facebook.react.bridge.WritableNativeArray)2 Polyline (com.yandex.mapkit.geometry.Polyline)2 CameraPosition (com.yandex.mapkit.map.CameraPosition)2 PlacemarkMapObject (com.yandex.mapkit.map.PlacemarkMapObject)2 HashMap (java.util.HashMap)2 ValueAnimator (android.animation.ValueAnimator)1 LinearInterpolator (android.view.animation.LinearInterpolator)1 NonNull (androidx.annotation.NonNull)1 ReadableArray (com.facebook.react.bridge.ReadableArray)1 Animation (com.yandex.mapkit.Animation)1 DrivingOptions (com.yandex.mapkit.directions.driving.DrivingOptions)1 DrivingRoute (com.yandex.mapkit.directions.driving.DrivingRoute)1 DrivingSection (com.yandex.mapkit.directions.driving.DrivingSection)1