CLLocationCoordinate2D

CLLocationCoordinate2D

本文介绍了MKCoordinateSpan和CLLocationCoordinate2D有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在浏览 MapKit CoreLocation 框架的示例。我发现这两个结构( MKCoordinateSpan CLLocationCoordinate2D )在声明中类似。这些功能有何不同,有人可以请一个例子(使用两者)来清除它们的含义。

I was going through the sample example of MapKit and CoreLocation framework. I found these two structs (MKCoordinateSpan and CLLocationCoordinate2D) which are similar in declaration. How are these different in functionality, can someone please site an example (using both) to clear their meanings.

谢谢!

推荐答案

MKCoordinateSpan 在纬度和经度方向上定义 span ,即delta在地图上显示。然后,您可以定义要在地图上显示的区域。

MKCoordinateSpan defines a span, i.e. a delta, in the latitude and longitude directions to show on a map. Along with a point you can then define a region to display on a map.

CLLocationCoordinate2D 定义单个点纬度和经度坐标系。

CLLocationCoordinate2D defines a single point in the latitude and longitude coordinate system.

例如:

|<---- deltaLat  ---->|
|---------------------|---
|                     | |
|                     | |
|                     | |
|                     | |
|          +          |deltaLon
|      (lat,lon)      | |
|                     | |
|                     | |
|                     | |
|---------------------|---

在这里你可以想象一个中心点(纬度,经度)你有 deltaLat deltaLon

Here you can imagine a centre point (lat,lon) about which you have a deltaLat and a deltaLon.

所以(lat,lon)将是 CLLocationCoordinate2D deltaLat,deltaLon 将形成 MKCoordinateSpan

你是对的,两个结构都以相同的方式定义,但这在两个不同结构具有不同语义的情况下很常见,因此像你找到的那样单独定义。

You're right that both structures are defined in the same way, but this is quite common where the two different structures have different semantics and therefore are defined separately like you've found.

这篇关于MKCoordinateSpan和CLLocationCoordinate2D有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 03:10