| | |
| | | mh_query_show: true, |
| | | |
| | | ZBCXresult: null, |
| | | |
| | | LXdhEnd: null, |
| | | LxdhLine: null, |
| | | |
| | | move: null, //存放移动实例 |
| | | |
| | |
| | | $("#mh_query").append(html); |
| | | } |
| | | |
| | | //添加景点li点击事件,地图定位 |
| | | //添加li点击事件,地图定位 |
| | | $('#mh_query li').click(function() { |
| | | |
| | | var ids = $(this).attr("id"); |
| | |
| | | xy.push(resdata[i][0]); |
| | | data.push(xy); |
| | | } |
| | | |
| | | if(that.LXdhEnd != null){ |
| | | that.map.removeLayer(that.LXdhEnd); |
| | | } |
| | | if(that.LxdhLine != null){ |
| | | that.map.removeLayer(that.LxdhLine); |
| | | } |
| | | |
| | | //绘制起点和终点 |
| | | var markers = L.markerClusterGroup(); |
| | | that.LXdhEnd = L.markerClusterGroup(); |
| | | |
| | | var transportIcon = L.Icon.extend({ //图标初始化 |
| | | options: { |
| | | iconSize: [30, 30], // 图标尺寸 |
| | | iconSize: [56, 32], // 图标尺寸 |
| | | } |
| | | }); |
| | | var qd = new transportIcon({ |
| | | iconUrl: './img/green.png' |
| | | }); |
| | | |
| | | var zd = new transportIcon({ |
| | | iconUrl: './img/green.png' |
| | | iconUrl: './img/zd.png' |
| | | }); |
| | | // var qd = new transportIcon({ |
| | | // iconUrl: './img/qd.png' |
| | | // }); |
| | | |
| | | var qdzb = res.data.result.query; |
| | | |
| | | markers.addLayer(L.marker([qdzb.start.x, qdzb.start.y], { |
| | | icon: qd, |
| | | })); |
| | | markers.addLayer(L.marker([qdzb.end.x, qdzb.end.y], { |
| | | |
| | | var x = resdata[resdata.length-1][0]; |
| | | var y = resdata[resdata.length-1][1]; |
| | | |
| | | that.LXdhEnd.addLayer(L.marker([y, x], { |
| | | icon: zd, |
| | | })); |
| | | that.map.addLayer(markers); |
| | | // markers.addLayer(L.marker([qdzb.start.y, qdzb.start.x], { |
| | | // icon: qd, |
| | | // })); |
| | | |
| | | that.map.addLayer(that.LXdhEnd); |
| | | |
| | | |
| | | that.showPolyLine(data); |
| | |
| | | [28.6876, 115.858], |
| | | [28.6791, 115.854] |
| | | ]; |
| | | var polyline = L.polyline(xy, { |
| | | that.LxdhLine = L.polyline(xy, { |
| | | color: 'red' |
| | | }).addTo(that.map); |
| | | |
| | | // zoom the map to the polyline |
| | | that.map.fitBounds(polyline.getBounds()) |
| | | that.map.fitBounds(that.LxdhLine.getBounds()) |
| | | }, |
| | | |
| | | }, |