自v7.6.1版本起,android地图sdk支持在地图上展示3d动态轨迹。添加3d动态轨迹请参考bmtrackoptions类
代码如下:
参数选项:
/*** 设置轨迹线的类型* @param tracktype* @return*/publicoverlayoptionssettracktype(bmtracktype tracktype)/*** 设置轨迹线的高度* 注:高度必须 >= 0,否则不绘制 单位:米* @param mheights*/publicoverlayoptionssetheights(int[] mheights)/*** 设置轨迹点数组* @param tracelocation* @return*/publicoverlayoptionssetpoints(list<latlng> tracelocation)/*** 设置轨迹线描边的宽度* @param width* @return*/publicoverlayoptionssetwidth(int width)/*** 设置轨迹动画的状态监听* @param mtraceanimationlistener* @return*/publicoverlayoptionssettraceanimationlistener(traceanimationlistener mtraceanimationlistener)/*** 设置轨迹颜色的取色图片* @param palette*/publicoverlayoptionssetpalette(bitmapdescriptor palette)/*** 设置3d轨迹底部描边的取色图片* 注:不设置 只绘制带高度的3d轨迹* @param palette*/publicoverlayoptionssetprojectionpalette(bitmapdescriptor palette)/*** 设置3d轨迹的不透明度(0.f ~ 1.f)* @param opacity*/publicoverlayoptionssetopacity(float opacity)/*** 设置3d轨迹描边的不透明度(0.f ~ 1.f)* @param mpaletteopacity*/publicoverlayoptionssetpaletteopacity(float mpaletteopacity)
示例:
bmtrackoptions trackoptions =newbmtrackoptions();trackoptions.settracktype(bmtracktype.surface);trackoptions.setpoints(points);trackoptions.setheights(heights);trackoptions.setpalette(mpalette);trackoptions.setpaletteopacity(0.3f);trackoptions.setprojectionpalette(mprojectionpalette);trackoptions.setwidth(10);trackoptions.setanimationtime(5000);privatetraceanimationlistener mtraceanimationlistener =newtraceanimationlistener(){@overridepublicvoidontraceanimationupdate(int percent){log.i(tag,"ontraceanimationupdate : " percent);}@overridepublicvoidontraceupdateposition(latlng position){log.i(tag,"ontraceupdateposition : " position.tostring());}@overridepublicvoidontraceanimationfinish(){log.i(tag,"traceanimationfinish");}};trackoptions.settraceanimationlistener(mtraceanimationlistener);trackoptions.setanimatetype(bmtrackoptions.bmtrackanimatetype.traceoverlayanimationeasingcurvelinear);track track =(track)mbaidumap.addoverlay(trackoptions);
效果:
trackoptions.settracktype(bmtracktype.surface);
效果:
trackoptions.settracktype(bmtracktype.default3d);
上一篇
下一篇
本篇文章对您是否有帮助?