立得地图iOS SDK 地图&搜索服务参考手册 V1.7.0
LMKMapView.h
浏览该文件的文档.
1 //
2 // LMKMapView.h
3 // LeadorMapSDK
4 //
5 // Copyright © 2016年 IShowChina. All rights reserved.
6 //
7 
8 #import "LMKAnnotation.h"
9 #import "LMKAnnotationView.h"
10 #import "LMKGeometry.h"
11 #import "LMKOverlayView.h"
12 #import "LMKUserLocation.h"
13 #import "LMKGeoJSONLayerOptions.h"
14 #import <CoreLocation/CoreLocation.h>
15 #import <UIKit/UIKit.h>
16 
17 @class LMKCustomDrawOverlay;
18 
22 typedef NS_ENUM(NSUInteger, LMKMapType) {
23  LMKMapTypeStandardDay,
24  LMKMapTypeStandardNight,
25  LMKMapTypeNaviDay,
26  LMKMapTypeNaviNight,
27  LMKMapTypeEagleEye,
28  LMKMapTypeSatellite,
29 };
30 
31 @protocol LMKMapViewDelegate;
32 
36 @interface LMKMapView : UIView
37 
46 - (instancetype)initWithFrame:(CGRect)frame
47  projectionType:(LMKMapProjectionType)type
48  hiddenVectorMap:(BOOL)hiddenVectorMap;
49 
53 @property (nonatomic, weak) id<LMKMapViewDelegate> delegate;
54 
58 @property (nonatomic) LMKMapType mapType;
59 
63 @property (nonatomic) CGFloat rotation;
64 
68 @property (nonatomic) CGFloat overlooking;
69 
74 @property (nonatomic) CGFloat maxZoomInLevel;
75 
79 @property (nonatomic) CGFloat zoomLevel;
80 
84 @property (nonatomic) CLLocationCoordinate2D centerCoordinate;
85 
91 - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate animated:(BOOL)animated;
92 
96 @property (nonatomic, assign) BOOL showsCompass;
97 
103 - (void)setCompassScreenPoint:(CGPoint)screenPoint animated:(BOOL)animated;
107 @property (nonatomic) BOOL showsLogo;
111 @property (nonatomic) BOOL showsBlueRoadNet;
115 @property (nonatomic) BOOL showsUserLocation;
116 
121 @property (nonatomic) BOOL touchPOIEnabled;
125 @property (nonatomic, readonly) LMKUserLocation* userLocation;
126 
130 @property (nonatomic) CGPoint logoCenter;
131 
135 @property (nonatomic, readonly) CGPoint screenAnchor;
136 
140 @property (nonatomic, readonly) CGSize logoSize;
141 
145 @property (nonatomic) BOOL showsScale;
146 
150 @property (nonatomic, getter=isShowTraffic) BOOL showTraffic;
151 
155 @property (nonatomic) CGPoint scaleRightBottomOrigin;
156 
160 @property (nonatomic) LMKMapRect visibleMapRect;
161 
167 - (void)setVisibleMapRect:(LMKMapRect)visibleMapRect animated:(BOOL)animated;
168 
175 - (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView*)view;
176 
183 - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView*)view;
184 
190 - (instancetype)initWithFrame:(CGRect)frame;
191 
195 - (void)setScrollEnabled:(BOOL)enabled;
196 
200 - (void)setZoomEnabled:(BOOL)enabled;
201 
205 - (void)setRotateEnabled:(BOOL)enabled;
206 
210 - (void)setCameraEnabled:(BOOL)enabled;
211 
217 - (void)setStyleFileName:(NSString *)styleFileName andIconsFileName:(NSString *)iconsFileName;
218 
222 - (BOOL)getverifyResult;
223 
224 @end
225 #pragma mark - LMKMapView (GeoJSONLayer)
226 
228 
233 - (void)setGeojsonOptions:(LMKGeoJSONLayerOptions *)options;
237 - (void)destroyGeojsonOverlay;
238 
239 @end
240 
241 #pragma mark - LMKMapView (Tools)
242 
246 
255 - (void)geo2lonlat_withPixel20X:(int)pixel20X pixel20Y:(int)pixel20Y
256  lon:(double *)outLon lat:(double *)outLat;
257 
266 - (void)lonlat2geo_withLon:(double)lon lat:(double)lat
267  geoX:(int *)outPixel20X geoY:(int *)outPixel20Y;
268 
277 - (void)geo2map_withPixel20X:(int)pixel20X pixel20Y:(int)pixel20Y
278  mapX:(float *)outMapX mapY:(float *)outMapY;
279 
288 - (void)map2geo_withMapX:(float)mapX mapY:(float)mapY
289  geoX:(int *)outPixel20X geoY:(int *)outPixel20Y;
290 
299 - (void)win2map_withWinX:(double)winX winY:(double)winY
300  mapX:(float *)outMapX mapY:(float *)outMapY;
301 
310 - (void)map2win_withMapX:(float)mapX mapY:(float)mapY
311  winX:(double *)outWinX winY:(double *)outWinY;
312 
321 - (float)getMapLenWithWinLen:(int)winPixelLen byY:(int)winY;
322 
330 - (float)getMapLenWithWinLen:(int)winPixelLen;
331 
339 - (float)getMapLenWithGeoLen:(int)geoPixelLen;
340 
348 - (float)getGeoLenWithWinLen:(int)winPixelLen;
349 
357 - (void)setMapcenterByGeoPointX:(int)x Y:(int)y;
358 
366 - (void)getMapcenterWithGeoPointX:(int)x Y:(int)y;
367 
372 - (float)getMapZoomer;
379 - (CGFloat)calculatePointA:(CLLocationCoordinate2D)pointA andPointB:(CLLocationCoordinate2D)pointB;
380 
388 - (CGFloat)calculatePointA:(CLLocationCoordinate2D)pointA andPointB:(CLLocationCoordinate2D)pointB andPointC:(CLLocationCoordinate2D)pointC andPointD:(CLLocationCoordinate2D)pointD;
389 
390 @end
391 
392 
393 #pragma mark - LMKMapView (Snapshot)
394 
398 
404 - (UIImage *)takeSnapshotInRect:(CGRect)rect;
405 
406 @end
407 
408 #pragma mark - LMKMapView (Annotation)
409 
414 
420 - (void)showAnnotations:(NSArray*)annotations animated:(BOOL)animated;
421 
426 - (void)addAnnotation:(id<LMKAnnotation>)annotation;
427 
432 - (void)addAnnotations:(NSArray*)annotations;
433 
438 - (void)removeAnnotation:(id<LMKAnnotation>)annotation;
439 
444 - (void)removeAnnotations:(NSArray*)annotations;
445 
449 @property (nonatomic, readonly) NSArray* annotations;
450 
451 #pragma mark - Annotation system delegate
452 
457 - (void)didSelectAnnotationView:(LMKAnnotationView*)view;
458 
463 - (void)didDeselectAnnotationView:(LMKAnnotationView*)view;
464 
471 - (void)annotationView:(LMKAnnotationView*)view
472  didChangeDragState:(LMKAnnotationViewDragState)newState
473  fromOldState:(LMKAnnotationViewDragState)oldState;
474 
480 - (void)annotationView:(LMKAnnotationView*)annotationView calloutAccessoryControlTapped:(UIControl*)control;
481 
486 - (void)didAnnotationViewCalloutTapped:(LMKAnnotationView*)annotationView;
487 
493 - (LMKAnnotationView*)dequeueReusableAnnotationViewWithIdentifier:(NSString*)identifier;
494 @end
495 
499 typedef NS_ENUM(NSInteger, LMKOverlayLevel) {
500  LMKOverlayLevelAboveRoads = 0, // 在地图底图标注和兴趣点图标之下绘制overlay
501  LMKOverlayLevelAboveLabels // 在地图底图标注和兴趣点图标之上绘制overlay
502 };
503 
508 
512 @property (nonatomic, readonly) NSArray* overlays;
513 
518 - (void)addOverlay:(id<LMKOverlay>)overlay;
519 
526 - (void)addOverlays:(NSArray*)overlays;
527 
532 - (void)removeOverlay:(id<LMKOverlay>)overlay;
533 
538 - (void)removeOverlays:(NSArray*)overlays;
539 
545 - (void)insertOverlay:(id<LMKOverlay>)overlay aboveOverlay:(id<LMKOverlay>)sibling;
546 
552 - (void)insertOverlay:(id<LMKOverlay>)overlay belowOverlay:(id<LMKOverlay>)sibling;
553 
559 - (void)insertOverlay:(id<LMKOverlay>)overlay atIndex:(NSUInteger)index;
560 
566 - (void)exchangeOverlayAtIndex:(NSUInteger)index1 withOverlayAtIndex:(NSUInteger)index2;
567 
568 @end
569 
574 
579 - (void)addCustomDrawOverlay:(LMKCustomDrawOverlay *)customOverlay;
580 
585 - (void)addCustomDrawOverlays:(NSArray *)customOverlays;
586 
591 - (void)removeCustomDrawOverlay:(LMKCustomDrawOverlay *)customOverlay;
592 
596 - (void)removeAllCustomDrawOverlays;
597 
598 @end
599 
600 
601 #pragma mark - LMKMapViewDelegate
602 
606 @protocol LMKMapViewDelegate <NSObject>
607 @optional
608 
613 - (void)mapViewRenderOver:(LMKMapView *)mapView;
614 
619 - (void)mapViewWillMove:(LMKMapView *)mapView;
620 
625 - (void)mapViewZoomOrMoveFinish:(LMKMapView *)mapView;
626 
633 - (LMKAnnotationView*)mapView:(LMKMapView*)mapView viewForAnnotation:(id<LMKAnnotation>)annotation;
634 
640 - (void)mapView:(LMKMapView*)mapView didAddAnnotationViews:(NSArray*)views;
641 
647 - (void)mapView:(LMKMapView*)mapView didSelectAnnotationView:(LMKAnnotationView*)view;
648 
654 - (void)mapView:(LMKMapView*)mapView didDeselectAnnotationView:(LMKAnnotationView*)view;
655 
662 - (void)mapView:(LMKMapView*)mapView annotationView:(LMKAnnotationView*)view calloutAccessoryControlTapped:(UIControl*)control;
663 
669 - (void)mapView:(LMKMapView*)mapView didAnnotationViewCalloutTapped:(LMKAnnotationView*)view;
670 
678 - (void)mapView:(LMKMapView*)mapView annotationView:(LMKAnnotationView*)view didChangeDragState:(LMKAnnotationViewDragState)newState fromOldState:(LMKAnnotationViewDragState)oldState;
679 
686 - (LMKOverlayView*)mapView:(LMKMapView*)mapView viewForOverlay:(id<LMKOverlay>)overlay;
687 
693 - (void)mapView:(LMKMapView*)mapView didAddOverlayViews:(NSArray*)views;
694 
700 - (void)mapView:(LMKMapView*)mapView didSingleTappedAtCoordinate:(CLLocationCoordinate2D)coordinate;
701 
707 - (void)mapView:(LMKMapView*)mapView didLongPressedAtCoordinate:(CLLocationCoordinate2D)coordinate;
708 
715 - (void)mapView:(LMKMapView*)mapView didUpdateUserLocation:(LMKUserLocation*)userLocation updatingLocation:(BOOL)updatingLocation;
716 
722 - (void)mapView:(LMKMapView *)mapView didTouchPois:(NSArray *)pois;
723 
733 - (NSString *)mapView:(LMKMapView *)mapView requireTileURLWithTileX:(int)tileX tileY:(int)tileY tileZ:(int)tileZ projection:(LMKMapProjectionType)proj;
734 
745 - (NSString *)mapView:(LMKMapView *)mapView getGeoJsonServerUrlWithMinLat:(double)minLat minLon:(double)minLon maxLat:(double)maxLat maxLon:(double)maxLon meshID:(long long)meshID;
746 @end
747 
748 
749 
定位信息类
Definition: LMKUserLocation.h:15
地图View关于标注的类别
Definition: LMKMapView.h:413
该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
Definition: LMKOverlay.h:14
地图view
Definition: LMKMapView.h:36
BOOL showsUserLocation
是否显示用户位置
Definition: LMKMapView.h:115
CGFloat overlooking
地图俯视角度,俯视角度 0 - 45度,0度为:视角从正上方,向下看
Definition: LMKMapView.h:68
CGFloat maxZoomInLevel
设置地图可放大的最大级别,取值区间为[19,22],默认为19
Definition: LMKMapView.h:74
LMKMapType mapType
地图类型,支持普通地图和夜间地图
Definition: LMKMapView.h:58
Definition: LMKMapView.h:227
BOOL getverifyResult()
返回专业版权限检验结果,使用专业版功能前请将鉴权文件product.sn和deviceid.dat放入LDMap.bundle主目录下。若要申请使用专业版功能,请访问http://dev.ishowchina.com/ios/map/index.html了解详细信息。
CGPoint scaleRightBottomOrigin
比例尺右下角原点位置,设置的值如果比例尺显示超出bounds范围则不生效
Definition: LMKMapView.h:155
BOOL showsScale
是否显示比例尺
Definition: LMKMapView.h:145
地图view的delegate
Definition: LMKMapView.h:606
BOOL showsBlueRoadNet
是否显示蓝色路网,蓝色路网:用于表示地图中存在实景数据的路段。
Definition: LMKMapView.h:111
typedef NS_ENUM(NSUInteger, LMKMapType)
地图类型,支持标准地图和导航地图
Definition: LMKMapView.h:22
地图view关于overlay类别
Definition: LMKMapView.h:507
标注view
Definition: LMKAnnotationView.h:27
CGPoint logoCenter
logo位置, 必须在mapView.bounds之内,否则会被忽略
Definition: LMKMapView.h:130
CGFloat zoomLevel
地图比例尺级别,可使用的地图比例尺级别的取值区间在3到maxZoomInLevel之间。
Definition: LMKMapView.h:79
CGPoint screenAnchor
地图的视图锚点。坐标系归一化,(0, 0)为LMKMapView左上角,(1, 1)为右下角。默认为(0.5, 0.5),即当前地图的视图中心。
Definition: LMKMapView.h:135
CGSize logoSize
logo的宽高
Definition: LMKMapView.h:140
id< LMKMapViewDelegate > delegate
LMKMapViewDelegate 代理
Definition: LMKMapView.h:53
该类为标注点的protocol,提供了标注类的基本信息函数
Definition: LMKAnnotation.h:15
CGFloat rotation
地图旋转角度,当前可使用的范围为-180~180度,大于 0度 时为逆时针旋转
Definition: LMKMapView.h:63
地图view关于截图的类别
Definition: LMKMapView.h:397
地图view关于自定义OpenGL绘制 overlay类别
Definition: LMKMapView.h:573
该类是地图覆盖物View的基类, 提供绘制overlay的接口但并无实际的实现
Definition: LMKOverlayView.h:19
BOOL touchPOIEnabled
是否支持单击地图获取POI信息,默认为YES。 对应的回调是 - (void)mapView:(LMKMapView *)mapView didTouchP...
Definition: LMKMapView.h:121
BOOL showsLogo
是否在地图左下角显示logo
Definition: LMKMapView.h:107
geoJson线覆盖物的样式
Definition: LMKGeoJSONLayerOptions.h:27
用户自定义OpenGL绘制类
Definition: LMKCustomDrawOverlay.h:15
BOOL showsCompass
显示指南针标志位,为YES时显示,默认是YES
Definition: LMKMapView.h:96
LMKMapRect visibleMapRect
当前地图的平面投影(20级像素坐标)可视范围
Definition: LMKMapView.h:160
BOOL showTraffic
是否显示交通
Definition: LMKMapView.h:150
CLLocationCoordinate2D centerCoordinate
当前地图的中心点,改变该值时,地图的比例尺级别不会发生变化
Definition: LMKMapView.h:84
LMKUserLocation * userLocation
当前的位置数据
Definition: LMKMapView.h:125
平面投影矩形结构定义
Definition: LMKGeometry.h:45
地图view工具类的类别(geo,20级像素坐标;lnglat,精度纬度;map,地图opengl坐标;win,屏幕坐标) ...
Definition: LMKMapView.h:245