我们正在将Android Project转换为Map Android Starter SDK到Lite Edition。我想显示路线上的多个航路点。

对于Starter SDK,我们使用RoutePlan绘制多个航路点。但是在精简版中,我找不到RoutePlan。有关更多信息,请找到以下Android Starter SDK代码段:

    val routePlan = RoutePlan()
    val routeOptions = RouteOptions()
    routeOptions.transportMode = RouteOptions.TransportMode.CAR
    routeOptions.routeType = RouteOptions.Type.FASTEST

    routePlan.routeOptions = routeOptions

   for (routeLatLang in tripRouteData) {
                try {
                    routePlan.addWaypoint(GeoCoordinate(lat.toDouble(), longg.toDouble()))
                } catch (e: Exception) {
                    e.printStackTrace()
                }
    }

    val error = routeManager.calculateRoute(routePlan, routeManagerListener)
    if (error != RouteManager.Error.NONE) {
        Toast.makeText(activity,
                "Route calculation failed with: " + error.toString(), Toast.LENGTH_SHORT)
                .show()
    }


还可以找到以下Lite Edition SDK的代码段:

    val waypoint1 = Waypoint(latitude1,longitude1)
    val waypoint2 = Waypoint(latitude2,longitude2)
    val waypoints = java.util.ArrayList(Arrays.asList(Waypoint(startGeoCoordinates),
            waypoint1, waypoint2, Waypoint(destinationGeoCoordinates)))


因此,如何在Here Map Lite Edition上绘制多个航路点,以及在路线上绘制最大航路点的限制是什么。

最佳答案

这是一个不同的SDK。看一下feature list,您会发现支持方向。因此,您必须查看documentation以确定其工作方式。

最终,您必须执行以下操作:

routingEngine.calculateRoute(
        waypoints,
        new CarOptions(),
        new CalculateRouteCallback() {
            @Override
            public void onRouteCalculated(@Nullable RoutingError routingError, @Nullable List<Route> routes) {
                if (routingError == null) {
                    Route route = routes.get(0);
                    showRouteDetails(route);
                    showRouteOnMap(route);
                } else {
                    showDialog("Error while calculating a route:", routingError.toString());
                }
            }
        });

10-08 14:53