release 1.0.3

This commit is contained in:
Kuloud
2024-01-03 17:12:29 +08:00
parent 6f49fc9228
commit 68178f96e3
24 changed files with 596 additions and 29 deletions

View File

@ -1,6 +1,7 @@
package com.amap.flutter.map.core;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.location.Location;
import androidx.annotation.NonNull;
@ -126,6 +127,16 @@ public class MapController
amap.removecache();
result.success(null);
break;
case Const.METHOD_MAP_TO_SCREEN_COORDINATE:
LatLng argLatLng = ConvertUtil.toLatLng(call.arguments);
Point resScreenLocation = amap.getProjection().toScreenLocation(argLatLng);
result.success(ConvertUtil.pointToJson(resScreenLocation));
break;
case Const.METHOD_MAP_FROM_SCREEN_COORDINATE:
Point argPoint = ConvertUtil.pointFromMap(call.arguments);
LatLng resLatLng = amap.getProjection().fromScreenLocation(argPoint);
result.success(ConvertUtil.latLngToList(resLatLng));
break;
default:
LogUtil.w(CLASS_NAME, "onMethodCall not find methodId:" + call.method);
break;

View File

@ -1,6 +1,7 @@
package com.amap.flutter.map.utils;
/**
* @author kuloud
* @author whm
* @date 2020/11/10 9:44 PM
* @mail hongming.whm@alibaba-inc.com
@ -18,6 +19,8 @@ public class Const {
public static final String METHOD_MAP_SET_RENDER_FPS = "map#setRenderFps";
public static final String METHOD_MAP_TAKE_SNAPSHOT = "map#takeSnapshot";
public static final String METHOD_MAP_CLEAR_DISK = "map#clearDisk";
public static final String METHOD_MAP_TO_SCREEN_COORDINATE = "map#toScreenCoordinate";
public static final String METHOD_MAP_FROM_SCREEN_COORDINATE = "map#fromScreenCoordinate";
public static final String[] METHOD_ID_LIST_FOR_MAP = {
METHOD_MAP_CONTENT_APPROVAL_NUMBER,
@ -27,7 +30,10 @@ public class Const {
METHOD_MAP_MOVE_CAMERA,
METHOD_MAP_SET_RENDER_FPS,
METHOD_MAP_TAKE_SNAPSHOT,
METHOD_MAP_CLEAR_DISK};
METHOD_MAP_CLEAR_DISK,
METHOD_MAP_TO_SCREEN_COORDINATE,
METHOD_MAP_FROM_SCREEN_COORDINATE
};
/**

View File

@ -143,6 +143,12 @@ public class ConvertUtil {
return new Point(toPixels(data.get(0)), toPixels(data.get(1)));
}
public static Point pointFromMap(Object o) {
Object x = toMap(o).get("x");
Object y = toMap(o).get("y");
return new Point((int) x, (int) y);
}
public static float toFloatPixels(Object o) {
return toFloat(o) * density;
}
@ -497,6 +503,13 @@ public class ConvertUtil {
return (Map<?, ?>) o;
}
public static Map<String, Integer> pointToJson(Point point) {
final Map<String, Integer> data = new HashMap<>(2);
data.put("x", point.x);
data.put("y", point.y);
return data;
}
public static String toString(Object o) {
return (String) o;
}