| | |
| | | window.showToast = showToast; |
| | | window.addMarker = addMarker; |
| | | window.setCenterAndZoom = setCenterAndZoom; |
| | | window.updateLocation=updateLocation; |
| | | } |
| | | |
| | | // 调用原生安卓方法显示取水口详情 |
| | |
| | | position: marker.getLngLat(), |
| | | offset: new T.Point(-35, 8), // 设置标注文字的位置 |
| | | opacity: 1, // 设置文本的显示不透明度(范围0-1) |
| | | }); |
| | | }); |
| | | label.setBorderLine(0); // 设置文本的边框线宽 |
| | | label.setBackgroundColor("transparent"); // 设置文本的背景色(透明色) |
| | | label.setFontColor("#0000FF"); |
| | |
| | | }); |
| | | return "addMarker加载成功" |
| | | } |
| | | //保存定位坐标生成轨迹 |
| | | var path=[]; |
| | | var lineLayer = new T.Polyline([], { color: '#ff4500', weight: 3, opacity: 0.8 }); |
| | | |
| | | function updateLocation(log,lat){ |
| | | var lastLat=lat; |
| | | // const intervalId = setInterval(() => { |
| | | // lastLat=lastLat+0.0001; |
| | | var newPoint = new T.LngLat(log,lastLat); |
| | | path.push(newPoint); |
| | | lineLayer.setLngLats(path); |
| | | map.addOverLay(lineLayer); |
| | | // 移动地图视角到最后一个位置 |
| | | map.panTo(newPoint); |
| | | // }, 500); |
| | | |
| | | } |
| | | |
| | | |
| | | })(); |
| | | |