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',
|
|
|
|
|
|
|
|
'core/Util.js',
|
|
|
|
'core/Class.js',
|
|
|
|
'core/Events.js',
|
|
|
|
'core/Browser.js',
|
|
|
|
|
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',
|
2010-12-16 00:41:35 +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',
|
|
|
|
|
|
|
|
'dom/transition/Transition.js',
|
|
|
|
'dom/transition/Transition.Native.js',
|
|
|
|
'dom/transition/Transition.Timer.js',
|
|
|
|
|
|
|
|
'geo/LatLng.js',
|
|
|
|
'geo/LatLngBounds.js',
|
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',
|
|
|
|
|
|
|
|
'geo/crs/CRS.js',
|
|
|
|
'geo/crs/CRS.EPSG3857.js',
|
|
|
|
'geo/crs/CRS.EPSG4326.js',
|
|
|
|
'geo/crs/CRS.EPSG3395.js',
|
2010-12-15 23:14:59 +08:00
|
|
|
|
2011-06-10 17:38:24 +08:00
|
|
|
'layer/LayerGroup.js',
|
|
|
|
'layer/FeatureGroup.js',
|
|
|
|
|
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-02-26 01:01:29 +08:00
|
|
|
|
2011-01-21 17:55:08 +08:00
|
|
|
'layer/marker/Icon.js',
|
|
|
|
'layer/marker/Marker.js',
|
|
|
|
'layer/marker/Marker.Popup.js',
|
2010-12-15 23:14:59 +08:00
|
|
|
|
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',
|
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',
|
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-02-26 01:01:29 +08:00
|
|
|
|
2011-06-10 19:26:16 +08:00
|
|
|
'layer/GeoJSON.js',
|
|
|
|
|
2010-12-15 23:14:59 +08:00
|
|
|
'handler/Handler.js',
|
|
|
|
'handler/MapDrag.js',
|
|
|
|
'handler/TouchZoom.js',
|
|
|
|
'handler/DoubleClickZoom.js',
|
|
|
|
'handler/ScrollWheelZoom.js',
|
2011-03-22 01:09:43 +08:00
|
|
|
'handler/ShiftDragZoom.js',
|
2011-04-12 04:43:23 +08:00
|
|
|
'handler/MarkerDrag.js',
|
2010-12-15 23:14:59 +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',
|
2011-04-11 20:49:15 +08:00
|
|
|
|
2010-12-15 23:14:59 +08:00
|
|
|
'map/Map.js',
|
2011-01-21 17:55:08 +08:00
|
|
|
'map/ext/Map.Geolocation.js',
|
|
|
|
'map/ext/Map.Popup.js',
|
|
|
|
'map/ext/Map.PanAnimation.js',
|
2011-04-11 20:49:15 +08:00
|
|
|
'map/ext/Map.ZoomAnimation.js',
|
|
|
|
'map/ext/Map.Control.js'
|
2010-12-15 23:14:59 +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/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var path = getSrcUrl();
|
2010-12-15 23:14:59 +08:00
|
|
|
for (var i = 0; i < scripts.length; i++) {
|
2011-06-01 21:07:40 +08:00
|
|
|
document.writeln("<script type='text/javascript' src='" + path + "../src/" + scripts[i] + "'></script>");
|
2010-12-15 23:14:59 +08:00
|
|
|
}
|
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;
|
|
|
|
|
|
|
|
return new L.LatLng(
|
|
|
|
southWest.lat + latSpan * Math.random(),
|
|
|
|
southWest.lng + lngSpan * Math.random());
|
|
|
|
}
|