管灌系统巡查员智能手机App
zuoxiao
2024-10-21 c9f622302bbc5a9a30cff341200334c3dd23ffe0
app/src/main/assets/js/map.js
@@ -31,6 +31,9 @@
        var lay = new T.TileLayer(imageURL, { minZoom: 1, maxZoom: 18 });
        var config = { layers: [lay] };
        map = new T.Map("mapDiv", config);
        var scale = new T.Control.Scale();
        //添加比例尺控件
        map.addControl(scale);
        map.centerAndZoom(new T.LngLat(116.40769, 39.89945), zoom); //地图的初始化中心点,此为北京的经纬度
        map.addEventListener("click", closeWaterIntakeDetail);
    }
@@ -131,21 +134,21 @@
    // 手机获取到定位后显示定位
    function locationOverLay(lng, lag) {
        console.log("function》》》》》locationOverLay");
        map.centerAndZoom(new T.LngLat(lng, lag), 18);
        map.centerAndZoom(new T.LngLat(lng, lag), map.getZoom());
        let icon = new T.Icon({
            iconUrl: locationIMGPath,
            iconSize: new T.Point(27, 27),
            iconAnchor: new T.Point(10, 25)
        });
        let marker = new T.Marker(new T.LngLat(lng, lag), { icon: icon });
        map.addOverLay(marker);
    }
    //设置地图中心点
    function setCenterAndZoom(lng, lat) {
    function setCenterAndZoom(lng, lat,thiszoom) {
    zoom=thiszoom;
        console.log("function》》》》》setCenterAndZoom>>>>lng:" + lng + ",lat:" + lat);
        map.centerAndZoom(new T.LngLat(lng, lat), zoom);
    }