Tag: 折线

谷歌地图Android api v2折线长度

我正在尝试找到android maps api v2方法,它将决定我在移动时创建的折线的长度。 我会把它放在onLocationChanged()中以进行持续更新。 任何人都知道方法是什么以及地图api将显示长度的单位? Polyline line = map.addPolyline(new PolylineOptions()); public void onLocationChanged(Location location) { line.add(new LatLng(location.getLatitude(), location.getLongitude()) .width(5) .color(Color.RED)); }

谷歌地图v2 – 绘制不同颜色的路线 – Android

我正在构建一个基于位置的Android应用程序,我想根据他的速度绘制用户需要的路线。 例如:0-10kmh – 黄色折线10-20kmh – 红色折线 现在我在后台服务中运行所有内容并更新Map Activity; 定位服务 : if (location.getSpeed() >0 && location.getSpeed 10 && location.getSpeed < 20) { redPolyLineArray.add(new LatLng(location.getLatitude(), location.getLongitude())); polylineIntent.putParcelableArrayListExtra("red",redPolyLineArray); } 这一切都是在onLocationChanged方法中完成的,每次用户移动时,我都会使用本地广播接收器发送数组列表来映射活动: private BroadcastReceiver mDrawRouteRec = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //Receiver array of yellowspeed polylines yellowPolyline = intent.getParcelableArrayListExtra(“yellow”); if(yellowPolyline != null){ //Implement polyline […]