BaiduMap_IOSSDK_v6.6.6_Docs 6.6.6

载入中...
搜索中...
未找到
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);
137UIKIT_EXTERN BMKMapPoint BMKGetPointToTheVerticalFootOfLine(BMKMapPoint point, BMKMapPoint lineStartPt, BMKMapPoint lineEndPt);
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
197UIKIT_EXTERN BMKMapRect BMKMapRectUnion(BMKMapRect rect1, BMKMapRect rect2);
198
205UIKIT_EXTERN BMKMapRect BMKMapRectIntersection(BMKMapRect rect1, BMKMapRect rect2);
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
264UIKIT_EXTERN BMKCoordinateRegion BMKCoordinateRegionForMapRect(BMKMapRect rect);
265
271UIKIT_EXTERN BOOL BMKMapRectSpans180thMeridian(BMKMapRect rect);
272
278UIKIT_EXTERN BMKMapRect BMKMapRectRemainder(BMKMapRect rect);
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
400UIKIT_EXTERN BOOL BMKEncodedGeoPointsContainsPoint(BMKMapPoint point,
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
439- (BMKMapPoint)BMKMapPointValue;
440
443- (BMKMapSize)BMKMapSizeValue;
444
447- (BMKMapRect)BMKMapRectValue;
448
451- (CLLocationCoordinate2D)Coordinate2DValue;
452
453@end
BMKAreaBetweenCoordinates
UIKIT_EXTERN double BMKAreaBetweenCoordinates(CLLocationCoordinate2D leftTop, CLLocationCoordinate2D rightBottom)
BMKStringFromMapPoint
UIKIT_STATIC_INLINE NSString * BMKStringFromMapPoint(BMKMapPoint point)
Definition BMKGeometry.h:360
BMKConvertToBaiduMercatorFromBD09LL
UIKIT_EXTERN CGPoint BMKConvertToBaiduMercatorFromBD09LL(CLLocationCoordinate2D bd09llCoordinate)
BMKMapRectGetWidth
UIKIT_STATIC_INLINE double BMKMapRectGetWidth(BMKMapRect rect)
Definition BMKGeometry.h:99
BMKMapRectSpans180thMeridian
UIKIT_EXTERN BOOL BMKMapRectSpans180thMeridian(BMKMapRect rect)
BMKCoordinateRegionMakeWithDistance
UIKIT_EXTERN BMKCoordinateRegion BMKCoordinateRegionMakeWithDistance(CLLocationCoordinate2D centerCoordinate, CLLocationDistance latitudinalMeters, CLLocationDistance longitudinalMeters)
BMKMapRectDivide
UIKIT_EXTERN void BMKMapRectDivide(BMKMapRect rect, BMKMapRect *slice, BMKMapRect *remainder, double amount, CGRectEdge edge)
BMKMetersBetweenCoordinates
UIKIT_EXTERN CLLocationDistance BMKMetersBetweenCoordinates(CLLocationCoordinate2D a, CLLocationCoordinate2D b)
BMKMapPointsPerMeterAtLatitude
UIKIT_EXTERN double BMKMapPointsPerMeterAtLatitude(CLLocationDegrees latitude)
BMKMapRectContainsRect
UIKIT_EXTERN BOOL BMKMapRectContainsRect(BMKMapRect rect1, BMKMapRect rect2)
BMKAreaForPolygon
UIKIT_EXTERN double BMKAreaForPolygon(CLLocationCoordinate2D *coordinates, int count)
BMKCircleContainsPoint
UIKIT_EXTERN BOOL BMKCircleContainsPoint(BMKMapPoint point, BMKMapPoint center, double radius)
BMKPolygonContainsCoordinate
UIKIT_EXTERN BOOL BMKPolygonContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D *polygon, NSUInteger count)
BMKStringFromMapRect
UIKIT_STATIC_INLINE NSString * BMKStringFromMapRect(BMKMapRect rect)
Definition BMKGeometry.h:378
BMKMetersBetweenMapPoints
UIKIT_EXTERN CLLocationDistance BMKMetersBetweenMapPoints(BMKMapPoint a, BMKMapPoint b)
BMKEncodedGeoPointsContainsPoint
UIKIT_EXTERN BOOL BMKEncodedGeoPointsContainsPoint(BMKMapPoint point, NSString *encodedGeoPoints, BMKEncodePointType type)
BMKGetDirectionFromPoints
UIKIT_EXTERN CLLocationDirection BMKGetDirectionFromPoints(BMKMapPoint startPt, BMKMapPoint endPt)
BMKMapRectIsEmpty
UIKIT_STATIC_INLINE BOOL BMKMapRectIsEmpty(BMKMapRect rect)
Definition BMKGeometry.h:185
BMKMapRectInset
UIKIT_EXTERN BMKMapRect BMKMapRectInset(BMKMapRect rect, double dx, double dy)
BMKMapRectContainsPoint
UIKIT_EXTERN BOOL BMKMapRectContainsPoint(BMKMapRect rect, BMKMapPoint point)
BMKCoordinateRegionForMapRect
UIKIT_EXTERN BMKCoordinateRegion BMKCoordinateRegionForMapRect(BMKMapRect rect)
BMKCoordinateForMapPoint
UIKIT_EXTERN CLLocationCoordinate2D BMKCoordinateForMapPoint(BMKMapPoint mapPoint)
BMKGetDirectionFromCoords
UIKIT_EXTERN CLLocationDirection BMKGetDirectionFromCoords(CLLocationCoordinate2D startCoord, CLLocationCoordinate2D endCoord)
BMKMapRectOffset
UIKIT_EXTERN BMKMapRect BMKMapRectOffset(BMKMapRect rect, double dx, double dy)
BMKMapPointForCoordinate
UIKIT_EXTERN BMKMapPoint BMKMapPointForCoordinate(CLLocationCoordinate2D coordinate)
BMKStringFromMapSize
UIKIT_STATIC_INLINE NSString * BMKStringFromMapSize(BMKMapSize size)
Definition BMKGeometry.h:369
BMKPolygonContainsPoint
UIKIT_EXTERN BOOL BMKPolygonContainsPoint(BMKMapPoint point, BMKMapPoint *polygon, NSUInteger count)
BMKMapRectEqualToRect
UIKIT_STATIC_INLINE BOOL BMKMapRectEqualToRect(BMKMapRect rect1, BMKMapRect rect2)
Definition BMKGeometry.h:174
BMKCoordTrans
UIKIT_EXTERN CLLocationCoordinate2D BMKCoordTrans(CLLocationCoordinate2D coordinate, BMK_COORD_TYPE fromType, BMK_COORD_TYPE toType)
BMKConvertBaiduCoorFrom
FOUNDATION_EXTERN NSDictionary * BMKConvertBaiduCoorFrom(CLLocationCoordinate2D coordinate, BMK_COORD_TYPE type) __attribute__((deprecated("使用BMKCoordTrans方法代替")))
BMKMapRectGetHeight
UIKIT_STATIC_INLINE double BMKMapRectGetHeight(BMKMapRect rect)
Definition BMKGeometry.h:108
BMKGetPointToTheVerticalFootOfLine
UIKIT_EXTERN BMKMapPoint BMKGetPointToTheVerticalFootOfLine(BMKMapPoint point, BMKMapPoint lineStartPt, BMKMapPoint lineEndPt)
BMKMapRectFromEncodedGeoPoints
UIKIT_EXTERN BMKMapRect BMKMapRectFromEncodedGeoPoints(NSString *encodedGeoPoints, BMKEncodePointType type)
BMKCoorDictionaryDecode
UIKIT_EXTERN CLLocationCoordinate2D BMKCoorDictionaryDecode(NSDictionary *dictionary)
BMKGetDistanceFromPointToLine
UIKIT_EXTERN CLLocationDistance BMKGetDistanceFromPointToLine(BMKMapPoint point, BMKMapPoint lineStartPt, BMKMapPoint lineEndPt)
BMKMapRectUnion
UIKIT_EXTERN BMKMapRect BMKMapRectUnion(BMKMapRect rect1, BMKMapRect rect2)
BMKMetersPerMapPointAtLatitude
UIKIT_EXTERN CLLocationDistance BMKMetersPerMapPointAtLatitude(CLLocationDegrees latitude)
BMKMapRectRemainder
UIKIT_EXTERN BMKMapRect BMKMapRectRemainder(BMKMapRect rect)
BMKConvertToBD09LLFromBaiduMercator
UIKIT_EXTERN CLLocationCoordinate2D BMKConvertToBD09LLFromBaiduMercator(CGPoint bdMCTCoordinate)
BMKMapRectIntersectsRect
UIKIT_EXTERN BOOL BMKMapRectIntersectsRect(BMKMapRect rect1, BMKMapRect rect2)
BMKMapSizeEqualToSize
UIKIT_STATIC_INLINE BOOL BMKMapSizeEqualToSize(BMKMapSize size1, BMKMapSize size2)
Definition BMKGeometry.h:164
BMKMapPointEqualToPoint
UIKIT_STATIC_INLINE BOOL BMKMapPointEqualToPoint(BMKMapPoint point1, BMKMapPoint point2)
Definition BMKGeometry.h:118
BMKGetNearestMapPointFromPolyline
UIKIT_EXTERN BMKMapPoint BMKGetNearestMapPointFromPolyline(BMKMapPoint point, BMKMapPoint *polyline, NSUInteger count)
BMKCircleContainsCoordinate
UIKIT_EXTERN BOOL BMKCircleContainsCoordinate(CLLocationCoordinate2D point, CLLocationCoordinate2D center, double radius)
BMKEncodedGeoPointsContainsCoordinate
UIKIT_EXTERN BOOL BMKEncodedGeoPointsContainsCoordinate(CLLocationCoordinate2D point, NSString *encodedGeoPoints, BMKEncodePointType type)
BMKMapRectIntersection
UIKIT_EXTERN BMKMapRect BMKMapRectIntersection(BMKMapRect rect1, BMKMapRect rect2)
BMKMapRectIsNull
UIKIT_STATIC_INLINE BOOL BMKMapRectIsNull(BMKMapRect rect)
Definition BMKTypes.h:296
-[NSValue(BMKGeometryExtension) Coordinate2DValue]
CLLocationCoordinate2D Coordinate2DValue()
-[NSValue(BMKGeometryExtension) BMKMapRectValue]
BMKMapRect BMKMapRectValue()
-[NSValue(BMKGeometryExtension) BMKMapSizeValue]
BMKMapSize BMKMapSizeValue()
-[NSValue(BMKGeometryExtension) BMKMapPointValue]
BMKMapPoint BMKMapPointValue()
BMKCoordinateRegion
表示一个经纬度区域
Definition BMKTypes.h:199
BMKMapPoint
地理坐标点，用直角地理坐标表示
Definition BMKTypes.h:222
BMKMapPoint::x
double x
Definition BMKTypes.h:223
BMKMapPoint::y
double y
横坐标
Definition BMKTypes.h:224
BMKMapRect
矩形，用直角地理坐标表示
Definition BMKTypes.h:278
BMKMapRect::size
BMKMapSize size
屏幕左上点对应的直角地理坐标
Definition BMKTypes.h:280
BMKMapRect::origin
BMKMapPoint origin
Definition BMKTypes.h:279
BMKMapSize
矩形大小，用直角地理坐标表示
Definition BMKTypes.h:264
BMKMapSize::width
double width
Definition BMKTypes.h:265
BMKMapSize::height
double height
宽度
Definition BMKTypes.h:266