HERE SDK Color only part of the route

对着背影说爱祢 提交于 2019-12-10 11:29:16

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!