2011-08-11 19:30:46 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Leaflet debug page</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../../dist/leaflet.css" />
|
|
|
|
<!--[if lte IE 8]><link rel="stylesheet" href="../../dist/leaflet.ie.css" /><![endif]-->
|
2012-02-16 19:00:45 +08:00
|
|
|
|
2011-08-11 19:30:46 +08:00
|
|
|
<link rel="stylesheet" href="../css/screen.css" />
|
2012-02-16 19:00:45 +08:00
|
|
|
|
2011-08-11 19:30:46 +08:00
|
|
|
<script src="../leaflet-include.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="map" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
|
|
|
|
|
|
|
|
<script src="route.js"></script>
|
|
|
|
<script>
|
|
|
|
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
|
|
|
|
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
|
2012-02-17 00:11:17 +08:00
|
|
|
map = new L.Map('map', {layers: [cloudmade], center: new L.LatLng(51.505, -0.04), zoom: 13});
|
2012-02-16 19:00:45 +08:00
|
|
|
|
|
|
|
|
2012-02-17 00:11:17 +08:00
|
|
|
var polygon = new L.Polygon([
|
|
|
|
new L.LatLng(51.51, -0.1),
|
|
|
|
new L.LatLng(51.5, -0.06),
|
|
|
|
new L.LatLng(51.52, -0.03)
|
|
|
|
]);
|
2012-02-16 19:00:45 +08:00
|
|
|
|
2012-02-21 21:28:11 +08:00
|
|
|
polygon.editing.enable();
|
|
|
|
|
2012-02-17 00:11:17 +08:00
|
|
|
map.addLayer(polygon);
|
2012-02-16 19:00:45 +08:00
|
|
|
|
2012-02-17 00:11:17 +08:00
|
|
|
var polyline = new L.Polyline([
|
|
|
|
new L.LatLng(51.49, -0.02),
|
|
|
|
new L.LatLng(51.51, 0),
|
|
|
|
new L.LatLng(51.52, -0.02)
|
|
|
|
]);
|
2012-02-16 20:15:47 +08:00
|
|
|
|
2012-02-21 21:28:11 +08:00
|
|
|
polyline.editing.enable();
|
|
|
|
|
2012-02-17 00:11:17 +08:00
|
|
|
map.addLayer(polyline);
|
|
|
|
|
2012-02-23 01:40:10 +08:00
|
|
|
polygon.on('edit', function() {
|
|
|
|
console.log('Polygon was edited!');
|
|
|
|
});
|
|
|
|
polyline.on('edit', function() {
|
|
|
|
console.log('Polyline was edited!');
|
|
|
|
});
|
2011-08-11 19:30:46 +08:00
|
|
|
</script>
|
|
|
|
</body>
|
2012-02-16 19:00:45 +08:00
|
|
|
</html>
|