You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
949 B
41 lines
949 B
1 year ago
|
//弹出提示
|
||
|
const popup = L.popup();
|
||
|
// .setLatLng([39.92, 116.46])
|
||
|
// .setContent('I am a standalone popup.');
|
||
|
// .openOn(map);
|
||
|
|
||
|
function onMapClick(e) {
|
||
|
// popup
|
||
|
// .setLatLng(e.latlng)
|
||
|
// .setContent(`You clicked the map at ${e.latlng.toString()}`)
|
||
|
// .openOn(map);
|
||
|
L.marker(e.latlng).addTo(map).bindPopup('<b>' + e.latlng + '</b>').openPopup();
|
||
|
routes.push(e.latlng);
|
||
|
// current = lines.push(L.polyline(routes, { color: 'red' }).addTo(map).bindPopup("这是折线"));
|
||
|
// map.removeLayer(last);
|
||
|
// last = current;
|
||
|
if(lines.length>0)
|
||
|
{
|
||
|
map.removeLayer(lines[0]);
|
||
|
// lines.shift();
|
||
|
}
|
||
|
|
||
|
lines.push(L.polyline(routes, { color: 'red' }).addTo(map).bindPopup("这是折线"));
|
||
|
}
|
||
|
|
||
|
|
||
|
function printInformation(information) {
|
||
|
alert(information);
|
||
|
}
|
||
|
|
||
|
function clearOneLine(a)
|
||
|
{
|
||
|
map.removeLayer(lines[a]);
|
||
|
// lines.pop();
|
||
|
}
|
||
|
|
||
|
// function addOnePoint(lng, lat)
|
||
|
// {
|
||
|
|
||
|
// }
|