缩放 HERE 地图以显示所有标记 Flutter
Zoom HERE maps to show all markers Flutter
我在 Flutter 应用程序的 HERE 地图上显示了多个位置。总共有4个标记,其中3个标记在一个城市,1个在另一个城市。目前,我的地图缩放到只有一个城市中的 3 个标记可见,而第 4 个标记不可见的级别。为了看到那个标记,我必须缩小相当大的水平。
有什么办法可以让地图范围内的所有标记都显示出来吗?
我得到了 android 的答案,但没有得到 Flutter 的答案。
Zoom HERE maps to show all markers Android
基于此answer on android。我试过 flutter 并且成功了。
GeoBox target = GeoBox.containingGeoCoordinates(geoCoordinateList);
_hereMapController.camera
.lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));
geoCoordinateList
是在 HERE map
上可见的 GeoCoordinates
列表中的 MapMarker
如果你在点击按钮时使用它,那么直接使用它。如果您在将地理坐标添加到 geoCoordinateList 后直接使用它,请将其与 delay
一起使用
Future.delayed(Duration(milliseconds: 10)).then((value) {
GeoBox target = GeoBox.containingGeoCoordinates(geoCooList);
_hereMapController.camera
.lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));
});
我在 Flutter 应用程序的 HERE 地图上显示了多个位置。总共有4个标记,其中3个标记在一个城市,1个在另一个城市。目前,我的地图缩放到只有一个城市中的 3 个标记可见,而第 4 个标记不可见的级别。为了看到那个标记,我必须缩小相当大的水平。
有什么办法可以让地图范围内的所有标记都显示出来吗?
我得到了 android 的答案,但没有得到 Flutter 的答案。
Zoom HERE maps to show all markers Android
基于此answer on android。我试过 flutter 并且成功了。
GeoBox target = GeoBox.containingGeoCoordinates(geoCoordinateList);
_hereMapController.camera
.lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));
geoCoordinateList
是在 HERE map
GeoCoordinates
列表中的 MapMarker
如果你在点击按钮时使用它,那么直接使用它。如果您在将地理坐标添加到 geoCoordinateList 后直接使用它,请将其与 delay
一起使用Future.delayed(Duration(milliseconds: 10)).then((value) {
GeoBox target = GeoBox.containingGeoCoordinates(geoCooList);
_hereMapController.camera
.lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));
});