package safeluck.drive.evaluation.arcgis
|
|
import android.content.Context
|
import android.graphics.Point
|
import android.view.MotionEvent
|
import android.widget.Toast
|
import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener
|
import com.esri.arcgisruntime.mapping.view.MapView
|
|
/**
|
*
|
* @ProjectName: DriveJudge
|
* @Package: safeluck.drive.evaluation.arcgis
|
* @ClassName: MapSingleTapListener
|
* @Description: java类作用描述
|
* @Author: 李占伟
|
* @CreateDate: 20/7/16 下午5:12
|
* @UpdateUser: 更新者
|
* @UpdateDate: 20/7/16 下午5:12
|
* @UpdateRemark: 更新说明
|
* @Version: 1.0
|
*/
|
|
class MapSingleTapListener(context: Context, mapView: MapView) : DefaultMapViewOnTouchListener(context, mapView) {
|
private var mContext: Context = context
|
val TAG = MapSingleTapListener::class.java.canonicalName
|
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
|
var mapPoint = mMapView.screenToLocation(e?.x?.toInt()?.let { Point(it, e.y.toInt()) })
|
showMessage(String.format("User tapped on the map at (%.3f,%.3f)", mapPoint.getX(), mapPoint.getY()))
|
return true
|
}
|
|
private fun showMessage(message: String) {
|
Toast.makeText(mContext,message,Toast.LENGTH_SHORT).show()
|
}
|
}
|