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);
}
}
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);
}
}
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()));
}
}
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);
}
}
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);
}
}
Aggregations