leaflet-js 0.7.9 → 0.8.dev2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +0 -10
- data/Rakefile +3 -3
- data/leaflet-js.gemspec +7 -13
- data/lib/leaflet-js.rb +10 -2
- data/lib/leaflet.draw/BREAKINGCHANGES.md +54 -0
- data/lib/leaflet.draw/CHANGELOG.md +130 -0
- data/lib/leaflet.draw/Jakefile.js +48 -0
- data/lib/leaflet.draw/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.draw/README.md +427 -0
- data/lib/leaflet.draw/TODO.md +62 -0
- data/lib/leaflet.draw/build/build.html +243 -0
- data/lib/leaflet.draw/build/build.js +187 -0
- data/lib/leaflet.draw/build/deps.js +76 -0
- data/lib/leaflet.draw/build/hintrc.js +39 -0
- data/lib/leaflet.draw/build/leaflet.draw-include.js +42 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet-2x.png +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/dist/images/spritesheet.png +0 -0
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +2872 -0
- data/lib/leaflet.draw/dist/leaflet.draw.css +295 -0
- data/lib/leaflet.draw/dist/leaflet.draw.js +10 -0
- data/lib/leaflet.draw/examples/basic.html +113 -0
- data/lib/leaflet.draw/examples/edithandlers.html +66 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers-2x.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/layers.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon-2x.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-icon.png +0 -0
- data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
- data/{vendor/assets/Leaflet/dist → lib/leaflet.draw/examples/libs}/images/marker-shadow.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +9191 -0
- data/{vendor/assets/leaflet.css.erb → lib/leaflet.draw/examples/libs/leaflet.css} +2 -2
- data/lib/leaflet.draw/package.json +40 -0
- data/lib/leaflet.draw/spec/after.js +2 -0
- data/lib/leaflet.draw/spec/before.js +3 -0
- data/lib/leaflet.draw/spec/expect.js +1253 -0
- data/lib/leaflet.draw/spec/happen.js +93 -0
- data/lib/leaflet.draw/spec/index.html +38 -0
- data/lib/leaflet.draw/spec/karma.conf.js +72 -0
- data/lib/leaflet.draw/spec/sinon.js +4223 -0
- data/lib/leaflet.draw/spec/spec.hintrc.js +25 -0
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +14 -0
- data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +25 -0
- data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +11 -0
- data/lib/leaflet.draw/spec/suites/SpecHelper.js +28 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Control.Draw.js +9 -9
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Leaflet.draw.js +1 -2
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Toolbar.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/Tooltip.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/copyright.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/DrawToolbar.js +0 -4
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Circle.js +1 -1
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Feature.js +2 -2
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Marker.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polygon.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Polyline.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.Rectangle.js +1 -19
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/draw/handler/Draw.SimpleShape.js +1 -7
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/EditToolbar.js +2 -9
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Circle.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Poly.js +2 -14
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.Rectangle.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/Edit.SimpleShape.js +3 -11
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Delete.js +1 -4
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/edit/handler/EditToolbar.Edit.js +83 -17
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/GeometryUtil.js +1 -1
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LatLngUtil.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/LineUtil.Intersect.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polygon.Intersect.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/ext/Polyline.Intersect.js +0 -0
- data/{vendor/assets/Leaflet.draw → lib/leaflet.draw}/src/images/spritesheet.svg +0 -0
- data/lib/leaflet.label/CHANGELOG.md +67 -0
- data/lib/leaflet.label/Jakefile.js +21 -0
- data/lib/leaflet.label/MIT-LICENCE.txt +20 -0
- data/lib/leaflet.label/README.md +103 -0
- data/lib/leaflet.label/build/build.js +155 -0
- data/lib/leaflet.label/build/deps.js +26 -0
- data/lib/leaflet.label/build/hint.js +30 -0
- data/lib/leaflet.label/build/hintrc.js +51 -0
- data/lib/leaflet.label/dist/images/death.png +0 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +542 -0
- data/{vendor/assets → lib/leaflet.label/dist}/leaflet.label.css +0 -0
- data/lib/leaflet.label/dist/leaflet.label.js +9 -0
- data/lib/leaflet.label/example/label.html +85 -0
- data/lib/leaflet.label/libs/leaflet/images/layers-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/layers.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon-2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.label/libs/leaflet/images/marker-shadow.png +0 -0
- data/lib/leaflet.label/libs/leaflet/leaflet-src.js +9108 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.css +478 -0
- data/lib/leaflet.label/libs/leaflet/leaflet.js +9 -0
- data/lib/leaflet.label/package.json +19 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/BaseMarkerMethods.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/CircleMarker.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/FeatureGroup.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Label.js +2 -5
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Leaflet.label.js +1 -1
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Map.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Marker.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/Path.Label.js +0 -0
- data/{vendor/assets/Leaflet.label → lib/leaflet.label}/src/copyright.js +0 -0
- data/lib/leaflet/CHANGELOG.md +1007 -0
- data/lib/leaflet/CONTRIBUTING.md +155 -0
- data/lib/leaflet/FAQ.md +138 -0
- data/lib/leaflet/Jakefile.js +56 -0
- data/lib/leaflet/LICENSE +23 -0
- data/lib/leaflet/PLUGIN-GUIDE.md +127 -0
- data/lib/leaflet/README.md +34 -0
- data/lib/leaflet/build/build.html +227 -0
- data/lib/leaflet/build/build.js +190 -0
- data/lib/leaflet/build/deps.js +258 -0
- data/lib/leaflet/build/hintrc.js +40 -0
- data/lib/leaflet/debug/css/mobile.css +6 -0
- data/lib/leaflet/debug/css/screen.css +5 -0
- data/lib/leaflet/debug/hacks/jitter.html +42 -0
- data/lib/leaflet/debug/leaflet-include.js +59 -0
- data/lib/leaflet/debug/map/canvas.html +49 -0
- data/lib/leaflet/debug/map/controls.html +49 -0
- data/lib/leaflet/debug/map/geolocation.html +34 -0
- data/lib/leaflet/debug/map/grid.html +45 -0
- data/lib/leaflet/debug/map/iframe.html +11 -0
- data/lib/leaflet/debug/map/image-overlay.html +43 -0
- data/lib/leaflet/debug/map/map-mobile.html +34 -0
- data/lib/leaflet/debug/map/map.html +61 -0
- data/lib/leaflet/debug/map/max-bounds.html +38 -0
- data/lib/leaflet/debug/map/opacity.html +223 -0
- data/lib/leaflet/debug/map/scroll.html +41 -0
- data/lib/leaflet/debug/map/simple-proj.html +59 -0
- data/lib/leaflet/debug/map/wms-marble.html +30 -0
- data/lib/leaflet/debug/map/wms.html +40 -0
- data/lib/leaflet/debug/map/zoomlevels.html +45 -0
- data/lib/leaflet/debug/tests/add_remove_layers.html +87 -0
- data/lib/leaflet/debug/tests/bringtoback.html +37 -0
- data/lib/leaflet/debug/tests/canvasloop.html +47 -0
- data/lib/leaflet/debug/tests/click_on_canvas.html +58 -0
- data/lib/leaflet/debug/tests/click_on_canvas_broken.html +49 -0
- data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +61 -0
- data/lib/leaflet/debug/tests/opacity.html +56 -0
- data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +59 -0
- data/lib/leaflet/debug/tests/remove_while_dragging.html +28 -0
- data/lib/leaflet/debug/tests/removetilewhilepan.html +41 -0
- data/lib/leaflet/debug/tests/reuse_popups.html +40 -0
- data/lib/leaflet/debug/tests/rtl.html +42 -0
- data/lib/leaflet/debug/tests/rtl2.html +27 -0
- data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +43 -0
- data/lib/leaflet/debug/tests/svg_clicks.html +54 -0
- data/lib/leaflet/debug/vector/bounds-extend.html +88 -0
- data/lib/leaflet/debug/vector/feature-group-bounds.html +90 -0
- data/lib/leaflet/debug/vector/geojson-sample.js +53 -0
- data/lib/leaflet/debug/vector/geojson.html +173 -0
- data/lib/leaflet/debug/vector/rectangle.html +53 -0
- data/lib/leaflet/debug/vector/route.js +1 -0
- data/lib/leaflet/debug/vector/touchzoomemu.html +194 -0
- data/lib/leaflet/debug/vector/us-states.js +54 -0
- data/lib/leaflet/debug/vector/vector-bounds.html +69 -0
- data/lib/leaflet/debug/vector/vector-canvas.html +92 -0
- data/lib/leaflet/debug/vector/vector-mobile.html +38 -0
- data/lib/leaflet/debug/vector/vector-simple.html +47 -0
- data/lib/leaflet/debug/vector/vector.html +37 -0
- data/lib/leaflet/debug/vector/vector2.html +58 -0
- data/lib/leaflet/dist/images/layers-2x.png +0 -0
- data/lib/leaflet/dist/images/layers.png +0 -0
- data/lib/leaflet/dist/images/marker-icon-2x.png +0 -0
- data/lib/leaflet/dist/images/marker-icon.png +0 -0
- data/lib/leaflet/dist/images/marker-shadow.png +0 -0
- data/lib/leaflet/dist/leaflet.css +494 -0
- data/lib/leaflet/package.json +28 -0
- data/lib/leaflet/spec/after.js +2 -0
- data/lib/leaflet/spec/expect.js +1253 -0
- data/lib/leaflet/spec/index.html +87 -0
- data/lib/leaflet/spec/karma.conf.js +68 -0
- data/lib/leaflet/spec/sinon.js +4223 -0
- data/lib/leaflet/spec/spec.hintrc.js +25 -0
- data/lib/leaflet/spec/suites/SpecHelper.js +42 -0
- data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +68 -0
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +67 -0
- data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +6 -0
- data/lib/leaflet/spec/suites/core/ClassSpec.js +166 -0
- data/lib/leaflet/spec/suites/core/EventsSpec.js +416 -0
- data/lib/leaflet/spec/suites/core/UtilSpec.js +237 -0
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +102 -0
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +59 -0
- data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +27 -0
- data/lib/leaflet/spec/suites/geo/CRSSpec.js +151 -0
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +144 -0
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +102 -0
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +96 -0
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +87 -0
- data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +75 -0
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +104 -0
- data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +27 -0
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +31 -0
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +86 -0
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +282 -0
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +71 -0
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +119 -0
- data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +117 -0
- data/lib/leaflet/spec/suites/layer/tile/GridLayerSpec.js +70 -0
- data/lib/leaflet/spec/suites/layer/tile/TileLayerSpec.js +88 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +53 -0
- data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +18 -0
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +96 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +35 -0
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +55 -0
- data/lib/leaflet/spec/suites/map/MapSpec.js +553 -0
- data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +38 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/Leaflet.js +16 -11
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Attribution.js +1 -23
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Layers.js +42 -57
- data/lib/leaflet/src/control/Control.Scale.js +102 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.Zoom.js +11 -18
- data/{vendor/assets/Leaflet → lib/leaflet}/src/control/Control.js +7 -9
- data/lib/leaflet/src/copyright.js +4 -0
- data/lib/leaflet/src/core/Browser.js +65 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Class.js +8 -13
- data/lib/leaflet/src/core/Events.js +226 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/core/Handler.js +0 -0
- data/lib/leaflet/src/core/Util.js +196 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.DoubleTap.js +20 -27
- data/lib/leaflet/src/dom/DomEvent.Pointer.js +107 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/DomEvent.js +70 -59
- data/lib/leaflet/src/dom/DomUtil.js +213 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/Draggable.js +10 -19
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.Timer.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/dom/PosAnimation.js +4 -3
- data/lib/leaflet/src/geo/LatLng.js +67 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/LatLngBounds.js +0 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3395.js +13 -0
- data/lib/leaflet/src/geo/crs/CRS.EPSG3857.js +17 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.EPSG4326.js +2 -3
- data/lib/leaflet/src/geo/crs/CRS.Earth.js +19 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/crs/CRS.Simple.js +10 -1
- data/lib/leaflet/src/geo/crs/CRS.js +63 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geo/projection/Projection.LonLat.js +5 -1
- data/lib/leaflet/src/geo/projection/Projection.Mercator.js +43 -0
- data/lib/leaflet/src/geo/projection/Projection.SphericalMercator.js +31 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Bounds.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/LineUtil.js +16 -5
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Point.js +10 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/PolyUtil.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/geometry/Transformation.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/images/layers.svg +0 -0
- data/lib/leaflet/src/images/logo.svg +85 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/images/marker.svg +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/FeatureGroup.js +3 -20
- data/lib/leaflet/src/layer/GeoJSON.js +275 -0
- data/lib/leaflet/src/layer/ImageOverlay.js +123 -0
- data/lib/leaflet/src/layer/Layer.Popup.js +87 -0
- data/lib/leaflet/src/layer/Layer.js +150 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/LayerGroup.js +12 -14
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/Popup.js +65 -83
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/DivIcon.js +3 -8
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.Default.js +6 -12
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Icon.js +8 -25
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.Drag.js +13 -11
- data/lib/leaflet/src/layer/marker/Marker.Popup.js +16 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/marker/Marker.js +52 -103
- data/lib/leaflet/src/layer/tile/GridLayer.js +536 -0
- data/lib/leaflet/src/layer/tile/TileLayer.WMS.js +79 -0
- data/lib/leaflet/src/layer/tile/TileLayer.js +148 -0
- data/lib/leaflet/src/layer/vector/Canvas.js +292 -0
- data/lib/leaflet/src/layer/vector/Circle.js +67 -0
- data/lib/leaflet/src/layer/vector/CircleMarker.js +72 -0
- data/lib/leaflet/src/layer/vector/Path.js +79 -0
- data/lib/leaflet/src/layer/vector/Polygon.js +75 -0
- data/lib/leaflet/src/layer/vector/Polyline.js +223 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/layer/vector/Rectangle.js +27 -27
- data/lib/leaflet/src/layer/vector/Renderer.js +75 -0
- data/lib/leaflet/src/layer/vector/SVG.VML.js +134 -0
- data/lib/leaflet/src/layer/vector/SVG.js +189 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/Map.js +83 -199
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.PanAnimation.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/anim/Map.ZoomAnimation.js +30 -38
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/ext/Map.Geolocation.js +8 -8
- data/lib/leaflet/src/map/handler/Map.BoxZoom.js +105 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.DoubleClickZoom.js +0 -0
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Drag.js +12 -10
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Keyboard.js +19 -17
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.ScrollWheelZoom.js +10 -6
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.Tap.js +8 -6
- data/{vendor/assets/Leaflet → lib/leaflet}/src/map/handler/Map.TouchZoom.js +16 -32
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/images/spritesheet-2x.png +0 -0
- data/vendor/assets/images/spritesheet.png +0 -0
- data/vendor/assets/{leaflet-js.js → javascripts/leaflet-js.js} +2 -2
- data/vendor/assets/javascripts/leaflet.draw.js +37 -0
- data/vendor/assets/javascripts/leaflet.js +149 -0
- data/vendor/assets/javascripts/leaflet.label.js +11 -0
- data/vendor/assets/{leaflet-js.css → stylesheets/leaflet-js.css} +0 -0
- data/vendor/assets/stylesheets/leaflet.css.erb +478 -0
- data/vendor/assets/{leaflet.draw.css.erb → stylesheets/leaflet.draw.css.erb} +2 -2
- data/vendor/assets/{leaflet.draw.ie.css → stylesheets/leaflet.draw.ie.css} +0 -0
- data/vendor/assets/stylesheets/leaflet.label.css +52 -0
- metadata +298 -137
- data/lib/leaflet-js/engine.rb +0 -7
- data/lib/leaflet-js/version.rb +0 -3
- data/vendor/assets/Leaflet.draw/src/edit/handler/Edit.Marker.js +0 -75
- data/vendor/assets/Leaflet/src/control/Control.Scale.js +0 -112
- data/vendor/assets/Leaflet/src/copyright.js +0 -5
- data/vendor/assets/Leaflet/src/core/Browser.js +0 -66
- data/vendor/assets/Leaflet/src/core/Events.js +0 -178
- data/vendor/assets/Leaflet/src/core/Util.js +0 -182
- data/vendor/assets/Leaflet/src/dom/DomEvent.Pointer.js +0 -156
- data/vendor/assets/Leaflet/src/dom/DomUtil.js +0 -289
- data/vendor/assets/Leaflet/src/geo/LatLng.js +0 -99
- data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3395.js +0 -14
- data/vendor/assets/Leaflet/src/geo/crs/CRS.EPSG3857.js +0 -21
- data/vendor/assets/Leaflet/src/geo/crs/CRS.js +0 -32
- data/vendor/assets/Leaflet/src/geo/projection/Projection.Mercator.js +0 -56
- data/vendor/assets/Leaflet/src/geo/projection/Projection.SphericalMercator.js +0 -27
- data/vendor/assets/Leaflet/src/geo/projection/Projection.js +0 -5
- data/vendor/assets/Leaflet/src/layer/GeoJSON.js +0 -286
- data/vendor/assets/Leaflet/src/layer/ImageOverlay.js +0 -141
- data/vendor/assets/Leaflet/src/layer/marker/Marker.Popup.js +0 -90
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Anim.js +0 -110
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.Canvas.js +0 -61
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.WMS.js +0 -87
- data/vendor/assets/Leaflet/src/layer/tile/TileLayer.js +0 -597
- data/vendor/assets/Leaflet/src/layer/vector/Circle.js +0 -98
- data/vendor/assets/Leaflet/src/layer/vector/CircleMarker.js +0 -45
- data/vendor/assets/Leaflet/src/layer/vector/MultiPoly.js +0 -57
- data/vendor/assets/Leaflet/src/layer/vector/Path.Popup.js +0 -65
- data/vendor/assets/Leaflet/src/layer/vector/Path.SVG.js +0 -230
- data/vendor/assets/Leaflet/src/layer/vector/Path.VML.js +0 -135
- data/vendor/assets/Leaflet/src/layer/vector/Path.js +0 -119
- data/vendor/assets/Leaflet/src/layer/vector/Polygon.js +0 -92
- data/vendor/assets/Leaflet/src/layer/vector/Polyline.js +0 -164
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Circle.Canvas.js +0 -18
- data/vendor/assets/Leaflet/src/layer/vector/canvas/CircleMarker.Canvas.js +0 -9
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Path.Canvas.js +0 -204
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Polygon.Canvas.js +0 -37
- data/vendor/assets/Leaflet/src/layer/vector/canvas/Polyline.Canvas.js +0 -30
- data/vendor/assets/Leaflet/src/map/handler/Map.BoxZoom.js +0 -118
- data/vendor/assets/leaflet.draw.js +0 -38
- data/vendor/assets/leaflet.js +0 -155
- data/vendor/assets/leaflet.label.js +0 -11
@@ -0,0 +1,104 @@
|
|
1
|
+
describe("Point", function () {
|
2
|
+
|
3
|
+
describe('constructor', function () {
|
4
|
+
|
5
|
+
it("creates a point with the given x and y", function () {
|
6
|
+
var p = new L.Point(1.5, 2.5);
|
7
|
+
expect(p.x).to.eql(1.5);
|
8
|
+
expect(p.y).to.eql(2.5);
|
9
|
+
});
|
10
|
+
|
11
|
+
it("rounds the given x and y if the third argument is true", function () {
|
12
|
+
var p = new L.Point(1.3, 2.7, true);
|
13
|
+
expect(p.x).to.eql(1);
|
14
|
+
expect(p.y).to.eql(3);
|
15
|
+
});
|
16
|
+
});
|
17
|
+
|
18
|
+
describe('#subtract', function () {
|
19
|
+
it('subtracts the given point from this one', function () {
|
20
|
+
var a = new L.Point(50, 30),
|
21
|
+
b = new L.Point(20, 10);
|
22
|
+
expect(a.subtract(b)).to.eql(new L.Point(30, 20));
|
23
|
+
});
|
24
|
+
});
|
25
|
+
|
26
|
+
describe('#add', function () {
|
27
|
+
it('adds given point to this one', function () {
|
28
|
+
expect(new L.Point(50, 30).add(new L.Point(20, 10))).to.eql(new L.Point(70, 40));
|
29
|
+
});
|
30
|
+
});
|
31
|
+
|
32
|
+
describe('#divideBy', function () {
|
33
|
+
it('divides this point by the given amount', function () {
|
34
|
+
expect(new L.Point(50, 30).divideBy(5)).to.eql(new L.Point(10, 6));
|
35
|
+
});
|
36
|
+
});
|
37
|
+
|
38
|
+
describe('#multiplyBy', function () {
|
39
|
+
it('multiplies this point by the given amount', function () {
|
40
|
+
expect(new L.Point(50, 30).multiplyBy(2)).to.eql(new L.Point(100, 60));
|
41
|
+
});
|
42
|
+
});
|
43
|
+
|
44
|
+
describe('#floor', function () {
|
45
|
+
it('returns a new point with floored coordinates', function () {
|
46
|
+
expect(new L.Point(50.56, 30.123).floor()).to.eql(new L.Point(50, 30));
|
47
|
+
});
|
48
|
+
});
|
49
|
+
|
50
|
+
describe('#distanceTo', function () {
|
51
|
+
it('calculates distance between two points', function () {
|
52
|
+
var p1 = new L.Point(0, 30);
|
53
|
+
var p2 = new L.Point(40, 0);
|
54
|
+
expect(p1.distanceTo(p2)).to.eql(50.0);
|
55
|
+
});
|
56
|
+
});
|
57
|
+
|
58
|
+
describe('#equals', function () {
|
59
|
+
it('returns true if points are equal', function () {
|
60
|
+
var p1 = new L.Point(20.4, 50.12);
|
61
|
+
var p2 = new L.Point(20.4, 50.12);
|
62
|
+
var p3 = new L.Point(20.5, 50.13);
|
63
|
+
|
64
|
+
expect(p1.equals(p2)).to.be(true);
|
65
|
+
expect(p1.equals(p3)).to.be(false);
|
66
|
+
});
|
67
|
+
});
|
68
|
+
|
69
|
+
describe('#contains', function () {
|
70
|
+
it('returns true if the point is bigger in absolute dimensions than the passed one', function () {
|
71
|
+
var p1 = new L.Point(50, 30),
|
72
|
+
p2 = new L.Point(-40, 20),
|
73
|
+
p3 = new L.Point(60, -20),
|
74
|
+
p4 = new L.Point(-40, -40);
|
75
|
+
|
76
|
+
expect(p1.contains(p2)).to.be(true);
|
77
|
+
expect(p1.contains(p3)).to.be(false);
|
78
|
+
expect(p1.contains(p4)).to.be(false);
|
79
|
+
});
|
80
|
+
});
|
81
|
+
|
82
|
+
describe('#toString', function () {
|
83
|
+
it('formats a string out of point coordinates', function () {
|
84
|
+
expect(new L.Point(50, 30) + '').to.eql('Point(50, 30)');
|
85
|
+
});
|
86
|
+
});
|
87
|
+
|
88
|
+
describe('L.point factory', function () {
|
89
|
+
it('leaves L.Point instances as is', function () {
|
90
|
+
var p = new L.Point(50, 30);
|
91
|
+
expect(L.point(p)).to.be(p);
|
92
|
+
});
|
93
|
+
it('creates a point out of three arguments', function () {
|
94
|
+
expect(L.point(50.1, 30.1, true)).to.eql(new L.Point(50, 30));
|
95
|
+
});
|
96
|
+
it('creates a point from an array of coordinates', function () {
|
97
|
+
expect(L.point([50, 30])).to.eql(new L.Point(50, 30));
|
98
|
+
});
|
99
|
+
it('does not fail on invalid arguments', function () {
|
100
|
+
expect(L.point(undefined)).to.be(undefined);
|
101
|
+
expect(L.point(null)).to.be(null);
|
102
|
+
});
|
103
|
+
});
|
104
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe('PolyUtil', function () {
|
2
|
+
|
3
|
+
describe('#clipPolygon', function () {
|
4
|
+
it('clips polygon by bounds', function () {
|
5
|
+
var bounds = L.bounds([0, 0], [10, 10]);
|
6
|
+
|
7
|
+
var points = [
|
8
|
+
new L.Point(5, 5),
|
9
|
+
new L.Point(15, 10),
|
10
|
+
new L.Point(10, 15)
|
11
|
+
];
|
12
|
+
|
13
|
+
var clipped = L.PolyUtil.clipPolygon(points, bounds);
|
14
|
+
|
15
|
+
for (var i = 0, len = clipped.length; i < len; i++) {
|
16
|
+
delete clipped[i]._code;
|
17
|
+
}
|
18
|
+
|
19
|
+
expect(clipped).to.eql([
|
20
|
+
new L.Point(8, 10),
|
21
|
+
new L.Point(5, 5),
|
22
|
+
new L.Point(10, 8),
|
23
|
+
new L.Point(10, 10)
|
24
|
+
]);
|
25
|
+
});
|
26
|
+
});
|
27
|
+
});
|
@@ -0,0 +1,31 @@
|
|
1
|
+
describe("Transformation", function () {
|
2
|
+
var t, p;
|
3
|
+
|
4
|
+
beforeEach(function () {
|
5
|
+
t = new L.Transformation(1, 2, 3, 4);
|
6
|
+
p = new L.Point(10, 20);
|
7
|
+
});
|
8
|
+
|
9
|
+
describe('#transform', function () {
|
10
|
+
it("performs a transformation", function () {
|
11
|
+
var p2 = t.transform(p, 2);
|
12
|
+
expect(p2).to.eql(new L.Point(24, 128));
|
13
|
+
});
|
14
|
+
it('assumes a scale of 1 if not specified', function () {
|
15
|
+
var p2 = t.transform(p);
|
16
|
+
expect(p2).to.eql(new L.Point(12, 64));
|
17
|
+
});
|
18
|
+
});
|
19
|
+
|
20
|
+
describe('#untransform', function () {
|
21
|
+
it("performs a reverse transformation", function () {
|
22
|
+
var p2 = t.transform(p, 2);
|
23
|
+
var p3 = t.untransform(p2, 2);
|
24
|
+
expect(p3).to.eql(p);
|
25
|
+
});
|
26
|
+
it('assumes a scale of 1 if not specified', function () {
|
27
|
+
var p2 = t.transform(p);
|
28
|
+
expect(t.untransform(new L.Point(12, 64))).to.eql(new L.Point(10, 20));
|
29
|
+
});
|
30
|
+
});
|
31
|
+
});
|
@@ -0,0 +1,86 @@
|
|
1
|
+
describe('FeatureGroup', function () {
|
2
|
+
var map;
|
3
|
+
beforeEach(function () {
|
4
|
+
map = L.map(document.createElement('div'));
|
5
|
+
map.setView([0, 0], 1);
|
6
|
+
});
|
7
|
+
describe("#_propagateEvent", function () {
|
8
|
+
var marker;
|
9
|
+
beforeEach(function () {
|
10
|
+
marker = L.marker([0, 0]);
|
11
|
+
});
|
12
|
+
describe("when a Marker is added to multiple FeatureGroups ", function () {
|
13
|
+
it("e.layer should be the Marker", function () {
|
14
|
+
var fg1 = L.featureGroup(),
|
15
|
+
fg2 = L.featureGroup();
|
16
|
+
|
17
|
+
fg1.addLayer(marker);
|
18
|
+
fg2.addLayer(marker);
|
19
|
+
|
20
|
+
var wasClicked1,
|
21
|
+
wasClicked2;
|
22
|
+
|
23
|
+
fg2.on('click', function (e) {
|
24
|
+
expect(e.layer).to.be(marker);
|
25
|
+
expect(e.target).to.be(fg2);
|
26
|
+
wasClicked2 = true;
|
27
|
+
});
|
28
|
+
|
29
|
+
fg1.on('click', function (e) {
|
30
|
+
expect(e.layer).to.be(marker);
|
31
|
+
expect(e.target).to.be(fg1);
|
32
|
+
wasClicked1 = true;
|
33
|
+
});
|
34
|
+
|
35
|
+
marker.fire('click', {type: 'click'}, true);
|
36
|
+
|
37
|
+
expect(wasClicked1).to.be(true);
|
38
|
+
expect(wasClicked2).to.be(true);
|
39
|
+
});
|
40
|
+
});
|
41
|
+
});
|
42
|
+
describe('addLayer', function () {
|
43
|
+
it('adds the layer', function () {
|
44
|
+
var fg = L.featureGroup(),
|
45
|
+
marker = L.marker([0, 0]);
|
46
|
+
|
47
|
+
expect(fg.hasLayer(marker)).to.be(false);
|
48
|
+
|
49
|
+
fg.addLayer(marker);
|
50
|
+
|
51
|
+
expect(fg.hasLayer(marker)).to.be(true);
|
52
|
+
});
|
53
|
+
it('supports non-evented layers', function () {
|
54
|
+
var fg = L.featureGroup(),
|
55
|
+
g = L.layerGroup();
|
56
|
+
|
57
|
+
expect(fg.hasLayer(g)).to.be(false);
|
58
|
+
|
59
|
+
fg.addLayer(g);
|
60
|
+
|
61
|
+
expect(fg.hasLayer(g)).to.be(true);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
describe('removeLayer', function () {
|
65
|
+
it('removes the layer passed to it', function () {
|
66
|
+
var fg = L.featureGroup(),
|
67
|
+
marker = L.marker([0, 0]);
|
68
|
+
|
69
|
+
fg.addLayer(marker);
|
70
|
+
expect(fg.hasLayer(marker)).to.be(true);
|
71
|
+
|
72
|
+
fg.removeLayer(marker);
|
73
|
+
expect(fg.hasLayer(marker)).to.be(false);
|
74
|
+
});
|
75
|
+
it('removes the layer passed to it by id', function () {
|
76
|
+
var fg = L.featureGroup(),
|
77
|
+
marker = L.marker([0, 0]);
|
78
|
+
|
79
|
+
fg.addLayer(marker);
|
80
|
+
expect(fg.hasLayer(marker)).to.be(true);
|
81
|
+
|
82
|
+
fg.removeLayer(L.stamp(marker));
|
83
|
+
expect(fg.hasLayer(marker)).to.be(false);
|
84
|
+
});
|
85
|
+
});
|
86
|
+
});
|
@@ -0,0 +1,282 @@
|
|
1
|
+
describe("L.GeoJSON", function () {
|
2
|
+
describe("addData", function () {
|
3
|
+
var geoJSON = {
|
4
|
+
type: 'Feature',
|
5
|
+
properties: {},
|
6
|
+
geometry: {
|
7
|
+
type: 'Point',
|
8
|
+
coordinates: [20, 10, 5]
|
9
|
+
}
|
10
|
+
};
|
11
|
+
|
12
|
+
it("sets feature property on member layers", function () {
|
13
|
+
var layer = new L.GeoJSON();
|
14
|
+
layer.addData(geoJSON);
|
15
|
+
expect(layer.getLayers()[0].feature).to.eql(geoJSON);
|
16
|
+
});
|
17
|
+
|
18
|
+
it("normalizes a geometry to a Feature", function () {
|
19
|
+
var layer = new L.GeoJSON();
|
20
|
+
layer.addData(geoJSON.geometry);
|
21
|
+
expect(layer.getLayers()[0].feature).to.eql(geoJSON);
|
22
|
+
});
|
23
|
+
});
|
24
|
+
});
|
25
|
+
|
26
|
+
describe("L.Marker#toGeoJSON", function () {
|
27
|
+
it("returns a 2D Point object", function () {
|
28
|
+
var marker = new L.Marker([10, 20]);
|
29
|
+
expect(marker.toGeoJSON().geometry).to.eql({
|
30
|
+
type: 'Point',
|
31
|
+
coordinates: [20, 10]
|
32
|
+
});
|
33
|
+
});
|
34
|
+
|
35
|
+
it("returns a 3D Point object", function () {
|
36
|
+
var marker = new L.Marker([10, 20, 30]);
|
37
|
+
expect(marker.toGeoJSON().geometry).to.eql({
|
38
|
+
type: 'Point',
|
39
|
+
coordinates: [20, 10, 30]
|
40
|
+
});
|
41
|
+
});
|
42
|
+
});
|
43
|
+
|
44
|
+
describe("L.Circle#toGeoJSON", function () {
|
45
|
+
it("returns a 2D Point object", function () {
|
46
|
+
var circle = new L.Circle([10, 20], 100);
|
47
|
+
expect(circle.toGeoJSON().geometry).to.eql({
|
48
|
+
type: 'Point',
|
49
|
+
coordinates: [20, 10]
|
50
|
+
});
|
51
|
+
});
|
52
|
+
|
53
|
+
it("returns a 3D Point object", function () {
|
54
|
+
var circle = new L.Circle([10, 20, 30], 100);
|
55
|
+
expect(circle.toGeoJSON().geometry).to.eql({
|
56
|
+
type: 'Point',
|
57
|
+
coordinates: [20, 10, 30]
|
58
|
+
});
|
59
|
+
});
|
60
|
+
});
|
61
|
+
|
62
|
+
describe("L.CircleMarker#toGeoJSON", function () {
|
63
|
+
it("returns a 2D Point object", function () {
|
64
|
+
var marker = new L.CircleMarker([10, 20]);
|
65
|
+
expect(marker.toGeoJSON().geometry).to.eql({
|
66
|
+
type: 'Point',
|
67
|
+
coordinates: [20, 10]
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
it("returns a 3D Point object", function () {
|
72
|
+
var marker = new L.CircleMarker([10, 20, 30]);
|
73
|
+
expect(marker.toGeoJSON().geometry).to.eql({
|
74
|
+
type: 'Point',
|
75
|
+
coordinates: [20, 10, 30]
|
76
|
+
});
|
77
|
+
});
|
78
|
+
});
|
79
|
+
|
80
|
+
describe("L.Polyline#toGeoJSON", function () {
|
81
|
+
it("returns a 2D LineString object", function () {
|
82
|
+
var polyline = new L.Polyline([[10, 20], [2, 5]]);
|
83
|
+
expect(polyline.toGeoJSON().geometry).to.eql({
|
84
|
+
type: 'LineString',
|
85
|
+
coordinates: [[20, 10], [5, 2]]
|
86
|
+
});
|
87
|
+
});
|
88
|
+
|
89
|
+
it("returns a 3D LineString object", function () {
|
90
|
+
var polyline = new L.Polyline([[10, 20, 30], [2, 5, 10]]);
|
91
|
+
expect(polyline.toGeoJSON().geometry).to.eql({
|
92
|
+
type: 'LineString',
|
93
|
+
coordinates: [[20, 10, 30], [5, 2, 10]]
|
94
|
+
});
|
95
|
+
});
|
96
|
+
});
|
97
|
+
|
98
|
+
describe("L.Polyline (multi) #toGeoJSON", function () {
|
99
|
+
it("returns a 2D MultiLineString object", function () {
|
100
|
+
var multiPolyline = new L.Polyline([[[10, 20], [2, 5]], [[1, 2], [3, 4]]]);
|
101
|
+
expect(multiPolyline.toGeoJSON().geometry).to.eql({
|
102
|
+
type: 'MultiLineString',
|
103
|
+
coordinates: [
|
104
|
+
[[20, 10], [5, 2]],
|
105
|
+
[[2, 1], [4, 3]]
|
106
|
+
]
|
107
|
+
});
|
108
|
+
});
|
109
|
+
|
110
|
+
it("returns a 3D MultiLineString object", function () {
|
111
|
+
var multiPolyline = new L.Polyline([[[10, 20, 30], [2, 5, 10]], [[1, 2, 3], [4, 5, 6]]]);
|
112
|
+
expect(multiPolyline.toGeoJSON().geometry).to.eql({
|
113
|
+
type: 'MultiLineString',
|
114
|
+
coordinates: [
|
115
|
+
[[20, 10, 30], [5, 2, 10]],
|
116
|
+
[[2, 1, 3], [5, 4, 6]]
|
117
|
+
]
|
118
|
+
});
|
119
|
+
});
|
120
|
+
});
|
121
|
+
|
122
|
+
describe("L.Polygon#toGeoJSON", function () {
|
123
|
+
it("returns a 2D Polygon object (no holes)", function () {
|
124
|
+
var polygon = new L.Polygon([[1, 2], [3, 4], [5, 6]]);
|
125
|
+
expect(polygon.toGeoJSON().geometry).to.eql({
|
126
|
+
type: 'Polygon',
|
127
|
+
coordinates: [[[2, 1], [4, 3], [6, 5], [2, 1]]]
|
128
|
+
});
|
129
|
+
});
|
130
|
+
|
131
|
+
it("returns a 3D Polygon object (no holes)", function () {
|
132
|
+
var polygon = new L.Polygon([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
|
133
|
+
expect(polygon.toGeoJSON().geometry).to.eql({
|
134
|
+
type: 'Polygon',
|
135
|
+
coordinates: [[[2, 1, 3], [5, 4, 6], [8, 7, 9], [2, 1, 3]]]
|
136
|
+
});
|
137
|
+
});
|
138
|
+
|
139
|
+
it("returns a 2D Polygon object (with holes)", function () {
|
140
|
+
var polygon = new L.Polygon([[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]]);
|
141
|
+
expect(polygon.toGeoJSON().geometry).to.eql({
|
142
|
+
type: 'Polygon',
|
143
|
+
coordinates: [
|
144
|
+
[[2, 1], [4, 3], [6, 5], [2, 1]],
|
145
|
+
[[8, 7], [10, 9], [12, 11], [8, 7]]
|
146
|
+
]
|
147
|
+
});
|
148
|
+
});
|
149
|
+
|
150
|
+
it("returns a 3D Polygon object (with holes)", function () {
|
151
|
+
var polygon = new L.Polygon([[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[10, 11, 12], [13, 14, 15], [16, 17, 18]]]);
|
152
|
+
expect(polygon.toGeoJSON().geometry).to.eql({
|
153
|
+
type: 'Polygon',
|
154
|
+
coordinates: [
|
155
|
+
[[2, 1, 3], [5, 4, 6], [8, 7, 9], [2, 1, 3]],
|
156
|
+
[[11, 10, 12], [14, 13, 15], [17, 16, 18], [11, 10, 12]]
|
157
|
+
]
|
158
|
+
});
|
159
|
+
});
|
160
|
+
});
|
161
|
+
|
162
|
+
describe("L.Polygon (multi) #toGeoJSON", function () {
|
163
|
+
it("returns a 2D MultiPolygon object", function () {
|
164
|
+
var multiPolygon = new L.Polygon([[[1, 2], [3, 4], [5, 6]]]);
|
165
|
+
expect(multiPolygon.toGeoJSON().geometry).to.eql({
|
166
|
+
type: 'MultiPolygon',
|
167
|
+
coordinates: [
|
168
|
+
[[[2, 1], [4, 3], [6, 5], [2, 1]]]
|
169
|
+
]
|
170
|
+
});
|
171
|
+
});
|
172
|
+
|
173
|
+
it("returns a 3D MultiPolygon object", function () {
|
174
|
+
var multiPolygon = new L.Polygon([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]);
|
175
|
+
expect(multiPolygon.toGeoJSON().geometry).to.eql({
|
176
|
+
type: 'MultiPolygon',
|
177
|
+
coordinates: [
|
178
|
+
[[[2, 1, 3], [5, 4, 6], [8, 7, 9], [2, 1, 3]]]
|
179
|
+
]
|
180
|
+
});
|
181
|
+
});
|
182
|
+
});
|
183
|
+
|
184
|
+
describe("L.LayerGroup#toGeoJSON", function () {
|
185
|
+
it("returns a 2D FeatureCollection object", function () {
|
186
|
+
var marker = new L.Marker([10, 20]),
|
187
|
+
polyline = new L.Polyline([[10, 20], [2, 5]]),
|
188
|
+
layerGroup = new L.LayerGroup([marker, polyline]);
|
189
|
+
expect(layerGroup.toGeoJSON()).to.eql({
|
190
|
+
type: 'FeatureCollection',
|
191
|
+
features: [marker.toGeoJSON(), polyline.toGeoJSON()]
|
192
|
+
});
|
193
|
+
});
|
194
|
+
|
195
|
+
it("returns a 3D FeatureCollection object", function () {
|
196
|
+
var marker = new L.Marker([10, 20, 30]),
|
197
|
+
polyline = new L.Polyline([[10, 20, 30], [2, 5, 10]]),
|
198
|
+
layerGroup = new L.LayerGroup([marker, polyline]);
|
199
|
+
expect(layerGroup.toGeoJSON()).to.eql({
|
200
|
+
type: 'FeatureCollection',
|
201
|
+
features: [marker.toGeoJSON(), polyline.toGeoJSON()]
|
202
|
+
});
|
203
|
+
});
|
204
|
+
|
205
|
+
it("ensures that every member is a Feature", function () {
|
206
|
+
var tileLayer = new L.TileLayer(),
|
207
|
+
layerGroup = new L.LayerGroup([tileLayer]);
|
208
|
+
|
209
|
+
tileLayer.toGeoJSON = function () {
|
210
|
+
return {
|
211
|
+
type: 'Point',
|
212
|
+
coordinates: [20, 10]
|
213
|
+
};
|
214
|
+
};
|
215
|
+
|
216
|
+
expect(layerGroup.toGeoJSON()).to.eql({
|
217
|
+
type: 'FeatureCollection',
|
218
|
+
features: [{
|
219
|
+
type: 'Feature',
|
220
|
+
properties: {},
|
221
|
+
geometry: {
|
222
|
+
type: 'Point',
|
223
|
+
coordinates: [20, 10]
|
224
|
+
}
|
225
|
+
}]
|
226
|
+
});
|
227
|
+
});
|
228
|
+
|
229
|
+
it('roundtrips GeometryCollection features', function () {
|
230
|
+
var json = {
|
231
|
+
"type": "FeatureCollection",
|
232
|
+
"features": [{
|
233
|
+
"type": "Feature",
|
234
|
+
"geometry": {
|
235
|
+
"type": "GeometryCollection",
|
236
|
+
"geometries": [{
|
237
|
+
"type": "LineString",
|
238
|
+
"coordinates": [[-122.4425587930444, 37.80666418607323], [-122.4428379594768, 37.80663578323093]]
|
239
|
+
}, {
|
240
|
+
"type": "LineString",
|
241
|
+
"coordinates": [
|
242
|
+
[-122.4425509770566, 37.80662588061205],
|
243
|
+
[-122.4428340530617, 37.8065999493009]
|
244
|
+
]
|
245
|
+
}]
|
246
|
+
},
|
247
|
+
"properties": {
|
248
|
+
"name": "SF Marina Harbor Master"
|
249
|
+
}
|
250
|
+
}]
|
251
|
+
};
|
252
|
+
|
253
|
+
expect(L.geoJson(json).toGeoJSON()).to.eql(json);
|
254
|
+
});
|
255
|
+
|
256
|
+
it('roundtrips MiltiPoint features', function () {
|
257
|
+
var json = {
|
258
|
+
"type": "FeatureCollection",
|
259
|
+
"features": [{
|
260
|
+
"type": "Feature",
|
261
|
+
"geometry": {
|
262
|
+
"type": "MultiPoint",
|
263
|
+
"coordinates": [[-122.4425587930444, 37.80666418607323], [-122.4428379594768, 37.80663578323093]]
|
264
|
+
},
|
265
|
+
"properties": {
|
266
|
+
"name": "Test MultiPoints"
|
267
|
+
}
|
268
|
+
}]
|
269
|
+
};
|
270
|
+
|
271
|
+
expect(L.geoJson(json).toGeoJSON()).to.eql(json);
|
272
|
+
});
|
273
|
+
|
274
|
+
it("omits layers which do not implement toGeoJSON", function () {
|
275
|
+
var tileLayer = new L.TileLayer(),
|
276
|
+
layerGroup = new L.LayerGroup([tileLayer]);
|
277
|
+
expect(layerGroup.toGeoJSON()).to.eql({
|
278
|
+
type: 'FeatureCollection',
|
279
|
+
features: []
|
280
|
+
});
|
281
|
+
});
|
282
|
+
});
|