Compare commits

..

190 Commits

Author SHA1 Message Date
Frédéric Junod
ccdb189e77 Merge pull request #4693 from openlayers/release-v3.13.0
Release v3.13.0
2016-01-20 15:35:16 +01:00
Frederic Junod
b5e7a2673d Update package version to 3.13.0 2016-01-20 14:59:08 +01:00
Frederic Junod
e782e1262c Changelog for v3.13.0 2016-01-20 14:59:08 +01:00
Frédéric Junod
2975b92fea Merge pull request #4694 from fredj/lint_errors
Fix eslint errors in wms-time example
2016-01-20 14:53:37 +01:00
Frederic Junod
031c31d367 Fix no-use-before-define eslint error 2016-01-20 14:43:27 +01:00
Frederic Junod
30d8d6efd7 Remove unused variable 2016-01-20 14:43:10 +01:00
Bart van den Eijnden
268298d2d8 Merge pull request #4527 from bartvde/wmstime_new
Add support for smooth TileWMS dimensions
2016-01-20 14:14:16 +01:00
Tim Schaub
10837fb91a Merge pull request #4691 from tschaub/bing
Updated Bing Maps key.
2016-01-20 06:01:49 -07:00
Andreas Hocevar
7277e295e6 Merge pull request #4673 from ahocevar/fixed-tileurlfunction
Respect fixed tile url functions when setting url(s)
2016-01-20 13:28:32 +01:00
Tim Schaub
85ead5486c New Bing Maps key 2016-01-19 14:08:51 -07:00
Frédéric Junod
b134b080db Merge pull request #4689 from openlayers/revert-4581-no-render-on-interaction-start
Revert "Do not render in handleDownEvent"
2016-01-19 15:48:19 +01:00
Frédéric Junod
eb395894e1 Revert "Do not render in handleDownEvent" 2016-01-19 15:26:10 +01:00
Andreas Hocevar
86c7f950d6 Add setUrl tests 2016-01-19 13:40:47 +01:00
Andreas Hocevar
4b441dc503 Respect fixed tile url functions when setting url(s) 2016-01-19 13:40:47 +01:00
Marc Jansen
1ad3d4e764 Merge pull request #4688 from marcjansen/focus-map
Give map a focus-outline in accessible-example
2016-01-19 11:58:12 +01:00
Marc Jansen
f0b0e00b06 Give map a focus-outline in accessible-example 2016-01-19 11:16:20 +01:00
Frédéric Junod
4dbc4c5bfd Merge pull request #4642 from alexbrault/colour-ex
Move the icon style color to its own example
2016-01-19 08:43:21 +01:00
Frédéric Junod
d8296e5dac Merge pull request #4685 from fredj/rm_check-whitespace
Remove bin/check-whitespace.py
2016-01-19 08:37:29 +01:00
Alexandre Brault
2d151fb353 Remove popup code from color example 2016-01-18 22:40:04 -05:00
Alexandre Brault
341ba5b859 Move the icon style color to its own example 2016-01-18 22:36:34 -05:00
Tim Schaub
308565f8f4 Merge pull request #4684 from openlayers/greenkeeper-eslint-config-openlayers-3.0.0
Update eslint-config-openlayers to version 3.0.0 🚀
2016-01-18 10:21:33 -07:00
Frederic Junod
5b98066d16 Remove bin/check-whitespace.py 2016-01-18 16:50:16 +01:00
greenkeeperio-bot
93ed1ee50a chore(package): update eslint-config-openlayers to version 3.0.0
http://greenkeeper.io/
2016-01-18 08:46:43 -07:00
Andreas Hocevar
5961431505 Merge pull request #4677 from ahocevar/pixel-proj
Make pixel projection handling work in compiled mode
2016-01-15 22:06:42 +01:00
Andreas Hocevar
d6a8c9465e Make pixel projection handling work in compiled mode
The compiler seems to have trouble with functions that can run with
different 'this' types. By moving the units handling to the callback, this
issue can be avoided.
2016-01-15 20:59:16 +01:00
Tim Schaub
dc820fced4 Merge pull request #4639 from nicholas-l/googBind
Remove use of goog.bind and use ES5 .bind.
2016-01-15 09:41:11 -08:00
Nicholas L
db3ad70a3d Remove use of goog.bind and use ES5 .bind 2016-01-15 22:10:55 +13:00
Frédéric Junod
5b40190cbe Merge pull request #4655 from openlayers/greenkeeper-browserify-13.0.0
Update browserify to version 13.0.0 🚀
2016-01-13 13:48:52 +01:00
Andreas Hocevar
69ad741dd4 Merge pull request #4666 from WeaveTeam/dragbox-dragevent-pr
Add a 'boxdrag' event to ol.interaction.DragBox. Resolves #4563 .
2016-01-13 12:43:26 +01:00
Frédéric Junod
ffb9674243 Merge pull request #4669 from fredj/eslint_contributing
Remove reference to Closure Linter in CONTRIBUTING.md
2016-01-13 12:19:48 +01:00
Frederic Junod
22dab733f0 Remove reference to Closure Linter in CONTRIBUTING.md
See #4602
2016-01-13 12:01:29 +01:00
Frédéric Junod
ace3ac4f1d Merge pull request #4665 from openlayers/greenkeeper-istanbul-0.4.2
Update istanbul to version 0.4.2 🚀
2016-01-13 08:47:15 +01:00
greenkeeperio-bot
3a368809fb chore(package): update istanbul to version 0.4.2
http://greenkeeper.io/
2016-01-13 08:35:28 +01:00
Frédéric Junod
50daa17c2a Merge pull request #4663 from openlayers/greenkeeper-glob-6.0.4
Update glob to version 6.0.4 🚀
2016-01-13 08:32:44 +01:00
Petr Sloup
cd308e47d2 Merge pull request #4667 from klokantech/mapquest-opaque-fix
Fix rendering of transparent MapQuest layer type
2016-01-13 07:01:30 +01:00
Petr Sloup
5dfb4199ca Fix rendering of transparent MapQuest layer type 2016-01-12 23:23:16 +01:00
Philip "digitalfox" Kovac
83e173d91f Add a 'boxdrag' event to ol.interaction.DragBox. Resolves #4563 . 2016-01-12 17:16:56 -05:00
Marc Jansen
fdc2f9d97e Merge pull request #4661 from gaf-ag/devdocnodejs
Fixes #4654 Developer Documentation Updated
2016-01-12 18:22:08 +01:00
Yashar Moradi
f725a46220 Fixes #4654 Metalsmith v2.0 and above uses generators which are not supported out of the box by node.js 0.12.x and below. 2016-01-12 18:00:16 +01:00
Frédéric Junod
08e51d1c8e Merge pull request #4658 from openlayers/greenkeeper-jquery-2.2.0
Update jquery to version 2.2.0 🚀
2016-01-12 16:09:50 +01:00
Bart van den Eijnden
3f5a8085b6 Merge pull request #4659 from bartvde/drawimage-safari-fix
Make sure icons show up in Safari
2016-01-12 16:07:16 +01:00
Bart van den Eijnden
4ef1f5e63f Make sure icons show up in Safari
Make sure that drawImage calls don't exceed source image dimensions.
2016-01-12 15:57:11 +01:00
Frédéric Junod
936cd6a028 Merge pull request #4652 from fredj/simplify_fullscreen
Use map.getTargetElement instead of map.getTarget
2016-01-12 11:48:14 +01:00
Frederic Junod
3df9ae8c5e Use map.getTargetElement instead of map.getTarget 2016-01-12 11:36:07 +01:00
greenkeeperio-bot
63b17022f6 chore(package): update browserify to version 13.0.0
http://greenkeeper.io/
2016-01-12 02:19:02 -08:00
greenkeeperio-bot
d2ecb1e819 chore(package): update glob to version 6.0.4
http://greenkeeper.io/
2016-01-12 02:08:16 -08:00
greenkeeperio-bot
1757fa973b chore(package): update jquery to version 2.2.0
http://greenkeeper.io/
2016-01-12 01:58:35 -08:00
Petr Sloup
dccf867308 Merge pull request #4649 from klokantech/getopaque-doc-fix
Missing parameter description for ol.source.Tile#getOpaque
2016-01-12 09:27:41 +01:00
Petr Sloup
3607cddcca Missing parameter description for ol.source.Tile#getOpaque 2016-01-12 09:16:40 +01:00
Tim Schaub
c9e2b384e7 Merge pull request #4602 from tschaub/eslint
Use ESLint.
2016-01-12 00:09:15 -08:00
Petr Sloup
11bd31c15b Merge pull request #4628 from klokantech/opaque-reprojection-fix
Fix for reprojecting opaque tile sources
2016-01-12 09:06:14 +01:00
Petr Sloup
2c3ed38714 Fix for reprojecting opaque tile sources 2016-01-12 08:58:16 +01:00
Frédéric Junod
5504916b80 Merge pull request #4618 from openlayers/greenkeeper-resemblejs-2.1.0
Update resemblejs to version 2.1.0 🚀
2016-01-12 08:56:42 +01:00
Tim Schaub
fd77ab64ad Use eslint@2.0.0-beta.1 2016-01-11 23:37:29 -08:00
Tim Schaub
13a981c94b Fewer blank lines 2016-01-11 22:03:23 -08:00
Tim Schaub
8d80924ba8 Remove gjslint.py 2016-01-11 22:03:12 -08:00
Tim Schaub
0a5d15db50 Remove jshint 2016-01-11 18:58:02 -08:00
Tim Schaub
8f0ecc4df2 Run ESLint with make lint 2016-01-11 18:56:09 -08:00
Tim Schaub
534124ec2f Lint free rendering tests 2016-01-11 18:56:09 -08:00
Tim Schaub
8c38d22b60 Lint free examples 2016-01-11 18:56:09 -08:00
Tim Schaub
0555bb081a Test indentation 2016-01-11 18:56:09 -08:00
Tim Schaub
3cf8618fc7 Prefer single line assignment to 80 character limit 2016-01-11 18:56:08 -08:00
Tim Schaub
59a66c7aaa Remaining valid-jsdoc corrections 2016-01-11 18:56:08 -08:00
Tim Schaub
e6f6dcc230 Partial valid-jsdoc corrections 2016-01-11 18:56:08 -08:00
Tim Schaub
b1d00af58b More globals 2016-01-11 18:56:08 -08:00
Tim Schaub
fd0e2436da Always provide a default case for switch 2016-01-11 18:56:08 -08:00
Tim Schaub
932bf4deb3 Explicitly mark fall-throughs 2016-01-11 18:56:08 -08:00
Tim Schaub
54df314936 Consistent curly brace style 2016-01-11 18:56:08 -08:00
Tim Schaub
ec10b661f3 Use block scoping 2016-01-11 18:56:08 -08:00
Tim Schaub
29a723166d No empty blocks 2016-01-11 18:56:07 -08:00
Tim Schaub
4e0cddcb41 Lint-free tests 2016-01-11 18:56:07 -08:00
Tim Schaub
cca86886f1 Define variables before use 2016-01-11 18:56:07 -08:00
Tim Schaub
3602a37c96 Remove this commit with ESLint 2.0 2016-01-11 18:56:07 -08:00
Tim Schaub
f627f7679b Valid JSDoc annotations 2016-01-11 18:56:07 -08:00
Tim Schaub
154b8babc4 Allow console use in Phantom 2016-01-11 18:56:07 -08:00
Tim Schaub
3f23dfb87b Indentation 2016-01-11 18:56:07 -08:00
Tim Schaub
aac1d921c7 Unused variables 2016-01-11 18:56:07 -08:00
Tim Schaub
179b241aec Declare variables before assignment 2016-01-11 18:56:07 -08:00
Tim Schaub
f0fc4d4e73 Curly brace spacing 2016-01-11 18:56:06 -08:00
Tim Schaub
9ae748408a Statement inside curly braces on its own line 2016-01-11 18:56:06 -08:00
Tim Schaub
8ab5a338b5 Unused origins 2016-01-11 18:56:06 -08:00
Tim Schaub
227c984d89 More test globals 2016-01-11 18:56:06 -08:00
Tim Schaub
abd0d66e66 Lint-free tileurlfunction.test.js 2016-01-11 18:56:06 -08:00
Tim Schaub
23eebf396c Lint-free view.test.js 2016-01-11 18:56:06 -08:00
Tim Schaub
98dedfd2ff Custom lint configuration for test directory 2016-01-11 18:56:06 -08:00
Tim Schaub
681948e71c Lint-free test-extensions.js 2016-01-11 18:56:06 -08:00
Tim Schaub
b3578325cb Lint free tasks 2016-01-11 18:56:06 -08:00
Tim Schaub
b0a70b0ca6 Correcting invalid JSDoc blocks 2016-01-11 18:56:05 -08:00
Tim Schaub
38d0e98ff5 Whitespace 2016-01-11 18:56:05 -08:00
Tim Schaub
23f3e21ba4 Unused variables 2016-01-11 18:56:05 -08:00
Tim Schaub
1d65bab158 Dangling commas 2016-01-11 18:56:05 -08:00
Tim Schaub
80f9a7c5a5 Use ESLint 2016-01-11 18:56:05 -08:00
Andreas Hocevar
c2f90f21db Merge pull request #4647 from ahocevar/snap-round-to-pixel
Proper rounding for possibly negative numbers
2016-01-11 16:34:24 +01:00
Andreas Hocevar
a3147c5d08 Proper rounding for possibly negative numbers 2016-01-11 16:25:09 +01:00
Tim Schaub
7222af3284 Merge pull request #4641 from tschaub/icon
Remove extra options from icon example.
2016-01-11 05:14:04 -07:00
Andreas Hocevar
d916e8ccaf Merge pull request #4629 from ahocevar/scaleline
Simplify scaleline calculation
2016-01-11 10:12:53 +01:00
Tim Schaub
5001272a2e Remove extra options from icon example 2016-01-10 17:02:02 -07:00
Andreas Hocevar
d05b519f2f Merge pull request #4457 from alexbrault/colour-icon
Add color option to ol.style.Icon
2016-01-10 23:19:54 +01:00
Andreas Hocevar
0f8373dd2d Merge pull request #4638 from ahocevar/proj-extent
Do not rely on projection extent
2016-01-08 10:44:59 +01:00
Andreas Hocevar
dfb534f1d4 Do not rely on projection extent 2016-01-08 10:25:56 +01:00
Tim Schaub
7a644730a5 Merge pull request #4635 from openlayers/greenkeeper-async-1.5.2
Update async to version 1.5.2 🚀
2016-01-07 18:16:20 -07:00
greenkeeperio-bot
4066d38e4a chore(package): update async to version 1.5.2
http://greenkeeper.io/
2016-01-07 17:08:46 -07:00
Andreas Hocevar
393a95e41c Properly handle modulo of negative numbers 2016-01-07 20:19:40 +01:00
Andreas Hocevar
7a8451adeb Add example with US scale line and reprojection 2016-01-07 20:14:45 +01:00
Andreas Hocevar
b8fc917016 Do not depend on units for resolutions calculation 2016-01-07 20:14:44 +01:00
Andreas Hocevar
6b8da1237c Simplify scaleline calculation 2016-01-07 20:14:44 +01:00
Andreas Hocevar
5c49e399ce Merge pull request #4581 from ahocevar/no-render-on-interaction-start
Do not render in handleDownEvent
2016-01-07 18:24:39 +01:00
Frédéric Junod
32dadc008b Merge pull request #4541 from fredj/linestring_interpolated_point
Add new ol.geom.LineString#getCoordinateAt function
2016-01-07 18:02:21 +01:00
Frédéric Junod
aff6449c74 Merge pull request #4489 from openlayers/greenkeeper-phantomjs-1.9.19
Update phantomjs to version 1.9.19 🚀
2016-01-07 15:34:34 +01:00
Petr Sloup
2237dc8e72 Merge pull request #4625 from klokantech/tilejson-xhr-default
Use XHR by default to load TileJSON in ol.source.TileJSON
2016-01-07 15:30:10 +01:00
greenkeeperio-bot
a4b34c16d7 chore(package): update phantomjs to version 1.9.19
http://greenkeeper.io/
2016-01-07 15:14:16 +01:00
Frederic Junod
e336947e8d Add new ol.geom.LineString#getCoordinateAt function 2016-01-07 11:32:25 +01:00
Petr Sloup
bc0d783f50 Use XHR by default to load TileJSON in ol.source.TileJSON 2016-01-07 09:19:23 +01:00
Tim Schaub
4ba443e829 Merge pull request #4622 from openlayers/greenkeeper-fs-extra-0.26.4
Update fs-extra to version 0.26.4 🚀
2016-01-06 12:48:02 -07:00
Andreas Hocevar
3d8adaab67 Merge pull request #4630 from ahocevar/meters-per-unit
Simplify meters per unit handling
2016-01-06 14:06:43 +01:00
Andreas Hocevar
24f8cba0a1 Simplify meters per unit handling 2016-01-06 13:53:55 +01:00
Frédéric Junod
607d8ad154 Merge pull request #4490 from openlayers/greenkeeper-istanbul-0.4.1
Update istanbul to version 0.4.1 🚀
2016-01-06 12:35:00 +01:00
Andreas Hocevar
cde6dce939 Merge pull request #4574 from WeaveTeam/dragbox-config-pr
Added boxEndCondition to DragBoxOptions to replace the hardcoded chec…
2016-01-06 11:47:56 +01:00
Frédéric Junod
1caaf6d75f Merge pull request #4553 from openlayers/greenkeeper-mustache-2.2.1
Update mustache to version 2.2.1 🚀
2016-01-06 11:43:33 +01:00
Frédéric Junod
1300cde76c Merge pull request #4626 from simonseyock/master
Fixed documentation error
2016-01-06 11:40:49 +01:00
Simon Seyock
310023e179 Fixed documentation error
The imageLoad function option of all ol.source.Image subclasses are not of type ol.TileLoadFunctionType but of type ol.ImageLoadFunctionType.
2016-01-06 11:31:54 +01:00
Frédéric Junod
8c6d9c9e66 Merge pull request #4606 from fredj/ol.DragBoxEvent_MapBrowserEvent
Include originating MapBrowserEvent in ol.DragBoxEvent
2016-01-06 09:15:32 +01:00
greenkeeperio-bot
bd6566f85b chore(package): update fs-extra to version 0.26.4
http://greenkeeper.io/
2016-01-05 22:38:23 -07:00
Tim Schaub
b8d69e0f3b Merge pull request #4614 from tschaub/one-fewer-interface
Remove checksum interface.
2016-01-05 11:16:34 -07:00
Philip "digitalfox" Kovac
10e2510f0f Added boxEndCondition to DragBoxOptions to replace the hardcoded check against DRAG_BOX_HYSTERESIS_PIXELS_SQUARED. 2016-01-05 13:14:30 -05:00
Andreas Hocevar
15be53e98c Merge pull request #4613 from ahocevar/select-self
Include own layer in layerFilter and only select unselected features
2016-01-05 17:48:20 +01:00
Frédéric Junod
ce3030268b Merge pull request #4612 from fredj/vector_event_type
Set oli.source.VectorEvent#feature to ol.Feature|undefined
2016-01-05 15:11:48 +01:00
Tim Schaub
aeffd48ccb Remove checksum interface 2016-01-05 07:07:45 -07:00
Frédéric Junod
2f1975636a Merge pull request #4620 from fredj/polyline_option_factor
Fix olx.format.PolylineOptions#factor type
2016-01-05 15:07:26 +01:00
Frédéric Junod
b7be16eac7 Merge pull request #4621 from fredj/gpx_option_readExtensions
Fix olx.format.GPXOptions#readExtensions type
2016-01-05 14:59:51 +01:00
Frederic Junod
d55afd57b5 Fix olx.format.GPXOptions#readExtensions type
This property is optional.
2016-01-05 13:55:14 +01:00
Petr Sloup
22b1460595 Merge pull request #4619 from klokantech/tilejson-xhr
Add option to load TileJSON via XHR
2016-01-05 13:48:23 +01:00
Frederic Junod
efc601a76d Fix olx.format.PolylineOptions#factor type
This property is optional.
2016-01-05 13:44:01 +01:00
Petr Sloup
ffd9ace84e Add option to load TileJSON via XHR 2016-01-05 13:40:20 +01:00
greenkeeperio-bot
251cddfa96 chore(package): update resemblejs to version 2.1.0
http://greenkeeper.io/
2016-01-05 04:54:25 -07:00
Bart van den Eijnden
d9b89a8ebe Merge pull request #4617 from gberaudo/type_geojson_writeFeatureObject
Add missing return type to GeoJSON format
2016-01-05 11:17:39 +01:00
Guillaume Beraudo
a1c72d8890 Add missing return type to GeoJSON format 2016-01-05 11:02:23 +01:00
Marc Jansen
9fe3d8b2e2 Merge pull request #4615 from marcjansen/copyright-2016
Adjust copyright to include 2016
2016-01-05 11:01:25 +01:00
Marc Jansen
52667c1166 Adjust copyright to include 2016 2016-01-05 08:54:32 +01:00
Frédéric Junod
de1f18417a Merge pull request #4616 from openlayers/greenkeeper-closure-util-1.10.0
Update closure-util to version 1.10.0 🚀
2016-01-05 08:42:47 +01:00
greenkeeperio-bot
acd8b3ddc1 chore(package): update closure-util to version 1.10.0
http://greenkeeper.io/
2016-01-05 00:31:44 -07:00
Andreas Hocevar
a65d2d4078 Include own layer in layerFilter and only select unselected features
When selecting an already selected feature, it will be on the Select
interaction's featureOverlay_. So we need to include that featureOverlay_
in the layer filter, regardless of what the user set as layer filter.

