BaiduMap_IOSSDK_v6.6.2_Docs 6.6.2
载入中...
搜索中...
未找到
BMKGeometry.h
浏览该文件的文档.
1/* BMKGeometry.h
2 * BMapKit
3 *
4 * Copyright 2011 Baidu Inc. All rights reserved.
5 *
6 */
7
8#import <BaiduMapAPI_Base/BMKTypes.h>
9#import <UIKit/UIKit.h>
10
11
12#pragma mark -----坐标转换
18UIKIT_EXTERN BMKMapPoint BMKMapPointForCoordinate(CLLocationCoordinate2D coordinate);
19
25UIKIT_EXTERN CLLocationCoordinate2D BMKCoordinateForMapPoint(BMKMapPoint mapPoint);
26
27
33UIKIT_EXTERN CGPoint BMKConvertToBaiduMercatorFromBD09LL(CLLocationCoordinate2D bd09llCoordinate);
34
40UIKIT_EXTERN CLLocationCoordinate2D BMKConvertToBD09LLFromBaiduMercator(CGPoint bdMCTCoordinate);
41
52UIKIT_EXTERN CLLocationCoordinate2D BMKCoordTrans(CLLocationCoordinate2D coordinate, BMK_COORD_TYPE fromType, BMK_COORD_TYPE toType);
53
60FOUNDATION_EXTERN NSDictionary* BMKConvertBaiduCoorFrom(CLLocationCoordinate2D coordinate,BMK_COORD_TYPE type) __attribute__((deprecated("使用BMKCoordTrans方法代替")));
61
62#pragma mark -----几何计算
68UIKIT_EXTERN CLLocationDistance BMKMetersPerMapPointAtLatitude(CLLocationDegrees latitude);
69
75UIKIT_EXTERN double BMKMapPointsPerMeterAtLatitude(CLLocationDegrees latitude);
76
83UIKIT_EXTERN CLLocationDistance BMKMetersBetweenMapPoints(BMKMapPoint a, BMKMapPoint b);
84
91UIKIT_EXTERN CLLocationDistance BMKMetersBetweenCoordinates(CLLocationCoordinate2D a, CLLocationCoordinate2D b);
92
93
99UIKIT_STATIC_INLINE double BMKMapRectGetWidth(BMKMapRect rect) {
100 return rect.size.width;
101}
102
108UIKIT_STATIC_INLINE double BMKMapRectGetHeight(BMKMapRect rect) {
109 return rect.size.height;
110}
111
118UIKIT_STATIC_INLINE BOOL BMKMapPointEqualToPoint(BMKMapPoint point1, BMKMapPoint point2) {
119 return point1.x == point2.x && point1.y == point2.y;
120}
121
129UIKIT_EXTERN BMKMapPoint BMKGetNearestMapPointFromPolyline(BMKMapPoint point, BMKMapPoint* polyline, NSUInteger count);
145UIKIT_EXTERN CLLocationDistance BMKGetDistanceFromPointToLine(BMKMapPoint point, BMKMapPoint lineStartPt, BMKMapPoint lineEndPt);
146
147
155UIKIT_EXTERN BMKCoordinateRegion BMKCoordinateRegionMakeWithDistance(CLLocationCoordinate2D centerCoordinate, CLLocationDistance latitudinalMeters, CLLocationDistance longitudinalMeters);
156
157#pragma mark rect
164UIKIT_STATIC_INLINE BOOL BMKMapSizeEqualToSize(BMKMapSize size1, BMKMapSize size2) {
165 return size1.width == size2.width && size1.height == size2.height;
166}
167
174UIKIT_STATIC_INLINE BOOL BMKMapRectEqualToRect(BMKMapRect rect1, BMKMapRect rect2) {
175 return
176 BMKMapPointEqualToPoint(rect1.origin, rect2.origin) &&
177 BMKMapSizeEqualToSize(rect1.size, rect2.size);
178}
179
185UIKIT_STATIC_INLINE BOOL BMKMapRectIsEmpty(BMKMapRect rect) {
186 return BMKMapRectIsNull(rect) || (rect.size.width == 0.0 && rect.size.height == 0.0);
187}
188
189
190
198
206
214UIKIT_EXTERN BMKMapRect BMKMapRectInset(BMKMapRect rect, double dx, double dy);
215
223UIKIT_EXTERN BMKMapRect BMKMapRectOffset(BMKMapRect rect, double dx, double dy);
224
233UIKIT_EXTERN void BMKMapRectDivide(BMKMapRect rect, BMKMapRect *slice, BMKMapRect *remainder, double amount, CGRectEdge edge);
234
241UIKIT_EXTERN BOOL BMKMapRectContainsPoint(BMKMapRect rect, BMKMapPoint point);
242
249UIKIT_EXTERN BOOL BMKMapRectContainsRect(BMKMapRect rect1, BMKMapRect rect2);
250
257UIKIT_EXTERN BOOL BMKMapRectIntersectsRect(BMKMapRect rect1, BMKMapRect rect2);
258
265
272
279
280#pragma mark circle
288UIKIT_EXTERN BOOL BMKCircleContainsPoint(BMKMapPoint point, BMKMapPoint center, double radius);
289
297UIKIT_EXTERN BOOL BMKCircleContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D center, double radius);
298
299#pragma mark polygon
307UIKIT_EXTERN BOOL BMKPolygonContainsPoint(BMKMapPoint point, BMKMapPoint *polygon, NSUInteger count);
308
316UIKIT_EXTERN BOOL BMKPolygonContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D *polygon, NSUInteger count);
317
318
319
326UIKIT_EXTERN double BMKAreaBetweenCoordinates(CLLocationCoordinate2D leftTop, CLLocationCoordinate2D rightBottom);
327
328
336UIKIT_EXTERN double BMKAreaForPolygon(CLLocationCoordinate2D *coordinates, int count);
337
338
339#pragma mark -----Others
340
347UIKIT_EXTERN CLLocationDirection BMKGetDirectionFromCoords(CLLocationCoordinate2D startCoord, CLLocationCoordinate2D endCoord);
354UIKIT_EXTERN CLLocationDirection BMKGetDirectionFromPoints(BMKMapPoint startPt, BMKMapPoint endPt);
360UIKIT_STATIC_INLINE NSString *BMKStringFromMapPoint(BMKMapPoint point) {
361 return [NSString stringWithFormat:@"{%.1f, %.1f}", point.x, point.y];
362}
363
369UIKIT_STATIC_INLINE NSString *BMKStringFromMapSize(BMKMapSize size) {
370 return [NSString stringWithFormat:@"{%.1f, %.1f}", size.width, size.height];
371}
372
378UIKIT_STATIC_INLINE NSString *BMKStringFromMapRect(BMKMapRect rect) {
379 return [NSString stringWithFormat:@"{%@, %@}", BMKStringFromMapPoint(rect.origin), BMKStringFromMapSize(rect.size)];
380}
381
387UIKIT_EXTERN CLLocationCoordinate2D BMKCoorDictionaryDecode(NSDictionary* dictionary);
388
393UIKIT_EXTERN BMKMapRect BMKMapRectFromEncodedGeoPoints(NSString *encodedGeoPoints, BMKEncodePointType type);
394
401 NSString *encodedGeoPoints,
402 BMKEncodePointType type);
403
409UIKIT_EXTERN BOOL BMKEncodedGeoPointsContainsCoordinate(CLLocationCoordinate2D point,
410 NSString *encodedGeoPoints,
411 BMKEncodePointType type);
412
414@interface NSValue (BMKGeometryExtension)
415
419+ (NSValue *)valueWithBMKMapPoint:(BMKMapPoint)mapPoint;
420
424+ (NSValue *)valueWithBMKMapSize:(BMKMapSize)mapSize;
425
429+ (NSValue *)valueWithBMKMapRect:(BMKMapRect)mapRect;
430
434+ (NSValue *)valueWithCoordinate2D:(CLLocationCoordinate2D)coordinate;
435
436
440
444
448
451- (CLLocationCoordinate2D)Coordinate2DValue;
452
453@end
UIKIT_EXTERN double BMKAreaBetweenCoordinates(CLLocationCoordinate2D leftTop, CLLocationCoordinate2D rightBottom)
UIKIT_STATIC_INLINE NSString * BMKStringFromMapPoint(BMKMapPoint point)
Definition BMKGeometry.h:360
UIKIT_EXTERN CGPoint BMKConvertToBaiduMercatorFromBD09LL(CLLocationCoordinate2D bd09llCoordinate)
UIKIT_STATIC_INLINE double BMKMapRectGetWidth(BMKMapRect rect)
Definition BMKGeometry.h:99
UIKIT_EXTERN BOOL BMKMapRectSpans180thMeridian(BMKMapRect rect)
UIKIT_EXTERN BMKCoordinateRegion BMKCoordinateRegionMakeWithDistance(CLLocationCoordinate2D centerCoordinate, CLLocationDistance latitudinalMeters, CLLocationDistance longitudinalMeters)
UIKIT_EXTERN void BMKMapRectDivide(BMKMapRect rect, BMKMapRect *slice, BMKMapRect *remainder, double amount, CGRectEdge edge)
UIKIT_EXTERN CLLocationDistance BMKMetersBetweenCoordinates(CLLocationCoordinate2D a, CLLocationCoordinate2D b)
UIKIT_EXTERN double BMKMapPointsPerMeterAtLatitude(CLLocationDegrees latitude)
UIKIT_EXTERN BOOL BMKMapRectContainsRect(BMKMapRect rect1, BMKMapRect rect2)
UIKIT_EXTERN double BMKAreaForPolygon(CLLocationCoordinate2D *coordinates, int count)
UIKIT_EXTERN BOOL BMKCircleContainsPoint(BMKMapPoint point, BMKMapPoint center, double radius)
UIKIT_EXTERN BOOL BMKPolygonContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D *polygon, NSUInteger count)
UIKIT_STATIC_INLINE NSString * BMKStringFromMapRect(BMKMapRect rect)
Definition BMKGeometry.h:378
UIKIT_EXTERN CLLocationDistance BMKMetersBetweenMapPoints(BMKMapPoint a, BMKMapPoint b)
UIKIT_EXTERN BOOL BMKEncodedGeoPointsContainsPoint(BMKMapPoint point, NSString *encodedGeoPoints, BMKEncodePointType type)
UIKIT_EXTERN CLLocationDirection BMKGetDirectionFromPoints(BMKMapPoint startPt, BMKMapPoint endPt)
UIKIT_STATIC_INLINE BOOL BMKMapRectIsEmpty(BMKMapRect rect)
Definition BMKGeometry.h:185
UIKIT_EXTERN BMKMapRect BMKMapRectInset(BMKMapRect rect, double dx, double dy)
UIKIT_EXTERN BOOL BMKMapRectContainsPoint(BMKMapRect rect, BMKMapPoint point)
UIKIT_EXTERN BMKCoordinateRegion BMKCoordinateRegionForMapRect(BMKMapRect rect)
UIKIT_EXTERN CLLocationCoordinate2D BMKCoordinateForMapPoint(BMKMapPoint mapPoint)
UIKIT_EXTERN CLLocationDirection BMKGetDirectionFromCoords(CLLocationCoordinate2D startCoord, CLLocationCoordinate2D endCoord)
UIKIT_EXTERN BMKMapRect BMKMapRectOffset(BMKMapRect rect, double dx, double dy)
UIKIT_EXTERN BMKMapPoint BMKMapPointForCoordinate(CLLocationCoordinate2D coordinate)
UIKIT_STATIC_INLINE NSString * BMKStringFromMapSize(BMKMapSize size)
Definition BMKGeometry.h:369
UIKIT_EXTERN BOOL BMKPolygonContainsPoint(BMKMapPoint point, BMKMapPoint *polygon, NSUInteger count)
UIKIT_STATIC_INLINE BOOL BMKMapRectEqualToRect(BMKMapRect rect1, BMKMapRect rect2)
Definition BMKGeometry.h:174
UIKIT_EXTERN CLLocationCoordinate2D BMKCoordTrans(CLLocationCoordinate2D coordinate, BMK_COORD_TYPE fromType, BMK_COORD_TYPE toType)
FOUNDATION_EXTERN NSDictionary * BMKConvertBaiduCoorFrom(CLLocationCoordinate2D coordinate, BMK_COORD_TYPE type) __attribute__((deprecated("使用BMKCoordTrans方法代替")))
UIKIT_STATIC_INLINE double BMKMapRectGetHeight(BMKMapRect rect)
Definition BMKGeometry.h:108
UIKIT_EXTERN BMKMapPoint BMKGetPointToTheVerticalFootOfLine(BMKMapPoint point, BMKMapPoint lineStartPt, BMKMapPoint lineEndPt)
UIKIT_EXTERN BMKMapRect BMKMapRectFromEncodedGeoPoints(NSString *encodedGeoPoints, BMKEncodePointType type)
UIKIT_EXTERN CLLocationCoordinate2D BMKCoorDictionaryDecode(NSDictionary *dictionary)
UIKIT_EXTERN CLLocationDistance BMKGetDistanceFromPointToLine(BMKMapPoint point, BMKMapPoint lineStartPt, BMKMapPoint lineEndPt)
UIKIT_EXTERN BMKMapRect BMKMapRectUnion(BMKMapRect rect1, BMKMapRect rect2)
UIKIT_EXTERN CLLocationDistance BMKMetersPerMapPointAtLatitude(CLLocationDegrees latitude)
UIKIT_EXTERN BMKMapRect BMKMapRectRemainder(BMKMapRect rect)
UIKIT_EXTERN CLLocationCoordinate2D BMKConvertToBD09LLFromBaiduMercator(CGPoint bdMCTCoordinate)
UIKIT_EXTERN BOOL BMKMapRectIntersectsRect(BMKMapRect rect1, BMKMapRect rect2)
UIKIT_STATIC_INLINE BOOL BMKMapSizeEqualToSize(BMKMapSize size1, BMKMapSize size2)
Definition BMKGeometry.h:164
UIKIT_STATIC_INLINE BOOL BMKMapPointEqualToPoint(BMKMapPoint point1, BMKMapPoint point2)
Definition BMKGeometry.h:118
UIKIT_EXTERN BMKMapPoint BMKGetNearestMapPointFromPolyline(BMKMapPoint point, BMKMapPoint *polyline, NSUInteger count)
UIKIT_EXTERN BOOL BMKCircleContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D center, double radius)
UIKIT_EXTERN BOOL BMKEncodedGeoPointsContainsCoordinate(CLLocationCoordinate2D point, NSString *encodedGeoPoints, BMKEncodePointType type)
UIKIT_EXTERN BMKMapRect BMKMapRectIntersection(BMKMapRect rect1, BMKMapRect rect2)
UIKIT_STATIC_INLINE BOOL BMKMapRectIsNull(BMKMapRect rect)
Definition BMKTypes.h:251
CLLocationCoordinate2D Coordinate2DValue()
表示一个经纬度区域
Definition BMKTypes.h:166
地理坐标点,用直角地理坐标表示
Definition BMKTypes.h:189
double x
Definition BMKTypes.h:190
double y
横坐标
Definition BMKTypes.h:191
矩形,用直角地理坐标表示
Definition BMKTypes.h:233
BMKMapSize size
屏幕左上点对应的直角地理坐标
Definition BMKTypes.h:235
BMKMapPoint origin
Definition BMKTypes.h:234
矩形大小,用直角地理坐标表示
Definition BMKTypes.h:219
double width
Definition BMKTypes.h:220
double height
宽度
Definition BMKTypes.h:221