#import "BMKMapView.h"/// 地图是否展示路况事件图层默认NO,since 6.6.3@property (nonatomic, assign) BOOL showTrafficUGCLayer;
/// 点中底图标注后会回调此接口/// @param mapView 地图View/// @param mapPoi 标注点信息- (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi;
/// Poi点路况信息@property (nonatomic, assign) BMKTrafficUGCType trafficUGCType;
typedef enum {BMKTrafficUGCTypeNoUGC = 0, /// 非路况事件BMKTrafficUGCTypeConstruction, /// 道路施工BMKTrafficUGCTypeJam, /// 道路拥堵BMKTrafficUGCTypeBlocking, /// 道路封闭BMKTrafficUGCTypeEmergency /// 道路应急事故} BMKTrafficUGCType;
/// 1.创建地图BMKMapView *mapView = [[BMKMapView alloc] initWithFrame:self.view.frame];/// 2.设置地图代理mapView.delegate = self;// 3.设置地图显示路况事件图层mapView.showTrafficUGCLayer = YES;/// 4.在点击地图poi代理回调中处理相关数据- (void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi {NSLog(@"点击POI:coordinate -%@ lon:%@,lat:%@", mapPoi.text, @(mapPoi.pt.longitude), @(mapPoi.pt.latitude));if (mapPoi.trafficUGCType != BMKTrafficUGCTypeNoUGC) {switch (mapPoi.trafficUGCType) {case BMKTrafficUGCTypeConstruction:NSLog(@"当前位置道路施工");break;case BMKTrafficUGCTypeJam:NSLog(@"当前位置道路拥堵");break;case BMKTrafficUGCTypeBlocking:NSLog(@"当前位置道路封闭");break;case BMKTrafficUGCTypeEmergency:NSLog(@"当前位置有道路应急事故");break;default:break;}}}
上一篇
下一篇
本篇文章对您是否有帮助?