When in toggle mode, we need to make sure that we only select features that
are not already included in the selection.
2016-01-04 21:55:00 +01:00
Andreas Hocevar
9f43716723 Merge pull request #4596 from ahocevar/tile-key
Use consistent tile coordinate keys
2016-01-04 19:27:47 +01:00
Bart van den Eijnden
d6235e714e Merge pull request #4609 from bartvde/proj4js
Add ol.proj.setProj4 function
2016-01-04 19:08:30 +01:00
Bart van den Eijnden
cdf9a8e84d Add ol.proj.setProj4 function 2016-01-04 18:51:04 +01:00
Frederic Junod
437412362e Set oli.source.VectorEvent#feature to ol.Feature|undefined
This commit remove incoherency between the class and the interface.
2016-01-04 16:44:23 +01:00
Frederic Junod
7a364e0593 Include originating MapBrowserEvent in ol.DragBoxEvent 2016-01-04 13:29:26 +01:00
Tim Schaub
65b90df4b8 Merge pull request #4603 from openlayers/greenkeeper-async-1.5.1
Update async to version 1.5.1 🚀
2016-01-03 11:39:50 -07:00
Tim Schaub
38fd9f2685 Merge pull request #4604 from openlayers/greenkeeper-clean-css-3.4.9
Update clean-css to version 3.4.9 🚀
2016-01-03 11:39:01 -07:00
greenkeeperio-bot
de3e3d74ce chore(package): update clean-css to version 3.4.9
http://greenkeeper.io/
2016-01-03 08:28:55 -07:00
greenkeeperio-bot
becaf20ee9 chore(package): update async to version 1.5.1
http://greenkeeper.io/
2016-01-02 16:42:26 -07:00
Alexandre Brault
3f16b340fc Accept string as color input 2016-01-01 12:16:50 -05:00
Alexandre Brault
5c70d37da6 Don't tint the icon if the image is tainted 2016-01-01 12:16:50 -05:00
Alexandre Brault
c0b6eac0c2 Add color option to ol.style.Icon 2016-01-01 12:16:50 -05:00
Marc Jansen
a34c0e262b Merge pull request #4600 from openlayers/greenkeeper-glob-6.0.3
Update glob to version 6.0.3 🚀
2015-12-29 08:06:41 +01:00
greenkeeperio-bot
31a1aae02e chore(package): update glob to version 6.0.3
http://greenkeeper.io/
2015-12-28 16:51:47 -07:00
Andreas Hocevar
b208550e6e Merge pull request #4595 from ahocevar/opaque-xyz
Pass 'opaque' option on to superclass
2015-12-28 14:40:59 +01:00
Petr Sloup
cd1304aaae Merge pull request #4598 from klokantech/tilepixelratio
Make ol.source.Tile#getTilePixelRatio work correctly for all sources
2015-12-28 13:31:59 +01:00
Petr Sloup
767ac44e99 Make ol.source.Tile#getTilePixelRatio work for all sources
Even for sources which serve dynamic tile sizes based on devicePixelRatio
2015-12-28 13:19:03 +01:00
Petr Sloup
28240adaf5 Merge pull request #4594 from klokantech/tilequeue-reproj-jam
Fix for TileQueue gradually choking up when using raster reprojection
2015-12-28 13:17:39 +01:00
Petr Sloup
9cdf7678bb Make ol.reproj.Tile#load always async for consistency 2015-12-28 09:30:12 +01:00
Andreas Hocevar
300b5cad44 Use consistent tile coordinate keys
Tile coordinate keys from ol.tilecoord.toString() are different than the ones
from Array.prototype.toString(). Both were used, potentially causing problems.
This change makes them consistent and removes the now unnecessary
ol.tileCoord.toString() function.
2015-12-27 17:59:51 +01:00
Andreas Hocevar
72ec3fd48d Pass 'opaque' option on to superclass 2015-12-27 17:08:54 +01:00
Petr Sloup
e1712eb44a Initiate tile load only after registering it as loading 2015-12-26 10:49:21 +01:00
Andreas Hocevar
552063aeac Do not render in handleDownEvent 2015-12-18 18:21:32 +01:00
Andreas Hocevar
dad58ba622 Merge pull request #4557 from ahocevar/vectortile-canvas
Conditionally render tiles to a separate tile canvas
2015-12-18 10:43:52 +01:00
Andreas Hocevar
bbc49ca805 Merge pull request #4580 from openlayers/greenkeeper-fs-extra-0.26.3
Update fs-extra to version 0.26.3 🚀
2015-12-18 08:05:36 +01:00
Andreas Hocevar
38bb1569af Remove no longer needed buffer for direct rendering 2015-12-18 00:27:42 +01:00
greenkeeperio-bot
e07c0ec829 chore(package): update fs-extra to version 0.26.3
http://greenkeeper.io/
2015-12-17 10:21:32 -07:00
Bart van den Eijnden
6dbb4e6737 Merge pull request #4579 from openlayers/v3.12.x
Release v3.12.1
2015-12-17 16:20:01 +01:00
Andreas Hocevar
20be8980e1 Merge pull request #4578 from ahocevar/apidoc-landingpage
Fix apidoc landing page markup
2015-12-17 15:15:04 +01:00
Andreas Hocevar
34139f4dce Fix apidoc landing page markup 2015-12-17 15:13:26 +01:00
Andreas Hocevar
9affb99899 More sensible split between direct and canvas rendering 2015-12-17 10:58:35 +01:00
Marc Jansen
f395a0f8c5 Merge pull request #4575 from openlayers/greenkeeper-rbush-1.4.2
Update rbush to version 1.4.2 🚀
2015-12-17 08:14:54 +01:00
Andreas Hocevar
80f10ce824 Avoid unnecessary calculation in loops 2015-12-17 00:17:28 +01:00
Andreas Hocevar
46a266fa5c Fix replays on transformed contexts 2015-12-17 00:17:27 +01:00
Andreas Hocevar
4f2df30f1d Avoid clipping by rendering tiles with rotated labels
This only works when the device pixel ratio is 1. Labels are incorrectly
positioned and not at all rotated for other pixel ratios. I cannot find the
cause for this problem.
2015-12-17 00:17:27 +01:00
Andreas Hocevar
c1b16217f2 Conditionally render tiles to a separate tile canvas
Because clip geometries are anti-aliased in most browsers, there will be tiny
gaps between tiles. If tiles are rendered to a tile canvas which is then drawn
to the map canvas upon composition, these gaps can be avoided. For rotated
views, it is stil necessary to clip the tile, but in this case a 1-pixel
buffer is used.

