public static MBound getExtendedBounds(BaiduMap map, MBound bound, Integer gridSize) { // Log.d("getExtendBounds", "size:"+gridSize); MBound tbounds = cutBoundsInRange(bound); System.out.println("getExtendedBounds---" + tbounds.getRightTop() + tbounds.getLeftBottom()); Projection projection = map.getProjection(); Point pixelNE = new Point(); Point pixelSW = new Point(); pixelNE = projection.toScreenLocation(tbounds.getRightTop()); pixelSW = projection.toScreenLocation(tbounds.getLeftBottom()); System.out.println("前pixelNE:" + pixelNE + "pixelSW:" + pixelSW); pixelNE.x += gridSize; pixelNE.y += gridSize; pixelSW.x -= gridSize; pixelSW.y -= gridSize; System.out.println("后pixelNE:" + pixelNE + "pixelSW:" + pixelSW); LatLng rightTop = projection.fromScreenLocation(pixelNE); LatLng leftBottom = projection.fromScreenLocation(pixelSW); System.out.println("getExtendedBounds---" + "rightTop:" + rightTop + "leftBottom:" + leftBottom); return new MBound(rightTop, leftBottom); }
@Override public List<LatLong> projectPathIntoMap(List<LatLong> path) { List<LatLong> coords = new ArrayList<LatLong>(); Projection projection = getBaiduMap().getProjection(); for (LatLong point : path) { LatLng coord = projection.fromScreenLocation(new Point((int) point .getLatitude(), (int) point.getLongitude())); coords.add(MapUtils.baiduLatLngToCoord(coord)); } return coords; }
@Override public List<LatLong> projectPathIntoMap(List<LatLong> path) { List<LatLong> coords = new ArrayList<LatLong>(); Projection projection = getBaiduMap().getProjection(); for (LatLong point : path) { LatLng coord = projection.fromScreenLocation(new Point((int) point .getLatitude(), (int) point.getLongitude())); coords.add(DroneHelper.BaiduLatLngToCoord(coord)); } return coords; }
public void setProjection(Projection projection) { this.mProjection = projection; }