Here Routes SDK - 如何将 GeoPolygon 添加到 AvoidanceOptions 以便在计算时忽略某些指定区域的路线?

问题描述 投票:0回答:1

我正在使用适用于 Android 的 Here Routes SDK 的浏览器版本。我正在尝试将可自定义的多边形添加到计算路线时必须避开的区域列表中。

我尝试使用 avoidanceOptions.addAvoidArea(),但该方法无法识别,我找不到它的文档。

我在文档中找到了 avoidanceOptions.avoidAreas.add():“https://developer.here.com/documentation/android-sdk-explore/4.13.4.0/api_reference/com/here/sdk/routing/AvoidanceOptions。 html#avoidAreas", 但 avoidAreas 是一个列表。我需要使用 GeoPolygon,因为我不能局限于矩形。

避免多边形的功能是否已被删除,是否有不同的方法来完成此任务?

我最初尝试使用 GeoPolygon 来使用 avoidanceOptions.avoidAreas.add(),但这并没有奏效,因为它需要一个 GeoBox。我期待在计算路线时将多边形添加到区域列表中以避免。我添加最后一段是因为 Stack Overflow 要求我详细说明。我真的不知道还能说什么。这是我的第一个问题。

android polygon here-api area here-android
1个回答
0
投票

AvoidanceOptions
区域的用法示例:

GeoCoordinates southWest = new GeoCoordinates(southWest.latitude, southWest.longitude);
GeoCoordinates northEast = new GeoCoordinates(northEast.latitude, northEast.longitude);

carOptions.avoidanceOptions.avoidAreas.add(new GeoBox(southWest, northEast));

另请参阅此问题

© www.soinside.com 2019 - 2024. All rights reserved.