Arcgis For Android 实现元素屏幕居中
来源:互联网 发布:nginx 并发连接数设置 编辑:程序博客网 时间:2024/06/05 14:39
最近使用arcgis for android 实现一些功能,如何实现图层中所有元素居中呢?
eg:有两个点A(ax,ay),B(bx,by),实现在图层中居中
以下为实现代码:
import com.esri.core.geometry.Pointpublic void zoomToCenter(){ //lonA,latA为A点的经纬度 //将经纬度转成地图参考的坐标点 Point pntA = (Point)GeometryEngine.project(lonA, latA, mapSr) Point pntB = (Point)GeometryEngine.project(lonB, latB, mapSr) //计算A,B点在屏幕上的像素点 Point screenPntA = mapView.toScreenPoint(pntA); com.esri.core.geometry.Point screenPntB = mapView.toScreenPoint(pntB); //计算缩放比例 double s = Math.max(screenCp.getX() - screenSp.getX(), screenCp.getY() - screenSp.getY()) / (Math.min(mapView.getWidth(), mapView.getHeight())) ; mapView.setScale(mapView.getScale() * s); //计算中心点 com.esri.core.geometry.Point centerP = new Point(Math.abs(Math.sqrt( (pntA.getX() - pntB.getX()) * (pntA.getX() - pntB.getX()) + (pntA.getY() - pntB.getY()) * (pntA.getY() - pntB.getY()) ))); //将中心点位置移动到屏幕中心 mapView.centerAt(centerP, true);}
0 0
- Arcgis For Android 实现元素屏幕居中
- Arcgis For Android实现比例尺
- js实现使元素在屏幕里上下左右居中
- ArcGIS for Android 之callout初级实现
- arcgis for android 离线地图实现
- Arcgis For Android之GPS定位实现
- ArcGIS for Android 之callout初级实现
- 轻松实现元素居中
- csss实现元素居中
- css实现元素居中
- 五花八门实现元素居中
- [arcgis for android]arcgis for android 定位
- 元素居中屏幕的几种方法
- [ArcGIS for Android] arcgis runtime for android 中加载矢量数据的实现
- ArcGIS for Android
- arcgis for android 学习
- ArcGis for Android定位
- ARCGIS for android
- 函数后面加const
- hdu 1026 宽搜+标记路径
- 用netbeans编的简易计算器
- 谈谈session的生命周期
- Linux用户态定时器用法以及犯错总结
- Arcgis For Android 实现元素屏幕居中
- 一些OO练习
- 如何生成DLL工程
- Android Studio中aidl文件生成java文件
- SQL Server学习记录之set nocount on
- 在Eclipse里查看Java字节码
- httpd: Could not reliably determine the server's fully qualified domain name
- MIPS 通用寄存器
- Activity总结