管灌系统巡查员智能手机App
zuoxiao
2024-11-13 e7df063a027c0f066317da4437d01cf3f3bc8d31
app/src/main/assets/js/map.js
@@ -166,6 +166,7 @@
        window.showToast = showToast;
        window.addMarker = addMarker;
        window.setCenterAndZoom = setCenterAndZoom;
        window.updateLocation=updateLocation;
    }
    // 调用原生安卓方法显示取水口详情
@@ -268,6 +269,21 @@
        });
        return "addMarker加载成功"
    }
    //保存定位坐标生成轨迹
    var path=[];
    function updateLocation(lat,log){
        var newPoint = new T.LatLng(latitude, longitude);
        path.push(newPoint);
        var polyline = new T.Polyline({
            path: path,  // 轨迹坐标
            strokeColor: "#FF0000",  // 轨迹颜色
            strokeWeight: 6,  // 轨迹线宽
            strokeOpacity: 0.7  // 轨迹透明度
        });
        map.addOverlay(polyline);
         // 移动地图视角到最后一个位置
         map.panTo(newPoint);
    }
})();