2010-12-15 23:14:59 +08:00
|
|
|
(function() {
|
2011-01-13 18:17:50 +08:00
|
|
|
//TODO replace script list with the one from ../buid/deps.js
|
2010-12-15 23:14:59 +08:00
|
|
|
var scripts = [
|
|
|
|
'Leaflet.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
|
|
|
'core/Util.js',
|
2010-12-15 23:14:59 +08:00
|
|
|
'core/Class.js',
|
|
|
|
'core/Events.js',
|
|
|
|
'core/Browser.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2010-12-16 00:41:35 +08:00
|
|
|
'geometry/Point.js',
|
|
|
|
'geometry/Bounds.js',
|
|
|
|
'geometry/Transformation.js',
|
2011-02-26 01:01:29 +08:00
|
|
|
'geometry/LineUtil.js',
|
2011-03-01 23:41:33 +08:00
|
|
|
'geometry/PolyUtil.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2010-12-15 23:14:59 +08:00
|
|
|
'dom/DomEvent.js',
|
2011-04-12 21:53:07 +08:00
|
|
|
'dom/DomEvent.DoubleTap.js',
|
2010-12-15 23:14:59 +08:00
|
|
|
'dom/DomUtil.js',
|
|
|
|
'dom/Draggable.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2012-08-10 23:37:21 +08:00
|
|
|
'dom/PosAnimation.js',
|
|
|
|
'dom/PosAnimation.Timer.js',
|
|
|
|
// 'dom/transition/Transition.js',
|
|
|
|
// 'dom/transition/Transition.Native.js',
|
|
|
|
// 'dom/transition/Transition.Timer.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2010-12-15 23:14:59 +08:00
|
|
|
'geo/LatLng.js',
|
|
|
|
'geo/LatLngBounds.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-05-31 17:36:05 +08:00
|
|
|
'geo/projection/Projection.js',
|
|
|
|
'geo/projection/Projection.SphericalMercator.js',
|
|
|
|
'geo/projection/Projection.LonLat.js',
|
|
|
|
'geo/projection/Projection.Mercator.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-05-31 17:36:05 +08:00
|
|
|
'geo/crs/CRS.js',
|
|
|
|
'geo/crs/CRS.EPSG3857.js',
|
|
|
|
'geo/crs/CRS.EPSG4326.js',
|
|
|
|
'geo/crs/CRS.EPSG3395.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-10-21 22:50:59 +08:00
|
|
|
'map/Map.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-10-21 22:50:59 +08:00
|
|
|
'map/ext/Map.Geolocation.js',
|
|
|
|
'map/ext/Map.Popup.js',
|
|
|
|
'map/ext/Map.Control.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
|
|
|
'map/anim/Map.PanAnimation.js',
|
|
|
|
'map/anim/Map.ZoomAnimation.js',
|
|
|
|
|
|
|
|
'core/Handler.js',
|
|
|
|
'map/handler/Map.Drag.js',
|
|
|
|
'map/handler/Map.TouchZoom.js',
|
|
|
|
'map/handler/Map.DoubleClickZoom.js',
|
|
|
|
'map/handler/Map.ScrollWheelZoom.js',
|
|
|
|
'map/handler/Map.BoxZoom.js',
|
2012-07-27 20:10:17 +08:00
|
|
|
'map/handler/Map.Keyboard.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-06-10 17:38:24 +08:00
|
|
|
'layer/LayerGroup.js',
|
|
|
|
'layer/FeatureGroup.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-05-28 01:20:54 +08:00
|
|
|
'layer/tile/TileLayer.js',
|
|
|
|
'layer/tile/TileLayer.WMS.js',
|
|
|
|
'layer/tile/TileLayer.Canvas.js',
|
2010-12-15 23:14:59 +08:00
|
|
|
'layer/ImageOverlay.js',
|
2010-12-16 01:55:57 +08:00
|
|
|
'layer/Popup.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-01-21 17:55:08 +08:00
|
|
|
'layer/marker/Icon.js',
|
2012-07-18 18:55:49 +08:00
|
|
|
'layer/marker/Icon.Default.js',
|
2012-02-16 19:00:45 +08:00
|
|
|
'layer/marker/DivIcon.js',
|
2011-01-21 17:55:08 +08:00
|
|
|
'layer/marker/Marker.js',
|
|
|
|
'layer/marker/Marker.Popup.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
'layer/marker/Marker.Drag.js',
|
|
|
|
|
2011-02-26 01:01:29 +08:00
|
|
|
'layer/vector/Path.js',
|
2011-06-21 22:58:26 +08:00
|
|
|
'layer/vector/Path.Popup.js',
|
2011-06-21 21:19:55 +08:00
|
|
|
'layer/vector/Path.SVG.js',
|
2011-02-28 22:14:32 +08:00
|
|
|
'layer/vector/Path.VML.js',
|
2011-06-21 19:05:51 +08:00
|
|
|
'layer/vector/canvas/Path.Canvas.js',
|
2011-02-26 01:01:29 +08:00
|
|
|
'layer/vector/Polyline.js',
|
2012-02-16 20:15:47 +08:00
|
|
|
'layer/vector/Polyline.Edit.js',
|
2011-06-21 19:05:51 +08:00
|
|
|
'layer/vector/canvas/Polyline.Canvas.js',
|
2011-03-01 16:26:42 +08:00
|
|
|
'layer/vector/Polygon.js',
|
2012-02-17 14:36:46 +08:00
|
|
|
'layer/vector/Rectangle.js',
|
2011-06-21 19:05:51 +08:00
|
|
|
'layer/vector/canvas/Polygon.Canvas.js',
|
2011-06-10 17:45:34 +08:00
|
|
|
'layer/vector/MultiPoly.js',
|
2011-03-01 23:41:33 +08:00
|
|
|
'layer/vector/Circle.js',
|
2011-06-21 19:05:51 +08:00
|
|
|
'layer/vector/canvas/Circle.Canvas.js',
|
2011-05-19 21:36:25 +08:00
|
|
|
'layer/vector/CircleMarker.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-06-10 19:26:16 +08:00
|
|
|
'layer/GeoJSON.js',
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-04-11 20:49:15 +08:00
|
|
|
'control/Control.js',
|
|
|
|
'control/Control.Zoom.js',
|
2011-04-14 23:48:14 +08:00
|
|
|
'control/Control.Attribution.js',
|
2011-07-13 01:19:29 +08:00
|
|
|
'control/Control.Layers.js',
|
2012-02-25 23:04:27 +08:00
|
|
|
'control/Control.Scale.js'
|
2010-12-15 23:14:59 +08:00
|
|
|
];
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-06-02 22:07:56 +08:00
|
|
|
function getSrcUrl() {
|
|
|
|
var scripts = document.getElementsByTagName('script');
|
|
|
|
for (var i = 0; i < scripts.length; i++) {
|
|
|
|
var src = scripts[i].src;
|
|
|
|
if (src) {
|
|
|
|
var res = src.match(/^(.*)leaflet-include\.js$/);
|
2011-06-03 16:45:07 +08:00
|
|
|
if (res) {
|
2011-06-02 22:07:56 +08:00
|
|
|
return res[1] + '../src/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-06-02 22:07:56 +08:00
|
|
|
var path = getSrcUrl();
|
2012-05-16 20:34:36 +08:00
|
|
|
for (var i = 0; i < scripts.length; i++) {
|
2012-05-10 22:03:50 +08:00
|
|
|
document.writeln("<script src='" + path + scripts[i] + "'></script>");
|
2010-12-15 23:14:59 +08:00
|
|
|
}
|
2012-08-07 23:43:52 +08:00
|
|
|
document.writeln('<script defer>L.Icon.Default.imagePath = "' + path + '../dist/images";</script>');
|
2011-06-20 16:15:53 +08:00
|
|
|
})();
|
2011-08-11 19:30:46 +08:00
|
|
|
|
|
|
|
function getRandomLatLng(map) {
|
|
|
|
var bounds = map.getBounds(),
|
|
|
|
southWest = bounds.getSouthWest(),
|
|
|
|
northEast = bounds.getNorthEast(),
|
|
|
|
lngSpan = northEast.lng - southWest.lng,
|
|
|
|
latSpan = northEast.lat - southWest.lat;
|
2011-12-14 19:12:54 +08:00
|
|
|
|
2011-08-11 19:30:46 +08:00
|
|
|
return new L.LatLng(
|
|
|
|
southWest.lat + latSpan * Math.random(),
|
|
|
|
southWest.lng + lngSpan * Math.random());
|
2011-12-14 19:12:54 +08:00
|
|
|
}
|