This change also brings a huge performance improvement for panning, because
the fully rendered tiles can be reused.

Because of the added cost of using drawImage in addition to replaying the tile
replay group, we fall back to directly drawing to the map canvas when the tile
canvas would be too large, or during interaction/animation when resolution or
rotation change.
2015-12-17 00:17:27 +01:00
greenkeeperio-bot
34fb85a9d7 chore(package): update rbush to version 1.4.2
http://greenkeeper.io/
2015-12-16 16:01:49 -07:00
Marc Jansen
6bc6fd9cbc Merge pull request #4571 from marcjansen/select-i-docs
Correct typedef of selectinteraction options obj
2015-12-16 14:55:19 +01:00
Marc Jansen
945f1e7580 Correct typedef of selectinteraction options obj
The key `features` of the constructor options that can be passed to
`ol.interaction.Select` can also be `undefined`.
2015-12-16 14:42:39 +01:00
Bart van den Eijnden
ae90c32f01 Merge pull request #4570 from bartvde/numbersafe
Rename defaultSort to numberSafeCompareFunction on ol.array
2015-12-16 13:50:59 +01:00
Bart van den Eijnden
25e0053a13 Rename defaultSort to numberSafeCompareFunction on ol.array 2015-12-16 13:40:05 +01:00
Bart van den Eijnden
88255fd776 Merge pull request #4567 from bartvde/issue-4566
Always pass on a compare function to sort
2015-12-16 11:35:59 +01:00
Bart van den Eijnden
e0be143ed5 Always pass on a compare function to sort 2015-12-16 10:54:46 +01:00
Bart van den Eijnden
dd4e88525e Merge pull request #4001 from bartvde/jspdf2
Export PDF's using jsPDF
2015-12-15 11:43:04 +01:00
greenkeeperio-bot
195e802f7c chore(package): update mustache to version 2.2.1
http://greenkeeper.io/
2015-12-13 04:07:08 -07:00
Bart van den Eijnden
0c3aed0083 Add support for smooth TileWMS dimensions 2015-12-09 14:06:47 +01:00
Erik Timmers
004e7ad0d0 Add PDF example 2015-12-07 13:53:37 +01:00
greenkeeperio-bot
8b0bd11fc8 chore(package): update istanbul to version 0.4.1
http://greenkeeper.io/
2015-11-24 11:46:44 -07:00
407 changed files with 3103 additions and 2889 deletions

2
.eslintignore Normal file
View File

@@ -0,0 +1,2 @@
examples/Jugl.js
examples/resources/

View File

@@ -1,5 +0,0 @@
{
"-W030": true,
"-W083": true,
"-W069": true
}

View File

@@ -1,5 +1,4 @@
sudo: required
dist: trusty
sudo: false
language: node_js
@@ -14,7 +13,6 @@ env:
before_install:
- "npm prune"
- "sudo pip install -r requirements.txt"
before_script:
- "rm src/ol/renderer/webgl/*shader.js"

View File

