这是我在地图上的点击监听器:
@Override
public boolean onSingleTap(MotionEvent point) {
Point mapPoint=view.toMapPoint(point.getX(), point.getY());
SpatialReference sp = SpatialReference.create(SpatialReference.WKID_WGS84);
Point p1Done=(Point) GeometryEngine.project(mapPoint, view.getSpatialReference(), sp);
UtilsMapa.addPoint(p1Done, view, "Marker",view.getGraphicLayer());
return super.onSingleTap(point);
}
addPoint 方法:
public static void addPoint(Point point, MapViewExt mView, String textMarker, GraphicsLayer gLayer){
SimpleMarkerSymbol simpleMarker = new SimpleMarkerSymbol(Color.RED, 10, SimpleMarkerSymbol.STYLE.CIRCLE);
TextSymbol bassRockTextSymbol = new TextSymbol(10, textMarker, BLUE, TextSymbol.HorizontalAlignment.LEFT,
TextSymbol.VerticalAlignment.BOTTOM);
//When reaching this line, point has 0=-3.0246720297389555 1=40.83564363734672, which is where I tapped the screen
Graphic graphic=new Graphic(point,simpleMarker);
gLayer.addGraphic(graphic);
}
添加了图形(一个红点),但它是在 0,0 坐标处绘制的……这是为什么呢?我怎样才能把点画在正确的地方?
谢谢你。