didChangeCameraPosition获取可用坐标的边界框/矩形

编程入门 行业动态 更新时间:2024-10-25 08:16:12
本文介绍了didChangeCameraPosition获取可用坐标的边界框/矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何从GMSCameraPosition中检索GMSCoordinateBounds?每当用户移动摄像机时,我都想知道地图上的可见坐标(至少是东北/西南点):

(void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position

解决方案

GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion; GMSCoordinateBounds * bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion]; //我们得到了我们想要的东西,但是这里是NE和SW点 CLLocationCoordinate2D northEast = bounds.northEast; CLLocationCoordinate2D southWest = bounds.southWest;

How can I retrieve the GMSCoordinateBounds from a GMSCameraPosition? I want to know the visible coordinates on the map (at least Northeast/Southwest points) everytime the user moves the camera as in:

(void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position

解决方案

GMSVisibleRegion visibleRegion = mapView.projection.visibleRegion; GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion]; // we've got what we want, but here are NE and SW points CLLocationCoordinate2D northEast = bounds.northEast; CLLocationCoordinate2D southWest = bounds.southWest;

更多推荐

didChangeCameraPosition获取可用坐标的边界框/矩形

本文发布于:2023-10-13 17:19:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1488604.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:矩形   标的   边界   didChangeCameraPosition

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!