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,67 @@
|
|
1
|
+
/*
|
2
|
+
* L.Circle is a circle overlay (with a certain radius in meters).
|
3
|
+
* It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion)
|
4
|
+
*/
|
5
|
+
|
6
|
+
L.Circle = L.CircleMarker.extend({
|
7
|
+
|
8
|
+
initialize: function (latlng, radius, options) {
|
9
|
+
L.setOptions(this, options);
|
10
|
+
this._latlng = L.latLng(latlng);
|
11
|
+
this._mRadius = radius;
|
12
|
+
},
|
13
|
+
|
14
|
+
setRadius: function (radius) {
|
15
|
+
this._mRadius = radius;
|
16
|
+
return this.redraw();
|
17
|
+
},
|
18
|
+
|
19
|
+
getRadius: function () {
|
20
|
+
return this._mRadius;
|
21
|
+
},
|
22
|
+
|
23
|
+
getBounds: function () {
|
24
|
+
var half = [this._radius, this._radiusY];
|
25
|
+
|
26
|
+
return new L.LatLngBounds(
|
27
|
+
this._map.layerPointToLatLng(this._point.subtract(half)),
|
28
|
+
this._map.layerPointToLatLng(this._point.add(half)));
|
29
|
+
},
|
30
|
+
|
31
|
+
setStyle: L.Path.prototype.setStyle,
|
32
|
+
|
33
|
+
_project: function () {
|
34
|
+
|
35
|
+
var lng = this._latlng.lng,
|
36
|
+
lat = this._latlng.lat,
|
37
|
+
map = this._map,
|
38
|
+
crs = map.options.crs;
|
39
|
+
|
40
|
+
if (crs.distance === L.CRS.Earth.distance) {
|
41
|
+
var d = Math.PI / 180,
|
42
|
+
latR = (this._mRadius / L.CRS.Earth.R) / d,
|
43
|
+
top = map.project([lat + latR, lng]),
|
44
|
+
bottom = map.project([lat - latR, lng]),
|
45
|
+
p = top.add(bottom).divideBy(2),
|
46
|
+
lat2 = map.unproject(p).lat,
|
47
|
+
lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) /
|
48
|
+
(Math.cos(lat * d) * Math.cos(lat2 * d))) / d;
|
49
|
+
|
50
|
+
this._point = p.subtract(map.getPixelOrigin());
|
51
|
+
this._radius = isNaN(lngR) ? 0 : Math.max(Math.round(p.x - map.project([lat2, lng - lngR]).x), 1);
|
52
|
+
this._radiusY = Math.max(Math.round(p.y - top.y), 1);
|
53
|
+
|
54
|
+
} else {
|
55
|
+
var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0]));
|
56
|
+
|
57
|
+
this._point = map.latLngToLayerPoint(this._latlng);
|
58
|
+
this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x;
|
59
|
+
}
|
60
|
+
|
61
|
+
this._updateBounds();
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|
65
|
+
L.circle = function (latlng, radius, options) {
|
66
|
+
return new L.Circle(latlng, radius, options);
|
67
|
+
};
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/*
|
2
|
+
* L.CircleMarker is a circle overlay with a permanent pixel radius.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.CircleMarker = L.Path.extend({
|
6
|
+
|
7
|
+
options: {
|
8
|
+
fill: true,
|
9
|
+
radius: 10
|
10
|
+
},
|
11
|
+
|
12
|
+
initialize: function (latlng, options) {
|
13
|
+
L.setOptions(this, options);
|
14
|
+
this._latlng = L.latLng(latlng);
|
15
|
+
this._radius = this.options.radius;
|
16
|
+
},
|
17
|
+
|
18
|
+
setLatLng: function (latlng) {
|
19
|
+
this._latlng = L.latLng(latlng);
|
20
|
+
this.redraw();
|
21
|
+
return this.fire('move', {latlng: this._latlng});
|
22
|
+
},
|
23
|
+
|
24
|
+
getLatLng: function () {
|
25
|
+
return this._latlng;
|
26
|
+
},
|
27
|
+
|
28
|
+
setRadius: function (radius) {
|
29
|
+
this.options.radius = this._radius = radius;
|
30
|
+
return this.redraw();
|
31
|
+
},
|
32
|
+
|
33
|
+
getRadius: function () {
|
34
|
+
return this._radius;
|
35
|
+
},
|
36
|
+
|
37
|
+
setStyle : function (options) {
|
38
|
+
this._radius = options && options.radius || this._radius;
|
39
|
+
L.Path.prototype.setStyle.call(this, options);
|
40
|
+
},
|
41
|
+
|
42
|
+
_project: function () {
|
43
|
+
this._point = this._map.latLngToLayerPoint(this._latlng);
|
44
|
+
this._updateBounds();
|
45
|
+
},
|
46
|
+
|
47
|
+
_updateBounds: function () {
|
48
|
+
var r = this._radius,
|
49
|
+
r2 = this._radiusY || r,
|
50
|
+
w = this._clickTolerance(),
|
51
|
+
p = [r + w, r2 + w];
|
52
|
+
this._pxBounds = new L.Bounds(this._point.subtract(p), this._point.add(p));
|
53
|
+
},
|
54
|
+
|
55
|
+
_update: function () {
|
56
|
+
if (this._map) {
|
57
|
+
this._updatePath();
|
58
|
+
}
|
59
|
+
},
|
60
|
+
|
61
|
+
_updatePath: function () {
|
62
|
+
this._renderer._updateCircle(this);
|
63
|
+
},
|
64
|
+
|
65
|
+
_empty: function () {
|
66
|
+
return this._radius && !this._renderer._bounds.intersects(this._pxBounds);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
|
70
|
+
L.circleMarker = function (latlng, options) {
|
71
|
+
return new L.CircleMarker(latlng, options);
|
72
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/*
|
2
|
+
* L.Path is the base class for all Leaflet vector layers like polygons and circles.
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Path = L.Layer.extend({
|
6
|
+
|
7
|
+
options: {
|
8
|
+
stroke: true,
|
9
|
+
color: '#3388ff',
|
10
|
+
weight: 3,
|
11
|
+
opacity: 1,
|
12
|
+
lineCap: 'round',
|
13
|
+
lineJoin: 'round',
|
14
|
+
// dashArray: null
|
15
|
+
|
16
|
+
// fill: false
|
17
|
+
// fillColor: same as color by default
|
18
|
+
fillOpacity: 0.2,
|
19
|
+
|
20
|
+
// className: ''
|
21
|
+
clickable: true
|
22
|
+
},
|
23
|
+
|
24
|
+
onAdd: function () {
|
25
|
+
this._renderer = this._map.getRenderer(this);
|
26
|
+
this._renderer._initPath(this);
|
27
|
+
|
28
|
+
// defined in children classes
|
29
|
+
this._project();
|
30
|
+
this._update();
|
31
|
+
|
32
|
+
this._renderer._addPath(this);
|
33
|
+
},
|
34
|
+
|
35
|
+
onRemove: function () {
|
36
|
+
this._renderer._removePath(this);
|
37
|
+
},
|
38
|
+
|
39
|
+
getEvents: function () {
|
40
|
+
return {
|
41
|
+
viewreset: this._project,
|
42
|
+
moveend: this._update
|
43
|
+
};
|
44
|
+
},
|
45
|
+
|
46
|
+
redraw: function () {
|
47
|
+
if (this._map) {
|
48
|
+
this._renderer._updatePath(this);
|
49
|
+
}
|
50
|
+
return this;
|
51
|
+
},
|
52
|
+
|
53
|
+
setStyle: function (style) {
|
54
|
+
L.setOptions(this, style);
|
55
|
+
if (this._renderer) {
|
56
|
+
this._renderer._updateStyle(this);
|
57
|
+
}
|
58
|
+
return this;
|
59
|
+
},
|
60
|
+
|
61
|
+
bringToFront: function () {
|
62
|
+
this._renderer._bringToFront(this);
|
63
|
+
return this;
|
64
|
+
},
|
65
|
+
|
66
|
+
bringToBack: function () {
|
67
|
+
this._renderer._bringToBack(this);
|
68
|
+
return this;
|
69
|
+
},
|
70
|
+
|
71
|
+
_fireMouseEvent: function (e, type) {
|
72
|
+
this._map._fireMouseEvent(this, e, type, true);
|
73
|
+
},
|
74
|
+
|
75
|
+
_clickTolerance: function () {
|
76
|
+
// used when doing hit detection for Canvas layers
|
77
|
+
return (this.options.stroke ? this.options.weight / 2 : 0) + (L.Browser.touch ? 10 : 0);
|
78
|
+
}
|
79
|
+
});
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
* L.Polygon implements polygon vector layer (closed polyline with a fill inside).
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Polygon = L.Polyline.extend({
|
6
|
+
|
7
|
+
options: {
|
8
|
+
fill: true
|
9
|
+
},
|
10
|
+
|
11
|
+
getCenter: function () {
|
12
|
+
var i, j, len, p1, p2, f, area, x, y,
|
13
|
+
points = this._rings[0];
|
14
|
+
|
15
|
+
// polygon centroid algorithm; only uses the first ring if there are multiple
|
16
|
+
|
17
|
+
area = x = y = 0;
|
18
|
+
|
19
|
+
for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {
|
20
|
+
p1 = points[i];
|
21
|
+
p2 = points[j];
|
22
|
+
|
23
|
+
f = p1.y * p2.x - p2.y * p1.x;
|
24
|
+
x += (p1.x + p2.x) * f;
|
25
|
+
y += (p1.y + p2.y) * f;
|
26
|
+
area += f * 3;
|
27
|
+
}
|
28
|
+
|
29
|
+
return this._map.layerPointToLatLng([x / area, y / area]);
|
30
|
+
},
|
31
|
+
|
32
|
+
_convertLatLngs: function (latlngs) {
|
33
|
+
var result = L.Polyline.prototype._convertLatLngs.call(this, latlngs),
|
34
|
+
len = result.length;
|
35
|
+
|
36
|
+
// remove last point if it equals first one
|
37
|
+
if (len >= 2 && result[0] instanceof L.LatLng && result[0].equals(result[len - 1])) {
|
38
|
+
result.pop();
|
39
|
+
}
|
40
|
+
return result;
|
41
|
+
},
|
42
|
+
|
43
|
+
_clipPoints: function () {
|
44
|
+
if (this.options.noClip) {
|
45
|
+
this._parts = this._rings;
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
|
49
|
+
// polygons need a different clipping algorithm so we redefine that
|
50
|
+
|
51
|
+
var bounds = this._renderer._bounds,
|
52
|
+
w = this.options.weight,
|
53
|
+
p = new L.Point(w, w);
|
54
|
+
|
55
|
+
// increase clip padding by stroke width to avoid stroke on clip edges
|
56
|
+
bounds = new L.Bounds(bounds.min.subtract(p), bounds.max.add(p));
|
57
|
+
|
58
|
+
this._parts = [];
|
59
|
+
|
60
|
+
for (var i = 0, len = this._rings.length, clipped; i < len; i++) {
|
61
|
+
clipped = L.PolyUtil.clipPolygon(this._rings[i], bounds);
|
62
|
+
if (clipped.length) {
|
63
|
+
this._parts.push(clipped);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
},
|
67
|
+
|
68
|
+
_updatePath: function () {
|
69
|
+
this._renderer._updatePoly(this, true);
|
70
|
+
}
|
71
|
+
});
|
72
|
+
|
73
|
+
L.polygon = function (latlngs, options) {
|
74
|
+
return new L.Polygon(latlngs, options);
|
75
|
+
};
|
@@ -0,0 +1,223 @@
|
|
1
|
+
/*
|
2
|
+
* L.Polyline implements polyline vector layer (a set of points connected with lines)
|
3
|
+
*/
|
4
|
+
|
5
|
+
L.Polyline = L.Path.extend({
|
6
|
+
|
7
|
+
options: {
|
8
|
+
// how much to simplify the polyline on each zoom level
|
9
|
+
// more = better performance and smoother look, less = more accurate
|
10
|
+
smoothFactor: 1.0
|
11
|
+
// noClip: false
|
12
|
+
},
|
13
|
+
|
14
|
+
initialize: function (latlngs, options) {
|
15
|
+
L.setOptions(this, options);
|
16
|
+
this._setLatLngs(latlngs);
|
17
|
+
},
|
18
|
+
|
19
|
+
getLatLngs: function () {
|
20
|
+
// TODO rings
|
21
|
+
return this._latlngs;
|
22
|
+
},
|
23
|
+
|
24
|
+
setLatLngs: function (latlngs) {
|
25
|
+
this._setLatLngs(latlngs);
|
26
|
+
return this.redraw();
|
27
|
+
},
|
28
|
+
|
29
|
+
addLatLng: function (latlng) {
|
30
|
+
// TODO rings
|
31
|
+
latlng = L.latLng(latlng);
|
32
|
+
this._latlngs.push(latlng);
|
33
|
+
this._bounds.extend(latlng);
|
34
|
+
return this.redraw();
|
35
|
+
},
|
36
|
+
|
37
|
+
spliceLatLngs: function () {
|
38
|
+
// TODO rings
|
39
|
+
var removed = [].splice.apply(this._latlngs, arguments);
|
40
|
+
this._setLatLngs(this._latlngs);
|
41
|
+
this.redraw();
|
42
|
+
return removed;
|
43
|
+
},
|
44
|
+
|
45
|
+
closestLayerPoint: function (p) {
|
46
|
+
var minDistance = Infinity,
|
47
|
+
minPoint = null,
|
48
|
+
closest = L.LineUtil._sqClosestPointOnSegment,
|
49
|
+
p1, p2;
|
50
|
+
|
51
|
+
for (var j = 0, jLen = this._parts.length; j < jLen; j++) {
|
52
|
+
var points = this._parts[j];
|
53
|
+
|
54
|
+
for (var i = 1, len = points.length; i < len; i++) {
|
55
|
+
p1 = points[i - 1];
|
56
|
+
p2 = points[i];
|
57
|
+
|
58
|
+
var sqDist = closest(p, p1, p2, true);
|
59
|
+
|
60
|
+
if (sqDist < minDistance) {
|
61
|
+
minDistance = sqDist;
|
62
|
+
minPoint = closest(p, p1, p2);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
if (minPoint) {
|
67
|
+
minPoint.distance = Math.sqrt(minDistance);
|
68
|
+
}
|
69
|
+
return minPoint;
|
70
|
+
},
|
71
|
+
|
72
|
+
getCenter: function () {
|
73
|
+
var i, halfDist, segDist, dist, p1, p2, ratio,
|
74
|
+
points = this._rings[0],
|
75
|
+
len = points.length;
|
76
|
+
|
77
|
+
// polyline centroid algorithm; only uses the first ring if there are multiple
|
78
|
+
|
79
|
+
for (i = 0, halfDist = 0; i < len - 1; i++) {
|
80
|
+
halfDist += points[i].distanceTo(points[i + 1]) / 2;
|
81
|
+
}
|
82
|
+
|
83
|
+
for (i = 0, dist = 0; i < len - 1; i++) {
|
84
|
+
p1 = points[i];
|
85
|
+
p2 = points[i + 1];
|
86
|
+
segDist = p1.distanceTo(p2);
|
87
|
+
dist += segDist;
|
88
|
+
|
89
|
+
if (dist > halfDist) {
|
90
|
+
ratio = (dist - halfDist) / segDist;
|
91
|
+
return this._map.layerPointToLatLng([
|
92
|
+
p2.x - ratio * (p2.x - p1.x),
|
93
|
+
p2.y - ratio * (p2.y - p1.y)
|
94
|
+
]);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
},
|
98
|
+
|
99
|
+
getBounds: function () {
|
100
|
+
return this._bounds;
|
101
|
+
},
|
102
|
+
|
103
|
+
_setLatLngs: function (latlngs) {
|
104
|
+
this._bounds = new L.LatLngBounds();
|
105
|
+
this._latlngs = this._convertLatLngs(latlngs);
|
106
|
+
},
|
107
|
+
|
108
|
+
// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way
|
109
|
+
_convertLatLngs: function (latlngs) {
|
110
|
+
var result = [],
|
111
|
+
flat = this._flat(latlngs);
|
112
|
+
|
113
|
+
for (var i = 0, len = latlngs.length; i < len; i++) {
|
114
|
+
if (flat) {
|
115
|
+
result[i] = L.latLng(latlngs[i]);
|
116
|
+
this._bounds.extend(result[i]);
|
117
|
+
} else {
|
118
|
+
result[i] = this._convertLatLngs(latlngs[i]);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
return result;
|
123
|
+
},
|
124
|
+
|
125
|
+
_flat: function (latlngs) {
|
126
|
+
// true if it's a flat array of latlngs; false if nested
|
127
|
+
return !L.Util.isArray(latlngs[0]) || typeof latlngs[0][0] !== 'object';
|
128
|
+
},
|
129
|
+
|
130
|
+
_project: function () {
|
131
|
+
this._rings = [];
|
132
|
+
this._projectLatlngs(this._latlngs, this._rings);
|
133
|
+
|
134
|
+
// project bounds as well to use later for Canvas hit detection/etc.
|
135
|
+
var w = this._clickTolerance(),
|
136
|
+
p = new L.Point(w, -w);
|
137
|
+
|
138
|
+
if (this._latlngs.length) {
|
139
|
+
this._pxBounds = new L.Bounds(
|
140
|
+
this._map.latLngToLayerPoint(this._bounds.getSouthWest())._subtract(p),
|
141
|
+
this._map.latLngToLayerPoint(this._bounds.getNorthEast())._add(p));
|
142
|
+
}
|
143
|
+
},
|
144
|
+
|
145
|
+
// recursively turns latlngs into a set of rings with projected coordinates
|
146
|
+
_projectLatlngs: function (latlngs, result) {
|
147
|
+
|
148
|
+
var flat = latlngs[0] instanceof L.LatLng,
|
149
|
+
len = latlngs.length,
|
150
|
+
i, ring;
|
151
|
+
|
152
|
+
if (flat) {
|
153
|
+
ring = [];
|
154
|
+
for (i = 0; i < len; i++) {
|
155
|
+
ring[i] = this._map.latLngToLayerPoint(latlngs[i]);
|
156
|
+
}
|
157
|
+
result.push(ring);
|
158
|
+
} else {
|
159
|
+
for (i = 0; i < len; i++) {
|
160
|
+
this._projectLatlngs(latlngs[i], result);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
},
|
164
|
+
|
165
|
+
// clip polyline by renderer bounds so that we have less to render for performance
|
166
|
+
_clipPoints: function () {
|
167
|
+
if (this.options.noClip) {
|
168
|
+
this._parts = this._rings;
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
|
172
|
+
this._parts = [];
|
173
|
+
|
174
|
+
var parts = this._parts,
|
175
|
+
bounds = this._renderer._bounds,
|
176
|
+
i, j, k, len, len2, segment, points;
|
177
|
+
|
178
|
+
for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
|
179
|
+
points = this._rings[i];
|
180
|
+
|
181
|
+
for (j = 0, len2 = points.length; j < len2 - 1; j++) {
|
182
|
+
segment = L.LineUtil.clipSegment(points[j], points[j + 1], bounds, j);
|
183
|
+
|
184
|
+
if (!segment) { continue; }
|
185
|
+
|
186
|
+
parts[k] = parts[k] || [];
|
187
|
+
parts[k].push(segment[0]);
|
188
|
+
|
189
|
+
// if segment goes out of screen, or it's the last one, it's the end of the line part
|
190
|
+
if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
|
191
|
+
parts[k].push(segment[1]);
|
192
|
+
k++;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
},
|
197
|
+
|
198
|
+
// simplify each clipped part of the polyline for performance
|
199
|
+
_simplifyPoints: function () {
|
200
|
+
var parts = this._parts,
|
201
|
+
tolerance = this.options.smoothFactor;
|
202
|
+
|
203
|
+
for (var i = 0, len = parts.length; i < len; i++) {
|
204
|
+
parts[i] = L.LineUtil.simplify(parts[i], tolerance);
|
205
|
+
}
|
206
|
+
},
|
207
|
+
|
208
|
+
_update: function () {
|
209
|
+
if (!this._map) { return; }
|
210
|
+
|
211
|
+
this._clipPoints();
|
212
|
+
this._simplifyPoints();
|
213
|
+
this._updatePath();
|
214
|
+
},
|
215
|
+
|
216
|
+
_updatePath: function () {
|
217
|
+
this._renderer._updatePoly(this);
|
218
|
+
}
|
219
|
+
});
|
220
|
+
|
221
|
+
L.polyline = function (latlngs, options) {
|
222
|
+
return new L.Polyline(latlngs, options);
|
223
|
+
};
|