管灌系统巡查员智能手机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;
    }
    // 调用原生安卓方法显示取水口详情
@@ -259,7 +260,7 @@
                position: marker.getLngLat(),
                offset: new T.Point(-35, 8), // 设置标注文字的位置
                opacity: 1, // 设置文本的显示不透明度(范围0-1)
            });
                    });
            label.setBorderLine(0); // 设置文本的边框线宽
            label.setBackgroundColor("transparent"); // 设置文本的背景色(透明色)
            label.setFontColor("#0000FF");
@@ -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);
    }
})();