如何创建混合路线(行人和汽车)?

How to create hybrith route like (Pedestrian and Car)?

我有一条同时包含车辆和行人模式的路线。 HERE 创建这个的时候,我想用虚线或者不同的颜色来显示行人部分,以便用户理解。

我像那样解析了 sectionTransportMode 的路线部分

    _routeCalculator.calculatePedestrianRoute(waypoints, (HERE.RoutingError? routingError, List<HERE.Route>? routeList) async {
      if (routingError == null) {
        HERE.Route _calculatedRoute = routeList!.first;

        _calculatedRoute.sections.forEach((element) {
          print('TransportMode: ' + element.sectionTransportMode.toString());

        });

        _showRouteOnMap(_calculatedRoute);
        _startNavigationOnRoute(isSimulated, _calculatedRoute);
      } else {
        final error = routingError.toString();
        _showDialog('Error', 'Error while calculating a pedestrian route: $error');
      }
    });

但是在这段代码之后我该怎么做呢。

一个 MapPolyline 由三个元素组成:

  1. 两个或多个地理坐标的列表,用于定义在地图上放置多段线的位置。
  2. 包含此坐标列表的 GeoPolyline。
  3. 样式参数,例如 DashPatternLineCap 来定义折线的可视化方式。

https://developer.here.com/documentation/android-sdk-navigate/4.8.3.0/dev_guide/topics/map-items.html#add-map-polylines

调用showRouteOnMap时,您可以创建虚线的MapPolyline,如下例所示。

这是一个例子:

private void showRouteOnMap(Route route) {
        // Show route as polyline.
        GeoPolyline routeGeoPolyline;
        try {
            routeGeoPolyline = new GeoPolyline(route.getPolyline());
        } catch (InstantiationErrorException e) {
            // It should never happen that a route polyline contains less than two vertices.
            return;
        }

        float widthInPixels = 20;

        //Blue Color
        //Color lineColor = Color.valueOf(0, 0f, 0f, 139f);

        MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline,
                widthInPixels,
                Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA
        //Setting polyline to DashPattern
        routeMapPolyline.setDashPattern(new DashPattern(10));
       // routeMapPolyline.setDashFillColor(lineColor);

        mapView.getMapScene().addMapPolyline(routeMapPolyline);
        mapPolylines.add(routeMapPolyline);

        // Draw a circle to indicate starting point and destination.
        addCircleMapMarker(startGeoCoordinates, R.drawable.green_dot);
        addCircleMapMarker(destinationGeoCoordinates, R.drawable.green_dot);

        // Log maneuver instructions per route section.
        List<Section> sections = route.getSections();
        for (Section section : sections) {
            logManeuverInstructions(section);
        }
    }

请参考git中的这个例子: https://github.com/heremaps/here-sdk-examples/tree/master/examples/latest/navigate/flutter/routing_hybrid_app