问题
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.
回答1:
No, that is not supported. But if you are wondering about changing only the traveled portion color I previously answered here.
回答2:
You can extract the route geometry to get the list of GeoCoordinates constituing the polyline:
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)
来源:https://stackoverflow.com/questions/44621476/here-sdk-color-only-part-of-the-route