在这里SDK颜色仅是路线的一部分 [英] HERE SDK Color only part of the route

查看:47
本文介绍了在这里SDK颜色仅是路线的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以只用不同的颜色给路线的一部分上色? 就像画一条多段线一样,但它要考虑道路配置.

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.

推荐答案

您可以提取路径几何以获取构成折线的GeoCoordinates列表:

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)

这篇关于在这里SDK颜色仅是路线的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