since6.4.0起支持动态轨迹绘制,开发者可以提供轨迹数据,来动态展示轨迹。支持监听轨迹绘制状态。since 6.5.6起ios地图sdk动态轨迹支持渐变色绘制和.gltf .bin模型加载,并支持动画播放。
bmktraceoverlay*traceoverlay =[bmktraceoverlay traceoverlaywithcoordinates:_coords count:_coordscount option:self.animationoption];/// 是否使用渐变色轨迹/// 注意:要配合strokecolors使用,否则无效traceoverlay.isgradientcolor=yes;/// 是否使用发光轨迹traceoverlay.istrackbloom=yes;traceoverlay.bloomspeed=5.0f;traceoverlay.delegate= self;[self.mapview addoverlay:traceoverlay];/// 轨迹动画选项-(bmktraceoverlayoption*)animationoption {if(!_animationoption){_animationoption =[[bmktraceoverlayoption alloc] init];_animationoption.animate=yes;// 是否动画_animationoption.delay=0.0;// 动画延迟开始时间_animationoption.duration=10.0;// 动画时间_animationoption.fromvalue=0.0;_animationoption.tovalue=1.0;_animationoption.easingcurve=bmktraceoverlayanimationeasingcurvelinear;_animationoption.trackmove=no;// 是否跟踪轨迹动画(地图跟随移动)_animationoption.pointmove=yes;bmktrace3dmodeloption*option =[[bmktrace3dmodeloption alloc] init];option.scale=5;option.modelname= @"scenes";option.rotatex=90;option.rotatey=-90;option.type=bmk3dmodeltypegltf;option.modelyawaxis=bmktraceoverlay3dmodelyawaxisy;option.modelpath=[nsstring stringwithformat:@"%@/model3d",[nsbundle mainbundle].bundlepath];option.animationisenable=yes;option.animationspeed=1;option.animationrepeatcount=0;option.animationindex=1;_animationoption.modeloption= option;}return _animationoption;}
#pragma mark -<bmkmapviewdelegate>-(__kindof bmkoverlayview*)mapview:(bmkmapview*)mapview viewforoverlay:(id<bmkoverlay>)overlay {if([overlay iskindofclass:[bmktraceoverlayclass]]){bmktraceoverlayview*polylineview =[[bmktraceoverlayview alloc] initwithtraceoverlay:overlay];/// 纯色// polylineview.strokecolor = [uicolor bluecolor];// polylineview.fillcolor = [uicolor bluecolor];/// 渐变色颜色/// 注意:strokecolors 长度与轨迹点的个数必须保持一致polylineview.strokecolors=[_colors copy];polylineview.linewidth=8.0;return polylineview;}return nil;}
效果如下:
上一篇
下一篇
本篇文章对您是否有帮助?