Compare commits

...

326 Commits

Author SHA1 Message Date
Andreas Hocevar
849ef07639 Add version and dist for v4.6.4-backports.2 2018-01-22 16:39:58 +01:00
Andreas Hocevar
3696237894 Merge pull request #7661 from ahocevar/background-fill-stroke
Background fill stroke
2018-01-22 16:03:42 +01:00
Andreas Hocevar
af013db6d8 Update backport dist 2018-01-18 12:09:42 +01:00
Andreas Hocevar
9b0cd2a7c8 Backport changes for #7703 2018-01-18 12:04:04 +01:00
Andreas Hocevar
f7a1aba38e Merge pull request #7703 from ahocevar/draw-state
Improved drawing experience on touch devices
2018-01-18 11:32:28 +01:00
Andreas Hocevar
6e9fc2cbad Backport changes for #7668 2018-01-18 11:15:26 +01:00
Andreas Hocevar
61245fb83a Merge pull request #7668 from ahocevar/hit-detect-text-background
Hit detect text background
2018-01-18 10:50:32 +01:00
Andreas Hocevar
e065c851de Add dist for backport 2017-12-28 12:31:11 +01:00
Andreas Hocevar
ed29dde552 Clone backgroundFill and backgroundStroke 2017-12-27 11:51:34 +01:00
Andreas Hocevar
8a73db9331 Apply fill and stroke only when set 2017-12-27 09:31:41 +01:00
Andreas Hocevar
72ca7b28c6 Update package version to 4.6.4 2017-12-11 11:31:38 +01:00
Andreas Hocevar
f11d55fde6 Changelog for v4.6.4 2017-12-11 11:29:50 +01:00
Andreas Hocevar
48217bc218 Handle skipping and unskipping features with renderMode: 'image' 2017-12-11 11:23:34 +01:00
Andreas Hocevar
c76c445e43 Update package version to 4.6.3 2017-12-08 11:17:36 +01:00
Andreas Hocevar
3bba8ef061 Changelog for v4.6.3 2017-12-08 11:16:52 +01:00
Andreas Hocevar
a699cc348b Fix pull request link 2017-12-08 11:14:24 +01:00
Andreas Hocevar
f010f7b9c1 Only compose image vector frame when the replay group has changed 2017-12-08 11:12:05 +01:00
Andreas Hocevar
5d27dcc27c Update package version to 4.6.2 2017-12-07 08:36:40 +01:00
Andreas Hocevar
52bbebf9aa Changelog for v4.6.2 2017-12-07 08:36:03 +01:00
Andreas Hocevar
578f900435 Revert "Merge pull request #7530 from raiyni/crossing-dateline"
This reverts commit fca0b0771d, reversing
changes made to c3db3e2f6f.
2017-12-07 08:33:19 +01:00
Andreas Hocevar
3bc1de3f6c Make sure we do not request features for wrapped extent 2017-12-07 08:33:09 +01:00
Andreas Hocevar
992bfdc126 Update package version to 4.6.1 2017-12-06 21:43:24 +01:00
Andreas Hocevar
a96b8c5ca6 Changelog for v4.6.1 2017-12-06 21:42:35 +01:00
Andreas Hocevar
2bce90470e Merge pull request #7543 from ahocevar/interiorpoint-donut
Donut polygon labels do not get a chance to get rendered
2017-12-06 21:39:34 +01:00
Andreas Hocevar
50053c1b3f Merge pull request #7542 from ahocevar/overflow
Still respect deprecated exceedLength option
2017-12-06 21:39:14 +01:00
Andreas Hocevar
0c5134b789 Merge pull request #7541 from ahocevar/vectorrendertype-case
Fix case of vectorrendertype.js
2017-12-06 21:38:52 +01:00
Andreas Hocevar
ca3e11a10b Merge pull request #7539 from openlayers/release-v4.6.0
Release v4.6.0
2017-12-06 15:55:14 +01:00
Andreas Hocevar
7245805c90 Update package version to 4.6.0 2017-12-06 14:40:04 +01:00
Andreas Hocevar
5234a4dd21 Changelog for v4.6.0 2017-12-06 14:36:55 +01:00
Andreas Hocevar
b262b8535e Merge pull request #7538 from ahocevar/rem_from_loaded_ext
removeFromLoadedExtents to remove extents that failed to load
2017-12-06 14:22:11 +01:00
Andreas Hocevar
45ae731aa6 Add test 2017-12-06 13:39:35 +01:00
Andreas Hocevar
8bc61504c8 Give method a better name and add docs 2017-12-06 13:30:49 +01:00
geonux
5641430590 RemoveFromLoadedExtent to remove extent to the list of loaded extent in case of server error/restriction. 2017-12-06 12:53:14 +01:00
Frédéric Junod
2e2d8ea3d7 Merge pull request #7537 from walkermatt/removeLastPoint
Fix Draw.removeLastPoint exception when no points to remove
2017-12-06 11:51:14 +01:00
Frédéric Junod
d4f23e0ea9 Merge pull request #7536 from openlayers/greenkeeper/fs-extra-4.0.3
Update fs-extra to the latest version 🚀
2017-12-05 16:51:16 +01:00
greenkeeper[bot]
607e836df4 fix(package): update fs-extra to version 4.0.3 2017-12-05 15:03:48 +00:00
Bart van den Eijnden
8afcd1c2ff Merge pull request #7461 from oterral/teo_wmts
Use the matrixSet projection by default
2017-12-05 10:51:11 +01:00
Frédéric Junod
ebfdddbb8e Merge pull request #5883 from bylexus/master
Fixes setUrl() for WMTS sources (ol.source.WMTS)
2017-12-04 10:49:55 +01:00
Frederic Junod
14e3fd9214 Fix eslint errors 2017-12-04 10:06:00 +01:00
Frederic Junod
9c8c9c1a17 Store createFromWMTSTemplate into a private variable 2017-12-04 09:30:12 +01:00
Alexander Schenkel
c7cb26a066 Fixes setUrl() for WMTS sources (ol.source.WMTS)
See Issue #5881: setUrl was inherited from ol.source UrlTile, which creates a wrong tileUrlFunction: The official WMTS URL Template variables were no longer replaced.
2017-12-04 09:11:28 +01:00
Andreas Hocevar
b4a5142aaa Merge pull request #7531 from ahocevar/package-readme
Update the ol package readme
2017-12-02 17:42:20 +01:00
Tim Schaub
e96d190e1e Merge pull request #7533 from openlayers/greenkeeper/marked-0.3.7
Update marked to the latest version 🚀
2017-12-02 09:24:46 -07:00
greenkeeper[bot]
41efec1e74 chore(package): update marked to version 0.3.7 2017-12-01 18:30:04 +00:00
Andreas Hocevar
7941a33069 Merge pull request #7372 from notnotse/iconimagecache-setmaxcachesize
Add method to set max cache size in ol.style.IconImageCache
2017-12-01 18:00:36 +01:00
Andreas Hocevar
8a9f32fa09 Rename method and make it appear in the API docs 2017-12-01 17:03:28 +01:00
Matt Walker
90d8224a08 Fix Draw.removeLastPoint exception when no points to remove 2017-12-01 15:50:21 +00:00
Andreas Hocevar
55f7468c68 Update the ol package readme 2017-12-01 13:41:45 +01:00
Andreas Hocevar
fca0b0771d Merge pull request #7530 from raiyni/crossing-dateline
Check forward/back 1 world if wrapping
2017-12-01 09:20:39 +01:00
Ron Young
19bceff077 Check forward/back 1 world if wrapping 2017-11-30 14:23:42 -06:00
Tim Schaub
c3db3e2f6f Merge pull request #7526 from tschaub/stop-click
Allow clicks to be stopped while drawing
2017-11-30 09:21:06 -07:00
Andreas Hocevar
73f64a9e89 Merge pull request #7524 from ahocevar/view-pixel
Snap view center to pixel
2017-11-30 15:13:45 +01:00
Frédéric Junod
4990119f86 Merge pull request #7527 from openlayers/greenkeeper/eslint-4.12.1
Update eslint to the latest version 🚀
2017-11-30 08:27:18 +01:00
greenkeeper[bot]
741baa8d20 chore(package): update eslint to version 4.12.1 2017-11-30 06:05:47 +00:00
Andreas Hocevar
74bf846ffe Add pixel ratio to label cache key 2017-11-30 01:20:49 +01:00
Andreas Hocevar
4e8714d619 Fix tests 2017-11-30 01:03:15 +01:00
Andreas Hocevar
9307c35c17 Improve vertical font placement in Firefox 2017-11-30 01:03:15 +01:00
Andreas Hocevar
3bb62a2c41 Snap view center to pixel 2017-11-30 01:03:15 +01:00
Tim Schaub
b58073dd06 Allow clicks to be stopped while drawing 2017-11-29 16:58:26 -07:00
Andreas Hocevar
45d2f8debb Merge pull request #7521 from cs09g/patch-1
fix setMinZoom/setMaxZoom
2017-11-28 13:47:58 +01:00
cs09g
e745c63383 clamp when resolution is defined 2017-11-28 16:51:11 +09:00
Andreas Hocevar
5ed2f32621 Merge pull request #7519 from ahocevar/declutter-hit-detection
Reuse declutter tree for hit detection
2017-11-28 08:50:01 +01:00
Frédéric Junod
6e39926dd0 Merge pull request #7499 from openlayers/rm_attributions_FrameState
Remove attributions from olx.FrameState instances
2017-11-28 08:24:23 +01:00
cs09g
466d63ac41 fix setMinZoom/setMaxZoom
when view has resolutions property, setMinZoom/setMaxZoom doesn't work.
2017-11-28 16:20:26 +09:00
Andreas Hocevar
ac195c46b1 Reuse declutter tree for hit detection
Replaying for hit detection no longer declutters, but uses the declutter tree
from the previous rendered frame.
2017-11-28 01:36:47 +01:00
Andreas Hocevar
841e79b0e8 Merge pull request #7501 from ahocevar/vector-layer-image
Option to render vector layers as images
2017-11-27 18:11:10 +01:00
Andreas Hocevar
3c806f924e Address review comments 2017-11-27 17:54:16 +01:00
Andreas Hocevar
dde81d8585 Add renderMode option to ol.layer.Vector
This also deprecates ol.source.ImageVector.
2017-11-27 09:48:52 +01:00
Andreas Hocevar
29e3dd39e4 Merge pull request #7516 from ahocevar/overflow
Deprecate exceedLength and replace with overflow
2017-11-27 09:42:59 +01:00
Andreas Hocevar
674868a683 Deprecate exceedLength and replace with overflow 2017-11-27 09:25:41 +01:00
Andreas Hocevar
7ffed344d1 Merge pull request #7510 from ahocevar/states-no-fade
Do not fade the states layer
2017-11-27 08:47:40 +01:00
Andreas Hocevar
dce56ac73a Merge pull request #7513 from ahocevar/stroke-key
Make strokeKey safer
2017-11-27 08:47:09 +01:00
Andreas Hocevar
101b53e135 Merge pull request #7514 from ahocevar/less-aggressive-prune
Prune the label cache less aggressively
2017-11-27 08:46:42 +01:00
Andreas Hocevar
66d5d66129 Prune the label cache less aggressively 2017-11-26 23:30:58 +01:00
Andreas Hocevar
f426c1cd18 Make strokeKey safer 2017-11-26 12:50:14 +01:00
Andreas Hocevar
ceab6444b9 Merge pull request #7511 from openlayers/greenkeeper/rollup-0.52.0
Update rollup to the latest version 🚀
2017-11-26 10:47:41 +01:00
Marc Jansen
5085cd8d6a Merge pull request #7512 from openlayers/greenkeeper/eslint-4.12.0
Update eslint to the latest version 🚀
2017-11-26 10:25:07 +01:00
greenkeeper[bot]
4e0d52806c chore(package): update eslint to version 4.12.0 2017-11-26 05:41:40 +00:00
greenkeeper[bot]
ee8ccc33e0 fix(package): update rollup to version 0.52.0 2017-11-25 20:21:18 +00:00
Andreas Hocevar
5e43208d93 Do not fade the states layer 2017-11-25 10:08:43 +01:00
Frédéric Junod
7fbada28ac Merge pull request #7505 from fredj/rm_api_link
Remove ol.DeviceOrientation link from API index
2017-11-24 15:26:11 +01:00
Frederic Junod
2278715f85 Remove ol.DeviceOrientation link from API index
`ol.DeviceOrientation` is now deprecated
2017-11-24 12:39:05 +01:00
Frederic Junod
4f5613d2fa Remove attributions from olx.FrameState instances 2017-11-23 12:00:12 +01:00
Andreas Hocevar
c48685565d Merge pull request #7497 from nicholas-l/patch-1
Use getGeometry
2017-11-23 09:38:54 +01:00
Andreas Hocevar
0b3a92d89e Merge pull request #7495 from ahocevar/remove-layer-renderers-with-viewport
Remove layer renderers when viewport is removed
2017-11-23 08:58:18 +01:00
Frédéric Junod
53e675725b Merge pull request #7492 from fredj/type_cast_examples
Remove unneeded type cast from examples
2017-11-23 08:26:00 +01:00
Nicholas Latham
397c03a6b6 Use getGeometry
Use getGeometry for compatibility between RenderFeature and Feature
2017-11-23 15:13:47 +13:00
Andreas Hocevar
3e574529ad Remove layer renderers when viewport is removed 2017-11-22 23:56:28 +01:00
Frederic Junod
8aa591c04d Remove unneeded type cast from examples 2017-11-22 14:00:00 +01:00
Frédéric Junod
5d71dde8dd Merge pull request #7489 from fredj/draw_type_string
Allow string to be passed as ol.interaction.Draw type
2017-11-22 08:58:45 +01:00
Frederic Junod
c0d57ad005 Allow string to be passed as ol.interaction.Draw type 2017-11-21 09:55:54 +01:00
Frédéric Junod
ae6ba195f7 Merge pull request #7484 from openlayers/greenkeeper/closure-util-1.26.0
Update closure-util to the latest version 🚀
2017-11-17 15:01:06 +01:00
greenkeeper[bot]
f5c0ea3a28 fix(package): update closure-util to version 1.26.0 2017-11-17 12:32:57 +00:00
Frédéric Junod
f139b7001a Merge pull request #7445 from fredj/fs_css
Load css rules from full-screen.css in examples
2017-11-17 10:41:07 +01:00
Frédéric Junod
3e590f81ae Merge pull request #7481 from gberaudo/make_zoom_to_extent_extensible
Make zoom to extent control extensible
2017-11-17 09:10:50 +01:00
oterral
9cc7cca447 Fix #6835: doesn't break if Constraint does not exist 2017-11-17 09:00:44 +01:00
Andreas Hocevar
0bf7e95619 Merge pull request #7477 from ahocevar/text-style-keys
Make text states available for replay time
2017-11-16 19:59:45 +01:00
Andreas Hocevar
1aa54b52b0 Merge pull request #7482 from ahocevar/vectortile-unrotate
Reset rotation after rendering
2017-11-16 17:57:01 +01:00
Andreas Hocevar
006f8d49ec Reset rotation after rendering 2017-11-16 17:22:05 +01:00
Guillaume Beraudo
94e821f9bf Make zoom to extent control extensible 2017-11-16 15:54:13 +01:00
Andreas Hocevar
cbf24ebc4c Merge pull request #7480 from ahocevar/load-imagetile
Create a new image when loading tile after an error
2017-11-16 15:09:45 +01:00
Andreas Hocevar
f1aeb76ce8 Create a new image when loading after an error 2017-11-16 14:45:54 +01:00
Andreas Hocevar
000acfe854 Do not pass inexistent argument 2017-11-16 14:45:54 +01:00
Andreas Hocevar
8e9b69cb9b Merge pull request #7476 from ahocevar/reset-measurements
Reset text measurements when available fonts change
2017-11-16 13:43:04 +01:00
Andreas Hocevar
c35789ba73 Add and improve tests 2017-11-16 11:52:26 +01:00
Andreas Hocevar
ad8e4debbe Make text states available for replay time 2017-11-16 00:39:27 +01:00
Andreas Hocevar
febbba78dc Reset text measurements when available fonts change 2017-11-15 18:44:26 +01:00
Andreas Hocevar
4b0281bc8a Merge pull request #7454 from ahocevar/text-background-padding
Add text background rendering and text padding
2017-11-15 08:27:38 +01:00
Andreas Hocevar
c7f6c28d8e Merge pull request #7468 from chrismayer/chg-here-key
Add new API-key for HERE example
2017-11-14 12:34:17 +01:00
Christian Mayer
169e9583dd Add new HERE API-key to 'cloak' section
This adds the new API-key for the 'HERE Map Tile API' example to the
'cloak' section, so it is not visible in the example's code view.
2017-11-14 09:56:26 +01:00
Christian Mayer
b9540460ff Add new API-key for HERE example
Replace the existing API-key for the 'HERE Map Tile API' example
with a new one with a longer validity.
2017-11-14 09:09:17 +01:00
Frédéric Junod
697406cf59 Merge pull request #7465 from fredj/export_getAxisOrientation
Export ol.proj.Projection#getAxisOrientation function
2017-11-14 08:19:24 +01:00
Frederic Junod
c490fd4af8 Export ol.proj.Projection#getAxisOrientation function 2017-11-13 17:19:50 +01:00
Andreas Hocevar
53b85a9192 Add rendering tests 2017-11-13 13:58:11 +01:00
Andreas Hocevar
a77d01945f Merge pull request #7462 from ahocevar/scaleline-meters-per-unit
Respect metersPerUnit in ScaleLine control
2017-11-13 11:39:32 +01:00
Andreas Hocevar
9c45f9a8d6 Respect metersPerUnit in ScaleLine control 2017-11-13 11:09:54 +01:00
oterral
5a252e628b Fix #7460: use the matrixSet projection by default 2017-11-13 11:06:31 +01:00
Tim Schaub
a73170ca1d Merge pull request #7458 from tschaub/release-v4.5.0
Release v4.5.0
2017-11-12 17:19:14 -07:00
Andreas Hocevar
df90f1b78c Reuse more code 2017-11-12 22:49:32 +01:00
Andreas Hocevar
1afc686af9 Add text background rendering and text padding 2017-11-12 22:49:32 +01:00
Tim Schaub
c811bd488e Collapsed list of dependency changes 2017-11-12 11:35:32 -07:00
Tim Schaub
ce051b78a9 Update package version to 4.5.0 2017-11-12 11:25:08 -07:00
Tim Schaub
1103779432 Changelog for v4.5.0 2017-11-12 11:24:26 -07:00
Tim Schaub
bbec759c5e Merge pull request #7456 from tschaub/connect-retries
Retry if sauce connect fails
2017-11-12 07:29:49 -07:00
Tim Schaub
a2c5ce6925 Retry if sauce connect fails 2017-11-11 10:54:13 -07:00
Tim Schaub
54c69ae1c6 Merge pull request #7455 from openlayers/greenkeeper/eslint-4.11.0
Update eslint to the latest version 🚀
2017-11-10 20:13:19 -07:00
greenkeeper[bot]
0bd989e917 chore(package): update eslint to version 4.11.0 2017-11-11 00:00:58 +00:00
Frédéric Junod
93abd6fe57 Merge pull request #7447 from openlayers/greenkeeper/rollup-plugin-commonjs-8.2.6
chore(package): update rollup-plugin-commonjs to version 8.2.6
2017-11-10 11:14:53 +01:00
Frédéric Junod
3d8f39804e Merge pull request #7448 from openlayers/greenkeeper/debounce-1.1.0
chore(package): update debounce to version 1.1.0
2017-11-10 10:57:58 +01:00
greenkeeper[bot]
b2ef54d4a7 chore(package): update debounce to version 1.1.0 2017-11-10 10:35:55 +01:00
greenkeeper[bot]
09a324bc6b chore(package): update rollup-plugin-commonjs to version 8.2.6 2017-11-10 10:34:29 +01:00
Frédéric Junod
07631e4d1f Merge pull request #7451 from openlayers/greenkeeper/karma-1.7.1
chore(package): update karma to version 1.7.1
2017-11-10 10:32:14 +01:00
Frederic Junod
2825436983 Add missing .map:-ms-fullscreen css rule in example 2017-11-10 10:21:08 +01:00
greenkeeper[bot]
4aee919de2 chore(package): update karma to version 1.7.1 2017-11-10 10:18:42 +01:00
Andreas Hocevar
6cc3c47d95 Merge pull request #7440 from ahocevar/font-load
Attempt to make font loading tests more stable
2017-11-10 10:09:42 +01:00
Andreas Hocevar
55692c3da5 Merge pull request #7446 from openlayers/greenkeeper/rollup-0.51.3
fix(package): update rollup to version 0.51.3
2017-11-10 09:47:01 +01:00
Andreas Hocevar
dbfca19e09 Merge pull request #7444 from ahocevar/simpler-style-management
Simpler style management
2017-11-10 08:44:25 +01:00
Andreas Hocevar
4324d49813 Attempt to make font loading tests more stable
Also changes things to use setInterval() instead of setTimeout().
2017-11-10 08:34:30 +01:00
greenkeeper[bot]
2da2ae0154 fix(package): update rollup to version 0.51.3
Closes #7432
2017-11-10 07:14:09 +00:00
Andreas Hocevar
c6eca804f9 Refactor stroke style management to reuse code 2017-11-10 01:16:18 +01:00
Andreas Hocevar
47e6918072 Refactor setTextStyle() for better readability 2017-11-09 16:42:41 +01:00
Andreas Hocevar
c1181bdfe7 Merge pull request #7438 from ahocevar/source-projection
Call getProjection() only once
2017-11-09 14:44:20 +01:00
Tim Schaub
9a8afff0fa Merge pull request #7430 from tschaub/hexa
Add support for hex colors with alpha
2017-11-09 06:38:27 -07:00
Andreas Hocevar
0ec05f5795 Call getProjection() only once 2017-11-09 08:08:41 +01:00
Tim Schaub
6668d03122 Add support for hex colors with alpha 2017-11-08 09:53:22 -07:00
Tim Schaub
3a6fc7a1f2 Merge pull request #7431 from tschaub/defined-zoom
Avoid returning undefined zoom
2017-11-08 09:32:33 -07:00
Andreas Hocevar
be06224756 Merge pull request #7436 from pjeweb/patch-1
Always use source projection loading image tiles
2017-11-08 17:01:33 +01:00
Frédéric Junod
9fe032b49c Merge pull request #7433 from fredj/hints
Don't use getHints if it's not needed
2017-11-08 14:46:31 +01:00
pjeweb
b9313e76f4 Always use source projection loading image tiles
Use the defined source projection despite it being equivalent to the rendering projection to enable using the specified alias code name instead of the code provided by the renderer's projection object. For example: The server only knows the name "EPSG:900913", which is an alias for the equivalent "EPSG:3857", that the renderer uses (by default).
2017-11-08 14:36:46 +01:00
Frederic Junod
0d01a4ca0f Don't use getHints if it's not needed
memory optimization: `getHints` creates a copy of the hints array.
2017-11-08 11:47:29 +01:00
Frederic Junod
82da43af35 Use getAnimating and getInteracting from ol.View 2017-11-08 11:47:29 +01:00
Tim Schaub
967118e699 Avoid returning undefined zoom 2017-11-07 18:40:58 -07:00
Andreas Hocevar
0fceb2f3e3 Merge pull request #7428 from openlayers/greenkeeper/sinon-4.1.2
Update sinon to the latest version 🚀
2017-11-07 22:52:54 +01:00
Andreas Hocevar
ccab7be20a Merge pull request #7362 from Alexandre27/master
Added option to the ol.format.GeoJSON to allow the reading of the geometry_name from the geojson
2017-11-07 22:52:30 +01:00
greenkeeper[bot]
39e3e9f915 chore(package): update sinon to version 4.1.2 2017-11-07 17:41:49 +00:00
Alexandre Silva
cd5e5039e9 Changed option name to extractGeometryName 2017-11-07 10:24:10 +00:00
Andreas Hocevar
36fd49334c Merge pull request #7425 from openlayers/greenkeeper/async-2.6.0
Update async to the latest version 🚀
2017-11-07 08:18:54 +01:00
Andreas Hocevar
2e982deba6 Merge pull request #7426 from glen-nu/update-handleEvent-docs
Update InteractionOptions.prototype.handleEvent docs
2017-11-07 08:18:29 +01:00
glen-nu
2ebb1ce8fa update InteractionOptions.prototype.handleEvent docs
`InteractionOptions.prototype.handleEvent` stops propagation on falsy return, not explicit `false`
2017-11-07 14:16:01 +08:00
greenkeeper[bot]
d7bf98f49f fix(package): update async to version 2.6.0 2017-11-07 03:29:08 +00:00
Tim Schaub
2b09dc8b70 Merge pull request #7423 from tschaub/get-wrapped-features
Get rendered features by coordinate when wrapping
2017-11-06 17:14:52 -07:00
Tim Schaub
dbeef9f73e Use wrapped tile coord for getting feature at coordinate 2017-11-06 10:53:44 -07:00
Tim Schaub
8a6fe81f09 Example demonstrating how to get feature properties from vector tiles 2017-11-06 09:57:16 -07:00
Tim Schaub
4ea72c2483 Merge pull request #7421 from tschaub/one-world
Keep longitude between -180 and 180
2017-11-06 08:15:23 -07:00
Bart van den Eijnden
d15a85c402 Merge pull request #7420 from TDesjardins/master
Fix MapGuide example resolves #7325
2017-11-06 14:53:54 +01:00
Tim Schaub
42da3f18dd Keep longitude between -180 and 180 2017-11-06 06:39:17 -07:00
Alexandre Silva
260327341c Documented the default value. 2017-11-06 11:10:49 +00:00
Tino Desjardins
7cb8b526a9 Format source code 2017-11-04 14:53:21 +01:00
Tino Desjardins
02016cf244 Fix MapGuide example 2017-11-04 14:38:36 +01:00
Andreas Hocevar
4a6317dde3 Merge pull request #7340 from ahocevar/check-font-loaded
Clear label cache when fonts become available
2017-11-03 14:23:38 +01:00
Andreas Hocevar
129350d863 Fix return type 2017-11-03 13:54:41 +01:00
Andreas Hocevar
72eb8ab5e8 Define font as variable 2017-11-03 13:52:06 +01:00
Andreas Hocevar
5483fa3181 More efficient font checking loop 2017-11-03 13:52:06 +01:00
Andreas Hocevar
8c46f6d1f0 Workaround for a Safari issue 2017-11-03 13:04:06 +01:00
Andreas Hocevar
7f865b8520 Check if fonts are available and redraw when label cache was cleared 2017-11-03 13:04:06 +01:00
Tim Schaub
dea8a340a6 Add utility method for extracting font families from a font spec 2017-11-03 12:55:12 +01:00
Tim Schaub
06728ab0fa Quote font names with spaces 2017-11-03 12:55:12 +01:00
Andreas Hocevar
a80458f2c3 Show dynamic font loading in the ugly vector-labels example 2017-11-03 12:55:12 +01:00
Andreas Hocevar
2451c8f1d0 Merge pull request #7414 from ahocevar/preserve-ligatures
Only split text at line angle changes
2017-11-03 12:13:10 +01:00
Andreas Hocevar
431d570b91 Only split text at line angle changes 2017-11-03 11:26:38 +01:00
Frédéric Junod
ddba26b193 Merge pull request #7411 from fredj/getset_layers
Add getLayers and setLayers functions to ol.format.WMSGetFeatureInfo
2017-11-03 11:22:29 +01:00
Andreas Hocevar
f05511cff7 Merge pull request #7328 from ahocevar/declutter
Declutter text and images
2017-11-03 11:22:08 +01:00
Frédéric Junod
e55985818f Merge pull request #7418 from openlayers/greenkeeper/sinon-4.1.1
Update sinon to the latest version 🚀
2017-11-03 10:58:02 +01:00
Frederic Junod
8a9d6b417f Add getLayers and setLayers functions to ol.format.WMSGetFeatureInfo 2017-11-03 10:51:25 +01:00
Andreas Hocevar
306851d6ee Consistent naming of declutterTree 2017-11-03 10:36:28 +01:00
greenkeeper[bot]
70dc35cc6c chore(package): update sinon to version 4.1.1 2017-11-03 08:56:02 +00:00
Andreas Hocevar
bfebc50a48 Merge pull request #7406 from lasselaakkonen/7390-zoomify-custom-extent
Add option to Zoomify source for setting custom extent
2017-11-03 07:17:22 +01:00
Andreas Hocevar
50b50ae21f Merge pull request #7416 from openlayers/greenkeeper/sinon-4.1.0
Update sinon to the latest version 🚀
2017-11-03 07:13:34 +01:00
Andreas Hocevar
a5625955a8 Merge pull request #7417 from openlayers/greenkeeper/phantomjs-prebuilt-2.1.16
Update phantomjs-prebuilt to the latest version 🚀
2017-11-03 07:13:16 +01:00
greenkeeper[bot]
47a1aed750 chore(package): update phantomjs-prebuilt to version 2.1.16 2017-11-02 20:27:57 +00:00
greenkeeper[bot]
4afb5bfd40 chore(package): update sinon to version 4.1.0 2017-11-02 17:12:29 +00:00
Frédéric Junod
8ef9b8feea Merge pull request #7410 from fredj/getset_getFeatureType
Add getFeatureType and setFeatureType functions to ol.format.WFS
2017-11-01 15:32:25 +01:00
Frederic Junod
daea26ec50 Add getFeatureType and setFeatureType functions to ol.format.WFS 2017-11-01 14:07:54 +01:00
Lasse Laakkonen
1cf8631889 Add extent property definition to olx.source.ZoomifyOptions definition. 2017-11-01 00:30:20 +02:00
Lasse Laakkonen
eefb3f9207 Add option to Zoomify source for setting custom extent.
https://github.com/openlayers/openlayers/issues/7390
2017-11-01 00:20:43 +02:00
Andreas Hocevar
e6ae029d08 Improve text rendering performance 2017-10-31 11:33:48 +01:00
Andreas Hocevar
6ce201c429 Do not render text along oversimplified geometries 2017-10-31 11:33:48 +01:00
Andreas Hocevar
b29e74d1ab Measure height only once per font 2017-10-31 11:33:48 +01:00
Andreas Hocevar
4a73754b93 Entertain the compiler 2017-10-31 11:33:48 +01:00
Andreas Hocevar
dfa3cbf4e2 Use native decluttering in vector-label-decluttering example 2017-10-31 11:33:48 +01:00
Andreas Hocevar
29ebdde314 Test decluttering for vector tile layers 2017-10-31 11:33:48 +01:00
Andreas Hocevar
912e908032 Test decluttered hit detection 2017-10-31 11:33:48 +01:00
Andreas Hocevar
53a2cf55f1 Fix hit detection for decluttered layers 2017-10-31 11:33:48 +01:00
Andreas Hocevar
f4506d87eb Use existing sort function 2017-10-31 11:33:48 +01:00
Andreas Hocevar
22e4ba06a6 Add rendering tests 2017-10-31 11:33:48 +01:00
Andreas Hocevar
80e67bac7a Give lower z-index priority (painter's order) 2017-10-31 11:33:48 +01:00
Andreas Hocevar
b3f9e4e8ef Improve documentation 2017-10-31 11:33:48 +01:00
Andreas Hocevar
08af207724 Add decluttering for images and text 2017-10-31 11:33:48 +01:00
Andreas Hocevar
5ebc969599 Support line and polygon label points for ol.render.Feature 2017-10-31 11:33:48 +01:00
Andreas Hocevar
dbeb3d2795 Only render parts of source tile that are needed for the view tile 2017-10-31 11:33:48 +01:00
Andreas Hocevar
742a71cd4b Only render images when visible 2017-10-31 11:33:48 +01:00
Andreas Hocevar
1a1d45fdd1 Merge pull request #7379 from lasselaakkonen/6608-zoomify-custom-tile-size
Add support for custom tile size to Zoomify source
2017-10-31 10:50:37 +01:00
Andreas Hocevar
da2a23aacd Always use ol.Size tile size array 2017-10-31 10:36:20 +01:00
Lasse Laakkonen
3c8c7db8f3 Fix using multiple Zoomify sources at a time.. 2017-10-31 11:12:18 +02:00
Lasse Laakkonen
2836f9511f Remove unnecessary changes to Tile and ImageTile for changing Zoomify source tile size. 2017-10-31 09:31:38 +02:00
Lasse Laakkonen
e2581931a7 Add tileSize property definition to olx.source.ZoomifyOptions definition. 2017-10-30 21:53:52 +02:00
Frédéric Junod
435f93a197 Merge pull request #7376 from virtualcitySYSTEMS/feature-overlay-visibility
changed visibility of overlay properties to protected
2017-10-30 08:37:40 +01:00
Frédéric Junod
27eaa0d8c0 Merge pull request #7399 from openlayers/greenkeeper/eslint-4.10.0
Update eslint to the latest version 🚀
2017-10-30 08:29:35 +01:00
greenkeeper[bot]
00807ea98f chore(package): update eslint to version 4.10.0 2017-10-27 23:38:25 +00:00
Jannes Bolling
a802f5937b changed visibility of overlay properties to protected,
added new getOptions function to overlay, to get the original options

remove trailing underscore from protected properties and functions
2017-10-27 16:10:39 +02:00
Frédéric Junod
485680919e Merge pull request #7395 from openlayers/greenkeeper/closure-util-1.25.0
Update closure-util to the latest version 🚀
2017-10-27 10:12:12 +02:00
greenkeeper[bot]
cae6a07aa7 fix(package): update closure-util to version 1.25.0 2017-10-27 07:29:23 +00:00
Frédéric Junod
d33e41d322 Merge pull request #7392 from openlayers/greenkeeper/sinon-4.0.2
Update sinon to the latest version 🚀
2017-10-26 08:58:00 +02:00
greenkeeper[bot]
8d59b5d301 chore(package): update sinon to version 4.0.2 2017-10-25 17:20:30 +00:00
Frédéric Junod
5a6fafd85b Merge pull request #7377 from notnotse/overlay-classname
Add support to specify CSS class name when creating ol.Overlay
2017-10-25 15:32:24 +02:00
Bobo Häggström
343a4085a0 Add method to set max cache size in ol.style.IconImageCache 2017-10-24 16:04:55 +02:00
Andreas Hocevar
eeb20cf4ad Merge pull request #7383 from ahocevar/null-tilecoord
Handle null tile coordinates correctly
2017-10-22 21:59:35 +02:00
Frédéric Junod
35a357ee80 Merge pull request #7375 from fredj/ows_more_ServiceIdentification
Read 'Abstract', 'AccessConstraints' and 'Fees' in ol.format.OWS
2017-10-22 08:49:06 +02:00
Andreas Hocevar
6da92d5f71 Handle null tile coordinates correctly 2017-10-21 21:41:56 +02:00
Frédéric Junod
a625d1f1a8 Merge pull request #7378 from notnotse/fix-raster-source-docs
Fix incorrect docs about ol.source.Raster
2017-10-20 16:51:05 +02:00
Andreas Hocevar
10f59fc81c Merge pull request #7380 from openlayers/greenkeeper/rollup-plugin-cleanup-2.0.0
Update rollup-plugin-cleanup to the latest version 🚀
2017-10-20 10:55:14 +02:00
greenkeeper[bot]
0c9e2458e6 fix(package): update rollup-plugin-cleanup to version 2.0.0 2017-10-19 21:40:58 +00:00
Lasse Laakkonen
b8589acc6e Add test for initializing Zoomify source with custom tile size. 2017-10-19 17:54:46 +03:00
Bobo Häggström
7a800d4b39 Add support to specify CSS class name when creating ol.Overlay 2017-10-19 16:06:24 +02:00
itjope
f7b6682832 Fix incorrect docs about ol.source.Raster 2017-10-19 15:37:00 +02:00
Lasse Laakkonen
e41693816a Add support for custom tile size to Zoomify layer.
https://github.com/openlayers/openlayers/issues/6608
2017-10-19 15:39:47 +03:00
Andreas Hocevar
8d5a8665b2 Merge pull request #7371 from notnotse/vt-missing-api-annotation
Add @api annotation to ol.VectorTile.getExtent
2017-10-19 12:57:20 +02:00
Frederic Junod
e235c83231 Read 'Abstract', 'AccessConstraints' and 'Fees' in ol.format.OWS 2017-10-19 12:03:02 +02:00
Bobo Häggström
cdea7040ee Add @api annotation to ol.VectorTile.getExtent 2017-10-19 08:38:54 +02:00
Frédéric Junod
0e9bd75bc6 Merge pull request #7369 from fredj/bing_culture
Always request the Bing API with the 'culture' value
2017-10-19 08:25:31 +02:00
Frederic Junod
2e2e63a3e0 Always request the Bing API with the 'culture' value 2017-10-18 17:07:33 +02:00
Frédéric Junod
a121806715 Merge pull request #7366 from openlayers/greenkeeper/handlebars-4.0.11
Update handlebars to the latest version 🚀
2017-10-18 08:23:46 +02:00
greenkeeper[bot]
2268cbe90f chore(package): update handlebars to version 4.0.11 2017-10-17 21:05:07 +00:00
Frédéric Junod
82b7116f81 Merge pull request #7364 from fredj/rm_geojson_geoserver_workaround
Remove GeoJSON workaround for GeoServer
2017-10-17 16:52:59 +02:00
Tim Schaub
ab85a91efd Merge pull request #7355 from marcosox/master
Pass pixel tolerance as a parameter to constructor of ol.interaction.Extent
2017-10-17 08:44:42 -06:00
Frederic Junod
bcfad6ea8b Remove GeoJSON workaround for GeoServer
See #1569
See https://osgeo-org.atlassian.net/browse/GEOS-5996
2017-10-17 08:32:16 +02:00
Alexandre Silva
011285aefe Added option to the ol.format.GeoJSON to allow the reading of the geometry_name from the geojson. 2017-10-16 14:51:55 +01:00
marcosox
850aaf96f2 Add pixelTolerance to olx.interaction.ExtentOptions 2017-10-16 15:46:12 +02:00
marcosox
d40dd695cb Pass pixel tolerance as a parameter to constructor of ol.interaction.Extent
This adds the pixelTolerance option parameter to the constructor of ol.interaction.Extent.
In this way the user can override the current default value of 10.
2017-10-16 15:36:42 +02:00
Tim Schaub
382c6b9832 Merge pull request #7360 from openlayers/greenkeeper/eslint-4.9.0
Update eslint to the latest version 🚀
2017-10-14 16:58:32 -06:00
greenkeeper[bot]
660a661aa1 chore(package): update eslint to version 4.9.0 2017-10-14 21:19:32 +00:00
Tim Schaub
924780abf1 Merge pull request #7356 from EduardoNogueira/master
Fix documentation for target option in the controls
2017-10-14 12:13:37 -06:00
Tim Schaub
7d8a74ee5a Merge pull request #7359 from akkumar/rollup_options_fix
Rename entry to input - regarding options to rollup lib - Issue #7358
2017-10-14 12:09:34 -06:00
Karthik Kumar A
02b899869d rename entry to input - regarding options to rollup lib - Issue #7358 2017-10-14 14:18:20 +05:30
Tim Schaub
1f34f17436 Merge pull request #7357 from tschaub/release-v4.4.2
Release v4.4.2
2017-10-13 17:27:20 -06:00
Tim Schaub
f6eeee37d2 Bumping versions and logging changes for v4.4.2 2017-10-13 14:48:25 -06:00
Andreas Hocevar
d47dc52382 Calculate correct text box size 2017-10-13 14:45:27 -06:00
Andreas Hocevar
4d4afa1790 Pre-render text images for configured scale 2017-10-13 14:28:52 -06:00
Andreas Hocevar
1141c82da1 Handle different lineWidth scaling in Safari 2017-10-13 14:28:43 -06:00
Andreas Hocevar
637cf7c65f Allow reference image creation without existing reference image 2017-10-13 14:28:27 -06:00
Andreas Hocevar
84f083af86 Take pixel ratio into account for text stroke 2017-10-13 14:28:15 -06:00
Tim Schaub
90b08cdc1c Set time and handle frame animation in raster source 2017-10-13 14:24:08 -06:00
Tim Schaub
623dcd881f Avoid unnecessary transition on raster sources 2017-10-13 14:23:59 -06:00
Tim Schaub
177fcc7bcc Consistent use of ol.tilecoord.getKeyZXY() 2017-10-13 14:23:25 -06:00
Tim Schaub
5a1effb483 Get rid of unnecessary coord key prefix 2017-10-13 14:23:25 -06:00
Tim Schaub
97745c50af Prune all except for the most recent z on URL change 2017-10-13 14:23:25 -06:00
Tim Schaub
a4e0c54200 Maintain rendering order in the LRU cache 2017-10-13 14:23:24 -06:00
Tim Schaub
c679e3042e Functions to get key from coord and coord from key 2017-10-13 14:23:24 -06:00
Tim Schaub
b0f291973b Method for peeking at the newest cache entry key 2017-10-13 14:23:24 -06:00
Tim Schaub
168e6db951 Allow items to be removed from the cache 2017-10-13 14:23:24 -06:00
Eduardo Nogueira
ad29aa742e Fix documentation for target option in the controls 2017-10-13 18:20:45 +01:00
Frédéric Junod
d2e6acd478 Merge pull request #7354 from openlayers/greenkeeper/closure-util-1.24.2
Update closure-util to the latest version 🚀
2017-10-13 16:10:28 +02:00
greenkeeper[bot]
80d5cc87c4 fix(package): update closure-util to version 1.24.2 2017-10-13 13:42:29 +00:00
Andreas Hocevar
fe1d01a3cb Merge pull request #7350 from ahocevar/text-box
Calculate correct text box size
2017-10-12 07:04:39 +02:00
Andreas Hocevar
c2926df045 Merge pull request #7349 from ahocevar/vectortile-url
Do not use tileUrlFunction for renderer tile coordinates
2017-10-12 07:04:00 +02:00
Andreas Hocevar
8dbaf29fca Calculate correct text box size 2017-10-12 00:35:22 +02:00
Andreas Hocevar
ffb7d72c90 Do not use tileUrlFunction for renderer tile coordinates 2017-10-11 19:44:08 +02:00
Andreas Hocevar
e6534894fd Merge pull request #7305 from oterral/teo_info
Fix #7304: Re-calculate the resolution when the WMS source is reprojected
2017-10-11 17:04:33 +02:00
Andreas Hocevar
d74bef9fd7 Merge pull request #7346 from ahocevar/text-scale
Pre-render text images for configured scale
2017-10-11 16:06:04 +02:00
Andreas Hocevar
380690a6a3 Pre-render text images for configured scale 2017-10-11 15:51:15 +02:00
Andreas Hocevar
dcf38c22e2 Merge pull request #7345 from ahocevar/line-width
Handle different lineWidth scaling in Safari
2017-10-11 08:56:34 +02:00
Andreas Hocevar
b81952f142 Merge pull request #7344 from ahocevar/measure-width
Make text height detection independent of css settings
2017-10-11 08:56:02 +02:00
Andreas Hocevar
d0092ecd18 Handle different lineWidth scaling in Safari 2017-10-11 00:40:14 +02:00
Andreas Hocevar
1fcb94a29c Make text height detection independent of css settings 2017-10-11 00:21:29 +02:00
Tim Schaub
80dbedf946 Merge pull request #7341 from tschaub/raster-fix
Proper rendering of raster sources when there is a tile transition
2017-10-10 03:31:00 -06:00
Andreas Hocevar
609bd23eff Merge pull request #7339 from ahocevar/text-stroke
Use correct text stroke on HiDPI devices
2017-10-10 07:40:29 +02:00
Tim Schaub
373179ad82 Avoid unnecessary transition on raster sources 2017-10-09 18:24:21 -06:00
Tim Schaub
88ca77b8c7 Set time and handle frame animation in raster source 2017-10-09 18:24:15 -06:00
Tim Schaub
55b5d0c719 Merge pull request #7327 from tschaub/tile-management
Prune the tile cache after updating a source's URL
2017-10-09 17:01:12 -06:00
Tim Schaub
5558994827 Merge pull request #7333 from waxenegger/pluggable_calling
Pluggable Map/Layers - function calls to handles and create
2017-10-09 16:59:59 -06:00
Andreas Hocevar
1aafd8320d Allow reference image creation without existing reference image 2017-10-09 18:51:57 +02:00
Andreas Hocevar
02e23e3cd0 Take pixel ratio into account for text stroke 2017-10-09 18:51:45 +02:00
Tim Schaub
9b8232f65b Merge pull request #7329 from tschaub/attribution
Reworked attribution handling
2017-10-09 08:26:30 -06:00
Andreas Hocevar
83cfb77407 Merge pull request #7337 from ahocevar/blank-image
Always create a new blank image to avoid CSP violations
2017-10-09 13:24:49 +02:00
Andreas Hocevar
590dd6f1cf Always create a new blank image to avoid CSP violations 2017-10-09 12:46:34 +02:00
Harald Waxenegger
01b17de36d access functions via bracked/string to avoid compilation mangling 2017-10-09 15:23:56 +10:00
Tim Schaub
b94b8cc40d Add deprecation notes for ol.Attribution 2017-10-08 20:29:12 -06:00
Tim Schaub
2dd8fdb5b7 Reworked attribution handling 2017-10-08 20:29:02 -06:00
Tim Schaub
a5a0f5b98b Merge pull request #7330 from tschaub/upgrade-notes
Add upgrade notes to 4.4.0 changelog
2017-10-08 15:21:36 -06:00
Tim Schaub
2eb8ed047a Add upgrade notes to 4.4.0 changelog 2017-10-08 15:11:19 -06:00
Tim Schaub
bedec9d596 Consistent use of ol.tilecoord.getKeyZXY() 2017-10-08 09:08:20 -06:00
Tim Schaub
dbaf24ec39 Get rid of unnecessary coord key prefix 2017-10-08 09:08:20 -06:00
Tim Schaub
c96c9cfc6d Prune all except for the most recent z on URL change 2017-10-08 09:08:14 -06:00
Tim Schaub
c692b98fa9 Maintain rendering order in the LRU cache 2017-10-08 08:51:09 -06:00
Tim Schaub
9fb7778156 Functions to get key from coord and coord from key 2017-10-08 08:50:19 -06:00
Tim Schaub
177156c293 Method for peeking at the newest cache entry key 2017-10-08 08:43:53 -06:00
Tim Schaub
10af59bfce Allow items to be removed from the cache 2017-10-08 08:42:10 -06:00
Tim Schaub
ad5f21fa5c Merge pull request #7321 from tschaub/release-v4.4.1
Release v4.4.1
2017-10-06 11:13:29 -06:00
Tim Schaub
77892c435f Update versions for v4.4.1 2017-10-06 09:34:54 -06:00
Tim Schaub
917359107d Changes for v4.4.1 2017-10-06 09:34:36 -06:00
Tim Schaub
c4f460bcc2 Only clear the canvas when needed 2017-10-06 09:33:11 -06:00
Tim Schaub
c5a05f1abd Merge pull request #7323 from tschaub/flashless
Only clear the canvas when needed
2017-10-06 09:31:50 -06:00
Tim Schaub
ad4a258c87 Only clear the canvas when needed 2017-10-06 09:12:52 -06:00
Tim Schaub
6e78148174 Use lowercase module identifiers until ol@5 2017-10-06 08:52:22 -06:00
Frédéric Junod
7d8e2a7372 Merge pull request #7319 from openlayers/greenkeeper/closure-util-1.24.1
Update closure-util to the latest version 🚀
2017-10-06 15:24:38 +02:00
greenkeeper[bot]
adbc64507f fix(package): update closure-util to version 1.24.1 2017-10-06 13:03:07 +00:00
Tim Schaub
be32b0f769 Merge pull request #7313 from tschaub/patch
Use lowercase module identifiers until ol@5
2017-10-06 02:31:15 -06:00
Tim Schaub
57a5ffa40b Merge pull request #7316 from mprins/patch-1
fix copy-paste error in 4.4.0 changelog
2017-10-06 02:30:41 -06:00
Mark Prins
9c6c14a55c fix copy-paste error in 4.4.0 changelog
Also IMHO it doesn't make much sense to have issues of previous patch releases eg. 4.3.4 in here as these have their own release notes already, but I'll leave that for your debate
2017-10-06 09:14:56 +02:00
Frédéric Junod
ae906c7aff Merge pull request #7315 from fredj/contains_filter
Add new ol.format.filter.Contains spatial operator
2017-10-06 09:02:33 +02:00
Frédéric Junod
a7729cc602 Merge pull request #7314 from openlayers/greenkeeper/mocha-4.0.1
Update mocha to the latest version 🚀
2017-10-06 08:46:26 +02:00
Frederic Junod
dfe9e9b59a Add new ol.format.filter.Contains spatial operator 2017-10-06 08:45:17 +02:00
greenkeeper[bot]
a6a6ce9879 chore(package): update mocha to version 4.0.1 2017-10-06 05:15:58 +00:00
Tim Schaub
0802f50bc6 Use lowercase module identifiers until ol@5 2017-10-05 16:42:45 -06:00
Tim Schaub
9a50f9ff75 Merge pull request #7311 from tschaub/release-v4.4.0
Release v4.4.0
2017-10-05 15:55:10 -06:00
Kogis IWI
232f56e229 Fix #7304: Re-calculate the resolution when the WMS source is reprojected 2017-10-03 17:25:44 +02:00
236 changed files with 103940 additions and 1962 deletions

View File

@@ -1,6 +1,175 @@
## Upgrade notes ## Upgrade notes
### Next Release ### Next release
#### Changed behavior of the `Draw` interaction
For better drawing experience, two changes were made to the behavior of the Draw interaction:
1. On long press, the current vertex can be dragged to its desired position.
2. On touch move (e.g. when panning the map on a mobile device), no draw cursor is shown, and the geometry being drawn is not updated. But because of 1., the draw cursor will appear on long press. Mouse moves are not affected by this change.
#### Changes in proj4 integration
Because relying on a globally available proj4 is not practical with ES modules, we have made a change to the way we integrate proj4:
* The `setProj4()` function from the `ol/proj` module was removed.
* A new `ol/proj/proj4` module with a `register()` function was added. Regardless of whether the application imports `proj4` or uses a global `proj4`, this function needs to be called with the proj4 instance as argument whenever projection definitions were added to proj4's registry with (`proj4.defs`).
It is also recommended to no longer use a global `proj4`. Instead,
npm install proj4
and import it:
```js
import proj4 from 'proj4';
```
Applications can be updated by importing the `register` function from the `ol/proj/proj4` module
```js
import {register} from 'ol/proj/proj4'
```
and calling it before using projections, and any time the proj4 registry was changed by `proj4.defs()` calls:
```js
register(proj4);
```
#### Removal of logos
The map and sources no longer accept a `logo` option. Instead, if you wish to append a logo to your map, add the desired markup directly in your HTML. In addition, you can use the `attributions` property of a source to display arbitrary markup per-source with the attribution control.
#### Replacement of `ol/Sphere` constructor with `ol/sphere` functions
The `ol/Sphere` constructor has been removed. If you were using the `getGeodesicArea` method, use the `getArea` function instead. If you were using the `haversineDistance` method, use the `getDistance` function instead.
Examples before:
```js
// using ol@4
import Sphere from 'ol/sphere';
var sphere = new Sphere(Sphere.DEFAULT_RADIUS);
var area = sphere.getGeodesicArea(polygon);
var distance = sphere.haversineDistance(g1, g2);
```
Examples after:
```js
// using ol@5
import {circular as circularPolygon} from 'ol/geom/Polygon';
import {getArea, getDistance} from 'ol/sphere';
var area = getArea(polygon);
var distance = getDistance(g1, g2);
var circle = circularPolygon(center, radius);
```
#### New signature for the `circular` function for creating polygons
The `circular` function exported from `ol/geom/Polygon` no longer requires a `Sphere` as the first argument.
Example before:
```js
// using ol@4
import Polygon from 'ol/geom/polygon';
import Sphere from 'ol/sphere';
var poly = Polygon.circular(new Sphere(Sphere.DEFAULT_RADIUS), center, radius);
```
Example after:
```js
// using ol@5
import {circular as circularPolygon} from 'ol/geom/Polygon';
var poly = circularPolygon(center, radius);
```
#### Removal of optional this arguments.
The following methods did get the optional this (i.e. opt_this) arguments removed. Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
* Collection#forEach
* geom/LineString#forEachSegment
* Observable#on, #once, #un
* source/TileUTFGrid#forDataAtCoordinateAndResolution
* source/Vector#forEachFeature, #forEachFeatureInExtent, #forEachFeatureIntersectingExtent
### v4.6.0
#### Renamed `exceedLength` option of `ol.style.Text` to `overflow`
To update your applications, simply replace `exceedLength` with `overflow`.
#### Deprecation of `ol.source.ImageVector`
Rendering vector sources as image is now directly supported by `ol.layer.Vector` with the new `renderMode: 'image'` configuration option. Change code like this:
```js
new ol.layer.Image({
source: new ol.source.ImageVector({
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
})
});
```
to:
```js
new ol.layer.Vector({
renderMode: 'image',
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
});
```
### v4.5.0
#### Removed GeoJSON crs workaround for GeoServer
Previous version of GeoServer returned invalid crs in GeoJSON output. The workaround in `ol.format.GeoJSON` used to read this crs code is now removed.
#### Deprecation of `ol.Attribution`
`ol.Attribution` is deprecated and will be removed in the next major version. Instead, you can construct a source with a string attribution or an array of strings. For dynamic attributions, you can provide a function that gets called with the current frame state.
Before:
```js
var source = new ol.source.XYZ({
attributions: [
new ol.Attribution({html: 'some attribution'})
]
});
```
After:
```js
var source = new ol.source.XYZ({
attributions: 'some attribution'
});
```
In addition to passing a string or an array of strings for the `attributions` option, you can also pass a function that will get called with the current frame state.
```js
var source = new ol.source.XYZ({
attributions: function(frameState) {
// inspect the frame state and return attributions
return 'some attribution'; // or ['multiple', 'attributions'] or null
}
});
```
### v4.4.0
#### Behavior change for polygon labels #### Behavior change for polygon labels

View File

@@ -1,8 +1,51 @@
# 4.3.0 # 4.4.0
## Summary ## Summary
The 4.3.0 release includes features and fixes from 80 pull requests, including first time contributions from @EduardoNogueira, @ath0mas, @f7o, @trevorblades, @viethang, and @wb14123. There are some really nice rendering enhancements included in this release. It is now possible to render labels along lines (see [#7239](https://github.com/openlayers/openlayers/pull/7239) for more detail) and polygon labels are only rendered if they fit within the polygon ([#7292](https://github.com/openlayers/openlayers/pull/7292)). In addition, we now render tiles with an opacity transition, so tiled layers more gracefully fade in ([#7267](https://github.com/openlayers/openlayers/pull/7267)). The 4.4.0 release includes features and fixes from 80 pull requests, including first time contributions from @EduardoNogueira, @ath0mas, @f7o, @trevorblades, @viethang, and @wb14123. There are some really nice rendering enhancements included in this release. It is now possible to render labels along lines (see [#7239](https://github.com/openlayers/openlayers/pull/7239) for more detail) and polygon labels are only rendered if they fit within the polygon ([#7292](https://github.com/openlayers/openlayers/pull/7292)). In addition, we now render tiles with an opacity transition, so tiled layers more gracefully fade in ([#7267](https://github.com/openlayers/openlayers/pull/7267)).
### Upgrade notes
#### Behavior change for polygon labels
Polygon labels are now only rendered when the label does not exceed the polygon at the label position. To get the old behavior, configure your `ol.style.Text` with `exceedLength: true`.
#### Minor change for custom `tileLoadFunction` with `ol.source.VectorTile`
It is no longer necessary to set the projection on the tile. Instead, the `readFeatures` method must be called with the tile's extent as `extent` option and the view's projection as `featureProjection`.
Before:
```js
tile.setLoader(function() {
var data = // ... fetch data
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data));
tile.setProjection(format.readProjection(data));
// uncomment the line below for ol.format.MVT only
//tile.setExtent(format.getLastExtent());
});
```
After:
```js
tile.setLoader(function() {
var data = // ... fetch data
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data, {
featureProjection: map.getView().getProjection(),
// uncomment the line below for ol.format.MVT only
//extent: tile.getExtent()
}));
);
```
#### Deprecation of `ol.DeviceOrientation`
`ol.DeviceOrientation` is deprecated and will be removed in the next major version.
The device-orientation example has been updated to use the (gyronorm.js)[https://github.com/dorukeker/gyronorm.js] library.
## Detailed changes
See below for the full list of changes. See below for the full list of changes.

8
changelog/v4.4.1.md Normal file
View File

@@ -0,0 +1,8 @@
# 4.4.1
The v4.4.1 release includes a fix for the [`ol` package](https://www.npmjs.com/package/ol) and a fix for a tile rendering regression.
## Fixes
* [#7323](https://github.com/openlayers/openlayers/pull/7323) - Only clear the canvas when needed ([@tschaub](https://github.com/tschaub))
* [#7313](https://github.com/openlayers/openlayers/pull/7313) - Use lowercase module identifiers until ol@5 ([@tschaub](https://github.com/tschaub))

12
changelog/v4.4.2.md Normal file
View File

@@ -0,0 +1,12 @@
# 4.4.2
The v4.4.2 release fixes a number of rendering issues in the 4.4 releases.
## Fixes
* [#7327](https://github.com/openlayers/openlayers/pull/7327) - Prune the tile cache after updating a source's URL ([@tschaub](https://github.com/tschaub))
* [#7341](https://github.com/openlayers/openlayers/pull/7341) - Proper rendering of raster sources when there is a tile transition ([@tschaub](https://github.com/tschaub))
* [#7339](https://github.com/openlayers/openlayers/pull/7339) - Use correct text stroke on HiDPI devices ([@ahocevar](https://github.com/ahocevar))
* [#7345](https://github.com/openlayers/openlayers/pull/7345) - Handle different lineWidth scaling in Safari ([@ahocevar](https://github.com/ahocevar))
* [#7346](https://github.com/openlayers/openlayers/pull/7346) - Pre-render text images for configured scale ([@ahocevar](https://github.com/ahocevar))
* [#7350](https://github.com/openlayers/openlayers/pull/7350) - Calculate correct text box size ([@ahocevar](https://github.com/ahocevar))

127
changelog/v4.5.0.md Normal file
View File

@@ -0,0 +1,127 @@
# 4.5.0
### Summary
The 4.5 release includes enhancements and fixes from 50 or so pull requests. Headlining this release, vector layers got a new `declutter` option that can be used to avoid overlapping labels. See the [street labels example](http://openlayers.org/en/latest/examples/street-labels.html) for a demonstration of this feature.
Please note that if you are using `closure-util` to build your OpenLayers based application, it is time to migrate to using the [`ol` package](https://www.npmjs.com/package/ol) and a module bundler like webpack. OpenLayers has not had a dependency on the Closure Library since the [3.19 release](https://github.com/openlayers/openlayers/releases/tag/v3.19.0); and with the 5.0 release we will be moving completely away from `goog.require` and `goog.provide`, dropping support for `closure-util`, and going with ES modules for our sources.
We will be adding details to the wiki about upcoming changes in 5.0 and tips on how to upgrade. We'll likely have a few more 4.x releases before the 5.0 release. But if you're interested in continuing to get feature enhancements in future releases, migrating to the `ol` package now will make the transition easier.
### Upgrade notes
#### Removed GeoJSON crs workaround for GeoServer
Previous version of GeoServer returned invalid crs in GeoJSON output. The workaround in `ol.format.GeoJSON` used to read this crs code is now removed.
#### Deprecation of `ol.Attribution`
`ol.Attribution` is deprecated and will be removed in the next major version. Instead, you can construct a source with a string attribution or an array of strings. For dynamic attributions, you can provide a function that gets called with the current frame state.
Before:
```js
var source = new ol.source.XYZ({
attributions: [
new ol.Attribution({html: 'some attribution'})
]
});
```
After:
```js
var source = new ol.source.XYZ({
attributions: 'some attribution'
});
```
In addition to passing a string or an array of strings for the `attributions` option, you can also pass a function that will get called with the current frame state.
```js
var source = new ol.source.XYZ({
attributions: function(frameState) {
// inspect the frame state and return attributions
return 'some attribution'; // or ['multiple', 'attributions'] or null
}
});
```
## Detailed changes
See below for the full list of changes.
* [#7456](https://github.com/openlayers/openlayers/pull/7456) - Retry if sauce connect fails ([@tschaub](https://github.com/tschaub))
* [#7440](https://github.com/openlayers/openlayers/pull/7440) - Attempt to make font loading tests more stable ([@ahocevar](https://github.com/ahocevar))
* [#7444](https://github.com/openlayers/openlayers/pull/7444) - Simpler style management ([@ahocevar](https://github.com/ahocevar))
* [#7438](https://github.com/openlayers/openlayers/pull/7438) - Call getProjection() only once ([@ahocevar](https://github.com/ahocevar))
* [#7430](https://github.com/openlayers/openlayers/pull/7430) - Add support for hex colors with alpha ([@tschaub](https://github.com/tschaub))
* [#7431](https://github.com/openlayers/openlayers/pull/7431) - Avoid returning undefined zoom ([@tschaub](https://github.com/tschaub))
* [#7436](https://github.com/openlayers/openlayers/pull/7436) - Always use source projection loading image tiles ([@pjeweb](https://github.com/pjeweb))
* [#7433](https://github.com/openlayers/openlayers/pull/7433) - Don't use getHints if it's not needed ([@fredj](https://github.com/fredj))
* [#7362](https://github.com/openlayers/openlayers/pull/7362) - Added option to the ol.format.GeoJSON to allow the reading of the geometry_name from the geojson ([@Alexandre27](https://github.com/Alexandre27))
* [#7426](https://github.com/openlayers/openlayers/pull/7426) - Update InteractionOptions.prototype.handleEvent docs ([@glen-nu](https://github.com/glen-nu))
* [#7423](https://github.com/openlayers/openlayers/pull/7423) - Get rendered features by coordinate when wrapping ([@tschaub](https://github.com/tschaub))
* [#7421](https://github.com/openlayers/openlayers/pull/7421) - Keep longitude between -180 and 180 ([@tschaub](https://github.com/tschaub))
* [#7420](https://github.com/openlayers/openlayers/pull/7420) - Fix MapGuide example resolves #7325 ([@TDesjardins](https://github.com/TDesjardins))
* [#7340](https://github.com/openlayers/openlayers/pull/7340) - Clear label cache when fonts become available ([@ahocevar](https://github.com/ahocevar))
* [#7414](https://github.com/openlayers/openlayers/pull/7414) - Only split text at line angle changes ([@ahocevar](https://github.com/ahocevar))
* [#7411](https://github.com/openlayers/openlayers/pull/7411) - Add getLayers and setLayers functions to ol.format.WMSGetFeatureInfo ([@fredj](https://github.com/fredj))
* [#7328](https://github.com/openlayers/openlayers/pull/7328) - Declutter text and images ([@ahocevar](https://github.com/ahocevar))
* [#7406](https://github.com/openlayers/openlayers/pull/7406) - Add option to Zoomify source for setting custom extent ([@lasselaakkonen](https://github.com/lasselaakkonen))
* [#7410](https://github.com/openlayers/openlayers/pull/7410) - Add getFeatureType and setFeatureType functions to ol.format.WFS ([@fredj](https://github.com/fredj))
* [#7379](https://github.com/openlayers/openlayers/pull/7379) - Add support for custom tile size to Zoomify source ([@lasselaakkonen](https://github.com/lasselaakkonen))
* [#7376](https://github.com/openlayers/openlayers/pull/7376) - changed visibility of overlay properties to protected ([@virtualcitySYSTEMS](https://github.com/virtualcitySYSTEMS))
* [#7377](https://github.com/openlayers/openlayers/pull/7377) - Add support to specify CSS class name when creating ol.Overlay ([@notnotse](https://github.com/notnotse))
* [#7383](https://github.com/openlayers/openlayers/pull/7383) - Handle null tile coordinates correctly ([@ahocevar](https://github.com/ahocevar))
* [#7375](https://github.com/openlayers/openlayers/pull/7375) - Read 'Abstract', 'AccessConstraints' and 'Fees' in ol.format.OWS ([@fredj](https://github.com/fredj))
* [#7378](https://github.com/openlayers/openlayers/pull/7378) - Fix incorrect docs about ol.source.Raster ([@notnotse](https://github.com/notnotse))
* [#7371](https://github.com/openlayers/openlayers/pull/7371) - Add @api annotation to ol.VectorTile.getExtent ([@notnotse](https://github.com/notnotse))
* [#7369](https://github.com/openlayers/openlayers/pull/7369) - Always request the Bing API with the 'culture' value ([@fredj](https://github.com/fredj))
* [#7364](https://github.com/openlayers/openlayers/pull/7364) - Remove GeoJSON workaround for GeoServer ([@fredj](https://github.com/fredj))
* [#7355](https://github.com/openlayers/openlayers/pull/7355) - Pass pixel tolerance as a parameter to constructor of ol.interaction.Extent ([@marcosox](https://github.com/marcosox))
* [#7356](https://github.com/openlayers/openlayers/pull/7356) - Fix documentation for target option in the controls ([@EduardoNogueira](https://github.com/EduardoNogueira))
* [#7359](https://github.com/openlayers/openlayers/pull/7359) - Rename entry to input - regarding options to rollup lib - Issue #7358 ([@akkumar](https://github.com/akkumar))
* [#7357](https://github.com/openlayers/openlayers/pull/7357) - Release v4.4.2 ([@tschaub](https://github.com/tschaub))
* [#7350](https://github.com/openlayers/openlayers/pull/7350) - Calculate correct text box size ([@ahocevar](https://github.com/ahocevar))
* [#7349](https://github.com/openlayers/openlayers/pull/7349) - Do not use tileUrlFunction for renderer tile coordinates ([@ahocevar](https://github.com/ahocevar))
* [#7305](https://github.com/openlayers/openlayers/pull/7305) - Fix #7304: Re-calculate the resolution when the WMS source is reprojected ([@oterral](https://github.com/oterral))
* [#7346](https://github.com/openlayers/openlayers/pull/7346) - Pre-render text images for configured scale ([@ahocevar](https://github.com/ahocevar))
* [#7345](https://github.com/openlayers/openlayers/pull/7345) - Handle different lineWidth scaling in Safari ([@ahocevar](https://github.com/ahocevar))
* [#7344](https://github.com/openlayers/openlayers/pull/7344) - Make text height detection independent of css settings ([@ahocevar](https://github.com/ahocevar))
* [#7341](https://github.com/openlayers/openlayers/pull/7341) - Proper rendering of raster sources when there is a tile transition ([@tschaub](https://github.com/tschaub))
* [#7339](https://github.com/openlayers/openlayers/pull/7339) - Use correct text stroke on HiDPI devices ([@ahocevar](https://github.com/ahocevar))
* [#7327](https://github.com/openlayers/openlayers/pull/7327) - Prune the tile cache after updating a source's URL ([@tschaub](https://github.com/tschaub))
* [#7333](https://github.com/openlayers/openlayers/pull/7333) - Pluggable Map/Layers - function calls to handles and create ([@waxenegger](https://github.com/waxenegger))
* [#7329](https://github.com/openlayers/openlayers/pull/7329) - Reworked attribution handling ([@tschaub](https://github.com/tschaub))
* [#7337](https://github.com/openlayers/openlayers/pull/7337) - Always create a new blank image to avoid CSP violations ([@ahocevar](https://github.com/ahocevar))
* [#7330](https://github.com/openlayers/openlayers/pull/7330) - Add upgrade notes to 4.4.0 changelog ([@tschaub](https://github.com/tschaub))
* [#7321](https://github.com/openlayers/openlayers/pull/7321) - Release v4.4.1 ([@tschaub](https://github.com/tschaub))
* [#7323](https://github.com/openlayers/openlayers/pull/7323) - Only clear the canvas when needed ([@tschaub](https://github.com/tschaub))
* [#7313](https://github.com/openlayers/openlayers/pull/7313) - Use lowercase module identifiers until ol@5 ([@tschaub](https://github.com/tschaub))
* [#7316](https://github.com/openlayers/openlayers/pull/7316) - fix copy-paste error in 4.4.0 changelog ([@mprins](https://github.com/mprins))
* [#7315](https://github.com/openlayers/openlayers/pull/7315) - Add new ol.format.filter.Contains spatial operator ([@fredj](https://github.com/fredj))
* [#7311](https://github.com/openlayers/openlayers/pull/7311) - Release v4.4.0 ([@tschaub](https://github.com/tschaub))
Additionally a number of updates where made to our dependencies:
<details>
<summary>Click to expand</summary>
<ul>
<li><a href="https://github.com/openlayers/openlayers/pull/7455">#7455</a> - Update eslint to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7447">#7447</a> - chore(package): update rollup-plugin-commonjs to version 8.2.6 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7448">#7448</a> - chore(package): update debounce to version 1.1.0 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7451">#7451</a> - chore(package): update karma to version 1.7.1 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7446">#7446</a> - fix(package): update rollup to version 0.51.3 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7428">#7428</a> - Update sinon to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7425">#7425</a> - Update async to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7418">#7418</a> - Update sinon to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7416">#7416</a> - Update sinon to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7417">#7417</a> - Update phantomjs-prebuilt to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7399">#7399</a> - Update eslint to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7395">#7395</a> - Update closure-util to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7392">#7392</a> - Update sinon to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7380">#7380</a> - Update rollup-plugin-cleanup to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7366">#7366</a> - Update handlebars to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7360">#7360</a> - Update eslint to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7354">#7354</a> - Update closure-util to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7319">#7319</a> - Update closure-util to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
<li><a href="https://github.com/openlayers/openlayers/pull/7314">#7314</a> - Update mocha to the latest version 🚀 (<a href="https://github.com/openlayers">@openlayers</a>)</li>
</ul>
</details>

91
changelog/v4.6.0.md Normal file
View File

@@ -0,0 +1,91 @@
# v4.6.0
### Summary
The 4.6 release includes enhancements and fixes from 30 or so pull requests. Headlining this release, vector layers got new `textBackgroundFill`, `textBackgroundStroke` and `padding` options that can be used to render background boxes for text. `ol.source.ImageVector` is now deprecated and replaced by a more convenient way to render vectors as images: by simply setting `renderMode: 'image'` on the vector layer.
Please note that if you are using `closure-util` to build your OpenLayers based application, it is time to migrate to using the [`ol` package](https://www.npmjs.com/package/ol) and a module bundler like webpack. OpenLayers has not had a dependency on the Closure Library since the [3.19 release](https://github.com/openlayers/openlayers/releases/tag/v3.19.0); and with the 5.0 release we will be moving completely away from `goog.require` and `goog.provide`, dropping support for `closure-util`, and going with ES modules for our sources.
See the [wiki](https://github.com/openlayers/openlayers/wiki/OpenLayers-v5.x) about upcoming changes in 5.0 and tips on how to upgrade. We likely won't have another 4.x release before the 5.0 release. If you're interested in continuing to get feature enhancements in future releases, migrating to the `ol` package now will make the transition easier.
### Upgrade notes
#### Renamed `exceedLength` option of `ol.style.Text` to `overflow`
To update your applications, simply replace `exceedLength` with `overflow`.
#### Deprecation of `ol.source.ImageVector`
Rendering vector sources as image is now directly supported by `ol.layer.Vector` with the new `renderMode: 'image'` configuration option. Change code like this:
```js
new ol.layer.Image({
source: new ol.source.ImageVector({
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
})
});
```
to:
```js
new ol.layer.Vector({
renderMode: 'image',
style: myStyle,
source: new ol.source.Vector({
url: 'my/data.json',
format: new ol.format.GeoJSON()
})
});
```
## Detailed changes
See below for the full list of changes.
* [#7538](https://github.com/openlayers/openlayers/pull/7538) - removeFromLoadedExtents to remove extents that failed to load ([@ahocevar](https://github.com/ahocevar))
* [#7537](https://github.com/openlayers/openlayers/pull/7537) - Fix Draw.removeLastPoint exception when no points to remove ([@walkermatt](https://github.com/walkermatt))
* [#7461](https://github.com/openlayers/openlayers/pull/7461) - Use the matrixSet projection by default ([@oterral](https://github.com/oterral))
* [#5883](https://github.com/openlayers/openlayers/pull/5883) - Fixes setUrl() for WMTS sources (ol.source.WMTS) ([@bylexus](https://github.com/bylexus))
* [#7531](https://github.com/openlayers/openlayers/pull/7531) - Update the ol package readme ([@ahocevar](https://github.com/ahocevar))
* [#7372](https://github.com/openlayers/openlayers/pull/7372) - Add method to set max cache size in ol.style.IconImageCache ([@notnotse](https://github.com/notnotse))
* [#7530](https://github.com/openlayers/openlayers/pull/7530) - Check forward/back 1 world if wrapping ([@raiyni](https://github.com/raiyni))
* [#7526](https://github.com/openlayers/openlayers/pull/7526) - Allow clicks to be stopped while drawing ([@tschaub](https://github.com/tschaub))
* [#7524](https://github.com/openlayers/openlayers/pull/7524) - Snap view center to pixel ([@ahocevar](https://github.com/ahocevar))
* [#7521](https://github.com/openlayers/openlayers/pull/7521) - fix setMinZoom/setMaxZoom ([@cs09g](https://github.com/cs09g))
* [#7519](https://github.com/openlayers/openlayers/pull/7519) - Reuse declutter tree for hit detection ([@ahocevar](https://github.com/ahocevar))
* [#7499](https://github.com/openlayers/openlayers/pull/7499) - Remove attributions from olx.FrameState instances ([@openlayers](https://github.com/openlayers))
* [#7501](https://github.com/openlayers/openlayers/pull/7501) - Option to render vector layers as images ([@ahocevar](https://github.com/ahocevar))
* [#7516](https://github.com/openlayers/openlayers/pull/7516) - Deprecate exceedLength and replace with overflow ([@ahocevar](https://github.com/ahocevar))
* [#7510](https://github.com/openlayers/openlayers/pull/7510) - Do not fade the states layer ([@ahocevar](https://github.com/ahocevar))
* [#7513](https://github.com/openlayers/openlayers/pull/7513) - Make strokeKey safer ([@ahocevar](https://github.com/ahocevar))
* [#7514](https://github.com/openlayers/openlayers/pull/7514) - Prune the label cache less aggressively ([@ahocevar](https://github.com/ahocevar))
* [#7505](https://github.com/openlayers/openlayers/pull/7505) - Remove ol.DeviceOrientation link from API index ([@fredj](https://github.com/fredj))
* [#7497](https://github.com/openlayers/openlayers/pull/7497) - Use getGeometry ([@nicholas-l](https://github.com/nicholas-l))
* [#7495](https://github.com/openlayers/openlayers/pull/7495) - Remove layer renderers when viewport is removed ([@ahocevar](https://github.com/ahocevar))
* [#7492](https://github.com/openlayers/openlayers/pull/7492) - Remove unneeded type cast from examples ([@fredj](https://github.com/fredj))
* [#7489](https://github.com/openlayers/openlayers/pull/7489) - Allow string to be passed as ol.interaction.Draw type ([@fredj](https://github.com/fredj))
* [#7445](https://github.com/openlayers/openlayers/pull/7445) - Load css rules from full-screen.css in examples ([@fredj](https://github.com/fredj))
* [#7481](https://github.com/openlayers/openlayers/pull/7481) - Make zoom to extent control extensible ([@gberaudo](https://github.com/gberaudo))
* [#7477](https://github.com/openlayers/openlayers/pull/7477) - Make text states available for replay time ([@ahocevar](https://github.com/ahocevar))
* [#7482](https://github.com/openlayers/openlayers/pull/7482) - Reset rotation after rendering ([@ahocevar](https://github.com/ahocevar))
* [#7480](https://github.com/openlayers/openlayers/pull/7480) - Create a new image when loading tile after an error ([@ahocevar](https://github.com/ahocevar))
* [#7476](https://github.com/openlayers/openlayers/pull/7476) - Reset text measurements when available fonts change ([@ahocevar](https://github.com/ahocevar))
* [#7454](https://github.com/openlayers/openlayers/pull/7454) - Add text background rendering and text padding ([@ahocevar](https://github.com/ahocevar))
* [#7468](https://github.com/openlayers/openlayers/pull/7468) - Add new API-key for HERE example ([@chrismayer](https://github.com/chrismayer))
* [#7465](https://github.com/openlayers/openlayers/pull/7465) - Export ol.proj.Projection#getAxisOrientation function ([@fredj](https://github.com/fredj))
* [#7462](https://github.com/openlayers/openlayers/pull/7462) - Respect metersPerUnit in ScaleLine control ([@ahocevar](https://github.com/ahocevar))
Additionally a number of updates where made to our dependencies:
* [#7536](https://github.com/openlayers/openlayers/pull/7536) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#7533](https://github.com/openlayers/openlayers/pull/7533) - Update marked to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#7527](https://github.com/openlayers/openlayers/pull/7527) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#7511](https://github.com/openlayers/openlayers/pull/7511) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#7512](https://github.com/openlayers/openlayers/pull/7512) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#7484](https://github.com/openlayers/openlayers/pull/7484) - Update closure-util to the latest version 🚀 ([@openlayers](https://github.com/openlayers))

9
changelog/v4.6.1.md Normal file
View File

@@ -0,0 +1,9 @@
# 4.6.1
The v4.6.1 release fixes a number of issues in the 4.6 releases.
## Fixes
* [#7543](https://github.com/openlayers/openlayers/pull/7543) - Donut polygon labels do not get a chance to get rendered ([@ahocevar](https://github.com/ahocevar))
* [#7542](https://github.com/openlayers/openlayers/pull/7542) - Still respect deprecated exceedLength option ([@ahocevar](https://github.com/ahocevar))
* [#7541](https://github.com/openlayers/openlayers/pull/7541) - Fix case of vectorrendertype.js ([@ahocevar](https://github.com/ahocevar))

7
changelog/v4.6.2.md Normal file
View File

@@ -0,0 +1,7 @@
# 4.6.2
The v4.6.2 release fixes a regression that could cause tremendous amounts of unneeded vector data to be fetched from the source.
## Fixes
* [#7546](https://github.com/openlayers/openlayers/pull/7546) - Do not request features for wrapped extent ([@ahocevar](https://github.com/ahocevar))

7
changelog/v4.6.3.md Normal file
View File

@@ -0,0 +1,7 @@
# 4.6.3
The v4.6.3 release fixes a performance issue when `renderMode: 'image'` is set on an `ol.layer.Vector`.
## Fixes
* [#7554](https://github.com/openlayers/openlayers/pull/7554) - Only compose image vector frame when the replay group has changed ([@ahocevar](https://github.com/ahocevar))

7
changelog/v4.6.4.md Normal file
View File

@@ -0,0 +1,7 @@
# 4.6.4
The v4.6.4 release fixes a feature selection issue when `renderMode: 'image'` is set on an `ol.layer.Vector`.
## Fixes
* [#7559](https://github.com/openlayers/openlayers/pull/7559) - Handle skipping and unskipping features with renderMode: 'image' ([@ahocevar](https://github.com/ahocevar))

View File

@@ -35,7 +35,7 @@ Interactions for [vector features](ol.Feature.html)
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#.transform) and [ol.proj.transformExtent()](ol.proj.html#.transformExtent).</p> <tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#.transform) and [ol.proj.transformExtent()](ol.proj.html#.transformExtent).</p>
[ol.proj](ol.proj.html)</td> [ol.proj](ol.proj.html)</td>
<td><p>Changes to all [ol.Objects](ol.Object.html) can be observed by calling the [object.on('propertychange')](ol.Object.html#on) method. Listeners receive an [ol.Object.Event](ol.Object.Event.html) with information on the changed property and old value.</p> <td><p>Changes to all [ol.Objects](ol.Object.html) can be observed by calling the [object.on('propertychange')](ol.Object.html#on) method. Listeners receive an [ol.Object.Event](ol.Object.Event.html) with information on the changed property and old value.</p>
<td>[ol.DeviceOrientation](ol.DeviceOrientation.html)<br> <td>
[ol.Geolocation](ol.Geolocation.html)<br> [ol.Geolocation](ol.Geolocation.html)<br>
[ol.Overlay](ol.Overlay.html)<br></td> [ol.Overlay](ol.Overlay.html)<br></td>
</tr></table> </tr></table>

261
dist/ol-debug.css vendored Normal file
View File

@@ -0,0 +1,261 @@
.ol-box {
box-sizing: border-box;
border-radius: 2px;
border: 2px solid blue;
}
.ol-mouse-position {
top: 8px;
right: 8px;
position: absolute;
}
.ol-scale-line {
background: rgba(0,60,136,0.3);
border-radius: 4px;
bottom: 8px;
left: 8px;
padding: 2px;
position: absolute;
}
.ol-scale-line-inner {
border: 1px solid #eee;
border-top: none;
color: #eee;
font-size: 10px;
text-align: center;
margin: 1px;
will-change: contents, width;
}
.ol-overlay-container {
will-change: left,right,top,bottom;
}
.ol-unsupported {
display: none;
}
.ol-viewport, .ol-unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.ol-selectable {
-webkit-touch-callout: default;
-webkit-user-select: auto;
-moz-user-select: auto;
-ms-user-select: auto;
user-select: auto;
}
.ol-grabbing {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
.ol-grab {
cursor: move;
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.ol-control {
position: absolute;
background-color: rgba(255,255,255,0.4);
border-radius: 4px;
padding: 2px;
}
.ol-control:hover {
background-color: rgba(255,255,255,0.6);
}
.ol-zoom {
top: .5em;
left: .5em;
}
.ol-rotate {
top: .5em;
right: .5em;
transition: opacity .25s linear, visibility 0s linear;
}
.ol-rotate.ol-hidden {
opacity: 0;
visibility: hidden;
transition: opacity .25s linear, visibility 0s linear .25s;
}
.ol-zoom-extent {
top: 4.643em;
left: .5em;
}
.ol-full-screen {
right: .5em;
top: .5em;
}
@media print {
.ol-control {
display: none;
}
}
.ol-control button {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 1.14em;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 1.375em;
width: 1.375em;
line-height: .4em;
background-color: rgba(0,60,136,0.5);
border: none;
border-radius: 2px;
}
.ol-control button::-moz-focus-inner {
border: none;
padding: 0;
}
.ol-zoom-extent button {
line-height: 1.4em;
}
.ol-compass {
display: block;
font-weight: normal;
font-size: 1.2em;
will-change: transform;
}
.ol-touch .ol-control button {
font-size: 1.5em;
}
.ol-touch .ol-zoom-extent {
top: 5.5em;
}
.ol-control button:hover,
.ol-control button:focus {
text-decoration: none;
background-color: rgba(0,60,136,0.7);
}
.ol-zoom .ol-zoom-in {
border-radius: 2px 2px 0 0;
}
.ol-zoom .ol-zoom-out {
border-radius: 0 0 2px 2px;
}
.ol-attribution {
text-align: right;
bottom: .5em;
right: .5em;
max-width: calc(100% - 1.3em);
}
.ol-attribution ul {
margin: 0;
padding: 0 .5em;
font-size: .7rem;
line-height: 1.375em;
color: #000;
text-shadow: 0 0 2px #fff;
}
.ol-attribution li {
display: inline;
list-style: none;
line-height: inherit;
}
.ol-attribution li:not(:last-child):after {
content: " ";
}
.ol-attribution img {
max-height: 2em;
max-width: inherit;
vertical-align: middle;
}
.ol-attribution ul, .ol-attribution button {
display: inline-block;
}
.ol-attribution.ol-collapsed ul {
display: none;
}
.ol-attribution.ol-logo-only ul {
display: block;
}
.ol-attribution:not(.ol-collapsed) {
background: rgba(255,255,255,0.8);
}
.ol-attribution.ol-uncollapsible {
bottom: 0;
right: 0;
border-radius: 4px 0 0;
height: 1.1em;
line-height: 1em;
}
.ol-attribution.ol-logo-only {
background: transparent;
bottom: .4em;
height: 1.1em;
line-height: 1em;
}
.ol-attribution.ol-uncollapsible img {
margin-top: -.2em;
max-height: 1.6em;
}
.ol-attribution.ol-logo-only button,
.ol-attribution.ol-uncollapsible button {
display: none;
}
.ol-zoomslider {
top: 4.5em;
left: .5em;
height: 200px;
}
.ol-zoomslider button {
position: relative;
height: 10px;
}
.ol-touch .ol-zoomslider {
top: 5.5em;
}
.ol-overviewmap {
left: 0.5em;
bottom: 0.5em;
}
.ol-overviewmap.ol-uncollapsible {
bottom: 0;
left: 0;
border-radius: 0 4px 0 0;
}
.ol-overviewmap .ol-overviewmap-map,
.ol-overviewmap button {
display: inline-block;
}
.ol-overviewmap .ol-overviewmap-map {
border: 1px solid #7b98bc;
height: 150px;
margin: 2px;
width: 150px;
}
.ol-overviewmap:not(.ol-collapsed) button{
bottom: 1px;
left: 2px;
position: absolute;
}
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
.ol-overviewmap.ol-uncollapsible button {
display: none;
}
.ol-overviewmap:not(.ol-collapsed) {
background: rgba(255,255,255,0.8);
}
.ol-overviewmap-box {
border: 2px dotted rgba(0,60,136,0.7);
}
.ol-overviewmap .ol-overviewmap-box:hover {
cursor: move;
}

96548
dist/ol-debug.js vendored Normal file

File diff suppressed because one or more lines are too long

261
dist/ol.css vendored Normal file
View File

@@ -0,0 +1,261 @@
.ol-box {
box-sizing: border-box;
border-radius: 2px;
border: 2px solid blue;
}
.ol-mouse-position {
top: 8px;
right: 8px;
position: absolute;
}
.ol-scale-line {
background: rgba(0,60,136,0.3);
border-radius: 4px;
bottom: 8px;
left: 8px;
padding: 2px;
position: absolute;
}
.ol-scale-line-inner {
border: 1px solid #eee;
border-top: none;
color: #eee;
font-size: 10px;
text-align: center;
margin: 1px;
will-change: contents, width;
}
.ol-overlay-container {
will-change: left,right,top,bottom;
}
.ol-unsupported {
display: none;
}
.ol-viewport, .ol-unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.ol-selectable {
-webkit-touch-callout: default;
-webkit-user-select: auto;
-moz-user-select: auto;
-ms-user-select: auto;
user-select: auto;
}
.ol-grabbing {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
.ol-grab {
cursor: move;
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.ol-control {
position: absolute;
background-color: rgba(255,255,255,0.4);
border-radius: 4px;
padding: 2px;
}
.ol-control:hover {
background-color: rgba(255,255,255,0.6);
}
.ol-zoom {
top: .5em;
left: .5em;
}
.ol-rotate {
top: .5em;
right: .5em;
transition: opacity .25s linear, visibility 0s linear;
}
.ol-rotate.ol-hidden {
opacity: 0;
visibility: hidden;
transition: opacity .25s linear, visibility 0s linear .25s;
}
.ol-zoom-extent {
top: 4.643em;
left: .5em;
}
.ol-full-screen {
right: .5em;
top: .5em;
}
@media print {
.ol-control {
display: none;
}
}
.ol-control button {
display: block;
margin: 1px;
padding: 0;
color: white;
font-size: 1.14em;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 1.375em;
width: 1.375em;
line-height: .4em;
background-color: rgba(0,60,136,0.5);
border: none;
border-radius: 2px;
}
.ol-control button::-moz-focus-inner {
border: none;
padding: 0;
}
.ol-zoom-extent button {
line-height: 1.4em;
}
.ol-compass {
display: block;
font-weight: normal;
font-size: 1.2em;
will-change: transform;
}
.ol-touch .ol-control button {
font-size: 1.5em;
}
.ol-touch .ol-zoom-extent {
top: 5.5em;
}
.ol-control button:hover,
.ol-control button:focus {
text-decoration: none;
background-color: rgba(0,60,136,0.7);
}
.ol-zoom .ol-zoom-in {
border-radius: 2px 2px 0 0;
}
.ol-zoom .ol-zoom-out {
border-radius: 0 0 2px 2px;
}
.ol-attribution {
text-align: right;
bottom: .5em;
right: .5em;
max-width: calc(100% - 1.3em);
}
.ol-attribution ul {
margin: 0;
padding: 0 .5em;
font-size: .7rem;
line-height: 1.375em;
color: #000;
text-shadow: 0 0 2px #fff;
}
.ol-attribution li {
display: inline;
list-style: none;
line-height: inherit;
}
.ol-attribution li:not(:last-child):after {
content: " ";
}
.ol-attribution img {
max-height: 2em;
max-width: inherit;
vertical-align: middle;
}
.ol-attribution ul, .ol-attribution button {
display: inline-block;
}
.ol-attribution.ol-collapsed ul {
display: none;
}
.ol-attribution.ol-logo-only ul {
display: block;
}
.ol-attribution:not(.ol-collapsed) {
background: rgba(255,255,255,0.8);
}
.ol-attribution.ol-uncollapsible {
bottom: 0;
right: 0;
border-radius: 4px 0 0;
height: 1.1em;
line-height: 1em;
}
.ol-attribution.ol-logo-only {
background: transparent;
bottom: .4em;
height: 1.1em;
line-height: 1em;
}
.ol-attribution.ol-uncollapsible img {
margin-top: -.2em;
max-height: 1.6em;
}
.ol-attribution.ol-logo-only button,
.ol-attribution.ol-uncollapsible button {
display: none;
}
.ol-zoomslider {
top: 4.5em;
left: .5em;
height: 200px;
}
.ol-zoomslider button {
position: relative;
height: 10px;
}
.ol-touch .ol-zoomslider {
top: 5.5em;
}
.ol-overviewmap {
left: 0.5em;
bottom: 0.5em;
}
.ol-overviewmap.ol-uncollapsible {
bottom: 0;
left: 0;
border-radius: 0 4px 0 0;
}
.ol-overviewmap .ol-overviewmap-map,
.ol-overviewmap button {
display: inline-block;
}
.ol-overviewmap .ol-overviewmap-map {
border: 1px solid #7b98bc;
height: 150px;
margin: 2px;
width: 150px;
}
.ol-overviewmap:not(.ol-collapsed) button{
bottom: 1px;
left: 2px;
position: absolute;
}
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
.ol-overviewmap.ol-uncollapsible button {
display: none;
}
.ol-overviewmap:not(.ol-collapsed) {
background: rgba(255,255,255,0.8);
}
.ol-overviewmap-box {
border: 2px dotted rgba(0,60,136,0.7);
}
.ol-overviewmap .ol-overviewmap-box:hover {
cursor: move;
}

1075
dist/ol.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -13,9 +13,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -22,9 +22,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: ol.proj.transform( center: ol.proj.transform(

View File

@@ -51,9 +51,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: view view: view
}); });

View File

@@ -102,7 +102,8 @@ function xyz2rgb(x) {
var raster = new ol.source.Raster({ var raster = new ol.source.Raster({
sources: [new ol.source.Stamen({ sources: [new ol.source.Stamen({
layer: 'watercolor' layer: 'watercolor',
transition: 0
})], })],
operation: function(pixels, data) { operation: function(pixels, data) {
var hcl = rgb2hcl(pixels[0]); var hcl = rgb2hcl(pixels[0]);

View File

@@ -59,9 +59,9 @@ ol.inherits(app.RotateNorthControl, ol.control.Control);
var map = new ol.Map({ var map = new ol.Map({
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}).extend([ }).extend([
new app.RotateNorthControl() new app.RotateNorthControl()
]), ]),

View File

@@ -92,8 +92,7 @@ app.Drag.prototype.handleDragEvent = function(evt) {
var deltaX = evt.coordinate[0] - this.coordinate_[0]; var deltaX = evt.coordinate[0] - this.coordinate_[0];
var deltaY = evt.coordinate[1] - this.coordinate_[1]; var deltaY = evt.coordinate[1] - this.coordinate_[1];
var geometry = /** @type {ol.geom.SimpleGeometry} */ var geometry = this.feature_.getGeometry();
(this.feature_.getGeometry());
geometry.translate(deltaX, deltaY); geometry.translate(deltaX, deltaY);
this.coordinate_[0] = evt.coordinate[0]; this.coordinate_[0] = evt.coordinate[0];

View File

@@ -22,9 +22,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: view view: view
}); });

View File

@@ -1,9 +1,9 @@
--- ---
layout: example.html layout: example.html
title: Drag-and-Drop Image Vector title: Drag-and-Drop Image Vector
shortdesc: Example of using the drag-and-drop interaction with a ol.source.ImageVector. shortdesc: Example of using the drag-and-drop interaction with image vector rendering.
docs: > 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. Example of using the drag-and-drop interaction with an `ol.layer.Vector` with `renderMode: 'image'``. 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" tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image"
cloak: cloak:
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here

View File

@@ -7,10 +7,9 @@ goog.require('ol.format.KML');
goog.require('ol.format.TopoJSON'); goog.require('ol.format.TopoJSON');
goog.require('ol.interaction'); goog.require('ol.interaction');
goog.require('ol.interaction.DragAndDrop'); goog.require('ol.interaction.DragAndDrop');
goog.require('ol.layer.Image'); goog.require('ol.layer.Vector');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.source.BingMaps'); goog.require('ol.source.BingMaps');
goog.require('ol.source.ImageVector');
goog.require('ol.source.Vector'); goog.require('ol.source.Vector');
goog.require('ol.style.Circle'); goog.require('ol.style.Circle');
goog.require('ol.style.Fill'); goog.require('ol.style.Fill');
@@ -115,11 +114,10 @@ dragAndDropInteraction.on('addfeatures', function(event) {
var vectorSource = new ol.source.Vector({ var vectorSource = new ol.source.Vector({
features: event.features features: event.features
}); });
map.addLayer(new ol.layer.Image({ map.addLayer(new ol.layer.Vector({
source: new ol.source.ImageVector({ renderMode: 'image',
source: vectorSource, source: vectorSource,
style: styleFunction style: styleFunction
})
})); }));
map.getView().fit(vectorSource.getExtent()); map.getView().fit(vectorSource.getExtent());
}); });

View File

@@ -54,7 +54,7 @@ var typeSelect = document.getElementById('type');
function addInteractions() { function addInteractions() {
draw = new ol.interaction.Draw({ draw = new ol.interaction.Draw({
source: source, source: source,
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value) type: typeSelect.value
}); });
map.addInteraction(draw); map.addInteraction(draw);
snap = new ol.interaction.Snap({source: source}); snap = new ol.interaction.Snap({source: source});

View File

@@ -33,7 +33,7 @@ function addInteraction() {
if (value !== 'None') { if (value !== 'None') {
draw = new ol.interaction.Draw({ draw = new ol.interaction.Draw({
source: source, source: source,
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value) type: typeSelect.value
}); });
map.addInteraction(draw); map.addInteraction(draw);
} }

View File

@@ -33,7 +33,7 @@ function addInteraction() {
if (value !== 'None') { if (value !== 'None') {
draw = new ol.interaction.Draw({ draw = new ol.interaction.Draw({
source: source, source: source,
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value), type: typeSelect.value,
freehand: true freehand: true
}); });
map.addInteraction(draw); map.addInteraction(draw);

View File

@@ -67,7 +67,7 @@ function addInteraction() {
} }
draw = new ol.interaction.Draw({ draw = new ol.interaction.Draw({
source: source, source: source,
type: /** @type {ol.geom.GeometryType} */ (value), type: value,
geometryFunction: geometryFunction geometryFunction: geometryFunction
}); });
map.addInteraction(draw); map.addInteraction(draw);

View File

@@ -23,9 +23,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -30,9 +30,9 @@ var map = new ol.Map({
layers: [raster, vector], layers: [raster, vector],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -24,9 +24,9 @@ var map = new ol.Map({
}) })
], ],
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
target: 'map', target: 'map',
view: new ol.View({ view: new ol.View({

View File

@@ -4,6 +4,9 @@
.map:-webkit-full-screen { .map:-webkit-full-screen {
height: 100%; height: 100%;
} }
.map:-ms-fullscreen {
height: 100%;
}
.map:fullscreen { .map:fullscreen {
height: 100%; height: 100%;
} }

View File

@@ -180,9 +180,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -23,9 +23,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: view view: view
}); });
@@ -46,14 +46,14 @@ var positions = new ol.geom.LineString([],
/** @type {ol.geom.GeometryLayout} */ ('XYZM')); /** @type {ol.geom.GeometryLayout} */ ('XYZM'));
// Geolocation Control // Geolocation Control
var geolocation = new ol.Geolocation(/** @type {olx.GeolocationOptions} */ ({ var geolocation = new ol.Geolocation({
projection: view.getProjection(), projection: view.getProjection(),
trackingOptions: { trackingOptions: {
maximumAge: 10000, maximumAge: 10000,
enableHighAccuracy: true, enableHighAccuracy: true,
timeout: 600000 timeout: 600000
} }
})); });
var deltaMean = 500; // the geolocation sampling period mean in ms var deltaMean = 500; // the geolocation sampling period mean in ms

View File

@@ -26,9 +26,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: view view: view
}); });

View File

@@ -7,8 +7,8 @@ docs: >
<p>Be sure to respect the <a href="https://legal.here.com/en/terms/serviceterms/us/">HERE Service Terms</a> when using their tile API.</p> <p>Be sure to respect the <a href="https://legal.here.com/en/terms/serviceterms/us/">HERE Service Terms</a> when using their tile API.</p>
tags: "here, here-maps, here-tile-api" tags: "here, here-maps, here-tile-api"
cloak: cloak:
a2qhegvZZFIuJDkkqjhQ: Your HERE Maps appId from https://developer.here.com/ kDm0Jq1K4Ak7Bwtn8uvk: Your HERE Maps appId from https://developer.here.com/
lPJ3iaFLJDhD8fIAyU582A: Your HERE Maps appCode from https://developer.here.com/ xnmvc4dKZrDfGlvQHXSvwQ: Your HERE Maps appCode from https://developer.here.com/
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
<select id="layer-select"> <select id="layer-select">

View File

@@ -3,8 +3,8 @@ goog.require('ol.View');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.source.XYZ'); goog.require('ol.source.XYZ');
var appId = 'a2qhegvZZFIuJDkkqjhQ'; var appId = 'kDm0Jq1K4Ak7Bwtn8uvk';
var appCode = 'lPJ3iaFLJDhD8fIAyU582A'; var appCode = 'xnmvc4dKZrDfGlvQHXSvwQ';
var hereLayers = [ var hereLayers = [
{ {
base: 'base', base: 'base',

View File

@@ -99,9 +99,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [703365.7089403362, 5714629.865071137], center: [703365.7089403362, 5714629.865071137],

View File

@@ -3,9 +3,7 @@ layout: example.html
title: Image Vector Layer title: Image Vector Layer
shortdesc: Example of an image vector layer. shortdesc: Example of an image vector layer.
docs: > docs: >
<p>This example uses a <code>ol.source.ImageVector</code> source. That source gets vector features from the <p>This example uses <code>ol.layer.Vector</code> with `renderMode: 'image'`. This mode results in faster rendering during interaction and animations, at the cost of less accurate rendering.</p>
<code>ol.source.Vector</code> it's configured with, and draw these features to an HTML5 canvas element that
is then used as the image of an image layer.</p>
tags: "vector, image" tags: "vector, image"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -1,38 +1,37 @@
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.format.GeoJSON'); goog.require('ol.format.GeoJSON');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector'); goog.require('ol.layer.Vector');
goog.require('ol.source.ImageVector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector'); goog.require('ol.source.Vector');
goog.require('ol.style.Fill'); goog.require('ol.style.Fill');
goog.require('ol.style.Stroke'); goog.require('ol.style.Stroke');
goog.require('ol.style.Style'); goog.require('ol.style.Style');
goog.require('ol.style.Text');
var style = new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.6)'
}),
stroke: new ol.style.Stroke({
color: '#319FD3',
width: 1
}),
text: new ol.style.Text()
});
var map = new ol.Map({ var map = new ol.Map({
layers: [ layers: [
new ol.layer.Tile({ new ol.layer.Vector({
source: new ol.source.OSM() renderMode: 'image',
}), source: new ol.source.Vector({
new ol.layer.Image({ url: 'data/geojson/countries.geojson',
source: new ol.source.ImageVector({ format: new ol.format.GeoJSON()
source: new ol.source.Vector({ }),
url: 'data/geojson/countries.geojson', style: function(feature) {
format: new ol.format.GeoJSON() style.getText().setText(feature.get('name'));
}), return style;
style: new ol.style.Style({ }
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.6)'
}),
stroke: new ol.style.Stroke({
color: '#319FD3',
width: 1
})
})
})
}) })
], ],
target: 'map', target: 'map',

View File

@@ -22,9 +22,9 @@ if (!ol.has.WEBGL) {
renderer: /** @type {Array<ol.renderer.Type>} */ (['webgl', 'canvas']), renderer: /** @type {Array<ol.renderer.Type>} */ (['webgl', 'canvas']),
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -12,9 +12,9 @@ var map = new ol.Map({
layers: [osm], layers: [osm],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -19,9 +19,9 @@ var map = new ol.Map({
layers: [osm, bing], layers: [osm, bing],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -62,5 +62,5 @@ var map = new ol.Map({
map.addInteraction(new ol.interaction.Draw({ map.addInteraction(new ol.interaction.Draw({
source: source, source: source,
type: /** @type {ol.geom.GeometryType} */ ('LineString') type: 'LineString'
})); }));

View File

@@ -35,9 +35,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
maxZoom: 18, maxZoom: 18,

View File

@@ -15,6 +15,7 @@ var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
var map = new ol.Map({ var map = new ol.Map({
layers: [ layers: [
new ol.layer.VectorTile({ new ol.layer.VectorTile({
declutter: true,
source: new ol.source.VectorTile({ source: new ol.source.VectorTile({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' + '© <a href="https://www.openstreetmap.org/copyright">' +

View File

@@ -3,9 +3,9 @@ goog.require('ol.View');
goog.require('ol.layer.Image'); goog.require('ol.layer.Image');
goog.require('ol.source.ImageMapGuide'); goog.require('ol.source.ImageMapGuide');
var mdf = 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition'; var mdf = 'Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition';
var agentUrl = var agentUrl =
'http://data.mapguide.com/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous'; 'http://www.buoyshark.com/mapguide/mapagent/mapagent.fcgi?';
var bounds = [ var bounds = [
-87.865114442365922, -87.865114442365922,
43.665065564837931, 43.665065564837931,
@@ -23,7 +23,9 @@ var map = new ol.Map({
metersPerUnit: 111319.4908, //value returned from mapguide metersPerUnit: 111319.4908, //value returned from mapguide
params: { params: {
MAPDEFINITION: mdf, MAPDEFINITION: mdf,
FORMAT: 'PNG' FORMAT: 'PNG',
USERNAME: 'OpenLayers',
PASSWORD: 'OpenLayers'
}, },
ratio: 2 ratio: 2
}) })

View File

@@ -179,7 +179,7 @@ function addInteraction() {
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString'); var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
draw = new ol.interaction.Draw({ draw = new ol.interaction.Draw({
source: source, source: source,
type: /** @type {ol.geom.GeometryType} */ (type), type: type,
style: new ol.style.Style({ style: new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)' color: 'rgba(255, 255, 255, 0.2)'

View File

@@ -27,9 +27,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [653600, 5723680], center: [653600, 5723680],

View File

@@ -18,9 +18,9 @@ var mousePositionControl = new ol.control.MousePosition({
var map = new ol.Map({ var map = new ol.Map({
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}).extend([mousePositionControl]), }).extend([mousePositionControl]),
layers: [ layers: [
new ol.layer.Tile({ new ol.layer.Tile({

View File

@@ -15,9 +15,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -8,9 +8,9 @@ goog.require('ol.source.OSM');
var map = new ol.Map({ var map = new ol.Map({
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}).extend([ }).extend([
new ol.control.ZoomToExtent({ new ol.control.ZoomToExtent({
extent: [ extent: [

View File

@@ -30,9 +30,9 @@ var map = new ol.Map({
}) })
], ],
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
target: 'map', target: 'map',
view: new ol.View({ view: new ol.View({

View File

@@ -18,13 +18,13 @@ var closer = document.getElementById('popup-closer');
/** /**
* Create an overlay to anchor the popup to the map. * Create an overlay to anchor the popup to the map.
*/ */
var overlay = new ol.Overlay(/** @type {olx.OverlayOptions} */ ({ var overlay = new ol.Overlay({
element: container, element: container,
autoPan: true, autoPan: true,
autoPanAnimation: { autoPanAnimation: {
duration: 250 duration: 250
} }
})); });
/** /**

View File

@@ -13,9 +13,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [14200000, 4130000], center: [14200000, 4130000],

View File

@@ -10,9 +10,9 @@ var scaleLineControl = new ol.control.ScaleLine();
var map = new ol.Map({ var map = new ol.Map({
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}).extend([ }).extend([
scaleLineControl scaleLineControl
]), ]),

View File

@@ -26,7 +26,8 @@ function flood(pixels, data) {
var key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg'; var key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
var elevation = new ol.source.XYZ({ var elevation = new ol.source.XYZ({
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key, url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
crossOrigin: 'anonymous' crossOrigin: 'anonymous',
transition: 0
}); });
var raster = new ol.source.Raster({ var raster = new ol.source.Raster({

View File

@@ -104,7 +104,8 @@ function shade(inputs, data) {
var elevation = new ol.source.XYZ({ var elevation = new ol.source.XYZ({
url: 'https://{a-d}.tiles.mapbox.com/v3/aj.sf-dem/{z}/{x}/{y}.png', url: 'https://{a-d}.tiles.mapbox.com/v3/aj.sf-dem/{z}/{x}/{y}.png',
crossOrigin: 'anonymous' crossOrigin: 'anonymous',
transition: 0
}); });
var raster = new ol.source.Raster({ var raster = new ol.source.Raster({

View File

@@ -86,19 +86,19 @@ var Draw = {
}, },
Point: new ol.interaction.Draw({ Point: new ol.interaction.Draw({
source: vector.getSource(), source: vector.getSource(),
type: /** @type {ol.geom.GeometryType} */ ('Point') type: 'Point'
}), }),
LineString: new ol.interaction.Draw({ LineString: new ol.interaction.Draw({
source: vector.getSource(), source: vector.getSource(),
type: /** @type {ol.geom.GeometryType} */ ('LineString') type: 'LineString'
}), }),
Polygon: new ol.interaction.Draw({ Polygon: new ol.interaction.Draw({
source: vector.getSource(), source: vector.getSource(),
type: /** @type {ol.geom.GeometryType} */ ('Polygon') type: 'Polygon'
}), }),
Circle: new ol.interaction.Draw({ Circle: new ol.interaction.Draw({
source: vector.getSource(), source: vector.getSource(),
type: /** @type {ol.geom.GeometryType} */ ('Circle') type: 'Circle'
}), }),
getActive: function() { getActive: function() {
return this.activeType ? this[this.activeType].getActive() : false; return this.activeType ? this[this.activeType].getActive() : false;

View File

@@ -28,6 +28,7 @@ var map = new ol.Map({
imagerySet: 'Aerial' imagerySet: 'Aerial'
}) })
}), new ol.layer.Vector({ }), new ol.layer.Vector({
declutter: true,
source: new ol.source.Vector({ source: new ol.source.Vector({
format: new ol.format.GeoJSON(), format: new ol.format.GeoJSON(),
url: 'data/geojson/vienna-streets.geojson' url: 'data/geojson/vienna-streets.geojson'

View File

@@ -12,9 +12,9 @@ var map = new ol.Map({
}) })
], ],
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],

View File

@@ -64,7 +64,7 @@ var raster = new ol.layer.Tile({
var draw = new ol.interaction.Draw({ var draw = new ol.interaction.Draw({
source: vectorSource, source: vectorSource,
type: /** @type {ol.geom.GeometryType} */ ('Polygon') type: 'Polygon'
}); });
var select = new ol.interaction.Select(); var select = new ol.interaction.Select();

View File

@@ -4,10 +4,8 @@ title: Vector Label Decluttering
shortdesc: Label decluttering with a custom renderer. shortdesc: Label decluttering with a custom renderer.
resources: resources:
- https://cdn.polyfill.io/v2/polyfill.min.js?features=Set" - https://cdn.polyfill.io/v2/polyfill.min.js?features=Set"
- https://unpkg.com/rbush@2.0.1/rbush.min.js
- https://unpkg.com/labelgun@0.1.1/lib/labelgun.min.js
docs: > docs: >
A custom `renderer` function is used instead of an `ol.style.Text` to label the countries of the world. Only texts that are not wider than their country's bounding box are considered and handed over to [Labelgun](https://github.com/Geovation/labelgun) for decluttering. Decluttering is used to avoid overlapping labels with `overflow: true` set on the text style. For MultiPolygon geometries, only the widest polygon is selected in a custom `geometry` function.
tags: "vector, renderer, labelgun, label" tags: "vector, decluttering, labels"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -1,5 +1,3 @@
// NOCOMPILE
/* global labelgun */
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.extent'); goog.require('ol.extent');
@@ -9,26 +7,7 @@ goog.require('ol.source.Vector');
goog.require('ol.style.Fill'); goog.require('ol.style.Fill');
goog.require('ol.style.Stroke'); goog.require('ol.style.Stroke');
goog.require('ol.style.Style'); goog.require('ol.style.Style');
goog.require('ol.style.Text');
// Style for labels
function setStyle(context) {
context.font = '12px Calibri,sans-serif';
context.fillStyle = '#000';
context.strokeStyle = '#fff';
context.lineWidth = 3;
context.textBaseline = 'hanging';
context.textAlign = 'start';
}
// A separate canvas context for measuring label width and height.
var textMeasureContext = document.createElement('CANVAS').getContext('2d');
setStyle(textMeasureContext);
// The label height is approximated by the width of the text 'WI'.
var height = textMeasureContext.measureText('WI').width;
// A cache for reusing label images once they have been created.
var textCache = {};
var map = new ol.Map({ var map = new ol.Map({
target: 'map', target: 'map',
@@ -38,30 +17,35 @@ var map = new ol.Map({
}) })
}); });
var emptyFn = function() {};
var labelEngine = new labelgun['default'](emptyFn, emptyFn);
function createLabel(canvas, text, coord) {
var halfWidth = canvas.width / 2;
var halfHeight = canvas.height / 2;
var bounds = {
bottomLeft: [Math.round(coord[0] - halfWidth), Math.round(coord[1] - halfHeight)],
topRight: [Math.round(coord[0] + halfWidth), Math.round(coord[1] + halfHeight)]
};
labelEngine.ingestLabel(bounds, coord.toString(), 1, canvas, text, false);
}
// For multi-polygons, we only label the widest polygon. This is done by sorting
// by extent width in descending order, and take the first from the array.
function sortByWidth(a, b) {
return ol.extent.getWidth(b.getExtent()) - ol.extent.getWidth(a.getExtent());
}
var labelStyle = new ol.style.Style({ var labelStyle = new ol.style.Style({
renderer: function(coords, state) { geometry: function(feature) {
var text = state.feature.get('name'); var geometry = feature.getGeometry();
createLabel(textCache[text], text, coords); if (geometry.getType() == 'MultiPolygon') {
} // Only render label for the widest polygon of a multipolygon
var polygons = geometry.getPolygons();
var widest = 0;
for (var i = 0, ii = polygons.length; i < ii; ++i) {
var polygon = polygons[i];
var width = ol.extent.getWidth(polygon.getExtent());
if (width > widest) {
widest = width;
geometry = polygon;
}
}
}
return geometry;
},
text: new ol.style.Text({
font: '12px Calibri,sans-serif',
overflow: true,
fill: new ol.style.Fill({
color: '#000'
}),
stroke: new ol.style.Stroke({
color: '#fff',
width: 3
})
})
}); });
var countryStyle = new ol.style.Style({ var countryStyle = new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
@@ -72,54 +56,18 @@ var countryStyle = new ol.style.Style({
width: 1 width: 1
}) })
}); });
var styleWithLabel = [countryStyle, labelStyle]; var style = [countryStyle, labelStyle];
var styleWithoutLabel = [countryStyle];
var pixelRatio; // This is set by the map's precompose listener
var vectorLayer = new ol.layer.Vector({ var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({ source: new ol.source.Vector({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new ol.format.GeoJSON() format: new ol.format.GeoJSON()
}), }),
style: function(feature, resolution) { style: function(feature) {
var text = feature.get('name'); labelStyle.getText().setText(feature.get('name'));
var width = textMeasureContext.measureText(text).width; return style;
var geometry = feature.getGeometry(); },
if (geometry.getType() == 'MultiPolygon') { declutter: true
geometry = geometry.getPolygons().sort(sortByWidth)[0];
}
var extentWidth = ol.extent.getWidth(geometry.getExtent());
if (extentWidth / resolution > width) {
// Only consider label when it fits its geometry's extent
if (!(text in textCache)) {
// Draw the label to its own canvas and cache it.
var canvas = textCache[text] = document.createElement('CANVAS');
canvas.width = width * pixelRatio;
canvas.height = height * pixelRatio;
var context = canvas.getContext('2d');
context.scale(pixelRatio, pixelRatio);
setStyle(context);
context.strokeText(text, 0, 0);
context.fillText(text, 0, 0);
}
labelStyle.setGeometry(geometry.getInteriorPoint());
return styleWithLabel;
} else {
return styleWithoutLabel;
}
}
});
vectorLayer.on('precompose', function(e) {
pixelRatio = e.frameState.pixelRatio;
labelEngine.destroy();
});
vectorLayer.on('postcompose', function(e) {
var labels = labelEngine.getShown();
for (var i = 0, ii = labels.length; i < ii; ++i) {
var label = labels[i];
// Draw label to the map canvas
e.context.drawImage(label.labelObject, label.minX, label.minY);
}
}); });
map.addLayer(vectorLayer); map.addLayer(vectorLayer);

View File

@@ -6,7 +6,8 @@ docs: >
This example showcases a number of options that can be set on text styles. This example showcases a number of options that can be set on text styles.
When "Text/Wrap" is chosen (for example for the line features), the label is When "Text/Wrap" is chosen (for example for the line features), the label is
wrapped by inserting the character `\n`, which will create a multi-line wrapped by inserting the character `\n`, which will create a multi-line
label. label. The "Open Sans" web font will be loaded on demand, to show dynamic font
loading.
tags: "geojson, vector, openstreetmap, label" tags: "geojson, vector, openstreetmap, label"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
@@ -69,8 +70,8 @@ tags: "geojson, vector, openstreetmap, label"
<label>Font: </label> <label>Font: </label>
<select id="points-font"> <select id="points-font">
<option value="Arial" selected="selected">Arial</option> <option value="Arial" selected="selected">Arial</option>
<option value="Courier New">Courier New</option> <option value="'Courier New'">Courier New</option>
<option value="Quattrocento Sans">Quattrocento</option> <option value="'Open Sans'">Open Sans</option>
<option value="Verdana">Verdana</option> <option value="Verdana">Verdana</option>
</select> </select>
<br /> <br />
@@ -94,7 +95,7 @@ tags: "geojson, vector, openstreetmap, label"
</select> </select>
<br /> <br />
<label>Exceed Len: </label> <label>Exceed Len: </label>
<select disabled id="points-exceedlength"> <select disabled id="points-overflow">
<option value="true">True</option> <option value="true">True</option>
<option value="false" selected="selected">False</option> <option value="false" selected="selected">False</option>
</select> </select>
@@ -178,8 +179,8 @@ tags: "geojson, vector, openstreetmap, label"
<label>Font: </label> <label>Font: </label>
<select id="lines-font"> <select id="lines-font">
<option value="Arial">Arial</option> <option value="Arial">Arial</option>
<option value="Courier New" selected="selected">Courier New</option> <option value="'Courier New'" selected="selected">Courier New</option>
<option value="Quattrocento Sans">Quattrocento</option> <option value="'Open Sans'">Open Sans</option>
<option value="Verdana">Verdana</option> <option value="Verdana">Verdana</option>
</select> </select>
<br /> <br />
@@ -203,7 +204,7 @@ tags: "geojson, vector, openstreetmap, label"
</select> </select>
<br /> <br />
<label>Exceed Len: </label> <label>Exceed Len: </label>
<select id="lines-exceedlength"> <select id="lines-overflow">
<option value="true">True</option> <option value="true">True</option>
<option value="false" selected="selected">False</option> <option value="false" selected="selected">False</option>
</select> </select>
@@ -287,8 +288,8 @@ tags: "geojson, vector, openstreetmap, label"
<label>Font: </label> <label>Font: </label>
<select id="polygons-font"> <select id="polygons-font">
<option value="Arial">Arial</option> <option value="Arial">Arial</option>
<option value="Courier New">Courier New</option> <option value="'Courier New'">Courier New</option>
<option value="Quattrocento Sans">Quattrocento</option> <option value="'Open Sans'">Open Sans</option>
<option value="Verdana" selected="selected">Verdana</option> <option value="Verdana" selected="selected">Verdana</option>
</select> </select>
<br /> <br />
@@ -312,7 +313,7 @@ tags: "geojson, vector, openstreetmap, label"
</select> </select>
<br /> <br />
<label>Exceed Len: </label> <label>Exceed Len: </label>
<select id="polygons-exceedlength"> <select id="polygons-overflow">
<option value="true">True</option> <option value="true">True</option>
<option value="false" selected="selected">False</option> <option value="false" selected="selected">False</option>
</select> </select>

View File

@@ -11,6 +11,7 @@ goog.require('ol.style.Stroke');
goog.require('ol.style.Style'); goog.require('ol.style.Style');
goog.require('ol.style.Text'); goog.require('ol.style.Text');
var openSansAdded = false;
var myDom = { var myDom = {
points: { points: {
@@ -37,7 +38,7 @@ var myDom = {
weight: document.getElementById('lines-weight'), weight: document.getElementById('lines-weight'),
placement: document.getElementById('lines-placement'), placement: document.getElementById('lines-placement'),
maxangle: document.getElementById('lines-maxangle'), maxangle: document.getElementById('lines-maxangle'),
exceedlength: document.getElementById('lines-exceedlength'), overflow: document.getElementById('lines-overflow'),
size: document.getElementById('lines-size'), size: document.getElementById('lines-size'),
offsetX: document.getElementById('lines-offset-x'), offsetX: document.getElementById('lines-offset-x'),
offsetY: document.getElementById('lines-offset-y'), offsetY: document.getElementById('lines-offset-y'),
@@ -55,7 +56,7 @@ var myDom = {
weight: document.getElementById('polygons-weight'), weight: document.getElementById('polygons-weight'),
placement: document.getElementById('polygons-placement'), placement: document.getElementById('polygons-placement'),
maxangle: document.getElementById('polygons-maxangle'), maxangle: document.getElementById('polygons-maxangle'),
exceedlength: document.getElementById('polygons-exceedlength'), overflow: document.getElementById('polygons-overflow'),
size: document.getElementById('polygons-size'), size: document.getElementById('polygons-size'),
offsetX: document.getElementById('polygons-offset-x'), offsetX: document.getElementById('polygons-offset-x'),
offsetY: document.getElementById('polygons-offset-y'), offsetY: document.getElementById('polygons-offset-y'),
@@ -77,7 +78,7 @@ var getText = function(feature, resolution, dom) {
text = ''; text = '';
} else if (type == 'shorten') { } else if (type == 'shorten') {
text = text.trunc(12); text = text.trunc(12);
} else if (type == 'wrap') { } else if (type == 'wrap' && dom.placement.value != 'line') {
text = stringDivider(text, 16, '\n'); text = stringDivider(text, 16, '\n');
} }
@@ -94,8 +95,15 @@ var createTextStyle = function(feature, resolution, dom) {
var weight = dom.weight.value; var weight = dom.weight.value;
var placement = dom.placement ? dom.placement.value : undefined; var placement = dom.placement ? dom.placement.value : undefined;
var maxAngle = dom.maxangle ? parseFloat(dom.maxangle.value) : undefined; var maxAngle = dom.maxangle ? parseFloat(dom.maxangle.value) : undefined;
var exceedLength = dom.exceedlength ? (dom.exceedlength.value == 'true') : undefined; var overflow = dom.overflow ? (dom.overflow.value == 'true') : undefined;
var rotation = parseFloat(dom.rotation.value); var rotation = parseFloat(dom.rotation.value);
if (dom.font.value == '\'Open Sans\'' && !openSansAdded) {
var openSans = document.createElement('link');
openSans.href = 'https://fonts.googleapis.com/css?family=Open+Sans';
openSans.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(openSans);
openSansAdded = true;
}
var font = weight + ' ' + size + ' ' + dom.font.value; var font = weight + ' ' + size + ' ' + dom.font.value;
var fillColor = dom.color.value; var fillColor = dom.color.value;
var outlineColor = dom.outline.value; var outlineColor = dom.outline.value;
@@ -112,7 +120,7 @@ var createTextStyle = function(feature, resolution, dom) {
offsetY: offsetY, offsetY: offsetY,
placement: placement, placement: placement,
maxAngle: maxAngle, maxAngle: maxAngle,
exceedLength: exceedLength, overflow: overflow,
rotation: rotation rotation: rotation
}); });
}; };

View File

@@ -127,9 +127,9 @@ map = new ol.Map({
layers: [raster, vector], layers: [raster, vector],
target: document.getElementById('map'), target: document.getElementById('map'),
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [739218, 5906096], center: [739218, 5906096],

View File

@@ -0,0 +1,16 @@
#map {
position: relative;
}
#info {
z-index: 1;
opacity: 0;
position: absolute;
bottom: 0;
left: 0;
margin: 0;
background: rgba(0,60,136,0.7);
color: white;
border: 0;
transition: opacity 100ms ease-in;
}

View File

@@ -0,0 +1,11 @@
---
layout: example.html
title: Vector Tile Info
shortdesc: Getting feature information from vector tiles.
docs: >
<p>Move your pointer over rendered features to display feature properties.</p>
tags: "vector tiles"
---
<div id="map" class="map">
<pre id="info"/>
</div>

View File

@@ -0,0 +1,34 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.MVT');
goog.require('ol.layer.VectorTile');
goog.require('ol.source.VectorTile');
var map = new ol.Map({
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
}),
layers: [new ol.layer.VectorTile({
source: new ol.source.VectorTile({
format: new ol.format.MVT(),
url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf'
})
})]
});
map.on('pointermove', showInfo);
var info = document.getElementById('info');
function showInfo(event) {
var features = map.getFeaturesAtPixel(event.pixel);
if (!features) {
info.innerText = '';
info.style.opacity = 0;
return;
}
var properties = features[0].getProperties();
info.innerText = JSON.stringify(properties, null, 2);
info.style.opacity = 1;
}

View File

@@ -41,7 +41,7 @@ var layers = [
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'FORMAT': 'image/jpeg' 'FORMAT': 'image/jpeg'
}, },
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver') serverType: 'mapserver'
}) })
}), }),
new ol.layer.Image({ new ol.layer.Image({
@@ -52,7 +52,7 @@ var layers = [
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' + attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
'en/home.html">National parks / geo.admin.ch</a>', 'en/home.html">National parks / geo.admin.ch</a>',
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
serverType: /** @type {ol.source.WMSServerType} */ ('mapserver') serverType: 'mapserver'
}) })
}) })
]; ];

View File

@@ -14,7 +14,9 @@ var layers = [
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'topp:states', 'TILED': true}, params: {'LAYERS': 'topp:states', 'TILED': true},
serverType: 'geoserver' serverType: 'geoserver',
// Countries have transparency, so do not fade tiles:
transition: 0
}) })
}) })
]; ];

View File

@@ -23,11 +23,11 @@ var layers = [
}), }),
new ol.layer.Tile({ new ol.layer.Tile({
extent: extent, extent: extent,
source: new ol.source.TileWMS(/** @type {olx.source.TileWMSOptions} */ ({ source: new ol.source.TileWMS({
attributions: ['Iowa State University'], attributions: ['Iowa State University'],
url: 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi', url: 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi',
params: {'LAYERS': 'nexrad-n0r-wmst'} params: {'LAYERS': 'nexrad-n0r-wmst'}
})) })
}) })
]; ];
var map = new ol.Map({ var map = new ol.Map({

View File

@@ -1,4 +1,3 @@
goog.require('ol.Attribution');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.control'); goog.require('ol.control');
@@ -12,9 +11,9 @@ goog.require('ol.tilegrid.WMTS');
var map = new ol.Map({ var map = new ol.Map({
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
zoom: 5, zoom: 5,
@@ -50,11 +49,9 @@ var ign_source = new ol.source.WMTS({
projection: 'EPSG:3857', projection: 'EPSG:3857',
tileGrid: tileGrid, tileGrid: tileGrid,
style: 'normal', style: 'normal',
attributions: [new ol.Attribution({ attributions: '<a href="http://www.geoportail.fr/" target="_blank">' +
html: '<a href="http://www.geoportail.fr/" target="_blank">' +
'<img src="https://api.ign.fr/geoportail/api/js/latest/' + '<img src="https://api.ign.fr/geoportail/api/js/latest/' +
'theme/geoportal/img/logo_gp.gif"></a>' 'theme/geoportal/img/logo_gp.gif"></a>'
})]
}); });
var ign = new ol.layer.Tile({ var ign = new ol.layer.Tile({

View File

@@ -49,9 +49,9 @@ var map = new ol.Map({
], ],
target: 'map', target: 'map',
controls: ol.control.defaults({ controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({ attributionOptions: {
collapsible: false collapsible: false
}) }
}), }),
view: new ol.View({ view: new ol.View({
center: [-11158582, 4813697], center: [-11158582, 4813697],

View File

@@ -1,14 +1,9 @@
goog.require('ol.Attribution');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.source.XYZ'); goog.require('ol.source.XYZ');
var attribution = new ol.Attribution({
html: 'Copyright:© 2013 ESRI, i-cubed, GeoEye'
});
var projection = ol.proj.get('EPSG:4326'); var projection = ol.proj.get('EPSG:4326');
// The tile size supported by the ArcGIS tile service. // The tile size supported by the ArcGIS tile service.
@@ -22,7 +17,7 @@ var map = new ol.Map({
layers: [ layers: [
new ol.layer.Tile({ new ol.layer.Tile({
source: new ol.source.XYZ({ source: new ol.source.XYZ({
attributions: [attribution], attributions: 'Copyright:© 2013 ESRI, i-cubed, GeoEye',
maxZoom: 16, maxZoom: 16,
projection: projection, projection: projection,
tileSize: tileSize, tileSize: tileSize,

View File

@@ -1,4 +1,3 @@
goog.require('ol.Attribution');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
@@ -6,17 +5,13 @@ goog.require('ol.proj');
goog.require('ol.source.XYZ'); goog.require('ol.source.XYZ');
var attribution = new ol.Attribution({
html: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
});
var map = new ol.Map({ var map = new ol.Map({
target: 'map', target: 'map',
layers: [ layers: [
new ol.layer.Tile({ new ol.layer.Tile({
source: new ol.source.XYZ({ source: new ol.source.XYZ({
attributions: [attribution], attributions: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' + url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' +
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}' 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
}) })

View File

@@ -46,33 +46,11 @@ GeoJSONCRS.prototype.type;
/** /**
* TODO: remove GeoJSONCRSCode when http://jira.codehaus.org/browse/GEOS-5996 * @type {!GeoJSONCRSName|!GeoJSONLink}
* is fixed and widely deployed.
* @type {!GeoJSONCRSCode|!GeoJSONCRSName|!GeoJSONLink}
*/ */
GeoJSONCRS.prototype.properties; GeoJSONCRS.prototype.properties;
/**
* `GeoJSONCRSCode` is not part of the GeoJSON specification, but is generated
* by GeoServer.
* TODO: remove GeoJSONCRSCode when http://jira.codehaus.org/browse/GEOS-5996
* is fixed and widely deployed.
* @constructor
*/
var GeoJSONCRSCode = function() {};
/**
* TODO: remove this when http://jira.codehaus.org/browse/GEOS-5996 is fixed
* and widely deployed.
* @type {string}
*/
GeoJSONCRSCode.prototype.code;
/** /**
* @constructor * @constructor
*/ */
@@ -140,6 +118,11 @@ GeoJSONFeature.prototype.id;
GeoJSONFeature.prototype.properties; GeoJSONFeature.prototype.properties;
/**
* @type {string|undefined}
*/
GeoJSONFeature.prototype.geometry_name;
/** /**
* @constructor * @constructor

View File

@@ -273,9 +273,10 @@ olx.interaction.InteractionOptions;
/** /**
* Method called by the map to notify the interaction that a browser event was * Method called by the map to notify the interaction that a browser event was
* dispatched to the map. The function may return `false` to prevent the * dispatched to the map. If the function returns a falsy value,
* propagation of the event to other interactions in the map's interactions * propagation of the event to other interactions in the map's interactions
* chain. * chain will be prevented (this includes functions with no explicit return). See
* {@link https://developer.mozilla.org/en-US/docs/Glossary/Falsy}
* @type {function(ol.MapBrowserEvent):boolean} * @type {function(ol.MapBrowserEvent):boolean}
* @api * @api
*/ */
@@ -521,7 +522,8 @@ olx.AtPixelOptions.prototype.hitTolerance;
* insertFirst: (boolean|undefined), * insertFirst: (boolean|undefined),
* autoPan: (boolean|undefined), * autoPan: (boolean|undefined),
* autoPanAnimation: (olx.OverlayPanOptions|undefined), * autoPanAnimation: (olx.OverlayPanOptions|undefined),
* autoPanMargin: (number|undefined)}} * autoPanMargin: (number|undefined),
* className: (string|undefined)}}
*/ */
olx.OverlayOptions; olx.OverlayOptions;
@@ -623,6 +625,12 @@ olx.OverlayOptions.prototype.autoPanAnimation;
*/ */
olx.OverlayOptions.prototype.autoPanMargin; olx.OverlayOptions.prototype.autoPanMargin;
/**
* CSS class name. Default is `ol-overlay-container ol-selectable`.
* @type {string|undefined}
* @api
*/
olx.OverlayOptions.prototype.className;
/** /**
* @typedef {{ * @typedef {{
@@ -1174,7 +1182,7 @@ olx.control;
* label: (string|Node|undefined), * label: (string|Node|undefined),
* collapseLabel: (string|Node|undefined), * collapseLabel: (string|Node|undefined),
* render: (function(ol.MapEvent)|undefined), * render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined)}} * target: (Element|string|undefined)}}
*/ */
olx.control.AttributionOptions; olx.control.AttributionOptions;
@@ -1188,8 +1196,9 @@ olx.control.AttributionOptions.prototype.className;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.AttributionOptions.prototype.target; olx.control.AttributionOptions.prototype.target;
@@ -1349,7 +1358,7 @@ olx.control.DefaultsOptions.prototype.zoomOptions;
* labelActive: (string|Node|undefined), * labelActive: (string|Node|undefined),
* tipLabel: (string|undefined), * tipLabel: (string|undefined),
* keys: (boolean|undefined), * keys: (boolean|undefined),
* target: (Element|undefined), * target: (Element|string|undefined),
* source: (Element|string|undefined)}} * source: (Element|string|undefined)}}
*/ */
olx.control.FullScreenOptions; olx.control.FullScreenOptions;
@@ -1399,8 +1408,9 @@ olx.control.FullScreenOptions.prototype.keys;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.FullScreenOptions.prototype.target; olx.control.FullScreenOptions.prototype.target;
@@ -1417,7 +1427,7 @@ olx.control.FullScreenOptions.prototype.source;
* coordinateFormat: (ol.CoordinateFormatType|undefined), * coordinateFormat: (ol.CoordinateFormatType|undefined),
* projection: ol.ProjectionLike, * projection: ol.ProjectionLike,
* render: (function(ol.MapEvent)|undefined), * render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined), * target: (Element|string|undefined),
* undefinedHTML: (string|undefined)}} * undefinedHTML: (string|undefined)}}
*/ */
olx.control.MousePositionOptions; olx.control.MousePositionOptions;
@@ -1457,8 +1467,9 @@ olx.control.MousePositionOptions.prototype.render;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.MousePositionOptions.prototype.target; olx.control.MousePositionOptions.prototype.target;
@@ -1479,7 +1490,7 @@ olx.control.MousePositionOptions.prototype.undefinedHTML;
* label: (string|Node|undefined), * label: (string|Node|undefined),
* layers: (Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined), * layers: (Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined),
* render: (function(ol.MapEvent)|undefined), * render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined), * target: (Element|string|undefined),
* tipLabel: (string|undefined), * tipLabel: (string|undefined),
* view: (ol.View|undefined)}} * view: (ol.View|undefined)}}
*/ */
@@ -1542,7 +1553,7 @@ olx.control.OverviewMapOptions.prototype.render;
/** /**
* Specify a target if you want the control to be rendered outside of the map's * Specify a target if you want the control to be rendered outside of the map's
* viewport. * viewport.
* @type {Element|undefined} * @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.OverviewMapOptions.prototype.target; olx.control.OverviewMapOptions.prototype.target;
@@ -1569,7 +1580,7 @@ olx.control.OverviewMapOptions.prototype.view;
* @typedef {{className: (string|undefined), * @typedef {{className: (string|undefined),
* minWidth: (number|undefined), * minWidth: (number|undefined),
* render: (function(ol.MapEvent)|undefined), * render: (function(ol.MapEvent)|undefined),
* target: (Element|undefined), * target: (Element|string|undefined),
* units: (ol.control.ScaleLineUnits|string|undefined)}} * units: (ol.control.ScaleLineUnits|string|undefined)}}
*/ */
olx.control.ScaleLineOptions; olx.control.ScaleLineOptions;
@@ -1601,8 +1612,9 @@ olx.control.ScaleLineOptions.prototype.render;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.ScaleLineOptions.prototype.target; olx.control.ScaleLineOptions.prototype.target;
@@ -1621,7 +1633,7 @@ olx.control.ScaleLineOptions.prototype.units;
* className: (string|undefined), * className: (string|undefined),
* label: (string|Element|undefined), * label: (string|Element|undefined),
* tipLabel: (string|undefined), * tipLabel: (string|undefined),
* target: (Element|undefined), * target: (Element|string|undefined),
* render: (function(ol.MapEvent)|undefined), * render: (function(ol.MapEvent)|undefined),
* resetNorth: (function()|undefined), * resetNorth: (function()|undefined),
* autoHide: (boolean|undefined)}} * autoHide: (boolean|undefined)}}
@@ -1689,8 +1701,9 @@ olx.control.RotateOptions.prototype.resetNorth;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.RotateOptions.prototype.target; olx.control.RotateOptions.prototype.target;
@@ -1704,7 +1717,7 @@ olx.control.RotateOptions.prototype.target;
* zoomInTipLabel: (string|undefined), * zoomInTipLabel: (string|undefined),
* zoomOutTipLabel: (string|undefined), * zoomOutTipLabel: (string|undefined),
* delta: (number|undefined), * delta: (number|undefined),
* target: (Element|undefined)}} * target: (Element|string|undefined)}}
*/ */
olx.control.ZoomOptions; olx.control.ZoomOptions;
@@ -1768,8 +1781,9 @@ olx.control.ZoomOptions.prototype.delta;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.ZoomOptions.prototype.target; olx.control.ZoomOptions.prototype.target;
@@ -1828,7 +1842,7 @@ olx.control.ZoomSliderOptions.prototype.render;
/** /**
* @typedef {{className: (string|undefined), * @typedef {{className: (string|undefined),
* target: (Element|undefined), * target: (Element|string|undefined),
* label: (string|Node|undefined), * label: (string|Node|undefined),
* tipLabel: (string|undefined), * tipLabel: (string|undefined),
* extent: (ol.Extent|undefined)}} * extent: (ol.Extent|undefined)}}
@@ -1845,8 +1859,9 @@ olx.control.ZoomToExtentOptions.prototype.className;
/** /**
* Target. * Specify a target if you want the control to be rendered outside of the map's
* @type {Element|undefined} * viewport.
* @type {Element|string|undefined}
* @api * @api
*/ */
olx.control.ZoomToExtentOptions.prototype.target; olx.control.ZoomToExtentOptions.prototype.target;
@@ -1987,6 +2002,7 @@ olx.format.WriteOptions.prototype.decimals;
/** /**
* @typedef {{defaultDataProjection: ol.ProjectionLike, * @typedef {{defaultDataProjection: ol.ProjectionLike,
* geometryName: (string|undefined), * geometryName: (string|undefined),
* extractGeometryName: (boolean|undefined),
* featureProjection: ol.ProjectionLike}} * featureProjection: ol.ProjectionLike}}
*/ */
olx.format.GeoJSONOptions; olx.format.GeoJSONOptions;
@@ -2017,6 +2033,18 @@ olx.format.GeoJSONOptions.prototype.featureProjection;
olx.format.GeoJSONOptions.prototype.geometryName; olx.format.GeoJSONOptions.prototype.geometryName;
/**
* Certain GeoJSON providers include the geometry_name field in the feature
* geoJSON. If set to `true` the geoJSON reader will look for that field to
* set the geometry name. If both this field is set to `true` and a
* `geometryName` is provided, the `geometryName` will take precedence.
* Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.format.GeoJSONOptions.prototype.extractGeometryName;
/** /**
* @typedef {{geometryName: (string|undefined)}} * @typedef {{geometryName: (string|undefined)}}
*/ */
@@ -2975,8 +3003,10 @@ olx.interaction.DragZoomOptions.prototype.out;
* @typedef {{clickTolerance: (number|undefined), * @typedef {{clickTolerance: (number|undefined),
* features: (ol.Collection.<ol.Feature>|undefined), * features: (ol.Collection.<ol.Feature>|undefined),
* source: (ol.source.Vector|undefined), * source: (ol.source.Vector|undefined),
* dragVertexDelay: (number|undefined),
* snapTolerance: (number|undefined), * snapTolerance: (number|undefined),
* type: ol.geom.GeometryType, * type: (ol.geom.GeometryType|string),
* stopClick: (boolean|undefined),
* maxPoints: (number|undefined), * maxPoints: (number|undefined),
* minPoints: (number|undefined), * minPoints: (number|undefined),
* finishCondition: (ol.EventsConditionType|undefined), * finishCondition: (ol.EventsConditionType|undefined),
@@ -3019,6 +3049,14 @@ olx.interaction.DrawOptions.prototype.features;
olx.interaction.DrawOptions.prototype.source; olx.interaction.DrawOptions.prototype.source;
/**
* Delay in milliseconds after pointerdown before the current vertex can be
* dragged to its exact position. Default is 500 ms.
* @type {number|undefined}
*/
olx.interaction.DrawOptions.prototype.dragVertexDelay;
/** /**
* Pixel distance for snapping to the drawing finish. Default is `12`. * Pixel distance for snapping to the drawing finish. Default is `12`.
* @type {number|undefined} * @type {number|undefined}
@@ -3030,12 +3068,21 @@ olx.interaction.DrawOptions.prototype.snapTolerance;
/** /**
* Drawing type ('Point', 'LineString', 'Polygon', 'MultiPoint', * Drawing type ('Point', 'LineString', 'Polygon', 'MultiPoint',
* 'MultiLineString', 'MultiPolygon' or 'Circle'). * 'MultiLineString', 'MultiPolygon' or 'Circle').
* @type {ol.geom.GeometryType} * @type {ol.geom.GeometryType|string}
* @api * @api
*/ */
olx.interaction.DrawOptions.prototype.type; olx.interaction.DrawOptions.prototype.type;
/**
* Stop click, singleclick, and doubleclick events from firing during drawing.
* Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.interaction.DrawOptions.prototype.stopClick;
/** /**
* The number of points that can be drawn before a polygon ring or line string * The number of points that can be drawn before a polygon ring or line string
* is finished. The default is no restriction. * is finished. The default is no restriction.
@@ -3131,6 +3178,7 @@ olx.interaction.DrawOptions.prototype.wrapX;
/** /**
* @typedef {{extent: (ol.Extent|undefined), * @typedef {{extent: (ol.Extent|undefined),
* boxStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * boxStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* pixelTolerance: (number|undefined),
* pointerStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * pointerStyle: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* wrapX: (boolean|undefined)}} * wrapX: (boolean|undefined)}}
* @api * @api
@@ -3152,6 +3200,14 @@ olx.interaction.ExtentOptions.prototype.extent;
*/ */
olx.interaction.ExtentOptions.prototype.boxStyle; olx.interaction.ExtentOptions.prototype.boxStyle;
/**
* Pixel tolerance for considering the pointer close enough to a segment or
* vertex for editing. Default is `10`.
* @type {number|undefined}
* @api
*/
olx.interaction.ExtentOptions.prototype.pixelTolerance;
/** /**
* Style for the cursor used to draw the extent. * Style for the cursor used to draw the extent.
* Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POINT] * Defaults to ol.style.Style.createDefaultEditing()[ol.geom.GeometryType.POINT]
@@ -4225,8 +4281,10 @@ olx.layer.TileOptions.prototype.zIndex;
* maxResolution: (number|undefined), * maxResolution: (number|undefined),
* opacity: (number|undefined), * opacity: (number|undefined),
* renderBuffer: (number|undefined), * renderBuffer: (number|undefined),
* renderMode: (ol.layer.VectorRenderType|string|undefined),
* source: (ol.source.Vector|undefined), * source: (ol.source.Vector|undefined),
* map: (ol.PluggableMap|undefined), * map: (ol.PluggableMap|undefined),
* declutter: (boolean|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* updateWhileAnimating: (boolean|undefined), * updateWhileAnimating: (boolean|undefined),
* updateWhileInteracting: (boolean|undefined), * updateWhileInteracting: (boolean|undefined),
@@ -4236,6 +4294,20 @@ olx.layer.TileOptions.prototype.zIndex;
olx.layer.VectorOptions; olx.layer.VectorOptions;
/**
* Render mode for vector layers:
* * `'image'`: Vector layers are rendered as images. Great performance, but
* point symbols and texts are always rotated with the view and pixels are
* scaled during zoom animations.
* * `'vector'`: Vector layers are rendered as vectors. Most accurate rendering
* even during animations, but slower performance.
* Default is `vector`.
* @type {ol.layer.VectorRenderType|string|undefined}
* @api
*/
olx.layer.VectorOptions.prototype.renderMode;
/** /**
* Render order. Function to be used when sorting features before rendering. By * Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created. Use `null` to * default features are drawn in the order that they are created. Use `null` to
@@ -4309,6 +4381,16 @@ olx.layer.VectorOptions.prototype.renderBuffer;
olx.layer.VectorOptions.prototype.source; olx.layer.VectorOptions.prototype.source;
/**
* Declutter images and text. Decluttering is applied to all image and text
* styles, and the priority is defined by the z-index of the style. Lower
* z-index means higher priority. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.layer.VectorOptions.prototype.declutter;
/** /**
* Layer style. See {@link ol.style} for default style which will be used if * Layer style. See {@link ol.style} for default style which will be used if
* this is not defined. * this is not defined.
@@ -4366,6 +4448,7 @@ olx.layer.VectorOptions.prototype.zIndex;
* renderMode: (ol.layer.VectorTileRenderType|string|undefined), * renderMode: (ol.layer.VectorTileRenderType|string|undefined),
* renderOrder: (ol.RenderOrderFunction|undefined), * renderOrder: (ol.RenderOrderFunction|undefined),
* source: (ol.source.VectorTile|undefined), * source: (ol.source.VectorTile|undefined),
* declutter: (boolean|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* updateWhileAnimating: (boolean|undefined), * updateWhileAnimating: (boolean|undefined),
* updateWhileInteracting: (boolean|undefined), * updateWhileInteracting: (boolean|undefined),
@@ -4399,12 +4482,14 @@ olx.layer.VectorTileOptions.prototype.renderBuffer;
* * `'vector'`: Vector tiles are rendered as vectors. Most accurate rendering * * `'vector'`: Vector tiles are rendered as vectors. Most accurate rendering
* even during animations, but slower performance than the other options. * even during animations, but slower performance than the other options.
* *
* The default is `'hybrid'`. * When `declutter` is set to `true`, `'hybrid'` will be used instead of
* `'image'`. The default is `'hybrid'`.
* @type {ol.layer.VectorTileRenderType|string|undefined} * @type {ol.layer.VectorTileRenderType|string|undefined}
* @api * @api
*/ */
olx.layer.VectorTileOptions.prototype.renderMode; olx.layer.VectorTileOptions.prototype.renderMode;
/** /**
* Render order. Function to be used when sorting features before rendering. By * Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created. * default features are drawn in the order that they are created.
@@ -4475,6 +4560,17 @@ olx.layer.VectorTileOptions.prototype.preload;
olx.layer.VectorTileOptions.prototype.source; olx.layer.VectorTileOptions.prototype.source;
/**
* Declutter images and text. Decluttering is applied to all image and text
* styles, and the priority is defined by the z-index of the style. Lower
* z-index means higher priority. When set to `true`, a `renderMode` of
* `'image'` will be overridden with `'hybrid'`. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.layer.VectorTileOptions.prototype.declutter;
/** /**
* Layer style. See {@link ol.style} for default style which will be used if * Layer style. See {@link ol.style} for default style which will be used if
* this is not defined. * this is not defined.
@@ -4518,7 +4614,7 @@ olx.layer.VectorTileOptions.prototype.visible;
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */
olx.layer.VectorOptions.prototype.zIndex; olx.layer.VectorTileOptions.prototype.zIndex;
/** /**
@@ -5487,7 +5583,7 @@ olx.source.OSMOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined), * @typedef {{attributions: (ol.AttributionLike|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
* hidpi: (boolean|undefined), * hidpi: (boolean|undefined),
* logo: (string|olx.LogoOptions|undefined), * logo: (string|olx.LogoOptions|undefined),
@@ -5503,7 +5599,7 @@ olx.source.ImageArcGISRestOptions;
/** /**
* Attributions. * Attributions.
* @type {Array.<ol.Attribution>|undefined} * @type {ol.AttributionLike|undefined}
* @api * @api
*/ */
olx.source.ImageArcGISRestOptions.prototype.attributions; olx.source.ImageArcGISRestOptions.prototype.attributions;
@@ -6597,6 +6693,37 @@ olx.source.VectorOptions.prototype.format;
* The loader function used to load features, from a remote source for example. * The loader function used to load features, from a remote source for example.
* If this is not set and `url` is set, the source will create and use an XHR * If this is not set and `url` is set, the source will create and use an XHR
* feature loader. * feature loader.
*
* Example:
*
* ```js
* var vectorSource = new ol.source.Vector({
* format: new ol.format.GeoJSON(),
* loader: function(extent, resolution, projection) {
* var proj = projection.getCode();
* var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
* 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
* 'outputFormat=application/json&srsname=' + proj + '&' +
* 'bbox=' + extent.join(',') + ',' + proj;
* var xhr = new XMLHttpRequest();
* xhr.open('GET', url);
* var onError = function() {
* vectorSource.removeLoadedExtent(extent);
* }
* xhr.onerror = onError;
* xhr.onload = function() {
* if (xhr.status == 200) {
* vectorSource.addFeatures(
* vectorSource.getFormat().readFeatures(xhr.responseText));
* } else {
* onError();
* }
* }
* xhr.send();
* },
* strategy: ol.loadingstrategy.bbox
* });
* ```
* @type {ol.FeatureLoader|undefined} * @type {ol.FeatureLoader|undefined}
* @api * @api
*/ */
@@ -7210,7 +7337,9 @@ olx.source.CartoDBOptions.prototype.account;
* url: !string, * url: !string,
* tierSizeCalculation: (string|undefined), * tierSizeCalculation: (string|undefined),
* size: ol.Size, * size: ol.Size,
* transition: (number|undefined)}} * extent: (ol.Extent|undefined),
* transition: (number|undefined),
* tileSize: (number|undefined)}}
*/ */
olx.source.ZoomifyOptions; olx.source.ZoomifyOptions;
@@ -7301,6 +7430,17 @@ olx.source.ZoomifyOptions.prototype.tierSizeCalculation;
olx.source.ZoomifyOptions.prototype.size; olx.source.ZoomifyOptions.prototype.size;
/**
* Extent for the TileGrid that is created. Default sets the TileGrid in the
* fourth quadrant, meaning extent is `[0, -height, width, 0]`. To change the
* extent to the first quadrant (the default for OpenLayers 2) set the extent
* as `[0, 0, width, height]`.
* @type {ol.Extent|undefined}
* @api
*/
olx.source.ZoomifyOptions.prototype.extent;
/** /**
* Duration of the opacity transition for rendering. To disable the opacity * Duration of the opacity transition for rendering. To disable the opacity
* transition, pass `transition: 0`. * transition, pass `transition: 0`.
@@ -7310,6 +7450,15 @@ olx.source.ZoomifyOptions.prototype.size;
olx.source.ZoomifyOptions.prototype.transition; olx.source.ZoomifyOptions.prototype.transition;
/**
* Tile size. Same tile size is used for all zoom levels. Default value is
* `OpenLayers.DEFAULT_TILE_SIZE`.
* @type {number|undefined}
* @api
*/
olx.source.ZoomifyOptions.prototype.tileSize;
/** /**
* Namespace. * Namespace.
* @type {Object} * @type {Object}
@@ -7770,6 +7919,7 @@ olx.style.StrokeOptions.prototype.width;
* maxAngle: (number|undefined), * maxAngle: (number|undefined),
* offsetX: (number|undefined), * offsetX: (number|undefined),
* offsetY: (number|undefined), * offsetY: (number|undefined),
* overflow: (boolean|undefined),
* placement: (ol.style.TextPlacement|string|undefined), * placement: (ol.style.TextPlacement|string|undefined),
* scale: (number|undefined), * scale: (number|undefined),
* rotateWithView: (boolean|undefined), * rotateWithView: (boolean|undefined),
@@ -7778,16 +7928,22 @@ olx.style.StrokeOptions.prototype.width;
* textAlign: (string|undefined), * textAlign: (string|undefined),
* textBaseline: (string|undefined), * textBaseline: (string|undefined),
* fill: (ol.style.Fill|undefined), * fill: (ol.style.Fill|undefined),
* stroke: (ol.style.Stroke|undefined)}} * stroke: (ol.style.Stroke|undefined),
* backgroundFill: (ol.style.Fill|undefined),
* backgroundStroke: (ol.style.Stroke|undefined),
* padding: (Array.<number>|undefined)}}
*/ */
olx.style.TextOptions; olx.style.TextOptions;
/** /**
* **Deprecated**. Use the `overflow` option instead.
*
* For polygon labels or when `placement` is set to `'line'`, allow text to * For polygon labels or when `placement` is set to `'line'`, allow text to
* exceed the width of the polygon at the the label position or the length of * exceed the width of the polygon at the label position or the length of
* the path that it follows. Default is `false`. * the path that it follows. Default is `false`.
* @type {boolean|undefined} * @type {boolean|undefined}
* @deprecated
* @api * @api
*/ */
olx.style.TextOptions.prototype.exceedLength; olx.style.TextOptions.prototype.exceedLength;
@@ -7831,6 +7987,16 @@ olx.style.TextOptions.prototype.offsetX;
olx.style.TextOptions.prototype.offsetY; olx.style.TextOptions.prototype.offsetY;
/**
* For polygon labels or when `placement` is set to `'line'`, allow text to
* exceed the width of the polygon at the label position or the length of
* the path that it follows. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.style.TextOptions.prototype.overflow;
/** /**
* Text placement. * Text placement.
* @type {ol.style.TextPlacement|undefined} * @type {ol.style.TextPlacement|undefined}
@@ -7907,6 +8073,34 @@ olx.style.TextOptions.prototype.fill;
olx.style.TextOptions.prototype.stroke; olx.style.TextOptions.prototype.stroke;
/**
* Fill style for the text background when `placement` is `'point'`. Default is
* no fill.
* @type {ol.style.Fill|undefined}
* @api
*/
olx.style.TextOptions.prototype.backgroundFill;
/**
* Stroke style for the text background when `placement` is `'point'`. Default
* is no stroke.
* @type {ol.style.Stroke|undefined}
* @api
*/
olx.style.TextOptions.prototype.backgroundStroke;
/**
* Padding in pixels around the text for decluttering and background. The order
* of values in the array is `[top, right, bottom, left]`. Default is
* `[0, 0, 0, 0]`.
* @type {Array.<number>|undefined}
* @api
*/
olx.style.TextOptions.prototype.padding;
/** /**
* @typedef {{geometry: (undefined|string|ol.geom.Geometry|ol.StyleGeometryFunction), * @typedef {{geometry: (undefined|string|ol.geom.Geometry|ol.StyleGeometryFunction),
* fill: (ol.style.Fill|undefined), * fill: (ol.style.Fill|undefined),
@@ -8329,7 +8523,6 @@ olx.view.FitOptions.prototype.callback;
/** /**
* @typedef {{animate: boolean, * @typedef {{animate: boolean,
* attributions: Object.<string, ol.Attribution>,
* coordinateToPixelTransform: ol.Transform, * coordinateToPixelTransform: ol.Transform,
* extent: (null|ol.Extent), * extent: (null|ol.Extent),
* focus: ol.Coordinate, * focus: ol.Coordinate,
@@ -8341,7 +8534,7 @@ olx.view.FitOptions.prototype.callback;
* pixelToCoordinateTransform: ol.Transform, * pixelToCoordinateTransform: ol.Transform,
* postRenderFunctions: Array.<ol.PostRenderFunction>, * postRenderFunctions: Array.<ol.PostRenderFunction>,
* size: ol.Size, * size: ol.Size,
* skippedFeatureUids: Object.<string, boolean>, * skippedFeatureUids: !Object.<string, boolean>,
* tileQueue: ol.TileQueue, * tileQueue: ol.TileQueue,
* time: number, * time: number,
* usedTiles: Object.<string, Object.<string, ol.TileRange>>, * usedTiles: Object.<string, Object.<string, ol.TileRange>>,
@@ -8377,7 +8570,8 @@ olx.FrameState.prototype.viewState;
* @typedef {{center: ol.Coordinate, * @typedef {{center: ol.Coordinate,
* projection: ol.proj.Projection, * projection: ol.proj.Projection,
* resolution: number, * resolution: number,
* rotation: number}} * rotation: number,
* zoom: number}}
*/ */
olx.ViewState; olx.ViewState;
@@ -8410,6 +8604,14 @@ olx.ViewState.prototype.resolution;
olx.ViewState.prototype.rotation; olx.ViewState.prototype.rotation;
/**
* The current zoom level.
* @type {number}
* @api
*/
olx.ViewState.prototype.zoom;
/** /**
* @typedef {{initialSize: (number|undefined), * @typedef {{initialSize: (number|undefined),
* maxSize: (number|undefined), * maxSize: (number|undefined),

View File

@@ -1,6 +1,6 @@
{ {
"name": "openlayers", "name": "openlayers",
"version": "4.4.0", "version": "4.6.4-backports.2",
"description": "Build tools and sources for developing OpenLayers based mapping applications", "description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [ "keywords": [
"map", "map",
@@ -38,17 +38,17 @@
"css/ol.css" "css/ol.css"
], ],
"dependencies": { "dependencies": {
"async": "2.5.0", "async": "2.6.0",
"closure-util": "1.24.0", "closure-util": "1.26.0",
"fs-extra": "4.0.2", "fs-extra": "4.0.3",
"jsdoc": "3.5.5", "jsdoc": "3.5.5",
"nomnom": "1.8.1", "nomnom": "1.8.1",
"pbf": "3.1.0", "pbf": "3.1.0",
"pixelworks": "1.1.0", "pixelworks": "1.1.0",
"rbush": "2.0.1", "rbush": "2.0.1",
"rollup": "^0.50.0", "rollup": "^0.52.0",
"rollup-plugin-cleanup": "^1.0.0", "rollup-plugin-cleanup": "^2.0.0",
"rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-node-resolve": "^3.0.0",
"temp": "0.8.3", "temp": "0.8.3",
"walk": "2.3.9" "walk": "2.3.9"
@@ -56,34 +56,34 @@
"devDependencies": { "devDependencies": {
"clean-css-cli": "4.1.10", "clean-css-cli": "4.1.10",
"coveralls": "3.0.0", "coveralls": "3.0.0",
"debounce": "^1.0.0", "debounce": "^1.1.0",
"eslint": "4.8.0", "eslint": "4.12.1",
"eslint-config-openlayers": "7.0.0", "eslint-config-openlayers": "7.0.0",
"eslint-plugin-openlayers-internal": "^3.1.0", "eslint-plugin-openlayers-internal": "^3.1.0",
"expect.js": "0.3.1", "expect.js": "0.3.1",
"gaze": "^1.0.0", "gaze": "^1.0.0",
"glob": "7.1.1", "glob": "7.1.1",
"handlebars": "4.0.10", "handlebars": "4.0.11",
"istanbul": "0.4.5", "istanbul": "0.4.5",
"jquery": "3.2.1", "jquery": "3.2.1",
"jscodeshift": "^0.3.30", "jscodeshift": "^0.3.30",
"karma": "^1.7.0", "karma": "^1.7.1",
"karma-chrome-launcher": "^2.1.1", "karma-chrome-launcher": "^2.1.1",
"karma-coverage": "^1.1.1", "karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1", "karma-firefox-launcher": "^1.0.1",
"karma-mocha": "^1.3.0", "karma-mocha": "^1.3.0",
"karma-sauce-launcher": "^1.1.0", "karma-sauce-launcher": "^1.1.0",
"marked": "0.3.6", "marked": "0.3.7",
"metalsmith": "2.3.0", "metalsmith": "2.3.0",
"metalsmith-layouts": "1.8.1", "metalsmith-layouts": "1.8.1",
"mocha": "4.0.0", "mocha": "4.0.1",
"mocha-phantomjs-core": "^2.1.0", "mocha-phantomjs-core": "^2.1.0",
"mustache": "2.3.0", "mustache": "2.3.0",
"phantomjs-prebuilt": "2.1.15", "phantomjs-prebuilt": "2.1.16",
"pixelmatch": "^4.0.2", "pixelmatch": "^4.0.2",
"proj4": "2.4.4", "proj4": "2.4.4",
"serve-files": "1.0.1", "serve-files": "1.0.1",
"sinon": "4.0.1", "sinon": "4.1.2",
"slimerjs": "0.10.3", "slimerjs": "0.10.3",
"url-polyfill": "^1.0.7" "url-polyfill": "^1.0.7"
}, },

View File

@@ -1,6 +1,6 @@
{ {
"name": "ol", "name": "ol",
"version": "4.4.0", "version": "4.6.4",
"description": "OpenLayers as ES2015 modules", "description": "OpenLayers as ES2015 modules",
"main": "index.js", "main": "index.js",
"module": "index.js", "module": "index.js",

View File

@@ -37,6 +37,7 @@ See the following examples for more detail on bundling OpenLayers with your appl
* Using [Rollup & Uglify](https://gist.github.com/tschaub/8beb328ea72b36446fc2198d008287de) * Using [Rollup & Uglify](https://gist.github.com/tschaub/8beb328ea72b36446fc2198d008287de)
* Using [Rollup & Closure Compiler](https://gist.github.com/tschaub/32a5692bedac5254da24fa3b12072f35) * Using [Rollup & Closure Compiler](https://gist.github.com/tschaub/32a5692bedac5254da24fa3b12072f35)
* Using [Webpack & Uglify](https://gist.github.com/tschaub/79025aef325cd2837364400a105405b8) * Using [Webpack & Uglify](https://gist.github.com/tschaub/79025aef325cd2837364400a105405b8)
* Using [Webpack & Closure Compiler](https://gist.github.com/ahocevar/8ceafc6293455ba491dd9be12c15761f)
* Using [Browserify & Uglify](https://gist.github.com/tschaub/4bfb209a8f809823f1495b2e4436018e) * Using [Browserify & Uglify](https://gist.github.com/tschaub/4bfb209a8f809823f1495b2e4436018e)
## Module Identifiers ## Module Identifiers
@@ -46,7 +47,3 @@ The module identifiers above (e.g. `ol/map`) are like the `ol.Map` names in the
Constructors are exported from dedicated modules. For example, the `ol/layer/tile` module exports the `Tile` layer constructor. Constructors are exported from dedicated modules. For example, the `ol/layer/tile` module exports the `Tile` layer constructor.
Utility functions are available as properties of the default export from utility modules. For example, the `getCenter` function is a property of the default export from the `ol/extent` utility module. Utility functions are available as properties of the default export from utility modules. For example, the `getCenter` function is a property of the default export from the `ol/extent` utility module.
## Caveats
* The WebGL renderer is not available in this package.

View File

@@ -22,6 +22,7 @@ goog.require('ol.tilegrid');
* .. * ..
* *
* @constructor * @constructor
* @deprecated This class is deprecated and will removed in the next major release.
* @param {olx.AttributionOptions} options Attribution options. * @param {olx.AttributionOptions} options Attribution options.
* @struct * @struct
* @api * @api

View File

@@ -5,12 +5,12 @@ goog.require('ol.math');
/** /**
* This RegExp matches # followed by 3 or 6 hex digits. * This RegExp matches # followed by 3, 4, 6, or 8 hex digits.
* @const * @const
* @type {RegExp} * @type {RegExp}
* @private * @private
*/ */
ol.color.HEX_COLOR_RE_ = /^#(?:[0-9a-f]{3}){1,2}$/i; ol.color.HEX_COLOR_RE_ = /^#(?:[0-9a-f]{3,4}){1,2}$/i;
/** /**
@@ -138,18 +138,30 @@ ol.color.fromStringInternal_ = function(s) {
if (ol.color.HEX_COLOR_RE_.exec(s)) { // hex if (ol.color.HEX_COLOR_RE_.exec(s)) { // hex
var n = s.length - 1; // number of hex digits var n = s.length - 1; // number of hex digits
ol.asserts.assert(n == 3 || n == 6, 54); // Hex color should have 3 or 6 digits var d; // number of digits per channel
var d = n == 3 ? 1 : 2; // number of digits per channel if (n <= 4) {
d = 1;
} else {
d = 2;
}
var hasAlpha = n === 4 || n === 8;
r = parseInt(s.substr(1 + 0 * d, d), 16); r = parseInt(s.substr(1 + 0 * d, d), 16);
g = parseInt(s.substr(1 + 1 * d, d), 16); g = parseInt(s.substr(1 + 1 * d, d), 16);
b = parseInt(s.substr(1 + 2 * d, d), 16); b = parseInt(s.substr(1 + 2 * d, d), 16);
if (hasAlpha) {
a = parseInt(s.substr(1 + 3 * d, d), 16);
} else {
a = 255;
}
if (d == 1) { if (d == 1) {
r = (r << 4) + r; r = (r << 4) + r;
g = (g << 4) + g; g = (g << 4) + g;
b = (b << 4) + b; b = (b << 4) + b;
if (hasAlpha) {
a = (a << 4) + a;
}
} }
a = 1; color = [r, g, b, a / 255];
color = [r, g, b, a];
} else if (s.indexOf('rgba(') == 0) { // rgba() } else if (s.indexOf('rgba(') == 0) { // rgba()
parts = s.slice(5, -1).split(',').map(Number); parts = s.slice(5, -1).split(',').map(Number);
color = ol.color.normalize(parts); color = ol.color.normalize(parts);

View File

@@ -3,11 +3,13 @@
goog.provide('ol.control.Attribution'); goog.provide('ol.control.Attribution');
goog.require('ol'); goog.require('ol');
goog.require('ol.dom'); goog.require('ol.array');
goog.require('ol.control.Control'); goog.require('ol.control.Control');
goog.require('ol.css'); goog.require('ol.css');
goog.require('ol.dom');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.layer.Layer');
goog.require('ol.obj'); goog.require('ol.obj');
@@ -116,24 +118,19 @@ ol.control.Attribution = function(opt_options) {
target: options.target target: options.target
}); });
/**
* A list of currently rendered resolutions.
* @type {Array.<string>}
* @private
*/
this.renderedAttributions_ = [];
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.renderedVisible_ = true; this.renderedVisible_ = true;
/**
* @private
* @type {Object.<string, Element>}
*/
this.attributionElements_ = {};
/**
* @private
* @type {Object.<string, boolean>}
*/
this.attributionElementRenderedVisible_ = {};
/** /**
* @private * @private
* @type {Object.<string, Element>} * @type {Object.<string, Element>}
@@ -145,59 +142,62 @@ ol.inherits(ol.control.Attribution, ol.control.Control);
/** /**
* @param {?olx.FrameState} frameState Frame state. * Get a list of visible attributions.
* @return {Array.<Object.<string, ol.Attribution>>} Attributions. * @param {olx.FrameState} frameState Frame state.
* @return {Array.<string>} Attributions.
* @private
*/ */
ol.control.Attribution.prototype.getSourceAttributions = function(frameState) { ol.control.Attribution.prototype.getSourceAttributions_ = function(frameState) {
var i, ii, j, jj, tileRanges, source, sourceAttribution, /**
sourceAttributionKey, sourceAttributions, sourceKey; * Used to determine if an attribution already exists.
var intersectsTileRange; * @type {Object.<string, boolean>}
*/
var lookup = {};
/**
* A list of visible attributions.
* @type {Array.<string>}
*/
var visibleAttributions = [];
var layerStatesArray = frameState.layerStatesArray; var layerStatesArray = frameState.layerStatesArray;
/** @type {Object.<string, ol.Attribution>} */ var resolution = frameState.viewState.resolution;
var attributions = ol.obj.assign({}, frameState.attributions); for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
/** @type {Object.<string, ol.Attribution>} */ var layerState = layerStatesArray[i];
var hiddenAttributions = {}; if (!ol.layer.Layer.visibleAtResolution(layerState, resolution)) {
var uniqueAttributions = {}; continue;
var projection = /** @type {!ol.proj.Projection} */ (frameState.viewState.projection); }
for (i = 0, ii = layerStatesArray.length; i < ii; i++) {
source = layerStatesArray[i].layer.getSource(); var source = layerState.layer.getSource();
if (!source) { if (!source) {
continue; continue;
} }
sourceKey = ol.getUid(source).toString();
sourceAttributions = source.getAttributions(); var attributionGetter = source.getAttributions2();
if (!sourceAttributions) { if (!attributionGetter) {
continue; continue;
} }
for (j = 0, jj = sourceAttributions.length; j < jj; j++) {
sourceAttribution = sourceAttributions[j]; var attributions = attributionGetter(frameState);
sourceAttributionKey = ol.getUid(sourceAttribution).toString(); if (!attributions) {
if (sourceAttributionKey in attributions) { continue;
continue; }
}
tileRanges = frameState.usedTiles[sourceKey]; if (Array.isArray(attributions)) {
if (tileRanges) { for (var j = 0, jj = attributions.length; j < jj; ++j) {
var tileGrid = /** @type {ol.source.Tile} */ (source).getTileGridForProjection(projection); if (!(attributions[j] in lookup)) {
intersectsTileRange = sourceAttribution.intersectsAnyTileRange( visibleAttributions.push(attributions[j]);
tileRanges, tileGrid, projection); lookup[attributions[j]] = true;
} else {
intersectsTileRange = false;
}
if (intersectsTileRange) {
if (sourceAttributionKey in hiddenAttributions) {
delete hiddenAttributions[sourceAttributionKey];
} }
var html = sourceAttribution.getHTML(); }
if (!(html in uniqueAttributions)) { } else {
uniqueAttributions[html] = true; if (!(attributions in lookup)) {
attributions[sourceAttributionKey] = sourceAttribution; visibleAttributions.push(attributions);
} lookup[attributions] = true;
} else {
hiddenAttributions[sourceAttributionKey] = sourceAttribution;
} }
} }
} }
return [attributions, hiddenAttributions]; return visibleAttributions;
}; };
@@ -217,7 +217,6 @@ ol.control.Attribution.render = function(mapEvent) {
* @param {?olx.FrameState} frameState Frame state. * @param {?olx.FrameState} frameState Frame state.
*/ */
ol.control.Attribution.prototype.updateElement_ = function(frameState) { ol.control.Attribution.prototype.updateElement_ = function(frameState) {
if (!frameState) { if (!frameState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
this.element.style.display = 'none'; this.element.style.display = 'none';
@@ -226,65 +225,38 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
return; return;
} }
var attributions = this.getSourceAttributions(frameState); var attributions = this.getSourceAttributions_(frameState);
/** @type {Object.<string, ol.Attribution>} */ if (ol.array.equals(attributions, this.renderedAttributions_)) {
var visibleAttributions = attributions[0]; return;
/** @type {Object.<string, ol.Attribution>} */
var hiddenAttributions = attributions[1];
var attributionElement, attributionKey;
for (attributionKey in this.attributionElements_) {
if (attributionKey in visibleAttributions) {
if (!this.attributionElementRenderedVisible_[attributionKey]) {
this.attributionElements_[attributionKey].style.display = '';
this.attributionElementRenderedVisible_[attributionKey] = true;
}
delete visibleAttributions[attributionKey];
} else if (attributionKey in hiddenAttributions) {
if (this.attributionElementRenderedVisible_[attributionKey]) {
this.attributionElements_[attributionKey].style.display = 'none';
delete this.attributionElementRenderedVisible_[attributionKey];
}
delete hiddenAttributions[attributionKey];
} else {
ol.dom.removeNode(this.attributionElements_[attributionKey]);
delete this.attributionElements_[attributionKey];
delete this.attributionElementRenderedVisible_[attributionKey];
}
}
for (attributionKey in visibleAttributions) {
attributionElement = document.createElement('LI');
attributionElement.innerHTML =
visibleAttributions[attributionKey].getHTML();
this.ulElement_.appendChild(attributionElement);
this.attributionElements_[attributionKey] = attributionElement;
this.attributionElementRenderedVisible_[attributionKey] = true;
}
for (attributionKey in hiddenAttributions) {
attributionElement = document.createElement('LI');
attributionElement.innerHTML =
hiddenAttributions[attributionKey].getHTML();
attributionElement.style.display = 'none';
this.ulElement_.appendChild(attributionElement);
this.attributionElements_[attributionKey] = attributionElement;
} }
var renderVisible = // remove everything but the logo
!ol.obj.isEmpty(this.attributionElementRenderedVisible_) || while (this.ulElement_.lastChild !== this.logoLi_) {
!ol.obj.isEmpty(frameState.logos); this.ulElement_.removeChild(this.ulElement_.lastChild);
if (this.renderedVisible_ != renderVisible) {
this.element.style.display = renderVisible ? '' : 'none';
this.renderedVisible_ = renderVisible;
} }
if (renderVisible &&
ol.obj.isEmpty(this.attributionElementRenderedVisible_)) { // append the attributions
for (var i = 0, ii = attributions.length; i < ii; ++i) {
var element = document.createElement('LI');
element.innerHTML = attributions[i];
this.ulElement_.appendChild(element);
}
if (attributions.length === 0 && this.renderedAttributions_.length > 0) {
this.element.classList.add('ol-logo-only'); this.element.classList.add('ol-logo-only');
} else { } else if (this.renderedAttributions_.length === 0 && attributions.length > 0) {
this.element.classList.remove('ol-logo-only'); this.element.classList.remove('ol-logo-only');
} }
this.insertLogos_(frameState); var visible = attributions.length > 0 || !ol.obj.isEmpty(frameState.logos);
if (this.renderedVisible_ != visible) {
this.element.style.display = visible ? '' : 'none';
this.renderedVisible_ = visible;
}
this.renderedAttributions_ = attributions;
this.insertLogos_(frameState);
}; };

View File

@@ -174,6 +174,9 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
ol.proj.Units.METERS; ol.proj.Units.METERS;
var pointResolution = var pointResolution =
ol.proj.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits); ol.proj.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
if (units != ol.control.ScaleLineUnits.DEGREES) {
pointResolution *= projection.getMetersPerUnit();
}
var nominalCount = this.minWidth_ * pointResolution; var nominalCount = this.minWidth_ * pointResolution;
var suffix = ''; var suffix = '';

View File

@@ -22,9 +22,9 @@ ol.control.ZoomToExtent = function(opt_options) {
/** /**
* @type {ol.Extent} * @type {ol.Extent}
* @private * @protected
*/ */
this.extent_ = options.extent ? options.extent : null; this.extent = options.extent ? options.extent : null;
var className = options.className !== undefined ? options.className : var className = options.className !== undefined ? options.className :
'ol-zoom-extent'; 'ol-zoom-extent';
@@ -62,16 +62,16 @@ ol.inherits(ol.control.ZoomToExtent, ol.control.Control);
*/ */
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) { ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
event.preventDefault(); event.preventDefault();
this.handleZoomToExtent_(); this.handleZoomToExtent();
}; };
/** /**
* @private * @protected
*/ */
ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() { ol.control.ZoomToExtent.prototype.handleZoomToExtent = function() {
var map = this.getMap(); var map = this.getMap();
var view = map.getView(); var view = map.getView();
var extent = !this.extent_ ? view.getProjection().getExtent() : this.extent_; var extent = !this.extent ? view.getProjection().getExtent() : this.extent;
view.fit(extent); view.fit(extent);
}; };

View File

@@ -43,3 +43,30 @@ ol.css.CLASS_UNSUPPORTED = 'ol-unsupported';
* @type {string} * @type {string}
*/ */
ol.css.CLASS_CONTROL = 'ol-control'; ol.css.CLASS_CONTROL = 'ol-control';
/**
* Get the list of font families from a font spec. Note that this doesn't work
* for font families that have commas in them.
* @param {string} The CSS font property.
* @return {Object.<string>} The font families (or null if the input spec is invalid).
*/
ol.css.getFontFamilies = (function() {
var style;
var cache = {};
return function(font) {
if (!style) {
style = document.createElement('div').style;
}
if (!(font in cache)) {
style.font = font;
var family = style.fontFamily;
style.font = '';
if (!family) {
return null;
}
cache[font] = family.split(/,\s?/);
}
return cache[font];
};
})();

View File

@@ -12,6 +12,8 @@ ol.events.EventType = {
*/ */
CHANGE: 'change', CHANGE: 'change',
CLEAR: 'clear',
CONTEXTMENU: 'contextmenu',
CLICK: 'click', CLICK: 'click',
DBLCLICK: 'dblclick', DBLCLICK: 'dblclick',
DRAGENTER: 'dragenter', DRAGENTER: 'dragenter',

View File

@@ -2,6 +2,7 @@ goog.provide('ol.format.filter');
goog.require('ol.format.filter.And'); goog.require('ol.format.filter.And');
goog.require('ol.format.filter.Bbox'); goog.require('ol.format.filter.Bbox');
goog.require('ol.format.filter.Contains');
goog.require('ol.format.filter.During'); goog.require('ol.format.filter.During');
goog.require('ol.format.filter.EqualTo'); goog.require('ol.format.filter.EqualTo');
goog.require('ol.format.filter.GreaterThan'); goog.require('ol.format.filter.GreaterThan');
@@ -71,6 +72,21 @@ ol.format.filter.bbox = function(geometryName, extent, opt_srsName) {
return new ol.format.filter.Bbox(geometryName, extent, opt_srsName); return new ol.format.filter.Bbox(geometryName, extent, opt_srsName);
}; };
/**
* Create a `<Contains>` operator to test whether a geometry-valued property
* contains a given geometry.
*
* @param {!string} geometryName Geometry name to use.
* @param {!ol.geom.Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @returns {!ol.format.filter.Contains} `<Contains>` operator.
* @api
*/
ol.format.filter.contains = function(geometryName, geometry, opt_srsName) {
return new ol.format.filter.Contains(geometryName, geometry, opt_srsName);
};
/** /**
* Create a `<Intersects>` operator to test whether a geometry-valued property * Create a `<Intersects>` operator to test whether a geometry-valued property
* intersects a given geometry. * intersects a given geometry.

View File

@@ -0,0 +1,25 @@
goog.provide('ol.format.filter.Contains');
goog.require('ol');
goog.require('ol.format.filter.Spatial');
/**
* @classdesc
* Represents a `<Contains>` operator to test whether a geometry-valued property
* contains a given geometry.
*
* @constructor
* @param {!string} geometryName Geometry name to use.
* @param {!ol.geom.Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @extends {ol.format.filter.Spatial}
* @api
*/
ol.format.filter.Contains = function(geometryName, geometry, opt_srsName) {
ol.format.filter.Spatial.call(this, 'Contains', geometryName, geometry, opt_srsName);
};
ol.inherits(ol.format.filter.Contains, ol.format.filter.Spatial);

View File

@@ -53,6 +53,13 @@ ol.format.GeoJSON = function(opt_options) {
*/ */
this.geometryName_ = options.geometryName; this.geometryName_ = options.geometryName;
/**
* Look for the geometry name in the feature GeoJSON
* @type {boolean|undefined}
* @private
*/
this.extractGeometryName_ = options.extractGeometryName;
}; };
ol.inherits(ol.format.GeoJSON, ol.format.JSONFeature); ol.inherits(ol.format.GeoJSON, ol.format.JSONFeature);
@@ -377,6 +384,8 @@ ol.format.GeoJSON.prototype.readFeatureFromObject = function(
var feature = new ol.Feature(); var feature = new ol.Feature();
if (this.geometryName_) { if (this.geometryName_) {
feature.setGeometryName(this.geometryName_); feature.setGeometryName(this.geometryName_);
} else if (this.extractGeometryName_ && geoJSONFeature.geometry_name !== undefined) {
feature.setGeometryName(geoJSONFeature.geometry_name);
} }
feature.setGeometry(geometry); feature.setGeometry(geometry);
if (geoJSONFeature.id !== undefined) { if (geoJSONFeature.id !== undefined) {
@@ -457,12 +466,6 @@ ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
if (crs) { if (crs) {
if (crs.type == 'name') { if (crs.type == 'name') {
projection = ol.proj.get(crs.properties.name); projection = ol.proj.get(crs.properties.name);
} else if (crs.type == 'EPSG') {
// 'EPSG' is not part of the GeoJSON specification, but is generated by
// GeoServer.
// TODO: remove this when http://jira.codehaus.org/browse/GEOS-5996
// is fixed and widely deployed.
projection = ol.proj.get('EPSG:' + crs.properties.code);
} else { } else {
ol.asserts.assert(false, 36); // Unknown SRS type ol.asserts.assert(false, 36); // Unknown SRS type
} }

View File

@@ -403,6 +403,9 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ = ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
ol.xml.makeStructureNS( ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, { ol.format.OWS.NAMESPACE_URIS_, {
'Abstract': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'AccessConstraints': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Fees': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter( 'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString), ol.format.XSD.readString),

View File

@@ -116,6 +116,22 @@ ol.format.WFS.SCHEMA_LOCATIONS = {
ol.format.WFS.DEFAULT_VERSION = '1.1.0'; ol.format.WFS.DEFAULT_VERSION = '1.1.0';
/**
* @return {Array.<string>|string|undefined} featureType
*/
ol.format.WFS.prototype.getFeatureType = function() {
return this.featureType_;
};
/**
* @param {Array.<string>|string|undefined} featureType Feature type(s) to parse.
*/
ol.format.WFS.prototype.setFeatureType = function(featureType) {
this.featureType_ = featureType;
};
/** /**
* Read all features from a WFS FeatureCollection. * Read all features from a WFS FeatureCollection.
* *
@@ -628,6 +644,21 @@ ol.format.WFS.writeBboxFilter_ = function(node, filter, objectStack) {
}; };
/**
* @param {Node} node Node.
* @param {ol.format.filter.Contains} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeContainsFilter_ = function(node, filter, objectStack) {
var context = objectStack[objectStack.length - 1];
context['srsName'] = filter.srsName;
ol.format.WFS.writeOgcPropertyName_(node, filter.geometryName);
ol.format.GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
};
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {ol.format.filter.Intersects} filter Filter. * @param {ol.format.filter.Intersects} filter Filter.
@@ -846,6 +877,7 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
'Or': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_), 'Or': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
'Not': ol.xml.makeChildAppender(ol.format.WFS.writeNotFilter_), 'Not': ol.xml.makeChildAppender(ol.format.WFS.writeNotFilter_),
'BBOX': ol.xml.makeChildAppender(ol.format.WFS.writeBboxFilter_), 'BBOX': ol.xml.makeChildAppender(ol.format.WFS.writeBboxFilter_),
'Contains': ol.xml.makeChildAppender(ol.format.WFS.writeContainsFilter_),
'Intersects': ol.xml.makeChildAppender(ol.format.WFS.writeIntersectsFilter_), 'Intersects': ol.xml.makeChildAppender(ol.format.WFS.writeIntersectsFilter_),
'Within': ol.xml.makeChildAppender(ol.format.WFS.writeWithinFilter_), 'Within': ol.xml.makeChildAppender(ol.format.WFS.writeWithinFilter_),
'PropertyIsEqualTo': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_), 'PropertyIsEqualTo': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),

View File

@@ -63,6 +63,22 @@ ol.format.WMSGetFeatureInfo.featureIdentifier_ = '_feature';
ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer'; ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer';
/**
* @return {Array.<string>} layers
*/
ol.format.WMSGetFeatureInfo.prototype.getLayers = function() {
return this.layers_;
};
/**
* @param {Array.<string>} layers Layers to parse.
*/
ol.format.WMSGetFeatureInfo.prototype.setLayers = function(layers) {
this.layers_ = layers;
};
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.

View File

@@ -24,18 +24,20 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
/** @type {Array.<number>} */ /** @type {Array.<number>} */
var intersections = []; var intersections = [];
// Calculate intersections with the horizontal line // Calculate intersections with the horizontal line
var end = ends[0]; for (var r = 0, rr = ends.length; r < rr; ++r) {
x1 = flatCoordinates[end - stride]; var end = ends[r];
y1 = flatCoordinates[end - stride + 1]; x1 = flatCoordinates[end - stride];
for (i = offset; i < end; i += stride) { y1 = flatCoordinates[end - stride + 1];
x2 = flatCoordinates[i]; for (i = offset; i < end; i += stride) {
y2 = flatCoordinates[i + 1]; x2 = flatCoordinates[i];
if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) { y2 = flatCoordinates[i + 1];
x = (y - y1) / (y2 - y1) * (x2 - x1) + x1; if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {
intersections.push(x); x = (y - y1) / (y2 - y1) * (x2 - x1) + x1;
intersections.push(x);
}
x1 = x2;
y1 = y2;
} }
x1 = x2;
y1 = y2;
} }
// Find the longest segment of the horizontal line that has its center point // Find the longest segment of the horizontal line that has its center point
// inside the linear ring. // inside the linear ring.

View File

@@ -13,16 +13,12 @@ goog.require('ol.math');
* width of the character passed as 1st argument. * width of the character passed as 1st argument.
* @param {number} startM m along the path where the text starts. * @param {number} startM m along the path where the text starts.
* @param {number} maxAngle Max angle between adjacent chars in radians. * @param {number} maxAngle Max angle between adjacent chars in radians.
* @param {Array.<Array.<number>>=} opt_result Array that will be populated with the * @return {Array.<Array.<*>>} The result array of null if `maxAngle` was
* result. Each entry consists of an array of x, y and z of the char to draw. * exceeded. Entries of the array are x, y, anchorX, angle, chunk.
* If provided, this array will not be truncated to the number of characters of
* the `text`.
* @return {Array.<Array.<number>>} The result array of null if `maxAngle` was
* exceeded.
*/ */
ol.geom.flat.textpath.lineString = function( ol.geom.flat.textpath.lineString = function(
flatCoordinates, offset, end, stride, text, measure, startM, maxAngle, opt_result) { flatCoordinates, offset, end, stride, text, measure, startM, maxAngle) {
var result = opt_result ? opt_result : []; var result = [];
// Keep text upright // Keep text upright
var reverse = flatCoordinates[offset] > flatCoordinates[end - stride]; var reverse = flatCoordinates[offset] > flatCoordinates[end - stride];
@@ -37,11 +33,15 @@ ol.geom.flat.textpath.lineString = function(
var segmentM = 0; var segmentM = 0;
var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
var index, previousAngle; var chunk = '';
var chunkLength = 0;
var data, index, previousAngle;
for (var i = 0; i < numChars; ++i) { for (var i = 0; i < numChars; ++i) {
index = reverse ? numChars - i - 1 : i; index = reverse ? numChars - i - 1 : i;
var char = text[index]; var char = text.charAt(index);
var charLength = measure(char); chunk = reverse ? char + chunk : chunk + char;
var charLength = measure(chunk) - chunkLength;
chunkLength += charLength;
var charM = startM + charLength / 2; var charM = startM + charLength / 2;
while (offset < end - stride && segmentM + segmentLength < charM) { while (offset < end - stride && segmentM + segmentLength < charM) {
x1 = x2; x1 = x2;
@@ -64,11 +64,27 @@ ol.geom.flat.textpath.lineString = function(
return null; return null;
} }
} }
previousAngle = angle;
var interpolate = segmentPos / segmentLength; var interpolate = segmentPos / segmentLength;
var x = ol.math.lerp(x1, x2, interpolate); var x = ol.math.lerp(x1, x2, interpolate);
var y = ol.math.lerp(y1, y2, interpolate); var y = ol.math.lerp(y1, y2, interpolate);
result[index] = [x, y, angle]; if (previousAngle == angle) {
if (reverse) {
data[0] = x;
data[1] = y;
data[2] = charLength / 2;
}
data[4] = chunk;
} else {
chunk = char;
chunkLength = charLength;
data = [x, y, charLength / 2, angle, chunk];
if (reverse) {
result.unshift(data);
} else {
result.push(data);
}
previousAngle = angle;
}
startM += charLength; startM += charLength;
} }
return result; return result;

View File

@@ -14,16 +14,13 @@ goog.require('ol.extent');
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number|undefined} resolution Resolution. * @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @param {Array.<ol.Attribution>} attributions Attributions.
* @param {string} src Image source URI. * @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin. * @param {?string} crossOrigin Cross origin.
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
*/ */
ol.Image = function(extent, resolution, pixelRatio, attributions, src, ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
crossOrigin, imageLoadFunction) {
ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE, ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE);
attributions);
/** /**
* @private * @private

View File

@@ -13,18 +13,11 @@ goog.require('ol.events.EventType');
* @param {number|undefined} resolution Resolution. * @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @param {ol.ImageState} state State. * @param {ol.ImageState} state State.
* @param {Array.<ol.Attribution>} attributions Attributions.
*/ */
ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) { ol.ImageBase = function(extent, resolution, pixelRatio, state) {
ol.events.EventTarget.call(this); ol.events.EventTarget.call(this);
/**
* @private
* @type {Array.<ol.Attribution>}
*/
this.attributions_ = attributions;
/** /**
* @protected * @protected
* @type {ol.Extent} * @type {ol.Extent}
@@ -61,14 +54,6 @@ ol.ImageBase.prototype.changed = function() {
}; };
/**
* @return {Array.<ol.Attribution>} Attributions.
*/
ol.ImageBase.prototype.getAttributions = function() {
return this.attributions_;
};
/** /**
* @return {ol.Extent} Extent. * @return {ol.Extent} Extent.
*/ */

View File

@@ -11,13 +11,11 @@ goog.require('ol.ImageState');
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @param {Array.<ol.Attribution>} attributions Attributions.
* @param {HTMLCanvasElement} canvas Canvas. * @param {HTMLCanvasElement} canvas Canvas.
* @param {ol.ImageCanvasLoader=} opt_loader Optional loader function to * @param {ol.ImageCanvasLoader=} opt_loader Optional loader function to
* support asynchronous canvas drawing. * support asynchronous canvas drawing.
*/ */
ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions, ol.ImageCanvas = function(extent, resolution, pixelRatio, canvas, opt_loader) {
canvas, opt_loader) {
/** /**
* Optional canvas loader function. * Optional canvas loader function.
@@ -29,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
var state = opt_loader !== undefined ? var state = opt_loader !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED; ol.ImageState.IDLE : ol.ImageState.LOADED;
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions); ol.ImageBase.call(this, extent, resolution, pixelRatio, state);
/** /**
* @private * @private

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