@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 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)); } }
private void clearPolygonPaths(){ for(Polygon polygon: mPolygonsPaths){ polygon.remove(); } mPolygonsPaths.clear(); }
@Override public Polygon addPolygonWithPoints(List<LatLng> points) { PolygonOptions option = new PolygonOptions().points(points).zIndex(999); Polygon polygon = (Polygon) mBaiduMap.addOverlay(option); return polygon; }
@Override public void removePolygon(Polygon polygon) { polygon.remove(); }
@Override public void updatePolygonPoints(Polygon polygon, List<LatLng> points) { polygon.setPoints(points); }