|  |  |  | 
|---|
|  |  |  | 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=[]; | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | })(); | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.dayu.pipirrapp.utils.SharedPreferencesHelper; | 
|---|
|  |  |  | import com.dayu.pipirrapp.utils.ToastUtil; | 
|---|
|  |  |  | import com.dayu.pipirrapp.utils.WebViewUtils; | 
|---|
|  |  |  | import com.dayu.pipirrapp.view.ConfirmDialog; | 
|---|
|  |  |  | import com.jeremyliao.liveeventbus.LiveEventBus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.File; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onChanged(Object o) { | 
|---|
|  |  |  | LatLonBean latLonBean = (LatLonBean) o; | 
|---|
|  |  |  | mWebView.evaluateJavascript("javascript:locationOverLay(\"" + latLonBean.getLongitude() + "\",\"" + latLonBean.getLatitude() + "\")", value -> { | 
|---|
|  |  |  | mWebView.evaluateJavascript("javascript:updateLocation(\"" +  latLonBean.getLatitude()+ "\",\"" +  latLonBean.getLongitude()+ "\")", value -> { | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | //巡检按钮 | 
|---|
|  |  |  | binding.inspectButton.setOnClickListener(v -> { | 
|---|
|  |  |  | isStartInspec = !isStartInspec; | 
|---|
|  |  |  | chageInspecState(); | 
|---|
|  |  |  | if (isStartInspec){ | 
|---|
|  |  |  | ConfirmDialog confirmDialog=new ConfirmDialog(MapFragment.this.getActivity(), "提示", "确认关闭巡检吗?", new View.OnClickListener() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onClick(View v) { | 
|---|
|  |  |  | isStartInspec = !isStartInspec; | 
|---|
|  |  |  | chageInspecState(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | isStartInspec = !isStartInspec; | 
|---|
|  |  |  | chageInspecState(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|