- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
正如您在这里看到的,每次缩放级别发生变化时,我都会删除和添加注释,但问题是速度太慢并且应用程序卡住了。我搜索了所有 MapBox 文档,但没有找到实现它的更好方法。
isFull 、 isMedium 和 isEmpty 只是我需要的缩放级别的标志。
感谢帮助者:)
内部函数 mapView(mapView: MGLMapView, regionDidChangeAnimated animated: Bool) { 如果 (mapView.zoomLevel > 14) {
isFull = true
isMedium = false
isEmpty = false
if (gotMyHistory)
{
if (mapView.annotations?.count > 0){mapView.removeAnnotations(mapView.annotations!)}
LoadAnnotation()
}
}else if (mapView.zoomLevel <= 14 && mapView.zoomLevel >= 8 && !isMedium )
{
isFull = false
isMedium = true
isEmpty = false
if (gotMyHistory )
{
if (mapView.annotations?.count > 0){mapView.removeAnnotations(mapView.annotations!)}
LoadAnnotation()
}
}else if (mapView.zoomLevel < 8 && !isEmpty)
{
isFull = false
isMedium = false
isEmpty = true
if (gotMyHistory)
{
if (mapView.annotations?.count > 0){mapView.removeAnnotations(mapView.annotations!)}
}
}
最佳答案
我意识到这可能与原始发帖人无关,因为已经过去了很多时间,但希望对其他人有所帮助。我遇到了同样的问题,经过 3 种不同的实现(首先是像您一样使用注释),我发现创建自己的 map 层是最流畅的选择。
// Wait until the style is loaded before modifying the map style
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
//Bicycle Parking Annotations Layer
let bicycleParkingSource = MGLShapeSource(identifier: "bicycleParking", features: [], options: nil)
self.bicycleParkingSource = bicycleParkingSource
style.setImage(UIImage(named: "bicycleParking")!, forName: "bicycleParking") // referenced by an MGLSymbolStyleLayer’s iconImage
let bicycleParkingSymbols = MGLSymbolStyleLayer(identifier: "bicycleParking", source: bicycleParkingSource)
bicycleParkingSymbols.iconImageName = MGLStyleValue(rawValue: "bicycleParking")
bicycleParkingSymbols.minimumZoomLevel = 12.0
style.addSource(bicycleParkingSource)
style.addLayer(bicycleParkingSymbols)
}
我实际上发现 Mapbox 在完成后有一个很好的教程,它有助于改进我的代码。 https://www.mapbox.com/ios-sdk/examples/runtime-multiple-annotations/如您所见,您可以为图层设置最大可见缩放级别。希望这可以帮助!
关于swift - MapBox IOS SDK swift : how to show the user annotations from specific zoomLevel without delete and add again?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39318594/
我正在尝试使用 ArcGIS Runtime for Java 和 View 部分的 FXML 文件开发一个导航 map 系统。我目前面临 zoomButtons 禁用:在一些 zoomlevel例如
我将 WinRT 与 bing map 一起使用,并且我试图在 map 上缩放时(以编程方式)设置图钉的 RenderTransform 值。我试过这个 Solution但 Windows 8 控件似
我怎样才能简单地检测缩放级别的变化?可能吗? 我只需要在缩放级别不够时隐藏我的注释 View 。 regionDidChange:animated: 不适合我使用。还有其他办法吗? 我需要在这里隐藏我
我正在使用单个图钉创建 map 类型的 Google 图表可视化。 根据How to set zoomLevel in google Visualization Map api? ,我应该能够使用 Z
我正在使用 MKMapView 在 iPhone 中创建 map 应用程序. 我确实成功找到了我的 current location和 zoom在这一点上是这样的: - (void)viewDidLo
我用大react-native-maps来自 Airbnb 上的 react-native应用程序。 我在 JSON 文件中得到了一个标记列表,其中每个标记都有一个属性 zoom这是标记应在 map
我正在尝试实现可视化 map API,点击此链接 https://developers.google.com/chart/interactive/docs/gallery/map 我已成功在谷歌地图上
我有一个缩放级别zoom=Z和一个位置latitude=x,longitude=y,但我需要设置区域包含 latitude、longitude、latitudeDelta 和 longitudeDel
如何使用 GooleMaps API 和 Android 获取实际缩放级别中当前可用的纬度/经度值?我的 map 上确实有所有用户的地理位置,但我只想拥有位于我当前“显示”(缩放级别)上的用户,因此我
正如您在这里看到的,每次缩放级别发生变化时,我都会删除和添加注释,但问题是速度太慢并且应用程序卡住了。我搜索了所有 MapBox 文档,但没有找到实现它的更好方法。 isFull 、 isMedium
如果我删除“,zoomLevel:10”部分,那么我可以看到“Hello World”div。如果我将其添加回来,那么mapContainer div将占据整个页面,这样我就看不到“Hello Wor
我正在使用 robotium 来测试一个 android apk 文件。这个 apk 文件实现了 robotium 测试用例。在 mapview 中,一个按钮是内置按钮放大和缩小按钮我想获得某个阶段的
我是一名优秀的程序员,十分优秀!