package com.example.mountaintravel.util;

import com.esri.android.map.MapView;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.SpatialReference;


public class ArcgisUtil {
	MapView map;
	
	public ArcgisUtil(MapView map) {
		super();
		this.map=map;
	}

	public Point latAndlonToPoint(double x, double y) {
		Point point = new Point(x, y);
		return point;
	}
	/**
	 * 转为当前地图坐标系
	 */
	public Point latAndlonToMapPoint(double x, double y) {
		Point point = new Point(x, y);
		Point mapPoint = (Point) GeometryEngine.project(point,
				SpatialReference.create(4326), map.getSpatialReference());
		return mapPoint;
	}
	
	
	/**
	 * 当前坐标系转 4326（投影）
	 * 
	 * @param x
	 * @param y
	 * @return
	 */
	public Point latAndlonTo(double x, double y) {
		Point point = new Point(x, y);
		Point mapPoint = (Point) GeometryEngine.project(point,
				map.getSpatialReference(), SpatialReference.create(4326));
		return mapPoint;
	}
}
