@Override public void updatePolygonsPaths(List<List<LatLong>> paths) { final BaiduMap map = getBaiduMap(); if (map == null) return; for (Polygon poly : mPolygonsPaths) { poly.remove(); } for (List<LatLong> contour : paths) { PolygonOptions pathOptions = new PolygonOptions(); pathOptions.fillColor(POLYGONS_PATH_DEFAULT_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(contour.size()); for (LatLong coord : contour) { pathPoints.add(MapUtils.coordToBaiduLatLng(coord)); } pathOptions.points(pathPoints); mPolygonsPaths.add((Polygon)map.addOverlay(pathOptions)); } }
@Override public void addCameraFootprint(FootPrint footprintToBeDraw) { final BaiduMap map = getBaiduMap(); if (map == null) return; PolygonOptions pathOptions = new PolygonOptions(); pathOptions.stroke(mFootprintStroke); pathOptions.fillColor(FOOTPRINT_FILL_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(footprintToBeDraw.getVertexInGlobalFrame().size()); for (LatLong coord : footprintToBeDraw.getVertexInGlobalFrame()) { pathPoints.add(MapUtils.coordToBaiduLatLng(coord)); } pathOptions.points(pathPoints); map.addOverlay(pathOptions); }
@Override public void updatePolygonsPaths(List<List<LatLong>> paths) { for (Polygon poly : polygonsPaths) { poly.remove(); } for (List<LatLong> contour : paths) { PolygonOptions pathOptions = new PolygonOptions(); pathOptions.stroke(new Stroke(POLYGONS_PATH_DEFAULT_WIDTH,POLYGONS_PATH_DEFAULT_COLOR)); final List<LatLng> pathPoints = new ArrayList<LatLng>(contour.size()); for (LatLong coord : contour) { pathPoints.add(DroneHelper.CoordToBaiduLatLang(coord)); } pathOptions.points(pathPoints); polygonsPaths.add((Polygon)getBaiduMap().addOverlay(pathOptions)); } }
@Override public void addCameraFootprint(FootPrint footprintToBeDraw) { PolygonOptions pathOptions = new PolygonOptions(); pathOptions.stroke(new Stroke(FOOTPRINT_DEFAULT_WIDTH,FOOTPRINT_DEFAULT_COLOR)); pathOptions.fillColor(FOOTPRINT_FILL_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(); for (LatLong vertex : footprintToBeDraw.getVertexInGlobalFrame()) { pathPoints.add(DroneHelper.CoordToBaiduLatLang(vertex)); } pathOptions.points(pathPoints); getBaiduMap().addOverlay(pathOptions); }
@Override public Polygon addPolygonWithPoints(List<LatLng> points) { PolygonOptions option = new PolygonOptions().points(points).zIndex(999); Polygon polygon = (Polygon) mBaiduMap.addOverlay(option); return polygon; }