gpt4 book ai didi

cocoa - iOS MapKit - 每米点数

转载 作者:行者123 更新时间:2023-12-03 16:57:57 25 4
gpt4 key购买 nike

我正在 MKOverlayView 子类中画一个圆圈。我的半径以米为单位。我如何将所述米转换为点(在该缩放比例下)以便在drawMapRect:zoomScale:inContext:中绘制?

最佳答案

查看标题:

帮助者:

 // Conversion between distances and projected coordinates
MK_EXTERN CLLocationDistance MKMetersPerMapPointAtLatitude(CLLocationDegrees latitude) NS_AVAILABLE(NA, 4_0);
MK_EXTERN double MKMapPointsPerMeterAtLatitude(CLLocationDegrees latitude) NS_AVAILABLE(NA, 4_0);

MK_EXTERN CLLocationDistance MKMetersBetweenMapPoints(MKMapPoint a, MKMapPoint b) NS_AVAILABLE(NA, 4_0);

以及来自 MKOverlayView

 // Convert screen points relative to this view to absolute MKMapPoints
- (CGPoint)pointForMapPoint:(MKMapPoint)mapPoint;
- (MKMapPoint)mapPointForPoint:(CGPoint)point;

所以

double ppm = MKMapPointsPerMeterAtLatitude(centerCoordinate.latitude);
MKMapPoint mkptLeftmost = ptCenter.x -= ppm;
CGPoint ptLeftmost = [self pointForMapPoint:mkptLeftmost];

关于cocoa - iOS MapKit - 每米点数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15836648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com