leaflet-js 0.7.0.4 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +10 -3
- data/Rakefile +3 -3
- data/leaflet-js.gemspec +13 -7
- data/lib/leaflet-js.rb +2 -10
- data/lib/leaflet-js/engine.rb +7 -0
- data/lib/leaflet-js/version.rb +3 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/dist/images/spritesheet-2x.png +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/dist/images/spritesheet.png +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Control.Draw.js +21 -19
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Leaflet.draw.js +8 -3
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Toolbar.js +75 -14
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/Tooltip.js +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/copyright.js +0 -0
- data/vendor/assets/Leaflet.draw/src/draw/DrawToolbar.js +87 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Circle.js +2 -3
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Feature.js +4 -4
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Marker.js +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Polygon.js +9 -7
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Polyline.js +86 -36
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.Rectangle.js +19 -1
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/draw/handler/Draw.SimpleShape.js +18 -4
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/EditToolbar.js +34 -43
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.Circle.js +0 -0
- data/vendor/assets/Leaflet.draw/src/edit/handler/Edit.Marker.js +75 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.Poly.js +16 -2
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.Rectangle.js +3 -3
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/Edit.SimpleShape.js +13 -3
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/EditToolbar.Delete.js +11 -7
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/edit/handler/EditToolbar.Edit.js +26 -94
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/GeometryUtil.js +3 -3
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/LatLngUtil.js +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/LineUtil.Intersect.js +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/Polygon.Intersect.js +0 -0
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/ext/Polyline.Intersect.js +3 -3
- data/{lib/leaflet.draw → vendor/assets/Leaflet.draw}/src/images/spritesheet.svg +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/BaseMarkerMethods.js +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/CircleMarker.Label.js +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/FeatureGroup.Label.js +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Label.js +5 -2
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Leaflet.label.js +1 -1
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Map.Label.js +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Marker.Label.js +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/Path.Label.js +0 -0
- data/{lib/leaflet.label → vendor/assets/Leaflet.label}/src/copyright.js +0 -0
- data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/layers-2x.png +0 -0
- data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/layers.png +0 -0
- data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/marker-icon-2x.png +0 -0
- data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/marker-icon.png +0 -0
- data/{lib/leaflet.draw/examples/libs → vendor/assets/Leaflet/dist}/images/marker-shadow.png +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/Leaflet.js +1 -1
- data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Attribution.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Layers.js +2 -2
- data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Scale.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.Zoom.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/control/Control.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/copyright.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Browser.js +5 -36
- data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Class.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Events.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Handler.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/core/Util.js +9 -14
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomEvent.DoubleTap.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomEvent.Pointer.js +3 -2
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomEvent.js +7 -18
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/DomUtil.js +0 -5
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/Draggable.js +10 -4
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/PosAnimation.Timer.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/dom/PosAnimation.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/LatLng.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/LatLngBounds.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.EPSG3395.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.EPSG3857.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.EPSG4326.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.Simple.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/crs/CRS.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.LonLat.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.Mercator.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.SphericalMercator.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geo/projection/Projection.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/Bounds.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/LineUtil.js +1 -1
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/Point.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/PolyUtil.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/geometry/Transformation.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/images/layers.svg +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/images/marker.svg +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/FeatureGroup.js +5 -3
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/GeoJSON.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/ImageOverlay.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/LayerGroup.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/Popup.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/DivIcon.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Icon.Default.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Icon.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Marker.Drag.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Marker.Popup.js +1 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/marker/Marker.js +2 -4
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.Anim.js +5 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.Canvas.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.WMS.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/tile/TileLayer.js +3 -5
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Circle.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/CircleMarker.js +1 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/MultiPoly.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.Popup.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.SVG.js +1 -1
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.VML.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Path.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Polygon.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Polyline.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/Rectangle.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Circle.Canvas.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/CircleMarker.Canvas.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Path.Canvas.js +13 -6
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Polygon.Canvas.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/layer/vector/canvas/Polyline.Canvas.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/Map.js +9 -8
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/anim/Map.PanAnimation.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/anim/Map.ZoomAnimation.js +25 -16
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/ext/Map.Geolocation.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.BoxZoom.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.DoubleClickZoom.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.Drag.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.Keyboard.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.ScrollWheelZoom.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.Tap.js +0 -0
- data/{lib/leaflet → vendor/assets/Leaflet}/src/map/handler/Map.TouchZoom.js +1 -1
- data/vendor/assets/{stylesheets/leaflet-js.css → leaflet-js.css} +0 -0
- data/vendor/assets/{javascripts/leaflet-js.js → leaflet-js.js} +2 -2
- data/{lib/leaflet.label/libs/leaflet/leaflet.css → vendor/assets/leaflet.css.erb} +2 -2
- data/vendor/assets/{stylesheets/leaflet.draw.css.erb → leaflet.draw.css.erb} +2 -2
- data/{lib/leaflet.draw/dist → vendor/assets}/leaflet.draw.ie.css +0 -0
- data/vendor/assets/leaflet.draw.js +38 -0
- data/vendor/assets/leaflet.js +155 -0
- data/{lib/leaflet.label/dist → vendor/assets}/leaflet.label.css +0 -0
- data/vendor/assets/leaflet.label.js +11 -0
- metadata +139 -302
- data/lib/leaflet.draw/BREAKINGCHANGES.md +0 -54
- data/lib/leaflet.draw/CHANGELOG.md +0 -118
- data/lib/leaflet.draw/Jakefile.js +0 -26
- data/lib/leaflet.draw/MIT-LICENCE.txt +0 -20
- data/lib/leaflet.draw/README.md +0 -411
- data/lib/leaflet.draw/TODO.md +0 -62
- data/lib/leaflet.draw/build/build.html +0 -243
- data/lib/leaflet.draw/build/build.js +0 -189
- data/lib/leaflet.draw/build/deps.js +0 -76
- data/lib/leaflet.draw/build/hintrc.js +0 -47
- data/lib/leaflet.draw/build/leaflet.draw-include.js +0 -42
- data/lib/leaflet.draw/dist/leaflet.draw-src.js +0 -2782
- data/lib/leaflet.draw/dist/leaflet.draw.css +0 -244
- data/lib/leaflet.draw/dist/leaflet.draw.js +0 -10
- data/lib/leaflet.draw/examples/basic.html +0 -113
- data/lib/leaflet.draw/examples/edithandlers.html +0 -67
- data/lib/leaflet.draw/examples/libs/images/marker-icon@2x.png +0 -0
- data/lib/leaflet.draw/examples/libs/leaflet-src.js +0 -9108
- data/lib/leaflet.draw/examples/libs/leaflet.css +0 -478
- data/lib/leaflet.draw/package.json +0 -37
- data/lib/leaflet.draw/spec/after.js +0 -2
- data/lib/leaflet.draw/spec/before.js +0 -3
- data/lib/leaflet.draw/spec/expect.js +0 -1253
- data/lib/leaflet.draw/spec/happen.js +0 -93
- data/lib/leaflet.draw/spec/index.html +0 -36
- data/lib/leaflet.draw/spec/karma.conf.js +0 -69
- data/lib/leaflet.draw/spec/sinon.js +0 -4223
- data/lib/leaflet.draw/spec/suites/DrawControlSpec.js +0 -15
- data/lib/leaflet.draw/spec/suites/GeometryUtilSpec.js +0 -25
- data/lib/leaflet.draw/spec/suites/LatLngUtilSpec.js +0 -9
- data/lib/leaflet.draw/spec/suites/SpecHelper.js +0 -26
- data/lib/leaflet.draw/src/draw/DrawToolbar.js +0 -111
- data/lib/leaflet.label/CHANGELOG.md +0 -67
- data/lib/leaflet.label/Jakefile.js +0 -21
- data/lib/leaflet.label/MIT-LICENCE.txt +0 -20
- data/lib/leaflet.label/README.md +0 -103
- data/lib/leaflet.label/build/build.js +0 -155
- data/lib/leaflet.label/build/deps.js +0 -26
- data/lib/leaflet.label/build/hint.js +0 -30
- data/lib/leaflet.label/build/hintrc.js +0 -51
- data/lib/leaflet.label/dist/images/death.png +0 -0
- data/lib/leaflet.label/dist/leaflet.label-src.js +0 -542
- data/lib/leaflet.label/dist/leaflet.label.js +0 -9
- data/lib/leaflet.label/example/label.html +0 -85
- 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 +0 -9108
- data/lib/leaflet.label/libs/leaflet/leaflet.js +0 -9
- data/lib/leaflet.label/package.json +0 -19
- data/lib/leaflet/CHANGELOG.md +0 -905
- data/lib/leaflet/CONTRIBUTING.md +0 -155
- data/lib/leaflet/FAQ.md +0 -138
- data/lib/leaflet/Jakefile.js +0 -46
- data/lib/leaflet/LICENSE +0 -23
- data/lib/leaflet/PLUGIN-GUIDE.md +0 -127
- data/lib/leaflet/README.md +0 -34
- data/lib/leaflet/build/build.html +0 -227
- data/lib/leaflet/build/build.js +0 -163
- data/lib/leaflet/build/deps.js +0 -259
- data/lib/leaflet/build/hintrc.js +0 -39
- data/lib/leaflet/debug/css/mobile.css +0 -6
- data/lib/leaflet/debug/css/screen.css +0 -5
- data/lib/leaflet/debug/hacks/jitter.html +0 -42
- data/lib/leaflet/debug/leaflet-include.js +0 -59
- data/lib/leaflet/debug/map/canvas.html +0 -46
- data/lib/leaflet/debug/map/controls.html +0 -49
- data/lib/leaflet/debug/map/geolocation.html +0 -34
- data/lib/leaflet/debug/map/iframe.html +0 -11
- data/lib/leaflet/debug/map/image-overlay.html +0 -43
- data/lib/leaflet/debug/map/map-mobile.html +0 -34
- data/lib/leaflet/debug/map/map.html +0 -59
- data/lib/leaflet/debug/map/max-bounds.html +0 -38
- data/lib/leaflet/debug/map/opacity.html +0 -223
- data/lib/leaflet/debug/map/scroll.html +0 -41
- data/lib/leaflet/debug/map/simple-proj.html +0 -44
- data/lib/leaflet/debug/map/wms-marble.html +0 -30
- data/lib/leaflet/debug/map/wms.html +0 -40
- data/lib/leaflet/debug/map/zoomlevels.html +0 -45
- data/lib/leaflet/debug/tests/add_remove_layers.html +0 -87
- data/lib/leaflet/debug/tests/bringtoback.html +0 -37
- data/lib/leaflet/debug/tests/canvasloop.html +0 -47
- data/lib/leaflet/debug/tests/click_on_canvas.html +0 -58
- data/lib/leaflet/debug/tests/click_on_canvas_broken.html +0 -49
- data/lib/leaflet/debug/tests/dragging_and_copyworldjump.html +0 -61
- data/lib/leaflet/debug/tests/opacity.html +0 -56
- data/lib/leaflet/debug/tests/popupcontextmenuclicks.html +0 -59
- data/lib/leaflet/debug/tests/remove_while_dragging.html +0 -28
- data/lib/leaflet/debug/tests/removetilewhilepan.html +0 -41
- data/lib/leaflet/debug/tests/reuse_popups.html +0 -40
- data/lib/leaflet/debug/tests/rtl.html +0 -42
- data/lib/leaflet/debug/tests/rtl2.html +0 -27
- data/lib/leaflet/debug/tests/set_icon_reuse_dom.html +0 -43
- data/lib/leaflet/debug/tests/svg_clicks.html +0 -54
- data/lib/leaflet/debug/vector/bounds-extend.html +0 -88
- data/lib/leaflet/debug/vector/feature-group-bounds.html +0 -90
- data/lib/leaflet/debug/vector/geojson-sample.js +0 -53
- data/lib/leaflet/debug/vector/geojson.html +0 -173
- data/lib/leaflet/debug/vector/rectangle.html +0 -53
- data/lib/leaflet/debug/vector/route.js +0 -1
- data/lib/leaflet/debug/vector/touchzoomemu.html +0 -194
- data/lib/leaflet/debug/vector/us-states.js +0 -54
- data/lib/leaflet/debug/vector/vector-bounds.html +0 -69
- data/lib/leaflet/debug/vector/vector-canvas.html +0 -92
- data/lib/leaflet/debug/vector/vector-mobile.html +0 -38
- data/lib/leaflet/debug/vector/vector-simple.html +0 -48
- data/lib/leaflet/debug/vector/vector.html +0 -37
- 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 +0 -478
- data/lib/leaflet/package.json +0 -27
- data/lib/leaflet/spec/after.js +0 -2
- data/lib/leaflet/spec/before.js +0 -3
- data/lib/leaflet/spec/expect.js +0 -1253
- data/lib/leaflet/spec/index.html +0 -86
- data/lib/leaflet/spec/karma.conf.js +0 -65
- data/lib/leaflet/spec/sinon.js +0 -4223
- data/lib/leaflet/spec/spec.hintrc.js +0 -25
- data/lib/leaflet/spec/suites/LeafletSpec.js +0 -13
- data/lib/leaflet/spec/suites/SpecHelper.js +0 -42
- data/lib/leaflet/spec/suites/control/Control.AttributionSpec.js +0 -68
- data/lib/leaflet/spec/suites/control/Control.LayersSpec.js +0 -67
- data/lib/leaflet/spec/suites/control/Control.ScaleSpec.js +0 -6
- data/lib/leaflet/spec/suites/core/ClassSpec.js +0 -156
- data/lib/leaflet/spec/suites/core/EventsSpec.js +0 -392
- data/lib/leaflet/spec/suites/core/UtilSpec.js +0 -256
- data/lib/leaflet/spec/suites/dom/DomEventSpec.js +0 -102
- data/lib/leaflet/spec/suites/dom/DomUtilSpec.js +0 -82
- data/lib/leaflet/spec/suites/dom/PosAnimationSpec.js +0 -27
- data/lib/leaflet/spec/suites/geo/CRSSpec.js +0 -47
- data/lib/leaflet/spec/suites/geo/LatLngBoundsSpec.js +0 -144
- data/lib/leaflet/spec/suites/geo/LatLngSpec.js +0 -132
- data/lib/leaflet/spec/suites/geo/ProjectionSpec.js +0 -48
- data/lib/leaflet/spec/suites/geometry/BoundsSpec.js +0 -87
- data/lib/leaflet/spec/suites/geometry/LineUtilSpec.js +0 -75
- data/lib/leaflet/spec/suites/geometry/PointSpec.js +0 -104
- data/lib/leaflet/spec/suites/geometry/PolyUtilSpec.js +0 -27
- data/lib/leaflet/spec/suites/geometry/TransformationSpec.js +0 -31
- data/lib/leaflet/spec/suites/layer/FeatureGroupSpec.js +0 -86
- data/lib/leaflet/spec/suites/layer/GeoJSONSpec.js +0 -282
- data/lib/leaflet/spec/suites/layer/LayerGroupSpec.js +0 -58
- data/lib/leaflet/spec/suites/layer/PopupSpec.js +0 -119
- data/lib/leaflet/spec/suites/layer/TileLayerSpec.js +0 -88
- data/lib/leaflet/spec/suites/layer/marker/MarkerSpec.js +0 -94
- data/lib/leaflet/spec/suites/layer/vector/CircleMarkerSpec.js +0 -53
- data/lib/leaflet/spec/suites/layer/vector/CircleSpec.js +0 -17
- data/lib/leaflet/spec/suites/layer/vector/PolygonSpec.js +0 -91
- data/lib/leaflet/spec/suites/layer/vector/PolylineGeometrySpec.js +0 -35
- data/lib/leaflet/spec/suites/layer/vector/PolylineSpec.js +0 -55
- data/lib/leaflet/spec/suites/map/MapSpec.js +0 -536
- data/lib/leaflet/spec/suites/map/handler/Map.DragSpec.js +0 -38
- 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/javascripts/leaflet.draw.js +0 -37
- data/vendor/assets/javascripts/leaflet.js +0 -147
- data/vendor/assets/javascripts/leaflet.label.js +0 -11
- data/vendor/assets/stylesheets/leaflet.css.erb +0 -478
- data/vendor/assets/stylesheets/leaflet.draw.ie.css +0 -49
- data/vendor/assets/stylesheets/leaflet.label.css +0 -52
@@ -1,75 +0,0 @@
|
|
1
|
-
describe('LineUtil', function () {
|
2
|
-
|
3
|
-
describe('#clipSegment', function () {
|
4
|
-
|
5
|
-
var bounds;
|
6
|
-
|
7
|
-
beforeEach(function () {
|
8
|
-
bounds = L.bounds([5, 0], [15, 10]);
|
9
|
-
});
|
10
|
-
|
11
|
-
it('clips a segment by bounds', function () {
|
12
|
-
var a = new L.Point(0, 0);
|
13
|
-
var b = new L.Point(15, 15);
|
14
|
-
|
15
|
-
var segment = L.LineUtil.clipSegment(a, b, bounds);
|
16
|
-
|
17
|
-
expect(segment[0]).to.eql(new L.Point(5, 5));
|
18
|
-
expect(segment[1]).to.eql(new L.Point(10, 10));
|
19
|
-
|
20
|
-
var c = new L.Point(5, -5);
|
21
|
-
var d = new L.Point(20, 10);
|
22
|
-
|
23
|
-
var segment2 = L.LineUtil.clipSegment(c, d, bounds);
|
24
|
-
|
25
|
-
expect(segment2[0]).to.eql(new L.Point(10, 0));
|
26
|
-
expect(segment2[1]).to.eql(new L.Point(15, 5));
|
27
|
-
});
|
28
|
-
|
29
|
-
it('uses last bit code and reject segments out of bounds', function () {
|
30
|
-
var a = new L.Point(15, 15);
|
31
|
-
var b = new L.Point(25, 20);
|
32
|
-
var segment = L.LineUtil.clipSegment(a, b, bounds, true);
|
33
|
-
|
34
|
-
expect(segment).to.be(false);
|
35
|
-
});
|
36
|
-
});
|
37
|
-
|
38
|
-
describe('#pointToSegmentDistance & #closestPointOnSegment', function () {
|
39
|
-
|
40
|
-
var p1 = new L.Point(0, 10);
|
41
|
-
var p2 = new L.Point(10, 0);
|
42
|
-
var p = new L.Point(0, 0);
|
43
|
-
|
44
|
-
it('calculates distance from point to segment', function () {
|
45
|
-
expect(L.LineUtil.pointToSegmentDistance(p, p1, p2)).to.eql(Math.sqrt(200) / 2);
|
46
|
-
});
|
47
|
-
|
48
|
-
it('calculates point closest to segment', function () {
|
49
|
-
expect(L.LineUtil.closestPointOnSegment(p, p1, p2)).to.eql(new L.Point(5, 5));
|
50
|
-
});
|
51
|
-
});
|
52
|
-
|
53
|
-
describe('#simplify', function () {
|
54
|
-
it('simplifies polylines according to tolerance', function () {
|
55
|
-
var points = [
|
56
|
-
new L.Point(0, 0),
|
57
|
-
new L.Point(0.01, 0),
|
58
|
-
new L.Point(0.5, 0.01),
|
59
|
-
new L.Point(0.7, 0),
|
60
|
-
new L.Point(1, 0),
|
61
|
-
new L.Point(1.999, 0.999),
|
62
|
-
new L.Point(2, 1)
|
63
|
-
];
|
64
|
-
|
65
|
-
var simplified = L.LineUtil.simplify(points, 0.1);
|
66
|
-
|
67
|
-
expect(simplified).to.eql([
|
68
|
-
new L.Point(0, 0),
|
69
|
-
new L.Point(1, 0),
|
70
|
-
new L.Point(2, 1)
|
71
|
-
]);
|
72
|
-
});
|
73
|
-
});
|
74
|
-
|
75
|
-
});
|
@@ -1,104 +0,0 @@
|
|
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
|
-
});
|
@@ -1,27 +0,0 @@
|
|
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(7.5, 10),
|
21
|
-
new L.Point(5, 5),
|
22
|
-
new L.Point(10, 7.5),
|
23
|
-
new L.Point(10, 10)
|
24
|
-
]);
|
25
|
-
});
|
26
|
-
});
|
27
|
-
});
|
@@ -1,31 +0,0 @@
|
|
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
|
-
});
|
@@ -1,86 +0,0 @@
|
|
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' });
|
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
|
-
});
|
@@ -1,282 +0,0 @@
|
|
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.MultiPolyline#toGeoJSON", function () {
|
99
|
-
it("returns a 2D MultiLineString object", function () {
|
100
|
-
var multiPolyline = new L.MultiPolyline([[[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.MultiPolyline([[[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.MultiPolygon#toGeoJSON", function () {
|
163
|
-
it("returns a 2D MultiPolygon object", function () {
|
164
|
-
var multiPolygon = new L.MultiPolygon([[[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.MultiPolygon([[[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
|
-
});
|