[英]HERE SDK Color only part of the route
Is there a way to color only a part of the route in a different color? 有没有办法只用不同的颜色给路线的一部分上色? Like drawing a polyline but one that takes the road configuration into consideration.
就像画一条折线一样,但是它考虑了道路配置。
You can extract the route geometry to get the list of GeoCoordinates constituing the polyline: 您可以提取路线几何图形以获取构成折线的GeoCoordinates列表:
geoCoordinates = mapRoute.getRoute().getRouteGeometry()
Then you can draw portions of the route in various colors by building new polylines from these coordinates: 然后,您可以根据这些坐标构建新的折线,以各种颜色绘制路线的各个部分:
GeoPolyline geoPolyline = new GeoPolyline();
for (GeoCoordinates point : geoCoordinates) {
if (<your condition>){
geoPolyline.add(point);
}
}
MapPolyline mapPolyline = new MapPolyline(geoPolyline);
mapPolyline.setLineColor(<color>);
map.addMapObject(mapPolyline)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.