@@ -81,8 +81,7 @@ include:
OpenLayers 3 follows [Google's JavaScript Style
Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml).
This is checked using the [Closure
Linter](https://developers.google.com/closure/utilities/) in strict mode. You
This is checked using [ESLint](http://eslint.org/), you
can run the linter locally on your machine before committing using the `lint`
target:

View File

@@ -25,11 +25,11 @@ The minimum requirements are:
* GNU Make
* Git
* [Node.js](http://nodejs.org/) (0.10.x or higher)
* Python 2.6 or 2.7 with a couple of extra modules (see below)
* [Node.js](http://nodejs.org/) (higher than 0.12.x)
* Python 2.6 or 2.7
* Java 7 (JRE and JDK)
The executables `git`, `node`, `python` and `java` should be in your `PATH`.
The executables `git`, `node`, and `java` should be in your `PATH`.
You can check your configuration by running:
@@ -39,17 +39,6 @@ To install the Node.js dependencies run
$ npm install
To install the extra Python modules, run:
$ sudo pip install -r requirements.txt
or
$ cat requirements.txt | sudo xargs easy_install
depending on your OS and Python installation.
(You can also install the Python modules in a Python virtual environment if you want to.)
## Working with the build tool
As an ol3 developer you will use `make` to run build targets defined in the

View File

@@ -1,4 +1,4 @@
Copyright 2005-2015 OpenLayers Contributors. All rights reserved.
Copyright 2005-2016 OpenLayers Contributors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

View File

@@ -93,8 +93,7 @@ compile-examples: build/compiled-examples/all.combined.js
.PHONY: clean
clean:
rm -f build/timestamps/gjslint-timestamp
rm -f build/timestamps/jshint-timestamp
rm -f build/timestamps/eslint-timestamp
rm -f build/timestamps/check-*-timestamp
rm -f build/ol.css
rm -f build/ol.js
@@ -120,9 +119,8 @@ examples: $(BUILD_EXAMPLES)
install: build/timestamps/node-modules-timestamp
.PHONY: lint
lint: build/timestamps/gjslint-timestamp build/timestamps/jshint-timestamp \
build/timestamps/check-requires-timestamp \
build/timestamps/check-whitespace-timestamp
lint: build/timestamps/eslint-timestamp \
build/timestamps/check-requires-timestamp
.PHONY: npm-install
npm-install: build/timestamps/node-modules-timestamp
@@ -193,13 +191,6 @@ build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
@python bin/check-requires.py $(CLOSURE_LIB) $^
@touch $@
build/timestamps/check-whitespace-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
$(SPEC_JS) $(SPEC_RENDERING_JS) \
$(SRC_JSDOC)
@mkdir -p $(@D)
@python bin/check-whitespace.py $^
@touch $@
build/compiled-examples/all.js: $(EXAMPLES_JS)
@mkdir -p $(@D)
@python bin/combine-examples.py $^ > $@
@@ -231,13 +222,6 @@ build/timestamps/jsdoc-$(BRANCH)-timestamp: config/jsdoc/api/index.md \
./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d $(BUILD_HOSTED)/apidoc
@touch $@
build/timestamps/gjslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
$(EXAMPLES_JS)
@mkdir -p $(@D)
@echo "Running gjslint..."
@gjslint --jslint_error=all --custom_jsdoc_tags=event,fires,function,classdesc,api,observable --strict $?
@touch $@
$(BUILD_HOSTED_EXAMPLES_JS): $(BUILD_HOSTED)/examples/%.js: build/examples/%.js
@mkdir -p $(@D)
@python bin/split-example.py $< $(@D)
@@ -271,13 +255,12 @@ $(BUILD_HOSTED)/build/ol-deps.js: host-libraries
--root_with_prefix "$(BUILD_HOSTED)/closure-library/third_party ../../third_party" \
--output_file $@
build/timestamps/jshint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
$(TASKS_JS) $(EXAMPLES_JS) \
examples/resources/common.js \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
@echo "Running jshint..."
@./node_modules/.bin/jshint --verbose $?
@echo "Running eslint..."
@./node_modules/.bin/eslint $?
@touch $@
build/timestamps/node-modules-timestamp: package.json

View File

@@ -1,46 +0,0 @@
import logging
import re
import sys
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger('check-whitespace')
CR_RE = re.compile(r'\r')
LEADING_WHITESPACE_RE = re.compile(r'\s+')
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
NO_NEWLINE_RE = re.compile(r'[^\n]\Z')
ALL_WHITESPACE_RE = re.compile(r'\s+\Z')
def check_whitespace(*filenames):
errors = 0
for filename in sorted(filenames):
whitespace = False
for lineno, line in enumerate(open(filename, 'rU')):
if lineno == 0 and LEADING_WHITESPACE_RE.match(line):
logger.info('%s:%d: leading whitespace', filename, lineno + 1)
errors += 1
if CR_RE.search(line):
logger.info('%s:%d: carriage return character in line',
filename, lineno + 1)
errors += 1
if TRAILING_WHITESPACE_RE.search(line):
logger.info('%s:%d: trailing whitespace', filename, lineno + 1)
errors += 1
if NO_NEWLINE_RE.search(line):
logger.info('%s:%d: no newline at end of file', filename,
lineno + 1)
errors += 1
whitespace = ALL_WHITESPACE_RE.match(line)
if whitespace:
logger.info('%s: trailing whitespace at end of file', filename)
errors += 1
return errors
if __name__ == "__main__":
errors = check_whitespace(*sys.argv[1:])
if errors > 0:
logger.error('%d whitespace errors' % (errors,))
sys.exit(1)

View File

@@ -1,5 +1,31 @@
## Upgrade notes
### v3.14.0
### v3.13.0
#### `proj4js` integration
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
```js
import ol from 'openlayers';
import proj4 from 'proj4';
ol.proj.setProj4(proj4);
```
#### `ol.source.TileJSON` changes
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
```js
new ol.source.TileJSON({
url: 'http://serverwithoutcors.com/tilejson.json',
jsonp: true
})
```
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
### v3.12.0
#### `ol.Map#forEachFeatureAtPixel` changes

109
changelog/v3.13.0.md Normal file
View File

@@ -0,0 +1,109 @@
# v3.13.0
## Summary
The v3.13.0 release includes features and fixes from 68 pull requests since the v3.12.1 release. New features and improvements include:
* Improved tiles rendering for the canvas renderer
* Improved MapQuest rendering
* Add color option to ol.style.Icon
* Load TileJSON sources via XMLHttpRequest by default
* Add new ol.geom.LineString#getCoordinateAt function
* Simplify meters per unit handling
* Use ESLint as a replacement for gjslint.py and jshint
## Upgrade notes
#### `proj4js` integration
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
```js
import ol from 'openlayers';
import proj4 from 'proj4';
ol.proj.setProj4(proj4);
```
#### `ol.source.TileJSON` changes
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
```js
new ol.source.TileJSON({
url: 'http://serverwithoutcors.com/tilejson.json',
jsonp: true
})
```
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
## Full list of changes
* [#4694](https://github.com/openlayers/ol3/pull/4694) - Fix eslint errors in wms-time example ([@fredj](https://github.com/fredj))
* [#4527](https://github.com/openlayers/ol3/pull/4527) - Add support for smooth TileWMS dimensions ([@bartvde](https://github.com/bartvde))
* [#4691](https://github.com/openlayers/ol3/pull/4691) - Updated Bing Maps key. ([@tschaub](https://github.com/tschaub))
* [#4673](https://github.com/openlayers/ol3/pull/4673) - Respect fixed tile url functions when setting url(s) ([@ahocevar](https://github.com/ahocevar))
* [#4689](https://github.com/openlayers/ol3/pull/4689) - Revert "Do not render in handleDownEvent" ([@openlayers](https://github.com/openlayers))
* [#4688](https://github.com/openlayers/ol3/pull/4688) - Give map a focus-outline in accessible-example ([@marcjansen](https://github.com/marcjansen))
* [#4642](https://github.com/openlayers/ol3/pull/4642) - Move the icon style color to its own example ([@alexbrault](https://github.com/alexbrault))
* [#4685](https://github.com/openlayers/ol3/pull/4685) - Remove bin/check-whitespace.py ([@fredj](https://github.com/fredj))
* [#4684](https://github.com/openlayers/ol3/pull/4684) - Update eslint-config-openlayers to version 3.0.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4677](https://github.com/openlayers/ol3/pull/4677) - Make pixel projection handling work in compiled mode ([@ahocevar](https://github.com/ahocevar))
* [#4639](https://github.com/openlayers/ol3/pull/4639) - Remove use of goog.bind and use ES5 .bind. ([@nicholas-l](https://github.com/nicholas-l))
* [#4655](https://github.com/openlayers/ol3/pull/4655) - Update browserify to version 13.0.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4666](https://github.com/openlayers/ol3/pull/4666) - Add a 'boxdrag' event to ol.interaction.DragBox. Resolves #4563 . ([@WeaveTeam](https://github.com/WeaveTeam))
* [#4669](https://github.com/openlayers/ol3/pull/4669) - Remove reference to Closure Linter in CONTRIBUTING.md ([@fredj](https://github.com/fredj))
* [#4665](https://github.com/openlayers/ol3/pull/4665) - Update istanbul to version 0.4.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4663](https://github.com/openlayers/ol3/pull/4663) - Update glob to version 6.0.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4667](https://github.com/openlayers/ol3/pull/4667) - Fix rendering of transparent MapQuest layer type ([@klokantech](https://github.com/klokantech))
* [#4661](https://github.com/openlayers/ol3/pull/4661) - Fixes #4654 Developer Documentation Updated ([@gaf-ag](https://github.com/gaf-ag))
* [#4658](https://github.com/openlayers/ol3/pull/4658) - Update jquery to version 2.2.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4659](https://github.com/openlayers/ol3/pull/4659) - Make sure icons show up in Safari ([@bartvde](https://github.com/bartvde))
* [#4652](https://github.com/openlayers/ol3/pull/4652) - Use map.getTargetElement instead of map.getTarget ([@fredj](https://github.com/fredj))
* [#4649](https://github.com/openlayers/ol3/pull/4649) - Missing parameter description for ol.source.Tile#getOpaque ([@klokantech](https://github.com/klokantech))
* [#4602](https://github.com/openlayers/ol3/pull/4602) - Use ESLint. ([@tschaub](https://github.com/tschaub))
* [#4628](https://github.com/openlayers/ol3/pull/4628) - Fix for reprojecting opaque tile sources ([@klokantech](https://github.com/klokantech))
* [#4618](https://github.com/openlayers/ol3/pull/4618) - Update resemblejs to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4647](https://github.com/openlayers/ol3/pull/4647) - Proper rounding for possibly negative numbers ([@ahocevar](https://github.com/ahocevar))
* [#4641](https://github.com/openlayers/ol3/pull/4641) - Remove extra options from icon example. ([@tschaub](https://github.com/tschaub))
* [#4629](https://github.com/openlayers/ol3/pull/4629) - Simplify scaleline calculation ([@ahocevar](https://github.com/ahocevar))
* [#4457](https://github.com/openlayers/ol3/pull/4457) - Add color option to ol.style.Icon ([@alexbrault](https://github.com/alexbrault))
* [#4638](https://github.com/openlayers/ol3/pull/4638) - Do not rely on projection extent ([@ahocevar](https://github.com/ahocevar))
* [#4635](https://github.com/openlayers/ol3/pull/4635) - Update async to version 1.5.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4581](https://github.com/openlayers/ol3/pull/4581) - Do not render in handleDownEvent ([@ahocevar](https://github.com/ahocevar))
* [#4541](https://github.com/openlayers/ol3/pull/4541) - Add new ol.geom.LineString#getCoordinateAt function ([@fredj](https://github.com/fredj))
* [#4489](https://github.com/openlayers/ol3/pull/4489) - Update phantomjs to version 1.9.19 🚀 ([@openlayers](https://github.com/openlayers))
* [#4625](https://github.com/openlayers/ol3/pull/4625) - Use XHR by default to load TileJSON in ol.source.TileJSON ([@klokantech](https://github.com/klokantech))
* [#4622](https://github.com/openlayers/ol3/pull/4622) - Update fs-extra to version 0.26.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4630](https://github.com/openlayers/ol3/pull/4630) - Simplify meters per unit handling ([@ahocevar](https://github.com/ahocevar))
* [#4490](https://github.com/openlayers/ol3/pull/4490) - Update istanbul to version 0.4.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4574](https://github.com/openlayers/ol3/pull/4574) - Added boxEndCondition to DragBoxOptions to replace the hardcoded chec… ([@WeaveTeam](https://github.com/WeaveTeam))
* [#4553](https://github.com/openlayers/ol3/pull/4553) - Update mustache to version 2.2.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4626](https://github.com/openlayers/ol3/pull/4626) - Fixed documentation error ([@simonseyock](https://github.com/simonseyock))
* [#4606](https://github.com/openlayers/ol3/pull/4606) - Include originating MapBrowserEvent in ol.DragBoxEvent ([@fredj](https://github.com/fredj))
* [#4614](https://github.com/openlayers/ol3/pull/4614) - Remove checksum interface. ([@tschaub](https://github.com/tschaub))
* [#4613](https://github.com/openlayers/ol3/pull/4613) - Include own layer in layerFilter and only select unselected features ([@ahocevar](https://github.com/ahocevar))
* [#4612](https://github.com/openlayers/ol3/pull/4612) - Set oli.source.VectorEvent#feature to ol.Feature|undefined ([@fredj](https://github.com/fredj))
* [#4620](https://github.com/openlayers/ol3/pull/4620) - Fix olx.format.PolylineOptions#factor type ([@fredj](https://github.com/fredj))
* [#4621](https://github.com/openlayers/ol3/pull/4621) - Fix olx.format.GPXOptions#readExtensions type ([@fredj](https://github.com/fredj))
* [#4619](https://github.com/openlayers/ol3/pull/4619) - Add option to load TileJSON via XHR ([@klokantech](https://github.com/klokantech))
* [#4617](https://github.com/openlayers/ol3/pull/4617) - Add missing return type to GeoJSON format ([@gberaudo](https://github.com/gberaudo))
* [#4615](https://github.com/openlayers/ol3/pull/4615) - Adjust copyright to include 2016 ([@marcjansen](https://github.com/marcjansen))
* [#4616](https://github.com/openlayers/ol3/pull/4616) - Update closure-util to version 1.10.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4596](https://github.com/openlayers/ol3/pull/4596) - Use consistent tile coordinate keys ([@ahocevar](https://github.com/ahocevar))
* [#4609](https://github.com/openlayers/ol3/pull/4609) - Add ol.proj.setProj4 function ([@bartvde](https://github.com/bartvde))
* [#4603](https://github.com/openlayers/ol3/pull/4603) - Update async to version 1.5.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4604](https://github.com/openlayers/ol3/pull/4604) - Update clean-css to version 3.4.9 🚀 ([@openlayers](https://github.com/openlayers))
* [#4600](https://github.com/openlayers/ol3/pull/4600) - Update glob to version 6.0.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4595](https://github.com/openlayers/ol3/pull/4595) - Pass 'opaque' option on to superclass ([@ahocevar](https://github.com/ahocevar))
* [#4598](https://github.com/openlayers/ol3/pull/4598) - Make ol.source.Tile#getTilePixelRatio work correctly for all sources ([@klokantech](https://github.com/klokantech))
* [#4594](https://github.com/openlayers/ol3/pull/4594) - Fix for TileQueue gradually choking up when using raster reprojection ([@klokantech](https://github.com/klokantech))
* [#4557](https://github.com/openlayers/ol3/pull/4557) - Conditionally render tiles to a separate tile canvas ([@ahocevar](https://github.com/ahocevar))
* [#4580](https://github.com/openlayers/ol3/pull/4580) - Update fs-extra to version 0.26.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4579](https://github.com/openlayers/ol3/pull/4579) - Release v3.12.1 ([@openlayers](https://github.com/openlayers))
* [#4578](https://github.com/openlayers/ol3/pull/4578) - Fix apidoc landing page markup ([@ahocevar](https://github.com/ahocevar))
* [#4575](https://github.com/openlayers/ol3/pull/4575) - Update rbush to version 1.4.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4571](https://github.com/openlayers/ol3/pull/4571) - Correct typedef of selectinteraction options obj ([@marcjansen](https://github.com/marcjansen))
* [#4570](https://github.com/openlayers/ol3/pull/4570) - Rename defaultSort to numberSafeCompareFunction on ol.array ([@bartvde](https://github.com/bartvde))
* [#4567](https://github.com/openlayers/ol3/pull/4567) - Always pass on a compare function to sort ([@bartvde](https://github.com/bartvde))
* [#4001](https://github.com/openlayers/ol3/pull/4001) - Export PDF's using jsPDF ([@bartvde](https://github.com/bartvde))

View File

@@ -18,6 +18,7 @@
"externs/example.js",
"externs/fastclick.js",
"externs/geojson.js",
"externs/jspdf.js",
"externs/jquery-1.9.js",
"externs/proj4js.js",
"externs/tilejson.js",

View File

@@ -11,7 +11,7 @@
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
{{{ extraHead.local }}}
{{{ css.tag }}}
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,Function.prototype.bind|gated"></script>
<script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
<title>{{ title }}</title>
</head>

17
examples/.eslintrc Normal file
View File

@@ -0,0 +1,17 @@
{
"globals": {
"FastClick": false,
"$": false,
"arc": false,
"common": false,
"createMapboxStreetsV6Style": false,
"d3": false,
"jsPDF": false,
"jsts": false,
"topojson": false,
"turf": false
},
"rules": {
"no-unused-vars": [2, {"varsIgnorePattern": "^map"}]
}
}

View File

@@ -14,3 +14,6 @@ a.skiplink:focus {
background-color: #fff;
padding: 0.3em;
}
#map:focus {
outline: #4A74A8 solid 0.15em;
}

View File

@@ -14,7 +14,7 @@ var map = new ol.Map({
source: new ol.source.OSM()
})
],
controls: ol.control.defaults({ attribution: false }).extend([attribution]),
controls: ol.control.defaults({attribution: false}).extend([attribution]),
renderer: common.getRendererFromQueryString(),
target: 'map',
view: new ol.View({

View File

@@ -6,7 +6,7 @@ docs: >
<p>When the Bing Maps tile service doesn't have tiles for a given resolution and region it returns "placeholder" tiles indicating that. Zoom the map beyond level 19 to see the "placeholder" tiles. If you want OpenLayers to display stretched tiles in place of "placeholder" tiles beyond zoom level 19 then set <code>maxZoom</code> to <code>19</code> in the options passed to <code>ol.source.BingMaps</code>.</p>
tags: "bing, bing-maps"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<select id="layer-select">

View File

@@ -18,7 +18,7 @@ for (i = 0, ii = styles.length; i < ii; ++i) {
visible: false,
preload: Infinity,
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: styles[i]
// use maxZoom 19 to see stretched tiles instead of the BingMaps
// "no photos at this zoom level" tiles

View File

@@ -85,8 +85,13 @@ var map = new ol.Map({
})
});
// Get the form elements and bind the listeners
var select = document.getElementById('blend-mode');
var affectRed = document.getElementById('affect-red');
var affectGreen = document.getElementById('affect-green');
var affectBlue = document.getElementById('affect-blue');
// Various helper methods and event handlers
/**
* This method sets the globalCompositeOperation to the value of the select
* field and it is bound to the precompose event of the layers.
@@ -154,12 +159,6 @@ var affectLayerClicked = function() {
};
// Get the form elements and bind the listeners
var select = document.getElementById('blend-mode');
var affectRed = document.getElementById('affect-red');
var affectGreen = document.getElementById('affect-green');
var affectBlue = document.getElementById('affect-blue');
// Rerender map when blend mode changes
select.addEventListener('change', function() {
map.render();

View File

@@ -48,7 +48,7 @@ map.addInteraction(dragBox);
var infoBox = document.getElementById('info');
dragBox.on('boxend', function(e) {
dragBox.on('boxend', function() {
// features that intersect the box are added to the collection of
// selected features, and their names are displayed in the "info"
// div
@@ -64,7 +64,7 @@ dragBox.on('boxend', function(e) {
});
// clear selection when drawing a new box and when clicking on the map
dragBox.on('boxstart', function(e) {
dragBox.on('boxstart', function() {
selectedFeatures.clear();
infoBox.innerHTML = '&nbsp;';
});

View File

@@ -65,14 +65,7 @@ zoomtoswitzerlandbest.addEventListener('click', function() {
var feature = source.getFeatures()[0];
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize());
view.fit(
polygon,
size,
{
padding: [170, 50, 30, 150],
constrainResolution: false
}
);
view.fit(polygon, size, {padding: [170, 50, 30, 150], constrainResolution: false});
}, false);
var zoomtoswitzerlandconstrained =
@@ -81,13 +74,7 @@ zoomtoswitzerlandconstrained.addEventListener('click', function() {
var feature = source.getFeatures()[0];
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize());
view.fit(
polygon,
size,
{
padding: [170, 50, 30, 150]
}
);
view.fit(polygon, size, {padding: [170, 50, 30, 150]});
}, false);
var zoomtoswitzerlandnearest =
@@ -96,14 +83,7 @@ zoomtoswitzerlandnearest.addEventListener('click', function() {
var feature = source.getFeatures()[0];
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize());
view.fit(
polygon,
size,
{
padding: [170, 50, 30, 150],
nearest: true
}
);
view.fit(polygon, size, {padding: [170, 50, 30, 150], nearest: true});
}, false);
var zoomtolausanne = document.getElementById('zoomtolausanne');
@@ -111,14 +91,7 @@ zoomtolausanne.addEventListener('click', function() {
var feature = source.getFeatures()[1];
var point = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize());
view.fit(
point,
size,
{
padding: [170, 50, 30, 150],
minResolution: 50
}
);
view.fit(point, size, {padding: [170, 50, 30, 150], minResolution: 50});
}, false);
var centerlausanne = document.getElementById('centerlausanne');
@@ -126,9 +99,5 @@ centerlausanne.addEventListener('click', function() {
var feature = source.getFeatures()[1];
var point = /** @type {ol.geom.Point} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize());
view.centerOn(
point.getCoordinates(),
size,
[570, 500]
);
view.centerOn(point.getCoordinates(), size, [570, 500]);
}, false);

View File

@@ -34,7 +34,7 @@ var clusterSource = new ol.source.Cluster({
var styleCache = {};
var clusters = new ol.layer.Vector({
source: clusterSource,
style: function(feature, resolution) {
style: function(feature) {
var size = feature.get('features').length;
var style = styleCache[size];
if (!style) {
@@ -65,10 +65,6 @@ var raster = new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
});
var raw = new ol.layer.Vector({
source: source
});
var map = new ol.Map({
layers: [raster, clusters],
renderer: 'canvas',

View File

@@ -138,6 +138,8 @@ var raster = new ol.source.Raster({
}
});
var controls = {};
raster.on('beforeoperations', function(event) {
var data = event.data;
for (var id in controls) {
@@ -160,7 +162,6 @@ var map = new ol.Map({
});
var controlIds = ['hue', 'chroma', 'lightness'];
var controls = {};
controlIds.forEach(function(id) {
var control = document.getElementById(id);
var output = document.getElementById(id + 'Out');

View File

@@ -19,7 +19,6 @@ var app = window.app;
//
/**
* @constructor
* @extends {ol.control.Control}
@@ -33,7 +32,7 @@ app.RotateNorthControl = function(opt_options) {
button.innerHTML = 'N';
var this_ = this;
var handleRotateNorth = function(e) {
var handleRotateNorth = function() {
this_.getMap().getView().setRotation(0);
};

View File

@@ -22,7 +22,6 @@ goog.require('ol.style.Style');
var app = {};
/**
* @constructor
* @extends {ol.interaction.Pointer}
@@ -72,7 +71,7 @@ app.Drag.prototype.handleDownEvent = function(evt) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
function(feature) {
return feature;
});
@@ -89,13 +88,6 @@ app.Drag.prototype.handleDownEvent = function(evt) {
* @param {ol.MapBrowserEvent} evt Map browser event.
*/
app.Drag.prototype.handleDragEvent = function(evt) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
var deltaX = evt.coordinate[0] - this.coordinate_[0];
var deltaY = evt.coordinate[1] - this.coordinate_[1];
@@ -115,7 +107,7 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
if (this.cursor_) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
function(feature) {
return feature;
});
var element = evt.map.getTargetElement();
@@ -133,10 +125,9 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
/**
* @param {ol.MapBrowserEvent} evt Map browser event.
* @return {boolean} `false` to stop the drag sequence.
*/
app.Drag.prototype.handleUpEvent = function(evt) {
app.Drag.prototype.handleUpEvent = function() {
this.coordinate_ = null;
this.feature_ = null;
return false;
@@ -158,7 +149,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
})
}),
new ol.layer.Vector({

2
examples/d3.js vendored
View File

@@ -39,7 +39,7 @@ d3.json('data/topojson/us.json', function(error, us) {
* @param {number} pixelRatio Pixel ratio.
* @param {ol.Size} size Size.
* @param {ol.proj.Projection} projection Projection.
* @return {HTMLCanvasElement}
* @return {HTMLCanvasElement} A canvas element.
*/
var canvasFunction = function(extent, resolution, pixelRatio,
size, projection) {

BIN
examples/data/dot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

View File

@@ -39,7 +39,7 @@ el('track').addEventListener('change', function() {
deviceOrientation.setTracking(this.checked);
});
deviceOrientation.on('change', function(event) {
deviceOrientation.on('change', function() {
el('alpha').innerText = deviceOrientation.getAlpha() + ' [rad]';
el('beta').innerText = deviceOrientation.getBeta() + ' [rad]';
el('gamma').innerText = deviceOrientation.getGamma() + ' [rad]';

View File

@@ -6,7 +6,7 @@ docs: >
Example of using the drag-and-drop interaction with a ol.source.ImageVector. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client.
tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -100,7 +100,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
})
})
],
@@ -128,7 +128,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
var displayFeatureInfo = function(pixel) {
var features = [];
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
map.forEachFeatureAtPixel(pixel, function(feature) {
features.push(feature);
});
if (features.length > 0) {

View File

@@ -6,7 +6,7 @@ docs: >
Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857.
tags: "drag-and-drop, gpx, geojson, igc, kml, topojson"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -99,7 +99,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
})
})
],
@@ -124,7 +124,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
var displayFeatureInfo = function(pixel) {
var features = [];
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
map.forEachFeatureAtPixel(pixel, function(feature) {
features.push(feature);
});
if (features.length > 0) {

View File

@@ -60,6 +60,8 @@ var modify = new ol.interaction.Modify({
map.addInteraction(modify);
var draw; // global so we can remove it later
var typeSelect = document.getElementById('type');
function addInteraction() {
draw = new ol.interaction.Draw({
features: features,
@@ -68,14 +70,11 @@ function addInteraction() {
map.addInteraction(draw);
}
var typeSelect = document.getElementById('type');
/**
* Let user change the geometry type.
* @param {Event} e Change event.
* Handle change event.
*/
typeSelect.onchange = function(e) {
typeSelect.onchange = function() {
map.removeInteraction(draw);
addInteraction();
};

View File

@@ -83,10 +83,9 @@ function addInteraction() {
/**
* Let user change the geometry type.
* @param {Event} e Change event.
* Handle change event.
*/
typeSelect.onchange = function(e) {
typeSelect.onchange = function() {
map.removeInteraction(draw);
addInteraction();
};

View File

@@ -56,7 +56,7 @@ function createEarthquakeStyle(feature) {
});
}
var maxFeatureCount;
var maxFeatureCount, vector;
function calculateClusterInfo(resolution) {
maxFeatureCount = 0;
var features = vector.getSource().getFeatures();
@@ -65,7 +65,8 @@ function calculateClusterInfo(resolution) {
feature = features[i];
var originalFeatures = feature.get('features');
var extent = ol.extent.createEmpty();
for (var j = 0, jj = originalFeatures.length; j < jj; ++j) {
var j, jj;
for (j = 0, jj = originalFeatures.length; j < jj; ++j) {
ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent());
}
maxFeatureCount = Math.max(maxFeatureCount, jj);
@@ -104,7 +105,7 @@ function styleFunction(feature, resolution) {
return style;
}
function selectStyleFunction(feature, resolution) {
function selectStyleFunction(feature) {
var styles = [new ol.style.Style({
image: new ol.style.Circle({
radius: feature.get('radius'),
@@ -120,7 +121,7 @@ function selectStyleFunction(feature, resolution) {
return styles;
}
var vector = new ol.layer.Vector({
vector = new ol.layer.Vector({
source: new ol.source.Cluster({
distance: 40,
source: new ol.source.Vector({

View File

@@ -14,7 +14,7 @@ goog.require('ol.style.Style');
var styleCache = {};
var styleFunction = function(feature, resolution) {
var styleFunction = function(feature) {
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
// standards-violating <magnitude> tag in each Placemark. We extract it from
// the Placemark's name instead.
@@ -29,8 +29,8 @@ var styleFunction = function(feature, resolution) {
/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')),
{size: [size + 2, size + 2], pixelRatio: size / 10});
render.setFillStrokeStyle(
new ol.style.Fill({ color: 'rgba(255, 153, 0, 0.4)' }),
new ol.style.Stroke({ color: 'rgba(255, 204, 0, 0.2)', width: 1 }));
new ol.style.Fill({color: 'rgba(255, 153, 0, 0.4)'}),
new ol.style.Stroke({color: 'rgba(255, 204, 0, 0.2)', width: 1}));
render.drawPolygonGeometry(new ol.geom.Polygon(
[[[0, 0], [4, 2], [6, 0], [10, 5], [6, 3], [4, 5], [0, 0]]]));
style = new ol.style.Style({

View File

@@ -34,7 +34,7 @@ var map = new ol.Map({
var exportPNGElement = document.getElementById('export-png');
if ('download' in exportPNGElement) {
exportPNGElement.addEventListener('click', function(e) {
exportPNGElement.addEventListener('click', function() {
map.once('postcompose', function(event) {
var canvas = event.context.canvas;
exportPNGElement.href = canvas.toDataURL('image/png');

3
examples/export-pdf.css Normal file
View File

@@ -0,0 +1,3 @@
.map {
max-width: 566px;
}

33
examples/export-pdf.html Normal file
View File

@@ -0,0 +1,33 @@
---
layout: example.html
title: Export PDF example
shortdesc: Example of exporting a map as a PDF.
docs: >
Example of exporting a map as a PDF using the <a href="https://github.com/MrRio/jsPDF" target="_blank">jsPDF</a> library.
tags: "export, pdf, openstreetmap"
resources:
- http://mrrio.github.io/jsPDF/dist/jspdf.min.js
---
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<form class="form">
<label>Page size </label>
<select id="format">
<option value="a0">A0 (slow)</option>
<option value="a1">A1</option>
<option value="a2">A2</option>
<option value="a3">A3</option>
<option value="a4" selected>A4</option>
<option value="a5">A5 (fast)</option>
</select>
<label>Resolution </label>
<select id="resolution">
<option value="72">72 dpi (fast)</option>
<option value="150">150 dpi</option>
<option value="300">300 dpi (slow)</option>
</select>
</form>
<button id="export-pdf">Export PDF</button>

109
examples/export-pdf.js Normal file
View File

@@ -0,0 +1,109 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control');
goog.require('ol.format.WKT');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var format = new ol.format.WKT();
var feature = format.readFeature(
'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' +
'-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' +
'-39.1552734375, 10.689697265625 -25.0927734375))');
feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
features: [feature]
})
});
var map = new ol.Map({
layers: [raster, vector],
target: 'map',
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: false
})
}),
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
var dims = {
a0: [1189, 841],
a1: [841, 594],
a2: [594, 420],
a3: [420, 297],
a4: [297, 210],
a5: [210, 148]
};
var loading = 0;
var loaded = 0;
var exportButton = document.getElementById('export-pdf');
exportButton.addEventListener('click', function() {
exportButton.disabled = true;
document.body.style.cursor = 'progress';
var format = document.getElementById('format').value;
var resolution = document.getElementById('resolution').value;
var dim = dims[format];
var width = Math.round(dim[0] * resolution / 25.4);
var height = Math.round(dim[1] * resolution / 25.4);
var size = /** @type {ol.Size} */ (map.getSize());
var extent = map.getView().calculateExtent(size);
var source = raster.getSource();
var tileLoadStart = function() {
++loading;
};
var tileLoadEnd = function() {
++loaded;
if (loading === loaded) {
var canvas = this;
window.setTimeout(function() {
loading = 0;
loaded = 0;
var data = canvas.toDataURL('image/png');
var pdf = new jsPDF('landscape', undefined, format);
pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
pdf.save('map.pdf');
source.un('tileloadstart', tileLoadStart);
source.un('tileloadend', tileLoadEnd, canvas);
source.un('tileloaderror', tileLoadEnd, canvas);
map.setSize(size);
map.getView().fit(extent, size);
map.renderSync();
exportButton.disabled = false;
document.body.style.cursor = 'auto';
}, 100);
}
};
map.once('postcompose', function(event) {
source.on('tileloadstart', tileLoadStart);
source.on('tileloadend', tileLoadEnd, event.context.canvas);
source.on('tileloaderror', tileLoadEnd, event.context.canvas);
});
map.setSize([width, height]);
map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
map.renderSync();
}, false);

View File

@@ -108,11 +108,16 @@ var styles = {
})
};
var animating = false;
var speed, now;
var speedInput = document.getElementById('speed');
var startButton = document.getElementById('start-animation');
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: [routeFeature, geoMarker, startMarker, endMarker]
}),
style: function(feature, resolution) {
style: function(feature) {
// hide geoMarker if animation is active
if (animating && feature.get('type') === 'geoMarker') {
return null;
@@ -135,7 +140,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'AerialWithLabels',
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
})
}),
vectorLayer
@@ -198,8 +203,4 @@ function stopAnimation(ended) {
map.un('postcompose', moveFeature);
}
var speed, now;
var animating = false;
var speedInput = document.getElementById('speed');
var startButton = document.getElementById('start-animation');
startButton.addEventListener('click', startAnimation, false);

View File

@@ -35,6 +35,14 @@ var defaultStyle = new ol.style.Style({
stroke: defaultStroke
});
var flightsSource;
var addLater = function(feature, timeout) {
window.setTimeout(function() {
feature.set('start', new Date().getTime());
flightsSource.addFeature(feature);
}, timeout);
};
var pointsPerMs = 0.1;
var animateFlights = function(event) {
var vectorContext = event.vectorContext;
@@ -66,20 +74,13 @@ var animateFlights = function(event) {
map.render();
};
var addLater = function(feature, timeout) {
window.setTimeout(function() {
feature.set('start', new Date().getTime());
flightsSource.addFeature(feature);
}, timeout);
};
var flightsSource = new ol.source.Vector({
flightsSource = new ol.source.Vector({
wrapX: false,
attributions: [new ol.Attribution({
html: 'Flight data by ' +
'<a href="http://openflights.org/data.html">OpenFlights</a>,'
})],
loader: function(extent, resolution, projection) {
loader: function() {
var url = 'data/openflights/flights.json';
fetch(url).then(function(response) {
return response.json();
@@ -116,7 +117,7 @@ var flightsSource = new ol.source.Vector({
var flightsLayer = new ol.layer.Vector({
source: flightsSource,
style: function(feature, resolution) {
style: function(feature) {
// if the animation is still active for a feature, do not
// render the feature with the layer style
if (feature.get('finished')) {

View File

@@ -7,6 +7,6 @@ docs: >
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
tags: "full-screen, drag, rotate, zoom, bing, bing-maps"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -18,7 +18,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'Aerial'
})
})

View File

@@ -7,6 +7,6 @@ docs: >
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
tags: "full-screen, bing, bing-maps"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -18,7 +18,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'Aerial'
})
})

View File

@@ -85,7 +85,7 @@ var styles = {
})
};
var styleFunction = function(feature, resolution) {
var styleFunction = function(feature) {
return styles[feature.getGeometry().getType()];
};
@@ -97,79 +97,67 @@ var geojsonObject = {
'name': 'EPSG:3857'
}
},
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [0, 0]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6], [8e6, 2e6]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], [-3e6, -1e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiLineString',
'coordinates': [
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
[[1e6, -7.5e5], [1e6, 7.5e5]],
[[-7.5e5, -1e6], [7.5e5, -1e6]],
[[-7.5e5, 1e6], [7.5e5, 1e6]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
'coordinates': [
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
[[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], [0, 6e6]]],
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [
{
'type': 'LineString',
'coordinates': [[-5e6, -5e6], [0, -5e6]]
},
{
'type': 'Point',
'coordinates': [4e6, -5e6]
},
{
'type': 'Polygon',
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
}
]
}
'features': [{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [0, 0]
}
]
}, {
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6], [8e6, 2e6]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], [-3e6, -1e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'MultiLineString',
'coordinates': [
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
[[1e6, -7.5e5], [1e6, 7.5e5]],
[[-7.5e5, -1e6], [7.5e5, -1e6]],
[[-7.5e5, 1e6], [7.5e5, 1e6]]
]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
'coordinates': [
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [-3e6, 6e6]]],
[[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], [0, 6e6]]],
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [3e6, 6e6]]]
]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [{
'type': 'LineString',
'coordinates': [[-5e6, -5e6], [0, -5e6]]
}, {
'type': 'Point',
'coordinates': [4e6, -5e6]
}, {
'type': 'Polygon',
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
}]
}
}]
};
var vectorSource = new ol.source.Vector({

View File

@@ -13,6 +13,7 @@ tags: "fullscreen, geolocation, orientation, mobile"
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Function.prototype.bind|gated"></script>
<title>Mobile Geolocation Tracking with Orientation</title>
<style type="text/css">
html, body, .map {

View File

@@ -58,7 +58,7 @@ var geolocation = new ol.Geolocation(/** @type {olx.GeolocationOptions} */ ({
var deltaMean = 500; // the geolocation sampling period mean in ms
// Listen to position changes
geolocation.on('change', function(evt) {
geolocation.on('change', function() {
var position = geolocation.getPosition();
var accuracy = geolocation.getAccuracy();
var heading = geolocation.getHeading() || 0;
@@ -113,7 +113,7 @@ function addPosition(position, heading, m, speed) {
// force the rotation change to be less than 180°
if (Math.abs(headingDiff) > Math.PI) {
var sign = (headingDiff >= 0) ? 1 : -1;
headingDiff = - sign * (2 * Math.PI - Math.abs(headingDiff));
headingDiff = -sign * (2 * Math.PI - Math.abs(headingDiff));
}
heading = prevHeading + headingDiff;
}

View File

@@ -86,7 +86,7 @@ geolocation.on('change:position', function() {
new ol.geom.Point(coordinates) : null);
});
var featuresOverlay = new ol.layer.Vector({
new ol.layer.Vector({
map: map,
source: new ol.source.Vector({
features: [accuracyFeature, positionFeature]

View File

@@ -44,7 +44,7 @@ map.on('pointermove', function(evt) {
return;
}
var pixel = map.getEventPixel(evt.originalEvent);
var hit = map.forEachLayerAtPixel(pixel, function(layer) {
var hit = map.forEachLayerAtPixel(pixel, function() {
return true;
});
map.getTargetElement().style.cursor = hit ? 'pointer' : '';

View File

@@ -44,7 +44,7 @@ map.on('pointermove', function(evt) {
return;
}
var pixel = map.getEventPixel(evt.originalEvent);
var hit = map.forEachLayerAtPixel(pixel, function(layer) {
var hit = map.forEachLayerAtPixel(pixel, function() {
return true;
});
map.getTargetElement().style.cursor = hit ? 'pointer' : '';

View File

@@ -6,7 +6,7 @@ docs: >
Example of using the GPX source.
tags: "GPX"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -3,7 +3,6 @@ goog.require('ol.View');
goog.require('ol.format.GPX');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
goog.require('ol.source.Vector');
goog.require('ol.style.Circle');
@@ -11,12 +10,10 @@ goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var projection = ol.proj.get('EPSG:3857');
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
})
});
@@ -52,7 +49,7 @@ var vector = new ol.layer.Vector({
url: 'data/gpx/fells_loop.gpx',
format: new ol.format.GPX()
}),
style: function(feature, resolution) {
style: function(feature) {
return style[feature.getGeometry().getType()];
}
});
@@ -68,7 +65,7 @@ var map = new ol.Map({
var displayFeatureInfo = function(pixel) {
var features = [];
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
map.forEachFeatureAtPixel(pixel, function(feature) {
features.push(feature);
});
if (features.length > 0) {

3
examples/icon-color.css Normal file
View File

@@ -0,0 +1,3 @@
#map {
position: relative;
}

10
examples/icon-color.html Normal file
View File

@@ -0,0 +1,10 @@
---
layout: example.html
title: Icon Colors
shortdesc: Example assigning a custom color to an icon
docs: >
Example assigning a custom color to an icon. The features in this examples are all using the same image with the different colors coming from the javascript file
tags: "vector, style, icon, marker"
resources:
---
<div id="map" class="map"></div>

71
examples/icon-color.js Normal file
View File

@@ -0,0 +1,71 @@
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Point');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.proj');
goog.require('ol.source.TileJSON');
goog.require('ol.source.Vector');
goog.require('ol.style.Icon');
goog.require('ol.style.Style');
var rome = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.fromLonLat([12.5, 41.9]))
});
var london = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.fromLonLat([-0.12755, 51.507222]))
});
var madrid = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.fromLonLat([-3.683333, 40.4]))
});
rome.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#8959A8',
src: 'data/dot.png'
}))
}));
london.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#4271AE',
src: 'data/dot.png'
}))
}));
madrid.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: [113, 140, 0],
src: 'data/dot.png'
}))
}));
var vectorSource = new ol.source.Vector({
features: [rome, london, madrid]
});
var vectorLayer = new ol.layer.Vector({
source: vectorSource
});
var rasterLayer = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json',
crossOrigin: ''
})
});
var map = new ol.Map({
renderer: common.getRendererFromQueryString(),
layers: [rasterLayer, vectorLayer],
target: document.getElementById('map'),
view: new ol.View({
center: ol.proj.fromLonLat([2.896372, 44.60240]),
zoom: 3
})
});

View File

@@ -28,11 +28,13 @@ iconFeature.set('style', createStyle('data/icon.png', undefined));
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.Stamen({ layer: 'watercolor' })
source: new ol.source.Stamen({layer: 'watercolor'})
}),
new ol.layer.Vector({
style: function(feature) { return feature.get('style'); },
source: new ol.source.Vector({ features: [iconFeature] })
style: function(feature) {
return feature.get('style');
},
source: new ol.source.Vector({features: [iconFeature]})
})
],
target: document.getElementById('map'),
@@ -44,7 +46,7 @@ var map = new ol.Map({
var selectStyle = {};
var select = new ol.interaction.Select({
style: function(feature, resolution) {
style: function(feature) {
var image = feature.get('style').getImage().getImage();
if (!selectStyle[image.src]) {
var canvas = document.createElement('canvas');

View File

@@ -95,7 +95,7 @@ for (i = 0; i < featureCount; i += 30) {
overlayFeatures.push(clone);
}
var featureOverlay = new ol.layer.Vector({
new ol.layer.Vector({
map: map,
source: new ol.source.Vector({
features: overlayFeatures
@@ -112,8 +112,8 @@ map.on('click', function(evt) {
window.setTimeout(function() {
var features = [];
map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) {
features.push(features);
map.forEachFeatureAtPixel(evt.pixel, function(feature) {
features.push(feature);
return false;
});

View File

@@ -23,7 +23,6 @@ var iconStyle = new ol.style.Style({
anchor: [0.5, 46],
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
opacity: 0.75,
src: 'data/icon.png'
}))
});
@@ -40,7 +39,7 @@ var vectorLayer = new ol.layer.Vector({
var rasterLayer = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp',
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json',
crossOrigin: ''
})
});
@@ -67,7 +66,7 @@ map.addOverlay(popup);
// display popup on click
map.on('click', function(evt) {
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
function(feature) {
return feature;
});
if (feature) {

View File

@@ -25,7 +25,7 @@ var colors = {
};
var styleCache = {};
var styleFunction = function(feature, resolution) {
var styleFunction = function(feature) {
var color = colors[feature.get('PLT')];
var style = styleCache[color];
if (!style) {

View File

@@ -8,7 +8,7 @@ docs: >
In this example, the <code>postcompose</code> listener applies a filter to the image data.</p>
tags: "filter, image manipulation"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<select id="kernel" name="kernel">

View File

@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
var key = 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3';
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
var imagery = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Aerial'})

View File

@@ -4,7 +4,6 @@ goog.require('ol.layer.Image');
goog.require('ol.source.ImageWMS');
/**
* Renders a progress bar.
* @param {Element} el The target element.
@@ -84,14 +83,14 @@ var source = new ol.source.ImageWMS({
serverType: 'geoserver'
});
source.on('imageloadstart', function(event) {
source.on('imageloadstart', function() {
progress.addLoading();
});
source.on('imageloadend', function(event) {
source.on('imageloadend', function() {
progress.addLoaded();
});
source.on('imageloaderror', function(event) {
source.on('imageloaderror', function() {
progress.addLoaded();
});

View File

@@ -59,7 +59,7 @@ var featureOverlay = new ol.layer.Vector({
var highlight;
var displayFeatureInfo = function(pixel) {
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
return feature;
});

View File

@@ -12,7 +12,7 @@ goog.require('ol.style.Style');
var styleCache = {};
var styleFunction = function(feature, resolution) {
var styleFunction = function(feature) {
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
// standards-violating <magnitude> tag in each Placemark. We extract it from
// the Placemark's name instead.
@@ -74,7 +74,7 @@ var displayFeatureInfo = function(pixel) {
left: pixel[0] + 'px',
top: (pixel[1] - 15) + 'px'
});
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
return feature;
});
if (feature) {

View File

@@ -17,7 +17,7 @@ goog.require('ol.style.Style');
* currently midnight would have an opacity of 0. This doesn't account for
* daylight savings, so don't use it to plan your vacation.
*/
var styleFunction = function(feature, resolution) {
var styleFunction = function(feature) {
var offset = 0;
var name = feature.get('name'); // e.g. GMT -08:30
var match = name.match(/([\-+]\d{2}):(\d{2})$/);
@@ -81,7 +81,7 @@ var displayFeatureInfo = function(pixel) {
left: pixel[0] + 'px',
top: (pixel[1] - 15) + 'px'
});
var feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {
var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
return feature;
});
if (feature) {

View File

@@ -6,7 +6,7 @@ docs: >
This example uses the <code>ol.format.KML</code> to parse KML for rendering with a vector source.
tags: "KML"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -12,7 +12,7 @@ var projection = ol.proj.get('EPSG:3857');
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
})
});
@@ -35,7 +35,7 @@ var map = new ol.Map({
var displayFeatureInfo = function(pixel) {
var features = [];
map.forEachFeatureAtPixel(pixel, function(feature, layer) {
map.forEachFeatureAtPixel(pixel, function(feature) {
features.push(feature);
});
if (features.length > 0) {

View File

@@ -19,7 +19,7 @@ var extents = {
var base = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.world-black.jsonp',
'mapbox.world-black.json',
crossOrigin: 'anonymous'
})
});
@@ -28,7 +28,7 @@ var overlay = new ol.layer.Tile({
extent: extents.northwest,
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.world-glass.jsonp',
'mapbox.world-glass.json',
crossOrigin: 'anonymous'
})
});

View File

@@ -15,14 +15,14 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.20110804-hoa-foodinsecurity-3month.jsonp',
'mapbox.20110804-hoa-foodinsecurity-3month.json',
crossOrigin: 'anonymous'
})
}),
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.world-borders-light.jsonp',
'mapbox.world-borders-light.json',
crossOrigin: 'anonymous'
})
})

View File

@@ -10,6 +10,6 @@ docs: >
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
tags: "spy, image manipulation"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
var key = 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3';
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
var roads = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Road'})

View File

@@ -6,7 +6,7 @@ docs: >
Example of a Layer swipe map.
tags: "swipe, openstreetmap"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<input id="swipe" type="range" style="width: 100%">

View File

@@ -10,7 +10,7 @@ var osm = new ol.layer.Tile({
});
var bing = new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'Aerial'
})
});

View File

@@ -16,7 +16,7 @@ var raster = new ol.layer.Tile({
var source = new ol.source.Vector();
var styleFunction = function(feature, resolution) {
var styleFunction = function(feature) {
var geometry = feature.getGeometry();
var styles = [
// linestring

View File

@@ -96,7 +96,7 @@ var continueLineMsg = 'Click to continue drawing the line';
/**
* Handle pointer move.
* @param {ol.MapBrowserEvent} evt
* @param {ol.MapBrowserEvent} evt The event.
*/
var pointerMoveHandler = function(evt) {
if (evt.dragging) {
@@ -140,6 +140,66 @@ var typeSelect = document.getElementById('type');
var geodesicCheckbox = document.getElementById('geodesic');
var draw; // global so we can remove it later
/**
* Format length output.
* @param {ol.geom.LineString} line The line.
* @return {string} The formatted length.
*/
var formatLength = function(line) {
var length;
if (geodesicCheckbox.checked) {
var coordinates = line.getCoordinates();
length = 0;
var sourceProj = map.getView().getProjection();
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
var c1 = ol.proj.transform(coordinates[i], sourceProj, 'EPSG:4326');
var c2 = ol.proj.transform(coordinates[i + 1], sourceProj, 'EPSG:4326');
length += wgs84Sphere.haversineDistance(c1, c2);
}
} else {
length = Math.round(line.getLength() * 100) / 100;
}
var output;
if (length > 100) {
output = (Math.round(length / 1000 * 100) / 100) +
' ' + 'km';
} else {
output = (Math.round(length * 100) / 100) +
' ' + 'm';
}
return output;
};
/**
* Format length output.
* @param {ol.geom.Polygon} polygon The polygon.
* @return {string} Formatted area.
*/
var formatArea = function(polygon) {
var area;
if (geodesicCheckbox.checked) {
var sourceProj = map.getView().getProjection();
var geom = /** @type {ol.geom.Polygon} */(polygon.clone().transform(
sourceProj, 'EPSG:4326'));
var coordinates = geom.getLinearRing(0).getCoordinates();
area = Math.abs(wgs84Sphere.geodesicArea(coordinates));
} else {
area = polygon.getArea();
}
var output;
if (area > 10000) {
output = (Math.round(area / 1000000 * 100) / 100) +
' ' + 'km<sup>2</sup>';
} else {
output = (Math.round(area * 100) / 100) +
' ' + 'm<sup>2</sup>';
}
return output;
};
function addInteraction() {
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
draw = new ol.interaction.Draw({
@@ -186,7 +246,7 @@ function addInteraction() {
output = formatArea(/** @type {ol.geom.Polygon} */ (geom));
tooltipCoord = geom.getInteriorPoint().getCoordinates();
} else if (geom instanceof ol.geom.LineString) {
output = formatLength( /** @type {ol.geom.LineString} */ (geom));
output = formatLength(/** @type {ol.geom.LineString} */ (geom));
tooltipCoord = geom.getLastCoordinate();
}
measureTooltipElement.innerHTML = output;
@@ -195,7 +255,7 @@ function addInteraction() {
}, this);
draw.on('drawend',
function(evt) {
function() {
measureTooltipElement.className = 'tooltip tooltip-static';
measureTooltip.setOffset([0, -7]);
// unset sketch
@@ -246,70 +306,10 @@ function createMeasureTooltip() {
/**
* Let user change the geometry type.
* @param {Event} e Change event.
*/
typeSelect.onchange = function(e) {
typeSelect.onchange = function() {
map.removeInteraction(draw);
addInteraction();
};
/**
* format length output
* @param {ol.geom.LineString} line
* @return {string}
*/
var formatLength = function(line) {
var length;
if (geodesicCheckbox.checked) {
var coordinates = line.getCoordinates();
length = 0;
var sourceProj = map.getView().getProjection();
for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
var c1 = ol.proj.transform(coordinates[i], sourceProj, 'EPSG:4326');
var c2 = ol.proj.transform(coordinates[i + 1], sourceProj, 'EPSG:4326');
length += wgs84Sphere.haversineDistance(c1, c2);
}
} else {
length = Math.round(line.getLength() * 100) / 100;
}
var output;
if (length > 100) {
output = (Math.round(length / 1000 * 100) / 100) +
' ' + 'km';
} else {
output = (Math.round(length * 100) / 100) +
' ' + 'm';
}
return output;
};
/**
* format length output
* @param {ol.geom.Polygon} polygon
* @return {string}
*/
var formatArea = function(polygon) {
var area;
if (geodesicCheckbox.checked) {
var sourceProj = map.getView().getProjection();
var geom = /** @type {ol.geom.Polygon} */(polygon.clone().transform(
sourceProj, 'EPSG:4326'));
var coordinates = geom.getLinearRing(0).getCoordinates();
area = Math.abs(wgs84Sphere.geodesicArea(coordinates));
} else {
area = polygon.getArea();
}
var output;
if (area > 10000) {
output = (Math.round(area / 1000000 * 100) / 100) +
' ' + 'km<sup>2</sup>';
} else {
output = (Math.round(area * 100) / 100) +
' ' + 'm<sup>2</sup>';
}
return output;
};
addInteraction();

View File

@@ -19,7 +19,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.natural-earth-hypso-bathy.jsonp',
'mapbox.natural-earth-hypso-bathy.json',
crossOrigin: 'anonymous'
}),
minResolution: 2000,

View File

@@ -4,7 +4,7 @@ title: Full-Screen Mobile
shortdesc: Example of a full screen map.
tags: "fullscreen, geolocation, mobile"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<!doctype html>
<html lang="en">
@@ -13,6 +13,7 @@ cloak:
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>Mobile full screen example</title>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Function.prototype.bind|gated"></script>
<style type="text/css">
html, body, .map {
margin: 0;

View File

@@ -14,7 +14,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'Road'
})
})

View File

@@ -54,7 +54,7 @@ var styleFunction = (function() {
}),
image: image
});
return function(feature, resolution) {
return function(feature) {
return styles[feature.getGeometry().getType()] || styles['default'];
};
})();
@@ -67,94 +67,81 @@ var geojsonObject = {
'name': 'EPSG:3857'
}
},
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [0, 0]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiPoint',
'coordinates': [[-2e6, 0], [0, -2e6]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6], [8e6, 2e6], [9e6, 2e6]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6], [8e6, 2e6], [8e6, 3e6]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiLineString',
'coordinates': [
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
[[-7.5e5, -1e6], [7.5e5, -1e6]],
[[-7.5e5, 1e6], [7.5e5, 1e6]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
'coordinates': [
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]],
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-3e6, 6e6]]],
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [
{
'type': 'LineString',
'coordinates': [[-5e6, -5e6], [0, -5e6]]
},
{
'type': 'Point',
'coordinates': [4e6, -5e6]
},
{
'type': 'Polygon',
'coordinates': [
[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6], [1e6, -6e6]]
]
}
]
}
'features': [{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [0, 0]
}
]
}, {
'type': 'Feature',
'geometry': {
'type': 'MultiPoint',
'coordinates': [[-2e6, 0], [0, -2e6]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6], [8e6, 2e6], [9e6, 2e6]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6], [8e6, 2e6], [8e6, 3e6]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'MultiLineString',
'coordinates': [
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
[[-7.5e5, -1e6], [7.5e5, -1e6]],
[[-7.5e5, 1e6], [7.5e5, 1e6]]
]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
'coordinates': [
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]],
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-3e6, 6e6]]],
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [{
'type': 'LineString',
'coordinates': [[-5e6, -5e6], [0, -5e6]]
}, {
'type': 'Point',
'coordinates': [4e6, -5e6]
}, {
'type': 'Polygon',
'coordinates': [
[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6], [1e6, -6e6]]
]
}]
}
}]
};
var source = new ol.source.Vector({
@@ -224,7 +211,7 @@ var overlayStyle = (function() {
styles['GeometryCollection'] = styles['Polygon'].concat(styles['Point']);
return function(feature, resolution) {
return function(feature) {
return styles[feature.getGeometry().getType()];
};
})();

View File

@@ -10,7 +10,7 @@ goog.require('ol.style.Style');
var format = new ol.format.TopoJSON();
var tileGrid = ol.tilegrid.createXYZ({ maxZoom: 19 });
var tileGrid = ol.tilegrid.createXYZ({maxZoom: 19});
var roadStyleCache = {};
var roadColor = {
'major_road': '#776',
@@ -51,7 +51,7 @@ var map = new ol.Map({
url: 'http://{a-c}.tile.openstreetmap.us/' +
'vectiles-highroad/{z}/{x}/{y}.topojson'
}),
style: function(feature, resolution) {
style: function(feature) {
var kind = feature.get('kind');
var railway = feature.get('railway');
var sort_key = feature.get('sort_key');
@@ -97,7 +97,7 @@ var map = new ol.Map({
'vectiles-land-usages/{z}/{x}/{y}.topojson'
}),
visible: false,
style: function(feature, resolution) {
style: function(feature) {
var kind = feature.get('kind');
var styleKey = kind;
var style = landuseStyleCache[styleKey];

View File

@@ -49,40 +49,35 @@ var geojsonObject = {
'name': 'EPSG:3857'
}
},
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-2e6, 6e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
[0, -1e6], [-2e6, -1e6]]]
}
'features': [{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]]
}
]
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-2e6, 6e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
[0, -1e6], [-2e6, -1e6]]]
}
}]
};
var source = new ol.source.Vector({

View File

@@ -15,17 +15,6 @@ var content = document.getElementById('popup-content');
var closer = document.getElementById('popup-closer');
/**
* Add a click handler to hide the popup.
* @return {boolean} Don't follow the href.
*/
closer.onclick = function() {
overlay.setPosition(undefined);
closer.blur();
return false;
};
/**
* Create an overlay to anchor the popup to the map.
*/
@@ -38,6 +27,17 @@ var overlay = new ol.Overlay(/** @type {olx.OverlayOptions} */ ({
}));
/**
* Add a click handler to hide the popup.
* @return {boolean} Don't follow the href.
*/
closer.onclick = function() {
overlay.setPosition(undefined);
closer.blur();
return false;
};
/**
* Create the map.
*/
@@ -46,7 +46,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/' +
'mapbox.natural-earth-hypso-bathy.jsonp',
'mapbox.natural-earth-hypso-bathy.json',
crossOrigin: 'anonymous'
})
})

View File

@@ -6,7 +6,7 @@ docs: >
<p>The map on the top preloads low resolution tiles. The map on the bottom does not use any preloading. Try zooming out and panning to see the difference.</p>
tags: "preload, bing"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map1" class="map"></div>
<div id="map2" class="map"></div>

View File

@@ -14,7 +14,7 @@ var map1 = new ol.Map({
new ol.layer.Tile({
preload: Infinity,
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'Aerial'
})
})
@@ -29,7 +29,7 @@ var map2 = new ol.Map({
new ol.layer.Tile({
preload: 0, // default value
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'AerialWithLabels'
})
})

View File

@@ -22,7 +22,7 @@ tags: "raster, pixel"
resources:
- http://d3js.org/d3.v3.min.js
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div class="rel">
<div id="map" class="map"></div>

View File

@@ -50,7 +50,7 @@ function summarize(value, counts) {
* Use aerial imagery as the input data for the raster source.
*/
var bing = new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
imagerySet: 'Aerial'
});
@@ -61,6 +61,12 @@ var bing = new ol.source.BingMaps({
*/
var raster = new ol.source.Raster({
sources: [bing],
/**
* Run calculations on pixel data.
* @param {Array} pixels List of pixels (one per source).
* @param {Object} data User data object.
* @return {Array} The output pixel.
*/
operation: function(pixels, data) {
var pixel = pixels[0];
var value = vgi(pixel);

View File

@@ -25,7 +25,7 @@ docs: >
</p>
tags: "raster, region growing"
cloak:
Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here
---
<div id="map" class="map" style="cursor: pointer"></div>
<table class="controls">

View File

@@ -31,7 +31,7 @@ function growRegion(inputs, data) {
// As noted in the Raster source constructor, this function is provided
// using the `lib` option. Other functions will NOT be visible unless
// provided using the `lib` option.
var next = nextEdges(edge[i]);
var next = next4Edges(edge[i]);
for (var j = 0, jj = next.length; j < jj; j++) {
var s = next[j][0], t = next[j][1];
if (s >= 0 && s < width && t >= 0 && t < height) {
@@ -72,7 +72,7 @@ function next4Edges(edge) {
];
}
var key = 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3';
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
var imagery = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Aerial'})
@@ -85,7 +85,7 @@ var raster = new ol.source.Raster({
// Functions in the `lib` object will be available to the operation run in
// the web worker.
lib: {
nextEdges: next4Edges
next4Edges: next4Edges
}
});
@@ -110,6 +110,8 @@ map.on('click', function(event) {
raster.changed();
});
var thresholdControl = document.getElementById('threshold');
raster.on('beforeoperations', function(event) {
// the event.data object will be passed to operations
var data = event.data;
@@ -119,8 +121,6 @@ raster.on('beforeoperations', function(event) {
}
});
var thresholdControl = document.getElementById('threshold');
function updateControlValue() {
document.getElementById('threshold-value').innerText = thresholdControl.value;
}

View File

@@ -10,8 +10,8 @@ goog.require('ol.style.Stroke');
var canvas = document.getElementById('canvas');
var render = ol.render.toContext(canvas.getContext('2d'), {size: [100, 100]});
var fill = new ol.style.Fill({ color: 'blue' });
var stroke = new ol.style.Stroke({ color: 'black' });
var fill = new ol.style.Fill({color: 'blue'});
var stroke = new ol.style.Stroke({color: 'black'});
render.setFillStrokeStyle(fill, stroke);
render.setImageStyle(new ol.style.Circle({
radius: 10,

View File

@@ -7,7 +7,6 @@ goog.require('ol.source.MapQuest');
goog.require('ol.source.TileImage');
var map = new ol.Map({
layers: [
new ol.layer.Tile({
@@ -89,18 +88,19 @@ function search(query) {
/**
* @param {Event} e Change event.
* Handle click event.
* @param {Event} event The event.
*/
searchButton.onclick = function(e) {
searchButton.onclick = function(event) {
search(queryInput.value);
e.preventDefault();
event.preventDefault();
};
/**
* @param {Event} e Change event.
* Handle change event.
*/
renderEdgesCheckbox.onchange = function(e) {
renderEdgesCheckbox.onchange = function() {
map.getLayers().forEach(function(layer) {
if (layer instanceof ol.layer.Tile) {
var source = layer.getSource();

View File

@@ -192,9 +192,9 @@ function updateViewProjection() {
/**
* @param {Event} e Change event.
* Handle change event.
*/
viewProjSelect.onchange = function(e) {
viewProjSelect.onchange = function() {
updateViewProjection();
};
@@ -211,9 +211,9 @@ var updateRenderEdgesOnLayer = function(layer) {
/**
* @param {Event} e Change event.
* Handle change event.
*/
baseLayerSelect.onchange = function(e) {
baseLayerSelect.onchange = function() {
var layer = layers[baseLayerSelect.value];
if (layer) {
layer.setOpacity(1);
@@ -224,9 +224,9 @@ baseLayerSelect.onchange = function(e) {
/**
* @param {Event} e Change event.
* Handle change event.
*/
overlayLayerSelect.onchange = function(e) {
overlayLayerSelect.onchange = function() {
var layer = layers[overlayLayerSelect.value];
if (layer) {
layer.setOpacity(0.7);
@@ -237,9 +237,9 @@ overlayLayerSelect.onchange = function(e) {
/**
* @param {Event} e Change event.
* Handle change event.
*/
renderEdgesCheckbox.onchange = function(e) {
renderEdgesCheckbox.onchange = function() {
renderEdges = renderEdgesCheckbox.checked;
map.getLayers().forEach(function(layer) {
updateRenderEdgesOnLayer(layer);

View File

@@ -0,0 +1,11 @@
---
layout: example.html
title: OpenStreetMap Reprojection with ScaleLine Control
shortdesc: Demonstrates client-side reprojection of OpenStreetMap to NAD83 Indiana East.
docs: >
This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.
tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline"
resources:
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -0,0 +1,35 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control.ScaleLine');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
proj4.defs('Indiana-East', 'PROJCS["IN83-EF",GEOGCS["LL83",DATUM["NAD83",' +
'SPHEROID["GRS1980",6378137.000,298.25722210]],PRIMEM["Greenwich",0],' +
'UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],' +
'PARAMETER["false_easting",328083.333],' +
'PARAMETER["false_northing",820208.333],' +
'PARAMETER["scale_factor",0.999966666667],' +
'PARAMETER["central_meridian",-85.66666666666670],' +
'PARAMETER["latitude_of_origin",37.50000000000000],' +
'UNIT["Foot_US",0.30480060960122]]');
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
projection: 'Indiana-East',
center: ol.proj.fromLonLat([-85.685, 39.891], 'Indiana-East'),
zoom: 7,
extent: ol.proj.transformExtent([-172.54, 23.81, -47.74, 86.46],
'EPSG:4326', 'Indiana-East'),
minZoom: 6
})
});
map.addControl(new ol.control.ScaleLine({units: 'us'}));

View File

@@ -13,7 +13,7 @@ var map = new ol.Map({
}),
new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.jsonp',
url: 'http://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.json',
crossOrigin: 'anonymous'
})
})

View File

@@ -5,7 +5,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.source.MapQuest');
var domMap = new ol.Map({
var map1 = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
@@ -19,12 +19,18 @@ var domMap = new ol.Map({
})
});
var map2 = new ol.Map({
target: 'canvasMap',
layers: map1.getLayers(),
view: map1.getView()
});
if (ol.has.WEBGL) {
var webglMap = new ol.Map({
var map3 = new ol.Map({
renderer: 'webgl',
target: 'webglMap',
layers: domMap.getLayers(),
view: domMap.getView()
layers: map1.getLayers(),
view: map1.getView()
});
} else {
var info = document.getElementById('no-webgl');
@@ -33,9 +39,3 @@ if (ol.has.WEBGL) {
*/
info.style.display = '';
}
var canvasMap = new ol.Map({
target: 'canvasMap',
layers: domMap.getLayers(),
view: domMap.getView()
});

View File

@@ -72,6 +72,7 @@ var Modify = {
};
Modify.init();
var optionsForm = document.getElementById('options-form');
var Draw = {
init: function() {
@@ -111,8 +112,6 @@ var Draw = {
};
Draw.init();
var optionsForm = document.getElementById('options-form');
/**
* Let user change the geometry type.

View File

@@ -39,6 +39,6 @@ var map = new ol.Map({
})
});
var graticule = new ol.Graticule({
new ol.Graticule({
map: map
});

View File

@@ -45,7 +45,7 @@ var vectorSource = new ol.source.Vector({
});
var vector = new ol.layer.Vector({
source: vectorSource,
style: function(feature, resolution) {
style: function(feature) {
return styles[feature.get('size')];
}
});

View File

@@ -4,7 +4,6 @@ goog.require('ol.layer.Tile');
goog.require('ol.source.TileJSON');
/**
* Renders a progress bar.
* @param {Element} el The target element.
@@ -79,18 +78,18 @@ Progress.prototype.hide = function() {
var progress = new Progress(document.getElementById('progress'));
var source = new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.world-bright.jsonp',
url: 'http://api.tiles.mapbox.com/v3/mapbox.world-bright.json',
crossOrigin: 'anonymous'
});
source.on('tileloadstart', function(event) {
source.on('tileloadstart', function() {
progress.addLoading();
});
source.on('tileloadend', function(event) {
source.on('tileloadend', function() {
progress.addLoaded();
});
source.on('tileloaderror', function(event) {
source.on('tileloaderror', function() {
progress.addLoaded();
});

Some files were not shown because too many files have changed in this diff Show More