Android 百度地图 增加路线点的密集度
来源:互联网 发布:淘宝转链接微信朋友圈 编辑:程序博客网 时间:2024/05/16 12:58
/** * 增加点的密度 */private void makeDenseRoutePoi() { if (null != route && null != route.getAllStep() && route.getAllStep().size() > 0) { routePoiList.clear(); int stepCount = route.getAllStep().size(); List<DrivingStep> stepList = route.getAllStep(); for (int i = 0; i < stepCount; i++) { List<LatLng> points = stepList.get(i).getWayPoints(); int pointCount = points.size(); for (int j = 0; j < pointCount; j++) { LatLng p1 = null, p2 = null; double dis = 0; if (j + 1 < pointCount) { p1 = points.get(j); p2 = points.get(j + 1); dis = DistanceUtil.getDistance(p1, p2); // if(dis>200){ //if (dis > 80) { if(dis>20){ // 中间增加点,增大点密度 double latDif = p2.latitude - p1.latitude; double lngDif = p2.longitude - p1.longitude; // 将过大的距离等分,20m切割一次,得到份数 double count = dis / 20; double latInterval = latDif / count; double lngInterval = lngDif / count; String latIntervalNew = String.format("%.6f", latInterval); String lngIntervalNew = String.format("%.6f", lngInterval); latInterval = Double.parseDouble(latIntervalNew); lngInterval = Double.parseDouble(lngIntervalNew); RoutePlanePointModel routePlan = new RoutePlanePointModel(); routePlan.setBdLatitude(p1.latitude); routePlan.setBdLongitude(p1.longitude); routePoiList.add(routePlan); // int tempCount=(int)count; int tempCount=0; Log.i(TAG,"two poi cut count="+count); //份数,如果是小数,去掉小数点后面部分,如果是整数,减1, if((count+"").contains(".")){ tempCount=(int)count; }else{ //份数为整数,减1 tempCount=(int)count-1; } for (int a = 0; a < tempCount; a++) { double latNew = p1.latitude + latInterval * (a + 1); double lngNew = p1.longitude + lngInterval * (a + 1); RoutePlanePointModel routePlanAdd = new RoutePlanePointModel(); routePlanAdd.setBdLatitude(latNew); routePlanAdd.setBdLongitude(lngNew); routePoiList.add(routePlanAdd); } } else { RoutePlanePointModel routePlanAdd = new RoutePlanePointModel(); LatLng latLng = points.get(j); routePlanAdd.setBdLatitude(latLng.latitude); routePlanAdd.setBdLongitude(latLng.longitude); routePoiList.add(routePlanAdd); } } else { RoutePlanePointModel routePlanAdd = new RoutePlanePointModel(); LatLng latLng = points.get(j); routePlanAdd.setBdLatitude(latLng.latitude); routePlanAdd.setBdLongitude(latLng.longitude); routePoiList.add(routePlanAdd); } } } dumpRouteInfo(); }}
private void dumpRouteInfo() { if(null!=routePoiList){ for (int i = 0; i < routePoiList.size()-1; i++) { RoutePlanePointModel p1= routePoiList.get(i); RoutePlanePointModel p2 = routePoiList.get(i + 1); double p1Lat= p1.getBdLatitude(); double p1Lng=p1.getBdLongitude(); LatLng p1LatLng=new LatLng(p1Lat,p1Lng); double p2Lat=p2.getBdLatitude(); double p2Lng=p2.getBdLongitude(); LatLng p2Latlng=new LatLng(p2Lat,p2Lng); double dis= DistanceUtil.getDistance(p1LatLng,p2Latlng); LogFileUtils.getInstance().witeLogFile("after cut,route poi dis="+dis,3); } }}
0 0
- Android 百度地图 增加路线点的密集度
- android百度地图,路线规划增加没有路的虚线。
- 百度地图路线规划增加没有路的虚线
- 百度地图的路线规划
- android 百度地图获取两个坐标的实际路线距离
- 百度地图开发第三天(起始点和终点的路线查询)
- 百度地图之驾车路线的搜索
- 百度地图路线规划功能的实现
- 百度地图多个途径点规划路线
- Android百度地图和人人网简单的应用(获取路线,分享到人人)
- Android Studio百度地图路线规划以及POI搜索功能的实现
- android 百度地图路线规划去掉节点图标
- Android 开发百度地图之五 路线规划
- Android百度地图(六)自定义导航路线规划
- android 百度地图SDK 获得详细路线信息
- android百度地图之电子栅栏路线规划
- Android百度地图开发定位和路线导航
- 仿百度地图自行车路线搜索和地图选点,覆盖物,途经点阅览,路线总长度计算等
- IDEA myBatis的mapper.xml 提示<expression> expected,got 'where' 或者 unexpected end of file
- 如何用Maven创建web项目(具体步骤)
- android 自定义 view 实现表盘效果
- 一键安装JDK和自动配置Java环境变量
- 字符串处理 (包括NSScanner)
- Android 百度地图 增加路线点的密集度
- 【操作系统】堆与内存管理概述
- 利用Druid实现应用和SQL监控
- Linux中Mysql安装与使用(CentOS-6.5:mysql-5.5.27)
- 在VMware中安装红帽Linux系统
- C语言之结构体struct
- 谈谈Spring中的IOC和AOP概念
- 杭电 1037 Online Judge 字符处理
- HTML5 Canvas 旋转的“金字塔”