您现在的位置:
概述
四维地图导航客户端应用产品开发SDK【Navinfo Navigation SDK for iOS】是一套基于iOS 8.0版本及以上操作系统的地图导航客户端应用产品开发工具包。用户可以轻松构造地图导航基础上的各种交互式应用产品。四维地图导航客户端应用产品开发SDK提供了3D地图显示与操作、位置信息搜索、导航算路、导航过程管理等基本功能,满足不同用户的各种应用需求。
功能介绍与体验
-
地图展示
(完整代码请参见 SDKDemo 工程的 MBMapController.m 文件) #import <iNaviCore/MBMapView.h> @interface MBMapController () // 地图视图 @property (nonatomic ,strong) MBMapView *mapView; } - (void)viewDidLoad { [super viewDidLoad]; [self initMapView]; } - (void)initMapView { if (baseMapView == nil) { baseMapView = [[MBMapView alloc]initWithFrame:self.view.bounds]; [self.view addSubview:baseMapView]; } [baseMapView setZoomLevel:8.0 animated:YES]; baseMapView.delegate = self; }
-
覆盖物
(完整代码详见 SDKDemo工程的 MBNewSearchMapController.m) // 模拟点 MBPoint pos = {11617606,3971098}; // x轴和y轴的偏移量 CGPoint pivotPoint = {0.5,0.5}; // 初始化MBAnnotation annotation = [[MBAnnotation alloc] initWithZLevel:1 pos:pos iconId:8001 pivot:pivotPoint]; // 将MBAnnotation添加到MBMapView [mapView addAnnotation:annotation]; // 设置地图中心点为pos mapView.worldCenter = pos;
-
POI搜索
(完整代码详见 SDKDemo工程的 MBNewSearchListController.m) // 模拟点 MBPoint pos = {11637852,3986459}; // 初始化MBPoiSearchSession类 self.session = [MBPoiSearchSession defaultInstance]; // 设置查询模式(默认仅在线) self.session.preference = MBDataPreference_onlineOnly; self.session.isNearBy = YES; // 设置分页数 self.session.pageSize = 15; [self.session setCity:city]; // 设置搜索关键字 [self.session setKeyword:@"酒店"]; // 设置中心点 self.session.center = pos; // 开始执行查询操作 [self.session query]; [self.session setStartedBlock:^{ // 开始查询 }]; [self.session setEndedBlock:^{ // 查询成功,但是数据没加载 }]; [self.session setCanceledBlock:^{ // 取消查询 }]; [self.session setFailedBlock:^(MBPoiSearchError err, NSString* detail){ // 查询失败 }]; [self.session setLoadedBlock:^(NSArray *pois, NSArray *corrections, NSArray *cityDistributions, NSArray *citySuggestions, NSArray *districts) { // 查询成功回调 for (MBPoiItem *obj in pois){ NSLog(@"%@,%@",obj.name,obj.address); } NSLog(@"session pois:%@",pois); NSLog(@"correction:%@",corrections); NSLog(@"cityDistributions:%@",cityDistributions); NSLog(@"citySuggestions:%@",citySuggestions); NSLog(@"districts:%@",districts); }];
-
离线数据
- (void)datastoreRefreshed:(MBDatastore *)ds { NSArray *dataStoreItems = ds.root.subnodes; NSMutableArray *provinceItems = [NSMutableArray arrayWithCapacity:dataStoreItems.count]; NSMutableArray *cityItems = [NSMutableArray array]; NSMutableArray *cityDataStoreItems = [NSMutableArray array]; for (MBDatastoreItem*provinceItem in dataStoreItems) { CTMLObj *provinceNode = [CTMLObj nodeWithOwnID:provinceItem.itemId name:provinceItem.name level:1]; [provinceItems addObject:provinceNode]; if (provinceItem.subnodes.count) { for (MBDatastoreItem* cityItem in provinceItem.subnodes) { MLNodelObj *cityNode = [MLNodelObj nodeWithParentID:provinceItem.itemId ownID:cityItem.itemId name:cityItem.name level:2 isleaf:YES isroot:NO isExpand:NO]; [cityItems addObject:cityNode]; [cityDataStoreItems addObject:cityItem]; } } else { [cityDataStoreItems addObject:provinceItems]; } provinceNode.subNodes = cityItems; } }