INNSMap iOS SDK 是一套基于IOS及以上版本设备的应用程序接口,您可以使用该套SDK开发适用于IOS系统移动设备的室内地图和室内定位类的应用,通过调用该SDK接口,您可以轻松的访问寅时的地图数据和定位服务,构建功能丰富、交互类强的Android应用。
使用须知:您需在申请key,创建应用后,才可以使用寅时IOS SDK。
在您使用寅时iOS SDK之前,请先阅读政策规范。
INNSMap iOS SDK 是一套基于iOS及以上版本设备的应用程序接口,您可以通过该接口实现室内地图功能:
地图:提供地图的展示、缩放、平移、旋转手势监听等操作,并实现一切操作都基于实际的米为单位;
资源:提供城市楼宇列表,楼宇详情,POI(point of interest 兴趣点)详情、类型、模糊查询等资源接口;
定位:提供蓝牙、惯性导航等联合定位;
路径规划:支持同楼层,跨楼层的路径规划;
地图覆盖物:提供多种地图覆盖物(点,线,图片)的标记与拾取,可以自己设置颜色、大小、事件监听,满足开发者的各种需求;
地图操作:提供点击、长按监听、高亮、指北针展示、闪烁点等功能。
提供给具有iOS开发经验的开发者使用
开发者需要到SDK网站下载
iOS 7.0及以上系统版本
Xcode
将libIndoorLocationSDK.a添加到工程中即可
SystemConfiguration.framework
MobileCoreServices.framework
CoreLocation.framework
CoreMotion.framework
INGeometry.h
INNSMap_Annotation.h
INNSMap_Compass.h
INNSMap_Image.h
INNSMap_Line.h
INNSMap_LocationInfo.h
INNSMap_MapOptions.h
INNSMap_MapView.h
INNSMap_Overlay.h
INNSMap_POI.h
INNSMap_Point.h
INNSMap_Points.h
INNSMap_TextTitle.h
INNSMap_Ellipse.h
INNSMap_Polygon.h
INNSMap_Bubble.h
INNSMap_Facility.h
INNSMap_ReturnInfo.h
INNSMap_ServicesAuthorizationVerificationData.h
INNSMap_ServicesLocationAndNavigationHttpData.h
INNSMap_ServicesResourceData.h
(1).需要降https请求为http,在plist文件中添加App Transport Security Settings字典,其中key值为Allow Arbitrary Loads,value值为YES。详见(3)的下图
(2).将工程文件中的Capabilities中的keychain Sharing打开,详见下图:
(3).在plist文件中添加三个键值对:
Privacy - Location Always Usage Description
Privacy - Location When In Use Usage Description
Bundle display name (这个是授权需要)
/*!
* 注册应用,即对应用进行授权认证
* @param anAppKey 网页注册的key
* @return returnInfo 要返回的信息
* @return error 失败的错误信息
*/
-(void)INNSMap_RegisterSDKWithAppKey:(NSString *)anAppKey success:(void(^)(INNSMap_ReturnInfo *returnInfo))success failure:(void(^)(NSString *error))failure;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
INNSMap_ServicesAuthorizationVerificationData *services = [[INNSMap_ServicesAuthorizationVerificationData alloc] init];
[services INNSMap_RegisterSDKWithAppKey:@"你的appKey" success:^(INNSMap_ReturnInfo *returnInfo) {
NSLog(@"success");
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
/*!获取SDK版本 */
-(NSString *)getINNSMapSDK_Version;
/*!获取SDK的userID */
-(NSString *)getINNSMapSDK_UserID;
INNSMap_ServicesAuthorizationVerificationData *services = [[INNSMap_ServicesAuthorizationVerificationData aloc]init];
NSString *mapVersion = [services getINNSMapSDK_Version];
NSString *mapUserID = [services getINNSMapSDK_UserID];
/*! 获取授权城市列表接口函数,返回数据存放在buildingMutableArr
@return cityMutableArr 存城市的数组
@return error 失败的错误信息
*/
-(void)INNSMap_getAuthorizedCityListWithSuccess:(void(^)(NSMutableArray *cityMutableArr))
success failure:(void(^)(NSString *error))failure;
[servicesResouce INNSMap_getAuthorizedCityListWithSuccess:^(NSMutableArray *cityMutableArr)
{NSLog(@"%@",cityMutableArr);}
failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据:(以下示例数据全为成功时的返回数据 即success回调,failure里是失败的错误信息)
数组中存的是每个城市的对象,类为CityProperty。
返回数据:(以下示例数据全为成功时的返回数据 即success回调,failure里是失败的错误信息)
数组中存的是每个城市的对象,类为CityProperty。
/*! 获取城市建筑列表接口函数,返回数据存放在buildingMutableArr
@param countryID 国家码
@param cityId 城市码
@return buildingMutableArr 存城市建筑的数组
@return error 失败的错误信息
*/
-(void)INNSMap_getCityBuildingListWithCountryID:(int)countryID withCityID:(int)cityId success:(void(^)(NSMutableArray *buildingMutableArr))success failure:(void(^)(NSString *error))failure;
[servicesResouce INNSMap_getCityBuildingListWithCountryID:86 withCityID:103 success:^(NSMutableArray *buildingMutableArr) {
NSLog(@"%@",buildingMutableArr);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据:
数组中存的是这个城市下所有建筑的对象,类为CityBuilding。
/*! 获取建筑属性接口函数,返回数据存放在buildingPropertyObj
@param buildingID 建筑ID
@return buildingPropertyObj 建筑属性类
@return error 失败的错误信息
*/
-(void)INNSMap_getBuildingPropertyWithBuildingID:(NSString *)buildingID success:(void (^)(BuildingProperty *buildingPropertyObj))success failure:(void(^)(NSString *error))failure;
使用示例:
[servicesResouce INNSMap_getBuildingPropertyWithBuildingID:@"e287d375aa6d4fa990cb0b9b89a411c0" success:^(BuildingProperty *buildingPropertyObj) {
NSLog(@"%@",buildingPropertyObj);
NSArray *overArray = buildingPropertyObj.OvergroundFloorArray; //楼宇的地上楼层数组
NSArray *underArray = buildingPropertyObj.UndergroundFloorArray; //楼宇的地下楼层数组
}];
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据:
BuildingProperty的对象buildingPropertyObj中包含两个数组:楼上层和楼下层数组,分别存放OvergroundFloorObj和UndergroundFloorObj的对象。
/*! POI楼宇范围内检索接口函数,返回数据存放在poiSearchArr
@param buildingID 建筑ID
@param POI_Name POI名称
@return poiSearchArr 查到的POI数组
@return error 失败的错误信息
*/
-(void)INNSMap_POISearchBuildingWithBuildID:(NSString*)buildingID withPOI_Name:(NSString*)POI_Name success:(void(^)(NSMutableArray *poiSearchArr))success failure:(void(^)(NSString *error))failure;
使用示例:
[servicesResouce INNSMap_POISearchBuildingWithBuildID:@"e287d375aa6d4fa990cb0b9b89a411c0" withPOI_Name:@"人" success:^(NSMutableArray *poiSearchArr) {
NSLog(@"%@",poiSearchArr);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据:
数组中存的是搜索到的POI的对象,类为PoiSeach。
/*! POI检索城市范围内接口函数,返回数据存放在poiSearchArr
@param cityId 城市ID
@param POI_Name POI名称
@return poiSearchArr 查到的POI数组
@return error 失败的错误信息
*/
-(void)INNSMap_POISearchCityWithCityID:(int)cityId withPOI_Name:(NSString *)POI_Name success:(void(^)(NSMutableArray * poiSearchArr))success failure:(void(^)(NSString *error))failure;
使用示例:
[servicesResouce INNSMap_POISearchCityWithCityID:103 withPOI_Name:@"人" ret:^(int code, NSMutableArray *poiSearchArr) {
NSLog(@"%@",poiSearchArr);
}];
返回数据:
数组中存的是搜索到的POI的对象,类为PoiSeach。
/*! 获取POI详情接口函数,返回数据存放在PoiDetailObj
@param POI_ID POI的ID
@param buildingID 建筑ID
@param floorID 楼层ID
@return PoiDetailObj POI详情类
@return error 失败的错误信息
*/
-(void)INNSMap_getPOIPropertyWithPOI_ID:(int)POI_ID withBuildID:(NSString*)buildingID withFloorID:(NSString*)floorID success:(void(^)(PoiDetail* PoiDetailObj))success failure:(void(^)(NSString *error))failure;
使用示例:
[servicesResouce INNSMap_getPOIPropertyWithPOI_ID:473 withBuildID:@"e287d375aa6d4fa990cb0b9b89a411c0" withFloorID:@"5aefc22dca6247378d5c5dcfcf4bc4a3" success:^(PoiDetail *PoiDetailObj) {
NSLog(@"%@",PoiDetailObj);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
返回这个POI的详情,类为PoiDetail。
/*! 获取城市POI分类的列表
@param cityId 城市ID
@return poiCategoriesList POI的分类类
@return error 失败的错误信息
*/
-(void)INNSMap_getPOICategoriesWithCityID:(int)cityId success:(void (^)(PoiCategoriesList *poiCategoriesList))success failure:(void(^)(NSString *error))failure;
使用示例:
[servicesResouce INNSMap_getPOICategoriesWithCityID:103 success:^(PoiCategoriesList *poiCategoriesList) {
NSLog(@"%@",poiCategoriesList);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
暂时没有
/*! 获取周边 (多于5个返回5个)
@param buildid 建筑ID
@param startFloorID 楼层ID
@param poiID POI_ID
@param startPoint 起始点
@param requestTpye 查找类型 1:商铺 2:卫生间 3:楼梯 4:出口 5:电梯
@return peripheryArray 查找到周边的数组
@return error 失败的错误信息
*/
-(void)INNSMap_getPeripheryWithBuildID:(NSString*)buildid withStartFloorID:(NSString*)startFloorID withStartPOIID:(int)poiID withStartPoint:(CGPoint)startPoint withRequestTpye:(int)requestTpye success:(void (^)(NSMutableArray *peripheryArray))success failure:(void(^)(NSString *error))failure;
使用示例:
[servicesResouce INNSMap_getPeripheryWithBuildID:@"cf52046eb3304678ad5d31b1157373c1" withStartFloorID:@"812705fee7e54612ba86d8056e8f3ba3" withStartPOIID:12 withStartPoint:CGPointMake(25.5767, 60.279) withRequestTpye:5 success:^(NSMutableArray *peripheryArray) {
NSLog(@"%@",peripheryArray);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
这个数组有些特殊,查周边可能会查询到周边的POI,也有可能查到周边的设施,所以这个数组中存的有可能是周边POI类PeripheryPOI的对象,也有可能是周边设施类PeripheryFacility的对象。
/*! 查公共设施
@param buildid 建筑ID
@param floorID 楼层ID
@param requestTpye 查找类型 1:卫生间 2:楼梯 4:电梯 5:出入口 6:扶梯
31:吸烟区 32:收银台 33:服务台 34:atm 36:问讯处 37:饮水处
@return CommunalFacilityArray 查找到公共设施的数组
@return error 失败的错误信息
*/
-(void)INNSMap_getCommunalFacilitiesWithbuildID:(NSString*)buildid withFloorID:(NSString*)floorID withRequestTpye:(int)requestTpye success:(void (^)(NSMutableArray *CommunalFacilityArray))success failure:(void(^)(NSString *error))failure;
[servicesResouce INNSMap_getCommunalFacilitiesWithbuildID:@"cf52046eb3304678ad5d31b1157373c1" withFloorID:@"812705fee7e54612ba86d8056e8f3ba3" withRequestTpye:34 success:^(NSMutableArray *CommunalFacilityArray) {
NSLog(@"%@",CommunalFacilityArray);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
数组中存的是公共设施对象,类为CommunalFacility。
/*! 获取路径请求接口函数,返回数据存放在SearchPathObj
@param buildID 建筑ID
@param startFloorID 起始楼层ID
@param startPOIID 起始POI_ID
@param startPoint 起始点
@param endFloorID 终点楼层ID
@param endPOIID 终点POI_ID
@param endPoint 终点
@return SearchPathDic 查到的路径信息
@return error 失败的错误信息
*/
-(void)INNSMap_getPathRequestWithBuildID:(NSString*)buildID withStartFloorID:(NSString*)startFloorID withStartPOIID:(int)startPOIID withStartPoint:(CGPoint)startPoint withEndFloorID:(NSString*)endFloorID withEndPOIID:(int)endPOIID withEndPoint:(CGPoint)endPoint success:(void(^)(NSMutableDictionary *SearchPathDic))success failure:(void(^)(NSString *error))failure;
[servicesResouce INNSMap_getPathRequestWithBuildID:@"0d3d0929dfa644f29ee66c34bd0b2d48" withStartFloorID:@"3945b76dc6724d4d8317b30190a7e65e" withStartPOIID:999993 withStartPoint:CGPointMake(7.446770191192627, 146.52775573730469) withEndFloorID:@"3945b76dc6724d4d8317b30190a7e65e" withEndPOIID:20791 withEndPoint:CGPointMake(238.24044799804688, 70.158393859863281) success:^(NSMutableDictionary *SearchPathDic) {
NSLog(@"%@",SearchPathDic);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
SDK支持跨楼层寻径,所以可能在多层有路径,也有这样的情况,同一楼层寻径,但是却没有直接到达的方法,比如从东到西,中间被一些障碍物挡住,需要乘电梯到楼上,然后从楼上东到西,再下楼到达目的地,这时候在同一楼层就可能存在2段路径,然后楼上还有一段路径。
这个字典的key-value分别对应楼层ID和该楼层的路径,有多段路径的时候,value的个数也会有多个,value是一个数组,里面存的是该段路径的所有点集;此接口配合mapView的画路径方法可以画出导航路线。
/*! 位置分享
@param buildid 建筑ID
@param floorID 楼层ID
@param positionType 位置类型 1:为定位点 2:标记点
@param positionPoint 位置点坐标
@param description 用户自定义的描述信息
@return locationDic 位置的相关信息,存储为一个字典
@return error 失败的错误信息
*/
-(void)INNSMap_sharingTheLocationWithBuildingId:(NSString *)buildingId WithFloorId:(NSString *)floorId withPositionType:(int)positionType withPositionPoint:(CGPoint)positionPoint WithDescription:(NSString*)description success:(void (^)(NSMutableDictionary *locationDic))success failure:(void(^)(NSString *error))failure;
[servicesResouce INNSMap_sharingTheLocationWithBuildingId:_buildProObj.BuildingID WithFloorId:_floorID withPositionType:1 withPositionPoint:CGPointMake(10, 10) WithDescription:@"你好" success:^(NSMutableDictionary *locationDic) {
NSLog(@"%@",locationDic);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
字典中存储分享的相关信息。
/*! 位置共享
@param appId 应用的appId
@param uIdGroup 要共享位置的用户id的组合,id用,隔开
@return multi_locationArr 共享位置的相关信息,存储为一个数组,数组中包含每个用户id的位置信息
@return error 失败的错误信息
*/
-(void)INNSMap_multi_locationSharingWithUserIdGroup:(NSString *)uIdGroup success:(void (^)(NSMutableArray *multi_locationArr))success failure:(void(^)(NSString *error))failure;
[servicesResouce INNSMap_multi_locationSharingWithUserIdGroup:@"cb4bbba44182428c96663a438b5c05a3,88be5746961d486a971d7ea16acc6318" success:^(NSMutableArray *multi_locationArr) {
NSLog(@"%@",multi_locationArr);
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
返回数据
传入appID和要共享的所有用户的uuid,如果用户有定位,就会返回用户的位置信息,没有定位则没有该用户位置信息。数组里存的是共享者的对象,类为MutliShareObj。
/*!
* INNS_MapView初始化
* @param frame ISM_MapView对象的 frame
* @return ISM_MapView对象
*/
- (instancetype)initWithFrame:(CGRect)frame;
使用示例:
INNSMap_MapView *mapView = [[INNSMap_MapView alloc]initWithFrame:self.view.bounds];
mapView.delegate = self;
[self.view addSubview:mapView];
/*!
* 设置指北针的位置
* @param position 指北针位置坐标 (注意此方法要写在初始化之后,地图加载之前,不调用默认在左上角)
*/
- (void)setCompassPosition:(CGPoint)position;
使用示例:
[mapView setCompassPosition:CGPointMake(60, 60)];
/*!
* 设置比例尺的位置
* @param position 比例尺位置坐标 (注意此方法要写在初始化之后,地图加载之前,不调用默认在左下角)
*/
-(void)setMeasurePosition:(CGPoint)position;
/*!
* 设置是否显示比例尺
* @param isShow 显示(不显示) 默认是显示的
*/
-(void)setMeasureShow:(BOOL)isShow;
使用示例:
[inMapView setMeasurePosition:CGPointMake(300, 500)];
[inMapView setMeasureShow:NO]; //默认显示
/*!
* 在view上加载地图
* @param buildID 地图对应的buildID
* @param floorId 地图对应的 floorId
* @param success 成功的回调,无返回信息
* @param failure 失败回调,如果失败,返回信息是加载失败的原因
*/
- (void)loadMapViewWithBuildID:(NSString *)buildID withFloorID:(NSString *)floorId success:(void(^)(void))success
failure:(void(^)(NSString *error))failure;
使用示例:
[inMapView loadMapViewWithBuildID:@"楼宇ID" withFloorID:@"楼层ID" success:^{
NSLog(@"成功");
} failure:^(NSString *error) {
NSLog(@"加载失败,失败原因%@",error);
}];
/*!
* 获取地图上所有的POI
* @return NSMutableArray POI数组
*/
-(NSMutableArray *)getAllPoiArrayWithLoadMapView;
使用示例:
NSArray *allPOIArr = [inMapView getAllPoiArrayWithLoadMapView];
/*!
* 获取覆盖物是否支持点击长按事件状态 (是否可选中)
* @return BOOL 支持(不支持)
*/
- (BOOL)getOverlaySelectState;
/*!
* 设置覆盖物支持点击长按事件 默认值为NO
* @param state 支持(不支持)
*/
- (void)setOverlaySelectState:(BOOL)state;
/*!
* 获取当前poi拾取状态 是否可以拾取
* @return BOOL 能(不能)
*/
-(BOOL)getPoiSelectState;
/*!
* 设置poi是否可以拾取
* @param state 能(不能) 默认值为NO
*/
-(void)setCurrentPoiPickUpStateChoice:(BOOL)choice;
使用示例:
BOOL overSelect = [inMapView getOverlaySelectState];
[inMapView setOverlaySelectState:YES];
BOOL poiSelect = [inMapView getPoiSelectState];
[inMapView setPoiSelectState:YES];
/*!
* 设置单独一个Poi高亮
* @param PoiID POI的ID
*/
- (void)setSinglePoiHighlight:(NSInteger)PoiID;
使用示例:
[inMapView setSinglePoiHighlight:13];
/*!
* 将多个POI在地图上高亮显示出来 (如搜索POI使其高亮)
* @param poi_id_array POI的ID数组,以数组方式存储
*/
- (void)setPoisHighlight:(NSArray *)poi_id_array;
使用示例:
[inMapView setPoisHighlight:@[@1,@2,@3]];
/*!取消所有Poi高亮*/
-(void)cancelAllPoiAreaHighlight;
使用示例:
[inMapView cancelAllPoiAreaHighlight];
/*!
* 设置一些公共设施的图例显示(楼梯,电梯,扶梯,洗手间,出口) (如查询出来的某些公共设施)
* @param tuliArray 查询到的公共设施数组,里面存的是公共设施的对象(非ID)
*/
-(void)setPublicFacilitiesTuliShow:(NSArray *)tuliArray;
使用示例:(配合查询公共设施接口)
[servicesResouce INNSMap_getCommunalFacilitiesWithbuildID:_buildProObj.BuildingID withFloorID:_floorID withRequestTpye:1 ret:^(int code, NSMutableArray *CommunalFacilityArray) {
[inMapView setPublicFacilitiesTuliShow:CommunalFacilityArray];
}];
/*!设置本楼层所有的公共设施的图例显示(楼梯,电梯,扶梯,洗手间,出口)*/
-(void)setAllPublicFacilitiesTuliShow;
使用示例:(配合查询公共设施接口)
[inMapView setAllPublicFacilitiesTuliShow];
/*!
* 寻径画路径
* @param pathArray 存储着从服务器获得的寻径的点的坐标
*/
- (void)drawNavigationRoute:(NSArray *)pathArray;
使用示例:(配合寻径接口)
[serResData INNSMap_getPathRequestWithBuildID:_buildProObj.BuildingID withStartFloorID:_floorID withStartPOIID:beginPOIID withStartPoint:selectBeginPoint withEndFloorID:_floorID withEndPOIID:endPOIID withEndPoint:selectEndPoint success:^(NSMutableDictionary *SearchPathDic) {
NSLog(@"drawNavigationRoute");
NSDictionary *dic = SearchPathDic;
NSArray *keys = [dic allKeys];
if ([keys containsObject:_floorID]) {
NSArray *pointArr = dic[_floorID];
for (int i=0; i<pointArr.count; i++) {
[inMapView drawNavigationRoute:pointArr[i]];
}
}
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
/*!清除寻径路径*/
- (void)clearRoutingRoute;
使用示例:
[inMapView clearRoutingRoute];
/*!
* 获取当前缩放比例
* @return CGFloat 比例值
*/
- (CGFloat)getCurrentZoom;
使用示例:(配合寻径接口)
CGFloat zoom = [inMapView getCurrentZoom];
/*!
* 设置地图的旋转角度(0-360) (地图加载前设置会自动适配屏幕,加载后只旋转)
* @param rotation 旋转多少度(旋转基于地图初始位置)
*/
- (void)setMapRotation:(float)rotation;
使用示例:
[inMapView setMapRotation:90];
/*
* 获取当前的旋转角度
* @CGFloat 角度值
*/
- (CGFloat)getCurrentRotationAngle;
使用示例:
CGFloat rotation = [inMapView getCurrentRotationAngle];
/*!
* 添加一个覆盖物
* @param overlay 覆盖物对象
*/
- (void)addOverlay:(id)overlay;
/*!
* 添加多个覆盖物
* @param overlays 由覆盖物组成的数组
*/
- (void)addOverlays:(NSArray *)overlays;
使用示例:
添加覆盖物,先得创建覆盖物对象,覆盖物对象分点、线、图三种,具体如下:
// 1. 添加覆盖物点
ISM_MAP_POINT myPoint;
myPoint.x = 20;
myPoint.y = 5;
INNSMap_Point *point = [[INNSMap_Point alloc]initWithINPoint:myPoint];
point.pointRadius = 15;
[inMapView addOverlay:point];
// 2. 添加覆盖物线
ISM_MAP_POINT myPoint1[3];
myPoint1[0].x = 2;
myPoint1[0].y = 15;
myPoint1[1].x = 10;
myPoint1[1].y = 5;
myPoint1[2].x = 20;
myPoint1[2].y = 5;
INNSMap_Line *innsLine = [[INNSMap_Line alloc]initWithINLinePoints:myPoint1 pointNum:3];
innsLine.planeType = 2;
innsLine.lineStyle = 2;
innsLine.fillColor = [UIColor redColor];
innsLine.lineWidth = 10;
[inMapView addOverlay:innsLine];
// 3. 添加覆盖物图
UIImage *image = [UIImage imageNamed:@"定位.png"];
UIImage *image1 = [UIImage imageNamed:@"定位蓝.png"];
ISM_MAP_POINT myPoint2;
myPoint2.x = 20;
myPoint2.y = 10;
INNSMap_Image *innsImage = [[INNSMap_Image alloc]initWithINImage:image withInPoint:myPoint2 withAnchorPoint:CGPointMake(0.2, 0.5)];
innsImage.bounds = CGRectMake(0, 0, 50, 50);
[inMapView addOverlay:innsImage];
INNSMap_Image *innsImage1 = [[INNSMap_Image alloc]initWithINImage:image1 withInPoint:myPoint2 withAnchorPoint:CGPointMake(0.5, -2.0)];
innsImage1.bounds = CGRectMake(0, 0, 50, 50);
[inMapView addOverlay:innsImage1];
//4.添加点集覆盖物
ISM_MAP_POINT myPoint11[600];
for (int i=0; i<600; i++) {
myPoint11[i].x = arc4random()%40;
myPoint11[i].y = arc4random()%40;
}
INNSMap_Points *ps = [[INNSMap_Points alloc]initWithINPoints:myPoint11 pointNum:600];
ps.fillColor = [UIColor greenColor];
ps.pointRadius = 10;
ps.distance = 100;
[inMapView addOverlay:ps];
/*!
* 删除单个覆盖物
* @param overlay 覆盖物对象
*/
- (void)removeOverlay:(id<INNSMap_Overlay>)overlay;
/*!
* 删除多个覆盖物
* @param overlays 由覆盖物组成的数组
*/
- (void)removeOverlays:(NSArray *)overlays;
/*!删除所有的覆盖物*/
- (void)removeAllOverlays;
使用示例:(配合寻径接口)
[serResData INNSMap_getPathRequestWithBuildID:_buildProObj.BuildingID withStartFloorID:_floorID withStartPOIID:beginPOIID withStartPoint:selectBeginPoint withEndFloorID:_floorID withEndPOIID:endPOIID withEndPoint:selectEndPoint success:^(NSMutableDictionary *SearchPathDic) {
NSLog(@"drawNavigationRoute");
NSDictionary *dic = SearchPathDic;
NSArray *keys = [dic allKeys];
if ([keys containsObject:_floorID]) {
NSArray *pointArr = dic[_floorID];
for (int i=0; i<pointArr.count; i++) {
[inMapView drawNavigationRoute:pointArr[i]];
}
}
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
/*!
* 设置覆盖物偏移
* @param offset 偏移值 (实际地图坐标-即米)
* @param overlay 要移动的覆盖物
*/
-(void)setOffset:(CGPoint)offset withOverlay:(id<INNSMap_Overlay>)overlay;
使用示例:(配合寻径接口)
[serResData INNSMap_getPathRequestWithBuildID:_buildProObj.BuildingID withStartFloorID:_floorID withStartPOIID:beginPOIID withStartPoint:selectBeginPoint withEndFloorID:_floorID withEndPOIID:endPOIID withEndPoint:selectEndPoint success:^(NSMutableDictionary *SearchPathDic) {
NSLog(@"drawNavigationRoute");
NSDictionary *dic = SearchPathDic;
NSArray *keys = [dic allKeys];
if ([keys containsObject:_floorID]) {
NSArray *pointArr = dic[_floorID];
for (int i=0; i<pointArr.count; i++) {
[inMapView drawNavigationRoute:pointArr[i]];
}
}
} failure:^(NSString *error) {
NSLog(@"%@",error);
}];
/*!
* 转屏幕坐标,为地图坐标
* @param point 屏幕坐标
* @return 地图坐标
*/
- (ISM_MAP_POINT)convertPoint:(CGPoint)point;
使用示例:(配合寻径接口)
CGPoint scPoint;
scPoint.x = 10;
scPoint.y = 10;
ISM_MAP_POINT mapPoint = [inMapView convertPoint:scPoint];
/*!
* 转地图坐标为屏幕坐标
* @param point 地图坐标
* @return 屏幕坐标
*/
- (CGPoint)convertINMap_Point:(ISM_MAP_POINT)point;
使用示例:
ISM_MAP_POINT mapPoint;
mapPoint.x = 10;
mapPoint.y = 10;
CGPoint scPoint = [inMapView convertINMap_Point:mapPoint];
/*!
* 开始定位加定位点
* @param point 地图坐标
*/
- (void)addLocationPoint:(ISM_MAP_POINT)point;
使用示例:
配合定位的代理方法使用:
-(void)INNSMap_LocationReturnInfo:(INNSMap_ReturnInfo *)returnInfo{
ISM_MAP_POINT point;
point.x = returnInfo.locationInfo.locationPoint.x;
point.y = returnInfo.locationInfo.locationPoint.y;
[inMapView addLocationPoint:point];
}
/*!停止定位取消定位点*/
-(void)removeLocationPoint;
使用示例:
[inMapView removeLocationPoint];
/*!
* 获取点击的地图点坐标
* @return ISM_MAP_POINT 地图点坐标
*/
-(ISM_MAP_POINT)getSelectPointOfMap;
使用示例:(配合寻径接口)
ISM_MAP_POINT point = [inMapView getSelectPointOfMap];
/*!
* 设置某点为地图中心点
* @param point 地图点坐标
*/
-(void)setCenterByPoint:(ISM_MAP_POINT)point;
使用示例:(配合寻径接口)
ISM_MAP_POINT point = [inMapView getCurrentSelectPoint];
[inMapView setCenterByPoint:point];
/*!
* 截取当前显示的MapView转为图片
* @return image 截取出来的图片
*/
-(UIImage *)cutUpViewToImage;
使用示例:
UIImage *image = [inMapView cutUpViewToImage];
/*!
* 自定义View转图片
* @param customView 自定义View
* @return UIImage对象
*/
- (UIImage *)convertImageWithCustomView:(UIView *)customView;
使用示例:
UIView *myView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
myView.backgroundColor = [UIColor grayColor];
UILabel *myLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 20)];
myLabel.text = @"自定义文字";
myLabel.textColor = [UIColor whiteColor];
[myView addSubview:myLabel];
UIImageView *myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 40, 40)];
myImageView.image = [UIImage imageNamed:@"定位蓝"];
[myView addSubview:myImageView];
//转为UIImage,可以配合图片覆盖物使用
UIImage *myImage = [inMapView convertImageWithCustomView:myView];
INNSMap_Image *myImage11 = [[INNSMap_Image alloc]initWithINImage:myImage withInPoint:myPoint withAnchorPoint:CGPointMake(.5, .5)];
[inMapView addOverlay:myImage11];
/*!
* 设置热力图是否显示
* @param isShow 是否显示热力图 (默认不显示)
*/
- (void)setHeatMapShow:(BOOL)isShow;
/*!
* 根据提供点集在mapView上设置热力图
* @param points 地图点坐标数组 (注意这里数组里面点坐标代表的是地图点坐标)
*/
-(void)setHeatMapWithPoints:(NSArray *)points;
使用示例:
NSMutableArray *oldPoints = [[NSMutableArray alloc]init];
for (int i=0; i<100; i++) {
double x = arc4random()%40;
double y = arc4random()%35;
CGPoint p = CGPointMake(x, y);
[oldPoints addObject:[NSValue valueWithCGPoint:p]];
}
[inMapView setHeatMapWithPoints:oldPoints];
[inMapView setHeatMapShow:YES];
/*!
* 地图单击事件
* @param tapGesture 点击手势
*/
- (void)mapViewDidTaped:(UITapGestureRecognizer *)tapGesture;
/*!
* 地图平移事件
* @param panGesture 平移手势
*/
- (void)mapViewDidPaned:(UIPanGestureRecognizer *)panGesture;
/*!
* 地图缩放事件
* @param pinchGesture 缩放手势
*/
- (void)mapViewDidPinched:(UIPinchGestureRecognizer *)pinchGesture;
/*!
* 地图旋转事件
* @param rotationGesture 旋转手势
*/
- (void)mapViewDidRotationed:(UIRotationGestureRecognizer *)rotationGesture;
/*!
* 地图长按事件
* @param longPressGesture 长按手势
*/
- (void)mapViewDidLongPressed:(UILongPressGestureRecognizer *)LongPressGesture;
/*!
* POI被选中事件
* @param POI POI信息对象
*/
- (void)mapViewPOIDidTaped:(INNSMap_POI *)POI;
/*!
* 覆盖物被选中事件 -- 覆盖物轻拍
* @param overlay 覆盖物对象
*/
- (void)mapViewOverlayTaped:(id<INNSMap_Overlay>)overlay;
/*!
* 覆盖物被选中事件 -- 覆盖物长按
* @param overlay 覆盖物对象
*/
- (void)mapViewOverlayLongPressed:(id<INNSMap_Overlay>)overlay;
/*! 是否使用3D地图 (默认使用,为NO时为2D) */
@property (nonatomic, assign) BOOL use3D_Map;
使用示例:
inMapView.use3D_Map = NO; //设置后会自动切换为2D,3D地图
@interface CityProperty : NSObject
@property (nonatomic, assign)int regionId; //地区id
@property (nonatomic, strong)NSString *regionName; //地区名称
@property (nonatomic, assign)float longi; //经度
@property (nonatomic, assign)float lati; //纬度
@property (nonatomic, strong)NSString *nameStr; //拼音
@end
@interface BuildingProperty : NSObject
@property (nonatomic, strong)NSString *buildAddr; //楼宇地址
@property (nonatomic, strong)NSString *provinceName; //省
@property (nonatomic, strong)NSString *cityName; //市
@property (nonatomic, strong)NSString *countyName; //县
@property (nonatomic, strong)NSString *buildNameCn; //楼宇中文名
@property (nonatomic, strong)NSString*BuildingID; //楼宇ID
@property (nonatomic, assign)int FloorCnt; //楼层数
@property (nonatomic, assign)int DefaultFloor; //默认层号
@property (nonatomic, assign)int OvergroundCnt; //地上几层
//数组里存放的是OvergroundFloorObj对象
@property (nonatomic, strong)NSMutableArray *OvergroundFloorArray;
@property (nonatomic, assign)int UndergroundCnt; //地下几层
//数组里存放的是UndergroundFloorObj对象
@property (nonatomic, strong)NSMutableArray *UndergroundFloorArray;
@end
@interface OvergroundFloorObj: NSObject
@property (nonatomic, strong)NSString*floorId; //楼层ID
@property (nonatomic, assign)int overgroundCnt; //地上楼层数
@property (nonatomic, copy)NSString *overgroundFloorName; //默认层号
@property (nonatomic, assign)int overgroundFloorNum; //地上第几层
@end
@interface UndergroundFloorObj: NSObject
@property (nonatomic, strong)NSString*floorId; //楼宇ID
@property (nonatomic, assign)int undergroundCnt; //地下楼层数
@property (nonatomic, copy)NSString *undergroundFloorName; //默认层号
@property (nonatomic, assign)int undergroundFloorNum; //地下第几层
@end
@interface CityBuilding : NSObject
@property (nonatomic, strong)NSString* buildingCodeStr; //建筑code
@property (nonatomic, strong)NSString* buildingNameStr; //建筑名称
@property (nonatomic, strong)NSString* buildingFlagStr; //建筑标志
@property (nonatomic, assign)float longitudeNumber ; //经度
@property (nonatomic, assign)float latitudeNumber; //纬度
@end
@interface PoiDetail : NSObject
@property (nonatomic, strong)NSString* remark; //备注
@property (nonatomic, strong)NSString* address; //地址
@property (nonatomic, strong)NSString* POI_Name; //名称
@property (nonatomic, strong)NSString* POI_Tel; //电话
@property (nonatomic, strong)NSString* POI_LogoUrl; //LOGO
@property (nonatomic, strong)NSString* POI_InfoText; //简介
@property (nonatomic, copy)NSString* poiBigtype; //大类名
@property (nonatomic, copy)NSString* poiSmalltype; //小类名
@end
@interface PoiSearch : NSObject
@property (nonatomic, assign)int PoiId; //Poi标识符
@property (nonatomic, strong)NSString* PoiName; //Poi名称
@property (nonatomic, strong)NSString* PoiBuildingId; //Poi所属楼宇
@property (nonatomic, assign)int floorNum; //楼层当前层数
@property (nonatomic, strong)NSString* BuildingName; //楼名
@property (nonatomic, strong)NSString* PoiFloorId; //Poi所属楼层
@property (nonatomic, strong)NSString* Floor_name; //楼层名称
@property (nonatomic, strong)NSString* photoPath; //POI图片地址
@property (nonatomic, assign)float poiCenter_x; //poi中心点x坐标
@property (nonatomic, assign)float poiCenter_y; //poi中心点y坐标
@end
@interface PoiCategoriesList : NSObject
@property (nonatomic, assign)int bigCount; //大类数
@property (nonatomic, strong)NSArray* bigTypeNameArr; //大类类型
@property (nonatomic, strong)NSArray* bigSmallTypeArr; //大类中所有小类类型集合
@end
@interface SmallTypeObj : NSObject
@property (nonatomic, copy)NSString *typeName; //小类类型
@property (nonatomic, copy)NSString *belongBigType; //属于的大类
@end
@interface PeripheryPOI : NSObject
@property (nonatomic, assign)int distance; //距离
@property (nonatomic, assign)int nodeID; //PeripheryPOIID
@property (nonatomic, assign)CGPoint peripheryPoint; //位置点
@end
@interface PeripheryFacility : NSObject
@property (nonatomic, assign)int distance; //距离
@property (nonatomic, assign)int nodeID; //PeripheryPOIID
@property (nonatomic, assign)CGPoint peripheryPoint; //位置点
@end
@interface CommunalFacility : NSObject
@property (nonatomic, assign)int comFacID; //公共设施ID
@property (nonatomic, assign)CGPoint comFacPoint; //位置点
@end
@interface MultiShareObj : NSObject
@property (nonatomic, copy)NSString *buildId; //楼宇ID
@property (nonatomic, copy)NSString *floorId; //楼层ID
@property (nonatomic, copy)NSString *userid; //用户ID
@property (nonatomic, assign)CGPoint positionPoint; //用户位置点
@end
/*!请求定位*/
-(void)requestLocationInfo;
/*!停止定位*/
-(void)stopLocation;
使用示例:
INNSMap_ServicesLocationAndNavigationHttpData *locationNavi = [[INNSMap_ServicesLocationAndNavigationHttpData alloc]init];
[locationNavi requestLocationInfo];
[locationNavi stopLocation];
@protocol ServicesLocationAndNavigationHttpDataDelegate <NSObject>
/*!
* 返回定位的所有信息
* @return returnInfo 具体信息.(信息码,信息详情,如果错误返回则ISM_LocationInfo为空)
*/
-(void)INNSMap_LocationReturnInfo:(INNSMap_ReturnInfo *)returnInfo;
@end
使用示例:
签订代理,实现代理方法:
INNSMap_ServicesLocationAndNavigationHttpData *locationNavi = [[INNSMap_ServicesLocationAndNavigationHttpData alloc]init];
-(void)INNSMap_LocationReturnInfo:(INNSMap_ReturnInfo *)returnInfo{
if (returnInfo.code == 0) {
// 正确返回 NSLog(@"%@*******%@********%f********%f",returnInfo.locationInfo.buildingID,returnInfo.locationInfo.floorID,returnInfo.locationInfo.locationPoint.x,returnInfo.locationInfo.locationPoint.y);
ISM_MAP_POINT point;
point = returnInfo.locationInfo.locationPoint;
[inMapView addLocationPoint:point];
}else
{
// 错误返回
NSLog(@"%d********%@",returnInfo.code,returnInfo.message);
}
}
返回数据:
@interface INNSMap_ReturnInfo : NSObject
/*! 错误代码 */
@property (nonatomic,assign)int code;
/*! 错误原因 */
@property (nonatomic,strong)NSString *message;
/*! 位置信息 */
@property (nonatomic,strong)INNSMap_LocationInfo *locationInfo;
@end
当其code=0时,代表定位成功返回,INNSMap_LocationInfo里是定位返回的相关位置信息,如下:
@interface INNSMap_LocationInfo : NSObject
/*! 楼宇ID */
@property (nonatomic,strong)NSString *buildingID;
/*! 楼层ID */
@property (nonatomic,strong)NSString *floorID;
/*! 位置坐标 */
@property (nonatomic,assign)ISM_MAP_POINT locationPoint;
@end