Compare commits

...

497 Commits

Author SHA1 Message Date
ahocevar
bb9e13a3e5 Update package versin to v5.3.2 2019-04-11 11:23:15 +02:00
ahocevar
d1b1444744 Changelog for v5.3.2 2019-04-11 11:22:44 +02:00
Éric Lemoine
8992ed68f9 Merge pull request #9422 from elemoine/tile-render
Clear context when source revision changed (v5.3.x fix)
2019-04-11 11:16:58 +02:00
Tim Schaub
cb63b398d3 Merge pull request #9255 from openlayers/release-v5.3.1
Updates for 5.3.1
2019-02-21 13:16:41 -07:00
Tim Schaub
ce89a82e6a Updates for 5.3.1 2019-02-21 13:07:15 -07:00
Tim Schaub
1c269d6e0b Merge pull request #9253 from romanzoller/hotfix-PR-8893
Add proj.js to the sideEffects list
2019-02-21 13:02:24 -07:00
Frederic Junod
83b8fe4b33 Add proj.js to the sideEffects list 2019-02-21 17:10:20 +01:00
Tim Schaub
346cd562ee Changes for 5.3.0 2018-11-06 09:37:17 -07:00
Tim Schaub
ba88081eba Merge pull request #8642 from dimin/master
fixes for optional key passing, issue #8067 for tile sources
2018-11-06 08:56:25 -07:00
Frédéric Junod
2a3b21cfd9 Merge pull request #8885 from fredj/rm_GeolocationProperty
Move GeolocationProperty into Geolocation
2018-11-06 10:28:01 +01:00
Frederic Junod
785954f722 Move GeolocationProperty into Geolocation
`GeolocationProperty` is only used in `Geolocation`.
2018-11-06 08:38:53 +01:00
Tim Schaub
b8b3dcc066 Merge pull request #8884 from openlayers/greenkeeper/webpack-4.25.1
Update webpack to the latest version 🚀
2018-11-05 13:15:19 -07:00
greenkeeper[bot]
76c4c2f85c chore(package): update webpack to version 4.25.1 2018-11-05 19:04:35 +00:00
Tim Schaub
65bbee4c8b Merge pull request #8881 from fredj/dnd_style
Remove custom styles in drag-and-drop examples
2018-11-05 10:06:33 -07:00
Tim Schaub
10b56a4543 Merge pull request #8877 from tschaub/unconditional-context
Create context in vector tile layer constructor
2018-11-05 10:04:54 -07:00
Tim Schaub
42a094d730 Merge pull request #8883 from tschaub/new-ci
New test runner
2018-11-05 10:04:24 -07:00
Tim Schaub
680ce960e1 Test Chrome with CircleCI 2018-11-05 09:54:16 -07:00
Tim Schaub
77959efcff Updated dev dependencies 2018-11-05 09:28:19 -07:00
Frederic Junod
dc988cba60 Remove custom styles in drag-and-drop examples 2018-11-05 17:13:16 +01:00
Frédéric Junod
5f747cbf1b Merge pull request #8882 from fredj/import_path
Import simplification
2018-11-05 17:07:20 +01:00
Frédéric Junod
2b025e2266 Merge pull request #8858 from webgeodatavore/issue-7397
Add condition for viewParams and TypeScript related option
2018-11-05 16:28:09 +01:00
Frederic Junod
71ac0b18a9 Simplify import path in ol/reproj/ 2018-11-05 16:26:45 +01:00
Frederic Junod
3cf4dbfcc6 Simplify import path in ol/renderer/ 2018-11-05 16:26:45 +01:00
Frederic Junod
1732ed5a04 Simplify import path in ol/render/ 2018-11-05 16:26:45 +01:00
Frederic Junod
59c95dbe90 Simplify import path in ol/pointer/ 2018-11-05 16:26:45 +01:00
Frederic Junod
711afac80f Simplify import path in ol/format/ 2018-11-05 16:26:45 +01:00
Frederic Junod
43def3194f Simplify import path in ol/events/ 2018-11-05 16:26:45 +01:00
Frederic Junod
caf11a71f2 Simplify import path in ol/geom/ 2018-11-05 16:26:45 +01:00
Frederic Junod
53c2be0c7a Simplify import path in ol/proj/ 2018-11-05 16:26:45 +01:00
Frederic Junod
caaf8cb86f Simplify import path in ol/style/ 2018-11-05 16:26:45 +01:00
Frederic Junod
219dacb232 Simplify import path in ol/tilegrid/ 2018-11-05 16:26:45 +01:00
Frederic Junod
9ab201642c Simplify import path in ol/control/ 2018-11-05 16:26:45 +01:00
Frederic Junod
6d608c361a Simplify import path in ol/interaction/ 2018-11-05 16:26:45 +01:00
Frederic Junod
6a797e84ff Simplify import path in ol/layer/ 2018-11-05 16:26:45 +01:00
Frederic Junod
c12b41f8c6 Simplify import path in ol/source/ 2018-11-05 16:26:45 +01:00
Tim Schaub
aaad5b4977 Merge pull request #8879 from openlayers/circleci
Build with CircleCI
2018-11-05 06:59:35 -07:00
Tim Schaub
c2e756da05 Merge pull request #8878 from tschaub/test-log
Avoid logging 404 warnings
2018-11-05 06:58:23 -07:00
Andreas Hocevar
467e13fa2d Merge pull request #8880 from openlayers/greenkeeper/webpack-4.25.0
Update webpack to the latest version 🚀
2018-11-05 14:57:47 +01:00
greenkeeper[bot]
e0a46dd178 chore(package): update webpack to version 4.25.0 2018-11-05 09:38:54 +00:00
Tim Schaub
aeb3e5b271 Build with CircleCI 2018-11-04 22:10:00 -07:00
Tim Schaub
f34cb17ffa Avoid logging 404 warnings 2018-11-04 18:27:06 -07:00
Tim Schaub
5dfa82c27e Create context in vector tile layer constructor 2018-11-04 17:43:04 -07:00
Tim Schaub
e55cca1e7d Merge pull request #8876 from tschaub/extra-render-type
Remove RenderType enum from vector tile layer
2018-11-04 11:30:29 -07:00
Tim Schaub
d197864f5a Remove RenderType enum from vector tile layer 2018-11-04 10:27:35 -07:00
Tim Schaub
4d5d428a96 Merge pull request #8874 from tschaub/uncast
Remove unnecessary type casts in canvas layer renderer
2018-11-04 10:12:20 -07:00
Tim Schaub
0091bfa106 Remove unnecessary type casts in canvas layer renderer 2018-11-04 09:57:19 -07:00
Tim Schaub
765d2cdc9f Merge pull request #8872 from openlayers/greenkeeper/webpack-4.24.0
Update webpack to the latest version 🚀
2018-11-03 18:36:38 -06:00
Dmitry Fedorov
1de22f77dc merged with upstream and improved key handling 2018-11-02 17:19:10 -07:00
greenkeeper[bot]
f2b4555e1f chore(package): update webpack to version 4.24.0 2018-11-02 19:46:21 +00:00
Andreas Hocevar
3f69066d79 Merge pull request #8869 from ahocevar/typescript-fixes
Fix more types for TypeScript
2018-10-31 12:07:28 +01:00
Andreas Hocevar
1a00e20b1b Merge pull request #8868 from ahocevar/abstract-methods
Throw when calling abstract methods; fix abstract return types
2018-10-31 12:07:01 +01:00
Andreas Hocevar
c90b8c2a12 Merge pull request #8862 from ahocevar/legacy-build
Legacy build and apidoc improvements
2018-10-31 08:35:38 +01:00
Andreas Hocevar
6f57a272d0 Merge pull request #8867 from ahocevar/fix-examples
Fix example builder
2018-10-31 08:35:10 +01:00
ahocevar
1cdd040c96 Throw when calling abstract methods; fix abstract return types 2018-10-30 18:55:49 +01:00
ahocevar
1df9189d7f Fix more types for TypeScript 2018-10-30 18:55:03 +01:00
ahocevar
071a02556e Fix example builder 2018-10-30 18:25:01 +01:00
ahocevar
f8c0d284de Fix module paths 2018-10-29 19:15:01 +01:00
ahocevar
b50749e1ea Use jsdoc-plugin-typescript 2018-10-29 19:15:01 +01:00
ahocevar
e239eb338f Use webpack instead of rollup for the legacy build
This also changes the target path of the legacy build to build/legacy
2018-10-25 22:00:22 +02:00
ahocevar
1674620943 Use individual imports instead of * imports 2018-10-25 21:54:06 +02:00
ahocevar
6ceb03f86b Use typescript-plugin for generate-info task 2018-10-25 21:52:58 +02:00
ahocevar
ba20c6333b Move convert-types plugin to place for common use 2018-10-25 21:49:02 +02:00
Frédéric Junod
2adac0b3e7 Merge pull request #8860 from openlayers/greenkeeper/webpack-4.23.1
Update webpack to the latest version 🚀
2018-10-25 13:15:01 +02:00
greenkeeper[bot]
0a530725c6 chore(package): update webpack to version 4.23.1 2018-10-25 09:36:50 +00:00
Andreas Hocevar
391e38a973 Merge pull request #8852 from ahocevar/jsdoc-markdown
Improve link handling in API docs
2018-10-25 11:21:46 +02:00
Frédéric Junod
7f1728f8d4 Merge pull request #8855 from openlayers/greenkeeper/webpack-4.23.0
Update webpack to the latest version 🚀
2018-10-25 08:33:02 +02:00
ThomasG77
d3fdda6efc Add condition for viewParams and TypeScript related option 2018-10-25 05:46:49 +02:00
greenkeeper[bot]
1ed51d02e3 chore(package): update webpack to version 4.23.0 2018-10-24 18:13:06 +00:00
Andreas Hocevar
8f12177593 Merge pull request #8853 from ahocevar/rendercomplete-vector
Make rendercomplete work with vector sources without loader
2018-10-24 19:40:14 +02:00
ahocevar
f82619d6d0 Make rendercomplete work with vector sources without loader 2018-10-24 18:37:51 +02:00
ahocevar
453a723005 Improve link handling in API docs 2018-10-24 17:52:42 +02:00
Frédéric Junod
e8da3929d5 Merge pull request #8851 from fredj/rbush_types
Use typescript types for RBush
2018-10-24 17:21:17 +02:00
Frederic Junod
1f1951f3cc Use typescript types for RBush
The `toJSON` function simply returns the `data` property.
See: https://github.com/mourner/rbush/blob/v2.0.2/index.js#L184
2018-10-24 17:07:41 +02:00
Frédéric Junod
208f125158 Merge pull request #8850 from fredj/misc
Remove old TODO in ol/Graticule
2018-10-24 16:58:42 +02:00
Frederic Junod
df632dbaa9 Remove old TODO in ol/Graticule
Fixed with #8800
2018-10-24 16:51:35 +02:00
Andreas Hocevar
b11daa8344 Merge pull request #8847 from ahocevar/fix-apidocs
Fix API docs
2018-10-24 00:25:58 +02:00
Tim Schaub
0130ce71ba Merge pull request #8845 from tschaub/no-render-type
Remove RenderType enum from vector layer
2018-10-23 13:20:47 -06:00
ahocevar
3a42a0859c Fix event documentation 2018-10-23 18:05:43 +02:00
ahocevar
0593c352af Avoid duplicate documentation 2018-10-23 18:05:26 +02:00
ahocevar
724d141d3a Fix links and navigation 2018-10-23 18:05:02 +02:00
ahocevar
deb6c093a8 Update plugin chain to support JSDoc import types 2018-10-23 18:04:26 +02:00
ahocevar
0b21d1a6fc Document anonymous default exports 2018-10-23 18:01:46 +02:00
ahocevar
d1395d005c Fix comments for JSDoc 2018-10-23 17:58:50 +02:00
ahocevar
cd2f0f60d6 Make link texts consistent with docs 2018-10-23 17:40:51 +02:00
Tim Schaub
f58603bddf Remove RenderType enum from vector layer 2018-10-23 08:46:50 -06:00
Antoine Abt
1740f02737 Merge pull request #8843 from tonio/ts_fullscreen
Fix ts typing for fullscreen button
2018-10-23 14:18:46 +02:00
Frédéric Junod
0cd3e39fe8 Merge pull request #8841 from fredj/super
Use super.method instead of prototype.method.call
2018-10-23 13:25:11 +02:00
Frédéric Junod
d5c895aa8b Merge pull request #8842 from fredj/element_type
Change target type from Element to HTMLElement
2018-10-23 13:24:53 +02:00
Éric Lemoine
9810250fb4 Merge pull request #8840 from elemoine/ele_zindexkeys
Remove unneeded code in VectorTile renderer
2018-10-23 11:08:18 +02:00
Éric Lemoine
8a2f74fbe8 Merge pull request #8844 from elemoine/ele_crossorigin
Set crossOrigin to anonymous in mapbox-streets-v6-style
2018-10-23 11:04:38 +02:00
Andreas Hocevar
0801b9e0be Merge pull request #8776 from ahocevar/no-window-settimeout
Use setTimeout without the window namespace
2018-10-23 11:03:32 +02:00
Antoine Abt
fc8ba24d3f Store button and correctly type it. 2018-10-23 11:02:43 +02:00
Éric Lemoine
e0a018fa1e Set crossOrigin to anonymous in mapbox-streets-v6-style 2018-10-23 10:56:33 +02:00
Frederic Junod
3746ba99cf Change target type from Element to HTMLElement
Same as the parent class type for `MousePosition` and the type returned by the
`getViewport` function.
2018-10-23 09:17:17 +02:00
Frederic Junod
d294b87358 Use super.method instead of prototype.method.call 2018-10-23 09:15:51 +02:00
Éric Lemoine
29b21da608 Remove unneeded code in VectorTile renderer 2018-10-23 07:55:34 +02:00
Tim Schaub
0787aa3439 Merge pull request #8838 from openlayers/greenkeeper/webpack-4.22.0
Update webpack to the latest version 🚀
2018-10-21 07:42:34 -06:00
greenkeeper[bot]
41fea9905a chore(package): update webpack to version 4.22.0 2018-10-21 10:24:50 +00:00
Frédéric Junod
7cd7a4d111 Merge pull request #8837 from fredj/mp_reexport
Re-export MousePosition from ol/control
2018-10-20 18:44:47 +02:00
Frederic Junod
a06ad4940c Re-export MousePosition from ol/control 2018-10-19 14:05:55 +02:00
Frédéric Junod
6ff7747d98 Merge pull request #8832 from fredj/remove-source-foreachfeatureatcoordinate
Remove source foreachfeatureatcoordinate from ol/renderer/webgl/ImageLayer
2018-10-19 11:20:33 +02:00
Frédéric Junod
e4816faadf Merge pull request #8834 from openlayers/greenkeeper/webpack-4.21.0
Update webpack to the latest version 🚀
2018-10-18 08:34:30 +02:00
Frédéric Junod
f0c164802f Merge pull request #8833 from fredj/misc
Fix wrong filename in type annotation
2018-10-18 08:27:12 +02:00
greenkeeper[bot]
ae409f40d5 chore(package): update webpack to version 4.21.0 2018-10-17 18:36:13 +00:00
Frederic Junod
7e142080a1 Remove hasFeatureAtCoordinate from ol/renderer/webgl/ImageLayer 2018-10-17 17:08:53 +02:00
Frederic Junod
1a0f398f1f Fix wrong filename in type annotation 2018-10-17 15:47:15 +02:00
Frederic Junod
648ee4f4a4 Remove forEachFeatureAtCoordinate from ol/renderer/webgl/ImageLayer 2018-10-17 15:44:45 +02:00
Frédéric Junod
3d72490241 Merge pull request #8827 from schmidtk/remove-source-foreachfeatureatcoordinate
Removed unused forEachFeatureAtCoordinate from ol/source/Source
2018-10-17 15:09:37 +02:00
Kevin Schmidt
df4ef724b6 Removed unused forEachFeatureAtCoordinate from ol/source/Source
Fixes #8826.
2018-10-17 06:10:10 -06:00
Frédéric Junod
d2d041e54a Merge pull request #8830 from fredj/misc
Type annotation fixes in ol/control/
2018-10-17 13:26:05 +02:00
Frederic Junod
94fd57f690 Set projection property in MousePosition option optional 2018-10-17 10:56:11 +02:00
Frederic Junod
939aa565b5 Change ol/control/ScaleLine getUnits return type
Remove `undefined` from the return type: the default value is 'metric'
2018-10-17 10:48:19 +02:00
Frédéric Junod
1035ba7bf2 Merge pull request #8829 from fredj/getuid
Change getUid return type from number to string
2018-10-17 10:46:49 +02:00
Frederic Junod
041836c645 Change getUid return type from number to string 2018-10-17 10:22:53 +02:00
Frédéric Junod
a85099a36b Merge pull request #8825 from schmidtk/ts-misc-errors
Fix TypeScript errors
2018-10-17 09:45:28 +02:00
Éric Lemoine
cddfc11125 Merge pull request #8828 from elemoine/ele_source
Re-export VectorTile from ol/source
2018-10-17 07:49:03 +02:00
Éric Lemoine
d387702644 Re-export VectorTile from ol/source 2018-10-16 21:49:34 +02:00
Kevin Schmidt
49a4bf4248 Fix TypeScript error in ol/control/OverviewMap 2018-10-16 09:24:00 -06:00
Kevin Schmidt
1e90ffacec Avoid spread operator to fix TypeScript errors 2018-10-16 09:20:20 -06:00
Andreas Hocevar
43ca764293 Merge pull request #8806 from notnotse/preserve-fullscreen-button-class-names
Preserve button class name list in full screen control on toggle
2018-10-16 16:58:44 +02:00
Kevin Schmidt
fb11aad1d1 Fix geometry type in ol/renderer/vector#renderGeometry 2018-10-16 08:34:02 -06:00
Kevin Schmidt
f7adeac774 Fix arguments passed to forEachLayerAtCoordinate 2018-10-16 08:34:02 -06:00
Frédéric Junod
076d6425cb Merge pull request #8817 from romanzoller/wmts-document-image-format
Clarify format option for ol/source/WMTS
2018-10-16 16:20:36 +02:00
Frédéric Junod
2809784247 Merge pull request #8824 from schmidtk/ts-format-gml
Fix TypeScript errors in ol/format/GML
2018-10-16 16:09:58 +02:00
Kevin Schmidt
ee9c9bcefb Fix TypeScript errors in ol/format/GML 2018-10-16 07:20:22 -06:00
Andreas Hocevar
e37039d85e Merge pull request #8820 from hmdavidjunior/master
Polygon intersectsExtent failure - Issue #8795
2018-10-16 14:12:09 +02:00
Frédéric Junod
9362e33be9 Merge pull request #8519 from NielsCharlier/complex
GML Format Improvements #8516 #8517 #8518
2018-10-16 09:10:09 +02:00
Frederic Junod
aea9479c12 Rename parsers objects in ol/format/GML32 2018-10-16 08:48:42 +02:00
Frederic Junod
6b24760299 Fix jsdoc type notation 2018-10-16 08:26:41 +02:00
Niels Charlier
594a921598 Enable parsing complex features 2018-10-16 08:26:41 +02:00
NielsCharlier
2005c82dd2 add GML3.2 format 2018-10-16 08:26:41 +02:00
NielsCharlier
6252404d5b Fix GML Format featureMember tag 2018-10-16 08:25:53 +02:00
Frédéric Junod
316b4a1bb7 Merge pull request #8711 from schmidtk/ts-format-gml
Fix TypeScript errors in ol/format/GML
2018-10-16 08:25:41 +02:00
Hermes David Junior
7ec19645e9 Polygon intersectsExtent failure - Issue #8795 2018-10-15 10:00:37 -04:00
Andreas Hocevar
b43e5929f2 Merge pull request #8818 from cs09g/patch-1
fix the way zoom comes from
2018-10-15 14:23:07 +02:00
Seul-gi Choi(Chase)
f8585962b4 fix the way zoom comes from
fix zoom from view to tilegrid
2018-10-15 20:57:23 +09:00
Roman Zoller
43b9f70077 Clarify format option for ol/source/WMTS 2018-10-15 13:29:19 +02:00
Andreas Hocevar
6e7558e954 Merge pull request #8804 from notnotse/issue/8621-disable-collapsible-attributions-for-osm
Add possibility to disable collapsible attributions from Source
2018-10-14 12:16:36 +02:00
ahocevar
2768884044 Make new behavior overridable; update docs and examples 2018-10-14 12:10:40 +02:00
ahocevar
af4e5ca7cf Improve JSDoc 2018-10-14 09:57:26 +02:00
Andreas Hocevar
9285b283c0 Merge pull request #8787 from ahocevar/no-instanceof
Replace instanceof checks with other logic
2018-10-12 20:44:41 +02:00
ahocevar
9163558511 Replace instanceof checks with other logic 2018-10-12 20:35:59 +02:00
Frédéric Junod
80753eb909 Merge pull request #8808 from fredj/f8807
Fix format and version properties in ol/source/WMTS Options typedef
2018-10-12 12:53:23 +02:00
Andreas Hocevar
3e860d2c61 Merge pull request #8812 from rosedo/patch-1
Update snap.js
2018-10-12 12:15:03 +02:00
Andreas Hocevar
3ce80fbfb1 Merge pull request #8809 from notnotse/issue/8800-configurable-interval-options
Configurable interval options
2018-10-12 12:09:27 +02:00
Andreas Hocevar
8aebed1cd6 Add intervals default to documentation 2018-10-12 12:03:45 +02:00
Dominic Rose
90395c2355 Update snap.js
this was undefined inside the call to selectedFeatures.remove
2018-10-12 12:00:38 +02:00
itjope
50f90cdf61 Preserve button class name list in full screen control on toggle 2018-10-12 11:37:43 +02:00
Bobo Häggström
04f2174052 Add test for attributionsCollapsible property on source 2018-10-12 11:28:48 +02:00
Frédéric Junod
0f15d38ae7 Merge pull request #8798 from fredj/rawgit
Use unpkg.com instead of rawgit.com
2018-10-12 11:04:39 +02:00
Bobo Häggström
667f9a58f3 Add option to configure graticule interval limits 2018-10-12 10:41:12 +02:00
Bobo Häggström
2f4d31c8f4 Add possibility to disable collapsible attributions from Source 2018-10-12 09:28:34 +02:00
Frederic Junod
ad3f248825 Fix format and version properties in ol/source/WMTS Options typedef 2018-10-12 08:51:03 +02:00
Andreas Hocevar
c2c8cdab29 Merge pull request #8805 from notnotse/issue/8700-tile-scaled-below-zero
Do not draw image with width or height < 0.5
2018-10-11 19:40:41 +02:00
Andreas Hocevar
e828231449 Merge pull request #8803 from notnotse/zoom-slider-fix
Handle zoom slider position with floating point numbers
2018-10-11 17:38:34 +02:00
Bobo Häggström
dded939a07 Do not draw image with width or height < 0.5 2018-10-11 15:22:48 +02:00
Andreas Hocevar
945f686f8a Remove 2nd argument of parseFloat 2018-10-11 14:00:15 +02:00
itjope
2c6e80a601 Handle zoom slider position with floating point numbers 2018-10-11 12:50:51 +02:00
Andreas Hocevar
da41515944 Merge pull request #8799 from openlayers/greenkeeper/rollup-0.66.6
Update rollup to the latest version 🚀
2018-10-11 07:33:02 +02:00
greenkeeper[bot]
15c9fe7867 chore(package): update rollup to version 0.66.6 2018-10-10 15:12:48 +00:00
Frederic Junod
6d1cc3ba88 Use unpkg.com instead of rawgit.com 2018-10-10 15:11:07 +02:00
Frederic Junod
db15bb0942 Fix indentation 2018-10-10 14:55:33 +02:00
Frederic Junod
94da8dd0e2 Move adaptAttributions out of the class, set default Options values 2018-10-10 14:23:13 +02:00
Frédéric Junod
02b2be5b40 Merge pull request #8796 from openlayers/greenkeeper/rollup-plugin-commonjs-9.2.0
Update rollup-plugin-commonjs to the latest version 🚀
2018-10-10 10:36:23 +02:00
greenkeeper[bot]
7672fe3b16 chore(package): update rollup-plugin-commonjs to version 9.2.0 2018-10-10 04:21:56 +00:00
Frédéric Junod
04c2359d49 Merge pull request #8793 from openlayers/greenkeeper/rollup-plugin-buble-0.19.4
Update rollup-plugin-buble to the latest version 🚀
2018-10-09 12:58:37 +02:00
greenkeeper[bot]
f15ac14d2a chore(package): update rollup-plugin-buble to version 0.19.4 2018-10-09 11:41:25 +02:00
Frédéric Junod
177190403f Merge pull request #8794 from openlayers/greenkeeper/rollup-0.66.5
Update rollup to the latest version 🚀
2018-10-09 11:40:29 +02:00
greenkeeper[bot]
12786e4352 chore(package): update rollup to version 0.66.5 2018-10-09 05:43:29 +00:00
Kevin Schmidt
d308288eed Fix TypeScript errors in ol/format/GML 2018-10-08 05:36:21 -06:00
Frédéric Junod
d6aced3e43 Merge pull request #8789 from fredj/misc
Spelling and indentation fixes
2018-10-08 09:23:14 +02:00
Frederic Junod
720993431c Fix indentation 2018-10-08 08:50:40 +02:00
Frederic Junod
69dfbb9e54 Fix spelling 2018-10-08 08:30:10 +02:00
Tim Schaub
23473a8346 Merge pull request #8788 from openlayers/greenkeeper/front-matter-3.0.0
Update front-matter to the latest version 🚀
2018-10-06 22:26:12 -06:00
greenkeeper[bot]
414f6e0384 chore(package): update front-matter to version 3.0.0 2018-10-05 17:43:49 +00:00
Andreas Hocevar
96e99e481e Merge pull request #8782 from wallw-bits/fix-typecheck-render-feature
Fix getSimplifiedGeometry definition
2018-10-04 21:55:17 +02:00
Andreas Hocevar
f5e8e3e009 Merge pull request #8783 from wallw-bits/fix-typecheck-replaygroup
Fix missing method declaration
2018-10-04 21:53:55 +02:00
Andreas Hocevar
61dedbbe6d Merge pull request #8785 from openlayers/greenkeeper/rollup-0.66.4
chore(package): update rollup to version 0.66.4
2018-10-04 15:05:47 +02:00
greenkeeper[bot]
f3f138b9bc chore(package): update rollup to version 0.66.4
Closes #8777
2018-10-04 08:46:43 +00:00
William Wall
b8addb4c24 Fix missing method declaration
ol/renderer/vector was using the abstract ReplayGroup type while
referencing replayGroup.addDeclutter(), which was only defined
on the canvas and webgl implementations and was also defined
differently.
2018-10-03 16:08:26 -06:00
William Wall
8be23b799d Fix getSimplifiedGeometry definition
The override here should match the definition in ol/geom/Geometry
2018-10-03 15:23:10 -06:00
Marc Jansen
84dda90bfc Merge pull request #8781 from schmidtk/ts-misc-errors
Fix type check errors
2018-10-03 22:51:44 +02:00
Kevin Schmidt
a92c992e1a Cast to Array to avoid false union mismatch 2018-10-03 13:55:12 -06:00
Kevin Schmidt
c0903e6fc1 Cast overloaded ends property to fix type check errors 2018-10-03 13:23:40 -06:00
Kevin Schmidt
8d9fe7f688 Use void for optional return type 2018-10-03 13:23:05 -06:00
Andreas Hocevar
144c2f9f15 Merge pull request #8779 from schmidtk/ts-misc-errors
Fix additional type check errors
2018-10-03 19:38:55 +02:00
Andreas Hocevar
4a066670c2 Merge pull request #8753 from wallw-bits/fix-typecheck-pluggablemap
Fix type check in ol/PluggableMap.js
2018-10-03 19:33:12 +02:00
Kevin Schmidt
3781a6881d Fix type check errors in ol/layer/VectorTile 2018-10-03 11:24:41 -06:00
Kevin Schmidt
9d4821aafc Fix type check errors in ol/interaction/Snap 2018-10-03 11:20:56 -06:00
Kevin Schmidt
38aa620afa Fix type check errors in ol/layer/Layer 2018-10-03 10:42:05 -06:00
Kevin Schmidt
ddae414ddc Fix type check errors in ol/format/MVT 2018-10-03 10:41:52 -06:00
Kevin Schmidt
d3a82b0586 Fix type check errors in ol/pointer 2018-10-03 10:41:29 -06:00
Andreas Hocevar
83763a73d9 Merge pull request #8762 from schmidtk/ts-pointer-interaction-this
Fix type errors from interaction event handlers
2018-10-03 15:48:54 +02:00
Kevin Schmidt
07349de59b Add tests for interaction event handlers 2018-10-03 06:59:18 -06:00
Kevin Schmidt
909869b8b9 Fix type check errors in ol/interaction/Extent 2018-10-03 06:35:18 -06:00
Kevin Schmidt
942a0976be Move interaction event handlers to class methods 2018-10-03 06:30:09 -06:00
ahocevar
3397796ff2 Use setTimeout without the window namespace 2018-10-03 13:06:14 +02:00
ahocevar
9586c7cbc7 Get rid of private handler members 2018-10-03 05:06:01 -06:00
Kevin Schmidt
18570841d8 Move interaction event handlers to class methods 2018-10-03 05:06:01 -06:00
Andreas Hocevar
bafb9e4a8c Merge pull request #8763 from wallw-bits/fix-typecheck-events
Fix type check for ol/events
2018-10-03 11:52:44 +02:00
Tim Schaub
4cb5dc695b Merge pull request #8774 from schmidtk/ts-renderer-webgl
Fix type check errors in ol/renderer/webgl
2018-10-03 03:48:07 -06:00
Andreas Hocevar
4ca75e2aab Merge pull request #8768 from schmidtk/ts-interaction-select
Fix type check errors in ol/interaction/Select
2018-10-03 11:10:50 +02:00
Andreas Hocevar
56f623337b Merge pull request #8764 from schmidtk/ts-interaction-draw
Fix TypeScript errors in ol/interaction/Draw
2018-10-03 11:07:59 +02:00
ahocevar
3f79edba67 Use setTimeout with any return type 2018-10-03 10:50:44 +02:00
Andreas Hocevar
2799f0c824 Merge pull request #8767 from schmidtk/ts-interaction-modify
Fix type check errors in ol/interaction/Modify
2018-10-03 10:33:50 +02:00
Andreas Hocevar
cbd6aabea2 Merge pull request #8773 from schmidtk/ts-renderer-canvas
Fix type check errors in ol/renderer/canvas
2018-10-03 10:29:29 +02:00
Andreas Hocevar
5c737b21ae Merge pull request #8769 from schmidtk/ts-render-canvas
Fix type check errors in ol/render/canvas
2018-10-03 10:17:54 +02:00
Andreas Hocevar
0f9485a806 Merge pull request #8770 from schmidtk/ts-render-webgl
Fix type check errors in ol/render/webgl
2018-10-03 10:15:57 +02:00
Andreas Hocevar
bb544114ee Merge pull request #8765 from ahocevar/fixed-tileurlfunction-bye-bye
Simplify logic for fixed tile url functions
2018-10-03 10:10:18 +02:00
Frédéric Junod
c7813bbf45 Merge pull request #8766 from fredj/featurelike
Use FeatureLike typedef
2018-10-03 08:47:06 +02:00
Kevin Schmidt
e30293d07f Fix type check errors in ol/renderer/webgl 2018-10-02 15:36:02 -06:00
Kevin Schmidt
b26d81fd7e Fix type check errors in canvas tile renderers 2018-10-02 15:24:51 -06:00
Kevin Schmidt
d3e34f95c9 Fix type check errors in ol/renderer/canvas/VectorLayer 2018-10-02 15:24:51 -06:00
Kevin Schmidt
16faf064de Fix type check errors in ol/renderer/canvas/Map 2018-10-02 15:24:51 -06:00
Kevin Schmidt
be4afde507 Fix type check errors in ol/renderer/canvas/ImageLayer 2018-10-02 15:24:51 -06:00
Andreas Hocevar
2b8cee3e44 Merge pull request #8739 from schmidtk/ts-format-wmsgfi
Fix TypeScript errors in ol/format/WMSGetFeatureInfo
2018-10-02 21:27:54 +02:00
Andreas Hocevar
682fe47914 Merge pull request #8666 from schmidtk/ts-condition-fixes
Fix condition TypeScript errors
2018-10-02 21:10:10 +02:00
Kevin Schmidt
b1309578b4 Fix type check errors in ol/render/webgl/TextReplay 2018-10-02 12:59:41 -06:00
Kevin Schmidt
ecaec7bbfa Fix type check errors in ol/render/webgl/ReplayGroup 2018-10-02 12:55:59 -06:00
Kevin Schmidt
b4fced865d Fix type check errors in ol/render/webgl/Immediate 2018-10-02 12:54:27 -06:00
Kevin Schmidt
9b12b30100 Fix type check errors in ol/render/canvas/TextReplay 2018-10-02 12:39:45 -06:00
Kevin Schmidt
9ac00667b4 Fix type check errors in ol/render/canvas/Replay 2018-10-02 12:38:31 -06:00
Kevin Schmidt
452d5454cb Fix type check errors in ol/render/canvas/Immediate 2018-10-02 12:32:37 -06:00
ahocevar
4aff3d0631 Simplify logic for fixed tile url functions 2018-10-02 17:26:22 +02:00
Kevin Schmidt
2f151a7832 Fix type check errors in ol/interaction/Select 2018-10-02 08:57:25 -06:00
Kevin Schmidt
25cf54193a Fix type check errors in ol/interaction/Modify 2018-10-02 08:31:03 -06:00
Frederic Junod
ae87cad7ef Use FeatureLike typedef
Use `import("./Feature.js").FeatureLike` typedef instead of `import("./Feature.js").default|import("./render/Feature.js").default`
2018-10-02 12:58:56 +02:00
Kevin Schmidt
b6846d6b3d Use window.setTimeout to avoid TS conflict with Node's setTimeout 2018-10-01 15:41:03 -06:00
Kevin Schmidt
d62dd67942 Fix TypeScript errors in ol/interaction/Draw 2018-10-01 15:38:31 -06:00
William Wall
2517b838b6 Fix type check for ol/events
Cast to ol/events/Target since the function declarations only match
between EventTarget and Target for the first two parameters.
2018-10-01 14:02:12 -06:00
William Wall
9fc8475586 Fix type check in ol/PluggableMap.js
- Added JSDoc to getRenderer()
- Cast default options to types
- Cast event to MouseEvent to satisfy tsc. Non mouse/touch events
  will simply produce [NaN, NaN]
- Cast to Layer before calling getSource(), as it does not exist
  on Base
2018-10-01 12:49:47 -06:00
Andreas Hocevar
023ad3c531 Merge pull request #8757 from schmidtk/ts-typeof-ctor
Use typeof to simplify JSDoc class types
2018-10-01 18:33:35 +02:00
Kevin Schmidt
26f1cba808 Remove JSDoc to work around issue solved by typeof 2018-10-01 10:24:55 -06:00
Frédéric Junod
76dda0c422 Merge pull request #8759 from fredj/es6_examples
Use es6 class inheritance in examples
2018-10-01 17:12:20 +02:00
Andreas Hocevar
31ac0eb406 Merge pull request #8761 from schmidtk/ts-feature-types
Allow returning RenderFeature in ol/format/Feature
2018-10-01 17:04:36 +02:00
Kevin Schmidt
c5a9d5b0bc Move FeatureClass and FeatureLike to ol/Feature 2018-10-01 08:59:55 -06:00
Kevin Schmidt
7dbe38358a Replace TileClass with typeof ImageTile 2018-10-01 08:37:01 -06:00
Kevin Schmidt
accdc79c05 Use typeof to simplify JSDoc class types 2018-10-01 08:30:06 -06:00
Kevin Schmidt
7056eb8536 Allow returning RenderFeature in ol/format/Feature
Resolves #8760
2018-10-01 08:24:30 -06:00
Andreas Hocevar
88cde255f8 Merge pull request #8758 from schmidtk/ts-kml-color-node
Fix TS error and prevent extra string conversion
2018-10-01 15:45:32 +02:00
Frederic Junod
47b68ed96d Use es6 class inheritance in examples
Instead of using the deprecated `inherits` function.
2018-10-01 15:44:18 +02:00
Kevin Schmidt
d6b99a5a25 Fix TS error and prevent extra string conversion 2018-10-01 07:29:16 -06:00
Frédéric Junod
a2c7eb80fd Merge pull request #8736 from fredj/misc
Typescript misc fixes
2018-10-01 08:29:02 +02:00
Tim Schaub
6f1f85b729 Merge pull request #8741 from schmidtk/ts-geom
Fix TypeScript errors in ol/geom/*
2018-09-30 20:50:28 -07:00
Tim Schaub
2034e3f63b Merge pull request #8707 from schmidtk/ts-format-feature
Fix TypeScript errors in ol/format/Feature
2018-09-30 20:41:55 -07:00
Marc Jansen
8b26e53067 Merge pull request #8754 from wallw-bits/fix-typecheck-math
Fix type check in ol/math
2018-09-30 09:28:08 +02:00
Frédéric Junod
40ee806c27 Merge pull request #8747 from fredj/faq_modules
Update doc/faq.md
2018-09-30 07:38:15 +02:00
William Wall
831505c425 Fix type check in ol/math
tsc considers everything in the else block to be of type 'never',
since it thinks that cosh is permanently defined for Math. Casting
back to Math in the else block fixes the error.
2018-09-29 16:40:15 -06:00
Andreas Hocevar
b49f2448c7 Merge pull request #8744 from wallw-bits/fix-typecheck-vectortilesource
Fix type checks in VectorTileSource
2018-09-29 20:44:56 +02:00
Frederic Junod
513e11d263 Update doc/faq.md
Change code snippet to use es6 modules.
2018-09-29 08:58:02 +02:00
Frédéric Junod
01923ddbb2 Merge pull request #8740 from benVigie/updateFirefoxTextTestTolerance
Increase linestring textalign test tolerance to be Firefox compliant.
2018-09-29 08:34:48 +02:00
Frédéric Junod
313b00b8f3 Merge pull request #8738 from schmidtk/ts-format-xmlfeature
Cast to parent type to fix TS errors
2018-09-29 08:23:29 +02:00
Frédéric Junod
5abcaebabc Merge pull request #8737 from schmidtk/ts-format-topojson
Flag optional param to fix TS error
2018-09-29 08:18:09 +02:00
William Wall
a685e85c10 Fix type checks in VectorTileSource
Use typeof(Class) instead of defining a typedef for the tile class
2018-09-28 12:33:33 -06:00
Andreas Hocevar
9cbe9926b4 Merge pull request #8742 from wallw-bits/fix-typecheck-vectorsource-2
Fix type checks in Vector source
2018-09-28 18:20:46 +02:00
Andreas Hocevar
efea43d008 Merge pull request #8743 from wallw-bits/fix-typecheck-rastersource
Fix type check in Raster source
2018-09-28 18:20:07 +02:00
William Wall
0bbbd33bb1 Fix type check in Raster source 2018-09-28 09:38:33 -06:00
William Wall
4da372d515 Fix type checks in Vector source
The getResolutions override is unnecessary because the parent
implementation also returns undefined.
2018-09-28 09:24:55 -06:00
Kevin Schmidt
7d5a81d40f Fix TypeScript errors in ol/geom/* 2018-09-28 09:00:28 -06:00
Benjamin Vigie
f8b0eb9648 Increase linestring textalign test tolerance to be Firefox compliant. 2018-09-28 10:42:17 -04:00
Kevin Schmidt
df7c89baeb Fix TypeScript errors in ol/format/WMSGetFeatureInfo 2018-09-28 08:15:59 -06:00
Kevin Schmidt
497aef7309 Cast to parent type to fix TS errors 2018-09-28 07:58:43 -06:00
Kevin Schmidt
73a48eb3d4 Flag optional param to fix TS error 2018-09-28 07:56:07 -06:00
Andreas Hocevar
63f583e148 Merge pull request #8733 from schmidtk/ts-format-wfs
Fix TypeScript errors in ol/format/WFS
2018-09-28 13:19:14 +02:00
Andreas Hocevar
54fa2bdc94 Merge pull request #8735 from schmidtk/ts-format-wkt
Fix TypeScript errors in ol/format/WKT
2018-09-28 12:45:09 +02:00
Frederic Junod
8c69380ef6 Fix wrong property name in Stroke constructor 2018-09-28 09:13:43 +02:00
Frederic Junod
fa7a92b565 Add msTransform property in types/dom.d.ts 2018-09-28 09:13:43 +02:00
Frederic Junod
3d9b1af105 Remove 'extent' properties from ol/source/Tile children classes 2018-09-28 09:13:43 +02:00
Frederic Junod
f58cd03f3b Remove extra parameters 2018-09-28 09:13:43 +02:00
Andreas Hocevar
2e41302fc3 Merge pull request #8730 from schmidtk/ts-format-kml
Fix TypeScript errors in ol/format/KML
2018-09-28 08:31:32 +02:00
Frederic Junod
6ce56329dd Fix wrong type 2018-09-28 08:21:12 +02:00
Frédéric Junod
368fb2c6e8 Merge pull request #8732 from wallw-bits/fix-typecheck-tilesource
Fix type check in ol/source/Tile
2018-09-28 08:19:58 +02:00
Kevin Schmidt
280741f8d1 Fix TypeScript errors in ol/format/WKT 2018-09-27 14:46:15 -06:00
Kevin Schmidt
d4d45001f6 Fix TypeScript errors in ol/format/WFS 2018-09-27 14:03:06 -06:00
Kevin Schmidt
f8d3c8e140 Fix TypeScript errors in ol/format/KML 2018-09-27 13:33:41 -06:00
William Wall
1ee0c50c8a Fix type check in ol/source/Tile
Remove 'extent' because the parent Source class does not contain
'extent' on its options or use options.extent in the constructor.
Also removed 'extent' from 'Options' for 'TileSource'.
2018-09-27 10:47:51 -06:00
Frédéric Junod
2752541ff1 Merge pull request #8731 from fredj/GeolocationError
Dispatch a GeolocationError in Geolocation
2018-09-27 16:56:42 +02:00
Frederic Junod
39951a792d Dispatch a GeolocationError in Geolocation
See https://github.com/openlayers/openlayers/pull/8657#discussion_r219051918
2018-09-27 16:51:17 +02:00
Frédéric Junod
2d68f1506c Merge pull request #8729 from fredj/misc
Move functions out of the PointerEvent class
2018-09-27 16:05:54 +02:00
Frederic Junod
05c0b77a52 Move functions out of the PointerEvent class 2018-09-27 13:49:18 +02:00
Frédéric Junod
5bfd82a9bf Merge pull request #8724 from fredj/ts_fixes
Typescript misc fixes
2018-09-27 10:47:57 +02:00
Frederic Junod
4fbd7f2acd Add missing backtick 2018-09-27 10:18:47 +02:00
Frederic Junod
60c5d016a6 Remove unused 'opaque' property from ol/source/Stamen options
And set the `layer` property as mandatory.
2018-09-27 10:00:02 +02:00
Frederic Junod
7eee6ba07a Remove '=' from type when the parameter is not optional 2018-09-27 10:00:02 +02:00
Frederic Junod
d8ee6acefa Remove extra imports in jsdoc 2018-09-27 10:00:02 +02:00
Frédéric Junod
a4212abbb2 Merge pull request #8717 from fredj/ts_TileArcGISRest
Fix type checks in TileArcGISRest
2018-09-27 08:28:56 +02:00
Tim Schaub
2f51785968 Merge pull request #8718 from schmidtk/ts-format-gpx
Fix TypeScript errors in ol/format/GPX
2018-09-26 21:24:49 -07:00
Tim Schaub
ca9ac8e950 Merge pull request #8719 from openlayers/greenkeeper/marked-0.5.1
Update marked to the latest version 🚀
2018-09-26 21:23:15 -07:00
greenkeeper[bot]
80399f09df chore(package): update marked to version 0.5.1 2018-09-26 14:42:11 +00:00
Frédéric Junod
047f7ecf04 Merge pull request #8706 from schmidtk/ts-types-esrijson
Use EsriJSON types from @types/arcgis-rest-api
2018-09-26 15:56:27 +02:00
Frédéric Junod
277ecca881 Merge pull request #8709 from schmidtk/ts-format-geojson
Fix TypeScript errors in ol/format/GeoJSON
2018-09-26 15:54:20 +02:00
Frederic Junod
9cf7c71df8 Fix type checks in TileArcGISRest 2018-09-26 15:51:55 +02:00
Frédéric Junod
55b300082a Merge pull request #8708 from wallw-bits/fix-typecheck-imagecanvas
Fix type checks in ImageCanvas source
2018-09-26 15:50:42 +02:00
Kevin Schmidt
922e3824fb Fix TypeScript errors in ol/format/GPX 2018-09-26 07:38:12 -06:00
Andreas Hocevar
3b747f4d2d Merge pull request #8710 from wallw-bits/fix-typecheck-imagearcgis
Fix type checks in ImageArcGISRest
2018-09-26 11:10:27 +02:00
Andreas Hocevar
ce3988cfbb Merge pull request #8714 from openlayers/greenkeeper/webpack-4.20.2
chore(package): update webpack to version 4.20.2
2018-09-26 07:40:07 +02:00
greenkeeper[bot]
8f6f4de433 chore(package): update webpack to version 4.20.2
Closes #8705
2018-09-26 05:02:09 +00:00
William Wall
d37e04e8f3 Fix type checks in ImageArcGISRest
Added proper @link tags to links in descriptions. Fixed unclosed
backtick. Made params optional like the description says.
2018-09-25 14:00:23 -06:00
Kevin Schmidt
a6223abdce Fix TypeScript errors in ol/format/GeoJSON 2018-09-25 13:14:20 -06:00
Kevin Schmidt
e9baa2cfc4 Fix TypeScript errors in ol/format/Feature 2018-09-25 13:03:43 -06:00
William Wall
3ba789eae6 Fix type checks in ImageCanvas source
Fixed constructor docs specifying optional options without a
default value. Fixed malformed @link tag in typedef description.
canvasFunction type was previously declared with the 'this' type
as ImageCanvas, but the 'this' ref was not passed on the scope when
calling the function.
2018-09-25 13:01:02 -06:00
Kevin Schmidt
02d5d21d0d Use EsriJSON types from @types/arcgis-rest-api
Resolves #8597
2018-09-25 12:31:22 -06:00
Andreas Hocevar
be12573883 Merge pull request #8703 from openlayers/greenkeeper/webpack-4.20.0
Update webpack to the latest version 🚀
2018-09-25 15:04:16 +02:00
greenkeeper[bot]
8cfb4e9384 chore(package): update webpack to version 4.20.0 2018-09-25 09:48:31 +00:00
Andreas Hocevar
d9698dcb06 Merge pull request #8698 from intouch-smartwater/fix-zoom-slider-events
Fix zoom slider events
2018-09-24 13:15:43 +02:00
Frédéric Junod
708557afef Merge pull request #8697 from fredj/fix-typecheck-cluster
Remove unused properties from Cluster and Image options
2018-09-24 13:14:06 +02:00
James Cheese
9c5227850f Remove events causing errors on touch-screen devices.
Fix for case #5226
2018-09-24 09:55:13 +01:00
James Cheese
49ee4bbd1c Adding tests for ZoomSlider drags ending out of bounds.
As per the existing tests for the slider, ensure that listeners are unbound
correctly and values are as expected.
2018-09-24 09:55:13 +01:00
James Cheese
75947a6759 Revert changes from 7b687be
Adapted the changes to new class structures introduced since the original
deletion before committing, to ensure that everything compiles correctly.
2018-09-24 09:55:13 +01:00
Frederic Junod
7d1b90c7d2 Remove unused extent property from ol/source/Image options 2018-09-24 10:14:33 +02:00
Frederic Junod
557e2c9029 Remove extra imports in jsdoc
The symbols are already imported (es6 import)
2018-09-24 10:11:03 +02:00
Frederic Junod
3b208864bc Remove unused properties from Cluster options
Follow up on #8692
2018-09-24 10:06:25 +02:00
Frédéric Junod
32dea69f5e Merge pull request #8688 from fredj/ts_fixes
Fix PointerEventHandler event type
2018-09-24 10:02:49 +02:00
Frédéric Junod
7d36b893d3 Merge pull request #8686 from fredj/import
Remove extra imports in jsdoc
2018-09-24 10:02:27 +02:00
Tim Schaub
5ee1fd50fa Merge pull request #8681 from wallw-bits/fix-typecheck-webgl-tilelayer
Check the type of the source before using it
2018-09-22 06:23:31 -06:00
Tim Schaub
681941b537 Merge pull request #8691 from romanzoller/fix-error-url
Fix assertion error documentation URL
2018-09-22 06:19:57 -06:00
Tim Schaub
7c5ff5422d Merge pull request #8692 from wallw-bits/fix-typecheck-cluster
Type check fixes for Cluster source
2018-09-21 23:11:58 -06:00
Tim Schaub
c9068526e7 Merge pull request #8677 from wallw-bits/fix-typecheck-vectorsource
Type check fixes for VectorSource
2018-09-21 16:58:24 -06:00
Tim Schaub
9fd4807920 Merge pull request #8684 from wallw-bits/fix-typecheck-bingmaps
Define BingMapsImageryMetadataResponse type
2018-09-21 16:57:13 -06:00
Tim Schaub
16bd9a5450 Merge pull request #8690 from wallw-bits/fix-typecheck-cartodb
Fix type checks in CartoDB
2018-09-21 16:53:54 -06:00
Tim Schaub
ada7e404b1 Merge pull request #8693 from wallw-bits/fix-typecheck-image-source
Fix type check errors for Image source
2018-09-21 16:51:35 -06:00
William Wall
1c10bbf94c Fix arithmetic error on potential array
And also add zoomMax to response type
2018-09-21 11:57:25 -06:00
William Wall
1da2db83da Fix type check errors for Image source
The parent class does not accept an extent on its options. Also
check that the image is an img or video tag before setting the
source as Canvas does not have the src property.
2018-09-21 08:35:41 -06:00
William Wall
10c8371b38 Type check fixes for Cluster source
Removed options unused by super class.
2018-09-21 08:21:20 -06:00
Roman Zoller
5c5fc3f892 Fix assertion error documentation URL
Prefix version number with 'v' to obtain correct URL.

This fixes #8556.
2018-09-21 16:03:39 +02:00
William Wall
82cfa54584 Fix type checks in CartoDB
Removed state from super call options because super doesn't use it.
Defined CartoDBLayerInfo response type.
2018-09-21 08:00:45 -06:00
Frederic Junod
69c6db0bc7 Allow TouchEvent to be passed to getEventPixel 2018-09-21 09:23:03 +02:00
Frederic Junod
9b447ef3ed Fix PointerEventHandler event type 2018-09-21 09:19:05 +02:00
Frederic Junod
821a08ea79 Remove extra imports in jsdoc
The symbols are already imported (es6 import)
2018-09-21 09:12:06 +02:00
Frédéric Junod
a31453b55f Merge pull request #8646 from openlayers/greenkeeper/mustache-3.0.0
Update mustache to the latest version 🚀
2018-09-21 08:39:07 +02:00
Frédéric Junod
5b43b9f151 Merge pull request #8645 from openlayers/greenkeeper/rollup-plugin-uglify-6.0.0
Update rollup-plugin-uglify to the latest version 🚀
2018-09-21 08:38:45 +02:00
Frédéric Junod
bf6ecd7667 Merge pull request #8685 from openlayers/greenkeeper/rollup-0.66.2
Update rollup to the latest version 🚀
2018-09-21 08:28:50 +02:00
Frédéric Junod
725687c987 Merge pull request #8672 from fredj/raster_source_types
Fix source type in Raster source
2018-09-21 08:22:59 +02:00
greenkeeper[bot]
fca3bed6dc chore(package): update rollup to version 0.66.2 2018-09-21 05:26:48 +00:00
William Wall
fd0d6ff6f6 Define BingMapsImageryMetadataResponse type 2018-09-20 16:25:48 -06:00
Tim Schaub
aa39a8a508 Merge pull request #8665 from wallw-bits/fix-typecheck-rbush
Fix type check errors in RBush
2018-09-20 11:09:07 -06:00
Tim Schaub
c472910aae Merge pull request #8680 from schmidtk/ts-events-fixes
TypeScript fixes for ol/events
2018-09-20 11:03:13 -06:00
William Wall
7ff974be2c Remove superfluous bitwise operations 2018-09-20 10:27:13 -06:00
Tim Schaub
c414bd5923 Merge pull request #8678 from wallw-bits/fix-typecheck-source-tileimage
Ensure image is Image or Video before settings src
2018-09-20 09:40:29 -06:00
Tim Schaub
57bd015972 Merge pull request #8676 from wallw-bits/fix-typecheck-wmts
Cast tileGrid to WMTSTileGrid for type check
2018-09-20 04:24:08 -06:00
Tim Schaub
abeb6490e0 Merge pull request #8679 from wallw-bits/fix-typecheck-triangulation
Type check fixes in Triangulation
2018-09-20 04:20:29 -06:00
Tim Schaub
85407a45f2 Merge pull request #8683 from openlayers/greenkeeper/rollup-0.66.1
Update rollup to the latest version 🚀
2018-09-19 22:05:46 -06:00
greenkeeper[bot]
399e2587bb chore(package): update rollup to version 0.66.1 2018-09-19 22:38:34 +00:00
Tim Schaub
edfbb35c03 Merge pull request #8657 from fgravin/fgravin_help_typescript
Typescript fixes
2018-09-19 16:02:07 -06:00
William Wall
016436ae18 Check that tile is ImageTile before using it 2018-09-19 15:04:14 -06:00
Kevin Schmidt
34323c0618 Fix TypeScript error in Target 2018-09-19 14:42:45 -06:00
Kevin Schmidt
0ac94c93ff Fix TypeScript errors managing ol_lm on event targets 2018-09-19 14:42:45 -06:00
William Wall
7525c57688 Check the type of the source before using it
This satisfies tsc in addition to making the class more defensive
against source types that it does not support.
2018-09-19 14:39:10 -06:00
William Wall
a4aaab5e32 Change bitwise or assignment to boolean assignment
Because `tsc` does not like using bitwise operations on booleans.
2018-09-19 13:00:55 -06:00
Tim Schaub
e873949b31 Merge pull request #8671 from fgravin/fgravin_typescript_fixes_2
Fix typescript in FeatureLoader
2018-09-19 12:16:37 -06:00
William Wall
adfc174af3 Ensure image is Image or Video before settings src
Canvas elements do not contain the 'src' property.
2018-09-19 12:12:50 -06:00
Tim Schaub
d44ba929ab Merge pull request #8675 from wallw-bits/fix-typecheck-zoomify
Get width as number from number|Size
2018-09-19 11:55:35 -06:00
William Wall
20125ae96c Type check fixes for VectorSource
Added parameter types to event listeners. Fixed return type for
feature collection branch. Removed duplicate template definition.
2018-09-19 11:04:35 -06:00
William Wall
0994362bfe Cast tileGrid to WMTSTileGrid for type check 2018-09-19 10:31:28 -06:00
William Wall
45f2324a4e Get width as number from number|Size
This satisfies tsc in addition to being a bit more defensive from
custom tile grids, even if using them is very uncommon for this
source.
2018-09-19 10:02:33 -06:00
Florent gravin
9c6e14b050 Remove duplicate containsXY fn 2018-09-19 16:51:43 +02:00
Florent gravin
8b83371272 Feature opt_geometryOrProperties cannot be null 2018-09-19 16:48:51 +02:00
Florent gravin
25ade66017 Fix type conflict between Event and events/Event.js 2018-09-19 16:48:51 +02:00
Florent gravin
f3fb88905e Use window.setTimeout for correct type checking 2018-09-19 16:48:51 +02:00
Florent gravin
e740e7577a Secure type of HTMLImageElement in ImageTile 2018-09-19 16:48:51 +02:00
Florent gravin
d062904cc1 Correct ol event type propagation in Geolocation positionError 2018-09-19 16:48:51 +02:00
Florent gravin
cd169ede0d Correct cast of Projection in Geometry.transform 2018-09-19 16:48:51 +02:00
Florent gravin
bd655b325d Implement Geometry containsXY with correct signature 2018-09-19 16:48:51 +02:00
Florent gravin
7f32ba4216 Use Style instead of import(./style/Style.js).default 2018-09-19 16:47:51 +02:00
Florent gravin
109f16f717 Use Geometry instead of import(./geom/Geometry.js).default 2018-09-19 16:47:51 +02:00
Florent gravin
b3127f86be Fix cast for Geometry type 2018-09-19 16:47:51 +02:00
Florent gravin
e25d053ba6 Featureloader this reference can also be ol.VectorTile 2018-09-19 16:43:10 +02:00
Frederic Junod
3029a07c1a Fix source type in Raster source
The `sources` is an array of layer or source
2018-09-19 15:34:34 +02:00
Frédéric Junod
978b039ddc Merge pull request #8654 from fredj/import
Remove extra imports in jsdoc
2018-09-19 15:12:10 +02:00
Frédéric Junod
65066a0505 Merge pull request #8655 from fredj/webkit_touch
Remove webkit specific properties from Touch
2018-09-19 15:05:20 +02:00
Frédéric Junod
43bc3020a1 Merge pull request #8663 from schmidtk/ts-vendor-fullscreen
Add vendor-specific TS declarations for the Fullscreen API.
2018-09-19 15:05:05 +02:00
Frédéric Junod
5f63575106 Merge pull request #8658 from fredj/proto_void
Don't define functions in the prototype
2018-09-19 14:53:59 +02:00
Frederic Junod
9c52e0d6d9 Remove extra imports in jsdoc
The symbols are already imported (es6 import)
2018-09-19 14:52:58 +02:00
Tim Schaub
77dbf2fdb0 Merge pull request #8662 from wallw-bits/fix-typecheck-ol-tile
Explicitly define type of 'this'
2018-09-19 06:50:59 -06:00
Tim Schaub
ad399246a3 Merge pull request #8664 from schmidtk/ts-listener-fn
Add native Event to ListenerFunction signature.
2018-09-19 06:47:18 -06:00
Frédéric Junod
23be1ac56d Merge pull request #8668 from fredj/module_doc
Add missing 'module' annotation
2018-09-19 14:07:09 +02:00
Frederic Junod
600d156d01 Add missing 'module' annotation 2018-09-19 11:51:34 +02:00
Frédéric Junod
40227db7be Merge pull request #8656 from openlayers/greenkeeper/rollup-plugin-commonjs-9.1.8
chore(package): update rollup-plugin-commonjs to version 9.1.8
2018-09-19 11:29:51 +02:00
Frederic Junod
54cdaddf3a Don't use Chrome only ALLOW_KEYBOARD_INPUT param 2018-09-19 11:12:27 +02:00
Frédéric Junod
5a62d403c0 Merge pull request #8667 from openlayers/greenkeeper/uglifyjs-webpack-plugin-2.0.1
chore(package): update uglifyjs-webpack-plugin to version 2.0.1
2018-09-19 09:26:28 +02:00
Frédéric Junod
eade74384a Merge pull request #8661 from openlayers/greenkeeper/webpack-4.19.1
Update webpack to the latest version 🚀
2018-09-19 09:24:58 +02:00
Frederic Junod
31c392b63c Remove containsXY function from ol/geom/SimpleGeometry
The function is already present in the base class (ol/geom/Geometry)
2018-09-19 08:40:14 +02:00
Frederic Junod
7cb85fa975 Don't define functions in the prototype
If `VOID` is used, TypeScript is not able to figure out what the function parameters are.

Before:
```
$ npx tsc | wc -l
    1188
```

After:
```
$ npx tsc | wc -l
    1169
```
2018-09-19 08:40:14 +02:00
Kevin Schmidt
f8396d8f35 Fix condition TypeScript errors 2018-09-18 15:29:13 -06:00
Kevin Schmidt
4d26ab751d Add vendor-specific TS declarations for the Fullscreen API.
Fixes #8660.
2018-09-18 13:22:55 -06:00
Kevin Schmidt
f819ed137b Add native Event to ListenerFunction signature. 2018-09-18 13:10:36 -06:00
greenkeeper[bot]
91d31b57ec chore(package): update uglifyjs-webpack-plugin to version 2.0.1
Closes #8639
2018-09-18 17:00:44 +00:00
William Wall
1fbefcab64 Explicitly define type of 'this'
I'm not entirely sure that I like this pattern, but there does not
appear to be a better option since TypeScript would recommend:

  function(this: SomeClass, ...)

tsdoc does not appear to support an associated annotation for the
function a la @this {SomeClass}.
2018-09-18 10:38:23 -06:00
greenkeeper[bot]
b2bcbcbc04 chore(package): update webpack to version 4.19.1 2018-09-18 14:27:10 +00:00
Frederic Junod
960b433a2c Remove webkit specific properties from Touch
Remove the following errors from the TypeScript checks:
```
src/ol/pointer/TouchSource.js(231,23): error TS2339: Property 'webkitRadiusX' does not exist on type 'Touch'.
src/ol/pointer/TouchSource.js(232,24): error TS2339: Property 'webkitRadiusY' does not exist on type 'Touch'.
src/ol/pointer/TouchSource.js(233,26): error TS2339: Property 'webkitForce' does not exist on type 'Touch'.
```

The only reference that I've found for these properties is a warning message from Google Chrome:
```
'Touch.webkitRadiusX' is deprecated and will be removed in M47, around November 2015. Please use 'Touch.radiusX' instead.
```
2018-09-18 13:36:38 +02:00
greenkeeper[bot]
d777a6319b chore(package): update rollup-plugin-commonjs to version 9.1.8
Closes #8653
2018-09-18 10:54:15 +00:00
Frédéric Junod
5910e4d207 Merge pull request #8644 from openlayers/greenkeeper/rollup-0.66.0
Update rollup to the latest version 🚀
2018-09-18 09:12:34 +02:00
Tim Schaub
340a446b51 Merge pull request #8643 from schmidtk/style-typescript-cleanup
Fix style TypeScript errors
2018-09-17 14:35:50 -06:00
Kevin Schmidt
124fccf127 Fix style TypeScript errors 2018-09-17 12:38:00 -06:00
greenkeeper[bot]
74417a05d0 chore(package): update mustache to version 3.0.0 2018-09-16 20:43:30 +00:00
greenkeeper[bot]
3ffd7683d5 chore(package): update rollup-plugin-uglify to version 6.0.0 2018-09-16 14:12:44 +00:00
greenkeeper[bot]
457cbc9d9b chore(package): update rollup to version 0.66.0 2018-09-16 08:42:40 +00:00
Andreas Hocevar
7912c5d711 Merge pull request #8638 from ahocevar/fix-haslistener-check
Fix event type in hasListener check
2018-09-15 09:08:55 +02:00
Dmitry Fedorov
7d77d05a57 fix dangling comma 2018-09-14 13:58:13 -07:00
Dmitry Fedorov
028caa4664 fixes for optional key handling 2018-09-14 12:02:37 -07:00
ahocevar
90403421af Fix event type in hasListener check 2018-09-14 18:15:18 +02:00
Frédéric Junod
fe0ac80ba4 Merge pull request #8618 from fredj/topojson_types
Use TopoJSON types from @types/topojson
2018-09-14 13:09:43 +02:00
Frederic Junod
ba53b5e8aa Quotes topojson properties 2018-09-14 13:02:30 +02:00
Frederic Junod
abc3279752 Use TopoJSON types from @types/topojson 2018-09-14 13:02:30 +02:00
Frédéric Junod
84c689d456 Merge pull request #8619 from fredj/typing
Remove wrong Geometry type in KML format
2018-09-14 12:46:31 +02:00
Andreas Hocevar
693d1b24c6 Merge pull request #8631 from openlayers/greenkeeper/webpack-4.19.0
Update webpack to the latest version 🚀
2018-09-14 10:32:01 +02:00
greenkeeper[bot]
cdaca7b0ff chore(package): update webpack to version 4.19.0 2018-09-14 06:02:06 +00:00
Andreas Hocevar
3ccfc2ea61 Merge pull request #8630 from openlayers/greenkeeper/webpack-4.18.1
Update webpack to the latest version 🚀
2018-09-13 17:14:58 +02:00
greenkeeper[bot]
b351eaef29 chore(package): update webpack to version 4.18.1 2018-09-13 12:51:18 +00:00
Andreas Hocevar
14eb3fde14 Merge pull request #8627 from ahocevar/fix-textstate-type
Fix several type imports
2018-09-13 14:50:31 +02:00
ahocevar
f29e6ac397 Fix more incorrect type imports 2018-09-13 11:42:59 +02:00
ahocevar
79674363e6 Fix imports in TextState 2018-09-13 11:42:59 +02:00
Andreas Hocevar
0ce7402d61 Merge pull request #8629 from megawac/patch-1
Enable circle primitive in draw-shapes example
2018-09-13 07:25:09 +02:00
Graeme Yeates
00474dc038 Enable circle primitive in draw-shapes example
For some reason the circle polygon type was not available in the select despite the example code handling drawing circles.
2018-09-12 16:50:59 -04:00
Marc Jansen
8d054a404a Merge pull request #8626 from marcjansen/less-TS2345
Better type annotations / type casts
2018-09-12 05:45:51 +02:00
Marc Jansen
143bf731b6 Better type annotations / type casts 2018-09-11 21:59:54 +02:00
Tim Schaub
d4bbbcb690 Merge pull request #8622 from tschaub/unused
Remove unused method
2018-09-11 12:36:49 -06:00
Tim Schaub
f9f2f981f1 Remove unused method 2018-09-11 10:13:26 -06:00
Tim Schaub
8b45011cd5 Merge pull request #8615 from tschaub/geojson-types
Use GeoJSON types from @types/geojson
2018-09-11 09:57:31 -06:00
Tim Schaub
39c31e62a3 Remove unnecessary type casts 2018-09-11 09:02:33 -06:00
Tim Schaub
5b00231d7a Backwards compatibility with circle serialization 2018-09-11 08:55:31 -06:00
Frederic Junod
3c52757f3f Remove wrong Geometry type in KML format 2018-09-11 08:45:16 +02:00
Frédéric Junod
e6e9801a74 Merge pull request #8617 from openlayers/greenkeeper/webpack-4.18.0
chore(package): update webpack to version 4.18.0
2018-09-11 07:50:18 +02:00
Frédéric Junod
b5e2b9fe6f Merge pull request #8609 from fredj/import
Remove extra imports in jsdoc
2018-09-11 07:36:58 +02:00
greenkeeper[bot]
83e252bed9 chore(package): update webpack to version 4.18.0
Closes #8616
2018-09-10 22:25:19 +00:00
Andreas Hocevar
b0b248d8e6 Merge pull request #8613 from ahocevar/lazy-taint-detection
Lazily detect tainted canvas
2018-09-10 21:50:27 +02:00
Tim Schaub
0364beb312 GeoJSON types 2018-09-10 10:20:08 -06:00
ahocevar
fc5aafe9fe Lazily detect tainted canvas 2018-09-10 10:13:41 +02:00
Andreas Hocevar
968d8d6698 Merge pull request #8610 from ahocevar/mouseposition-touch
Sensible touch behavior of the MousePosition control
2018-09-08 12:35:11 +02:00
ahocevar
3c500e0b4b Sensible touch behavior of the MousePosition control 2018-09-08 11:10:56 +02:00
Frederic Junod
81bab31efb Remove extra imports in jsdoc
The symbols are already imported (es6 import)
2018-09-08 11:01:02 +02:00
Frédéric Junod
058f81c0fa Merge pull request #8602 from fredj/layer_map_opt_typedef
Add missing map property in ol/layer/Layer constructor options
2018-09-08 09:59:20 +02:00
Tim Schaub
6b851d812d Merge pull request #8607 from tschaub/listener-signature
Listener return is boolean or void
2018-09-07 09:54:48 -06:00
Tim Schaub
ef4936de4a Listener return is boolean or void 2018-09-07 09:10:31 -06:00
Tim Schaub
b6746d3432 Merge pull request #8595 from tschaub/optional
Optional arguments and typedef properties
2018-09-07 06:24:16 -06:00
Frederic Junod
3c05e09189 Add missing map property in ol/layer/Layer constructor options 2018-09-07 09:05:04 +02:00
Frédéric Junod
9b2dc88151 Merge pull request #8594 from fredj/import
Remove extra imports in jsdoc
2018-09-07 08:24:52 +02:00
Tim Schaub
5e7afbb393 Merge pull request #8596 from tschaub/externs-revisited
Add types for the UTFGrid and TileJSON JSON responses
2018-09-06 15:20:50 -06:00
Tim Schaub
f6e6878909 Brackets for optional properties 2018-09-06 11:01:59 -06:00
Tim Schaub
e49c691a22 Add types for the UTFGrid and TileJSON JSON responses 2018-09-06 10:11:35 -06:00
Tim Schaub
bd0f3556b6 Mark transform options as optional 2018-09-06 09:32:45 -06:00
Tim Schaub
82675d0bee Mark optional geom constructor args as optional 2018-09-06 09:29:44 -06:00
Tim Schaub
895bfcea8e Optional properties for animation 2018-09-06 09:21:17 -06:00
Frederic Junod
a6861f5f49 Remove extra imports in jsdoc
The symbols are already imported (es6 import)
2018-09-06 16:40:29 +02:00
Frédéric Junod
e32b3b5957 Merge pull request #8591 from fredj/textstate_typedef
Add missing properties in TextState typedef
2018-09-06 15:30:41 +02:00
Frédéric Junod
e3f13051f6 Merge pull request #8590 from fredj/import
Don't import ourselves
2018-09-06 15:30:22 +02:00
Frederic Junod
c8747d87a4 Add missing properties in TextState typedef 2018-09-06 09:30:28 +02:00
Frédéric Junod
225e02244e Merge pull request #8589 from openlayers/greenkeeper/rollup-0.65.2
Update rollup to the latest version 🚀
2018-09-06 09:06:37 +02:00
Frederic Junod
ea616e7751 Don't import ourselves 2018-09-06 09:05:32 +02:00
Frédéric Junod
ba698258c0 Merge pull request #8586 from fredj/ts_fixes
Cast 'originalEvent' in interactions
2018-09-06 09:00:33 +02:00
Tim Schaub
1f50a2b3e6 Merge pull request #8588 from tschaub/tilegrid-options
Rework createXYZ
2018-09-05 13:42:25 -06:00
greenkeeper[bot]
9b64ea4969 chore(package): update rollup to version 0.65.2 2018-09-05 19:36:58 +00:00
Tim Schaub
52b30ead65 Rework createXYZ 2018-09-05 12:00:54 -06:00
Tim Schaub
203cb12501 Merge pull request #8587 from tschaub/let-nothing
Add a statement to trigger TypeScript checking
2018-09-05 10:51:51 -06:00
Tim Schaub
60e907fb48 Add a statement to trigger TypeScript checking
TypeScript is not checking JSDoc comments attached to the EOF token.
See https://github.com/Microsoft/TypeScript/issues/26905
2018-09-05 09:13:24 -06:00
Frederic Junod
71328530fe Remove unnecessary 'function' in jsdoc blocks 2018-09-05 16:40:45 +02:00
Frederic Junod
a5f5c06af3 Cast 'originalEvent' in interactions 2018-09-05 16:38:42 +02:00
Tim Schaub
f825a08bcf Merge pull request #8345 from tschaub/ts
TypeScript (1/n)
2018-09-05 08:31:12 -06:00
Tim Schaub
ccfacc5ee6 Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e):

    jscodeshift --transform ts.js src
2018-09-05 08:05:29 -06:00
Tim Schaub
f2aaaa19e1 Custom ESLint rule @openlayers/valid-tsdoc 2018-09-05 08:04:34 -06:00
Tim Schaub
5ac94426e1 Add TypeScript config 2018-09-05 08:04:34 -06:00
Tim Schaub
e3b21b9994 Merge pull request #8581 from openlayers/greenkeeper/rollup-plugin-node-resolve-3.4.0
Update rollup-plugin-node-resolve to the latest version 🚀
2018-09-05 03:52:15 -06:00
Frédéric Junod
f34d024b22 Merge pull request #8585 from openlayers/greenkeeper/rollup-0.65.1
Update rollup to the latest version 🚀
2018-09-05 11:13:32 +02:00
greenkeeper[bot]
f515b84322 chore(package): update rollup to version 0.65.1 2018-09-05 07:17:42 +00:00
Marc Jansen
d6e8ecea5e Merge pull request #8579 from marcjansen/tsc-ts2367
Better type annotation
2018-09-04 18:41:56 +02:00
Marc Jansen
c691e7ca7a Merge pull request #8580 from marcjansen/tsc-ts2367-one-less
Cast POINTER_ID before comparison
2018-09-04 18:41:04 +02:00
greenkeeper[bot]
37221edbf0 chore(package): update rollup-plugin-node-resolve to version 3.4.0 2018-09-04 10:57:57 +00:00
Andreas Hocevar
ae14df9dca Merge pull request #8578 from openlayers/greenkeeper/webpack-4.17.2
Update webpack to the latest version 🚀
2018-09-04 10:16:18 +02:00
Marc Jansen
281873f22a Cast POINTER_ID before comparison 2018-09-04 09:37:15 +02:00
Frédéric Junod
8510169c69 Merge pull request #8574 from fredj/typescript_checks
Rename Extent to ExtentInteraction
2018-09-04 09:12:49 +02:00
Frédéric Junod
e2c0d59332 Merge pull request #8577 from fredj/cleanup
Remove geojson.js extern inclusion in tasks/generate-info
2018-09-04 09:12:30 +02:00
Marc Jansen
99245b47f7 Better type annotation 2018-09-03 21:17:56 +02:00
greenkeeper[bot]
eee7b0126b chore(package): update webpack to version 4.17.2 2018-09-03 18:28:55 +00:00
Frederic Junod
404c1bda0a Remove geojson.js extern inclusion in tasks/generate-info 2018-09-03 16:16:46 +02:00
Frederic Junod
8fdc4cc9fc Change property test in MousePosition options
TypeScript doesn't like the current implementation:
```
src/ol/control/MousePosition.js(82,64): error TS2339: Property 'undefinedHTML' does not exist on type 'never'.
```
2018-09-03 15:25:33 +02:00
Frederic Junod
ad1dec58ec Rename Extent to ExtentInteraction 2018-09-03 15:15:58 +02:00
Frédéric Junod
42b8340ea1 Merge pull request #8573 from fredj/f8360
Fix freehand polygon drawing
2018-09-03 12:40:34 +02:00
Frederic Junod
595009726f Fix freehand polygon drawing
Fixes #8360
2018-09-03 11:56:31 +02:00
Frédéric Junod
4025ddc364 Merge pull request #8572 from fredj/ts_fixes
typescript misc fixes
2018-09-03 10:49:05 +02:00
Frederic Junod
5b8b470568 Fix imports in jsdoc blocks 2018-09-03 09:41:00 +02:00
Frederic Junod
3c02bd15fb Add missing 'extent' property in TileImage constructor 2018-09-03 09:41:00 +02:00
Frederic Junod
5fdac622ef Add missing 'extent' property in VectorTile constructor 2018-09-03 09:41:00 +02:00
Frederic Junod
25c1754052 Cast empty optional options in constructor
To remove the typescript errors:
```
Property 'xxx' does not exist on type '{}'
```
2018-09-03 09:40:59 +02:00
Andreas Hocevar
a30f8859aa Merge pull request #8569 from ahocevar/simpler-faster-proj-get
Make proj~get simpler and faster
2018-08-31 16:33:08 +02:00
Frédéric Junod
5435379e70 Merge pull request #8567 from fredj/element_vs_node
Use 'Element' type instead of 'Node'
2018-08-31 16:32:18 +02:00
ahocevar
9eeacc585f Make proj~get simpler and faster 2018-08-31 12:19:23 +02:00
Frederic Junod
20a347b0c9 Use 'Element' type instead of 'Node' 2018-08-31 11:36:16 +02:00
Andreas Hocevar
6b851720d9 Merge pull request #8563 from openlayers/greenkeeper/rollup-plugin-uglify-5.0.2
Update rollup-plugin-uglify to the latest version 🚀
2018-08-31 10:56:58 +02:00
greenkeeper[bot]
d12537b975 chore(package): update rollup-plugin-uglify to version 5.0.2 2018-08-30 22:12:09 +00:00
Andreas Hocevar
ee3ebbff76 Merge pull request #8561 from openlayers/greenkeeper/rollup-plugin-uglify-5.0.0
Update rollup-plugin-uglify to the latest version 🚀
2018-08-30 22:22:32 +02:00
greenkeeper[bot]
411bc8ac61 chore(package): update rollup-plugin-uglify to version 5.0.0 2018-08-30 19:23:38 +00:00
Frédéric Junod
bb4f887545 Merge pull request #8558 from fredj/zIndex_doc
Fix default zIndex value and documentation for layer options
2018-08-29 12:53:50 +02:00
Frederic Junod
db04052b7a Fix default zIndex value and documentation for layer options 2018-08-29 11:33:09 +02:00
Andreas Hocevar
9daa556da1 Merge pull request #8555 from ahocevar/no-mangling-for-workers
Do not minify examples that inject code into workers
2018-08-29 10:45:26 +02:00
Andreas Hocevar
c29fdaf714 Merge pull request #8557 from ahocevar/fix-release-notes
Fix typo in release notes
2018-08-29 10:42:00 +02:00
ahocevar
2d79baf54d Fix typo in release notes 2018-08-29 10:40:40 +02:00
ahocevar
8e9e0ae848 Do not minify examples that inject code into workers 2018-08-29 08:56:24 +02:00
366 changed files with 10815 additions and 8351 deletions

36
.circleci/config.yml Normal file
View File

@@ -0,0 +1,36 @@
version: 2
jobs:
build:
docker:
- image: circleci/node:10-browsers
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run:
name: Install Dependencies
command: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Run Tests
command: npm test
- run:
name: Build Examples
command: npm run build-examples
- store_artifacts:
path: build/examples
destination: examples

View File

@@ -1,17 +0,0 @@
language: node_js
node_js:
- '8'
cache:
directories:
- node_modules
after_success:
- cat coverage/lcov.info | coveralls
branches:
only:
- master
addons:
hosts:
- travis.dev
jwt:
# This is the encrypted SAUCE_ACCESS_KEY
secure: bb2Ibzu9RLe6ZlIG7JVcuH7IoLMxa/i3LTM7t8mbsPjVOGs5ycyJ7M9MbvqB/F2EzbeV4XB2c9ufI4TkaLYceY5kdWjfZVN8iasr+GFqKMv1uR4i6bpu8KmHJ+blxwfY1QOQ/cGwEx+fbeycMtpTc3Y3GyXaPlCQLhbZvesMg88=

View File

@@ -2,6 +2,18 @@
### Next version
### v5.3.0
#### The `getUid` function returns string
The `getUid` function from the `ol/util` module now returns a string instead of a number.
#### Attributions are not collapsible for `ol/source/OSM`
When a map contains a layer from a `ol/source/OSM` source, the `ol/control/Attribution` control will be shown with the `collapsible: false` behavior.
To get the previous behavior, configure the `ol/control/Attribution` control with `collapsible: true`.
### v5.2.0
#### Removal of the `snapToPixel` option for `ol/style/Image` subclasses
@@ -16,7 +28,7 @@ When rendering with the Immediate API, symbols will no longer be snapped to inte
#### Geometry constructor and `setCoordinates` no longer accept `null` coordinates
Geometries (`ol/geom/*`) now need to be constructed with valid coordinates (center for `ol/geom/Circle`) as first constructor argument. The same applies to the `setCoordinates()` (`setCenter() for `ol/geom/Circle`) method.
Geometries (`ol/geom/*`) now need to be constructed with valid coordinates (center for `ol/geom/Circle`) as first constructor argument. The same applies to the `setCoordinates()` (`setCenter()` for `ol/geom/Circle`) method.
### v5.0.0

View File

@@ -1,4 +1,4 @@
# v5.1.0
# v5.2.0
The 5.2 release adds a few new features a handful of fixes, including regressions that were reported after the 5.1 release. You should be able to upgrade without any additional work. See the one note below regarding `snapToPixel` on `ol/style/Image` and subclasses.

217
changelog/v5.3.0.md Normal file
View File

@@ -0,0 +1,217 @@
# v5.3.0
We're continuing to work toward more complete type checking with TypeScript  based on JSDoc annotations in the source. The 5.3 release includes a number of bug fixes related to the type checking effort. In addition the release comes with a handful of new features and improved API reference docs.
### Upgrade Notes
#### The `getUid` function returns string
The `getUid` function from the `ol/util` module now returns a string instead of a number.
#### Attributions are not collapsible for `ol/source/OSM`
When a map contains a layer from a `ol/source/OSM` source, the `ol/control/Attribution` control will be shown with the `collapsible: false` behavior.
To get the previous behavior, configure the `ol/control/Attribution` control with `collapsible: true`.
### New Features and Fixes
* [#8642](https://github.com/openlayers/openlayers/pull/8642) - Fixes for optional key passing, issue #8067 for tile sources ([@dimin](https://github.com/dimin))
* [#8885](https://github.com/openlayers/openlayers/pull/8885) - Move GeolocationProperty into Geolocation ([@fredj](https://github.com/fredj))
* [#8881](https://github.com/openlayers/openlayers/pull/8881) - Remove custom styles in drag-and-drop examples ([@fredj](https://github.com/fredj))
* [#8877](https://github.com/openlayers/openlayers/pull/8877) - Create context in vector tile layer constructor ([@tschaub](https://github.com/tschaub))
* [#8883](https://github.com/openlayers/openlayers/pull/8883) - New test runner ([@tschaub](https://github.com/tschaub))
* [#8882](https://github.com/openlayers/openlayers/pull/8882) - Import simplification ([@fredj](https://github.com/fredj))
* [#8858](https://github.com/openlayers/openlayers/pull/8858) - Add condition for viewParams and TypeScript related option ([@webgeodatavore](https://github.com/webgeodatavore))
* [#8879](https://github.com/openlayers/openlayers/pull/8879) - Build with CircleCI ([@openlayers](https://github.com/openlayers))
* [#8878](https://github.com/openlayers/openlayers/pull/8878) - Avoid logging 404 warnings ([@tschaub](https://github.com/tschaub))
* [#8876](https://github.com/openlayers/openlayers/pull/8876) - Remove RenderType enum from vector tile layer ([@tschaub](https://github.com/tschaub))
* [#8874](https://github.com/openlayers/openlayers/pull/8874) - Remove unnecessary type casts in canvas layer renderer ([@tschaub](https://github.com/tschaub))
* [#8869](https://github.com/openlayers/openlayers/pull/8869) - Fix more types for TypeScript ([@ahocevar](https://github.com/ahocevar))
* [#8868](https://github.com/openlayers/openlayers/pull/8868) - Throw when calling abstract methods; fix abstract return types ([@ahocevar](https://github.com/ahocevar))
* [#8862](https://github.com/openlayers/openlayers/pull/8862) - Legacy build and apidoc improvements ([@ahocevar](https://github.com/ahocevar))
* [#8867](https://github.com/openlayers/openlayers/pull/8867) - Fix example builder ([@ahocevar](https://github.com/ahocevar))
* [#8852](https://github.com/openlayers/openlayers/pull/8852) - Improve link handling in API docs ([@ahocevar](https://github.com/ahocevar))
* [#8853](https://github.com/openlayers/openlayers/pull/8853) - Make rendercomplete work with vector sources without loader ([@ahocevar](https://github.com/ahocevar))
* [#8851](https://github.com/openlayers/openlayers/pull/8851) - Use typescript types for RBush ([@fredj](https://github.com/fredj))
* [#8850](https://github.com/openlayers/openlayers/pull/8850) - Remove old TODO in ol/Graticule ([@fredj](https://github.com/fredj))
* [#8847](https://github.com/openlayers/openlayers/pull/8847) - Fix API docs ([@ahocevar](https://github.com/ahocevar))
* [#8845](https://github.com/openlayers/openlayers/pull/8845) - Remove RenderType enum from vector layer ([@tschaub](https://github.com/tschaub))
* [#8843](https://github.com/openlayers/openlayers/pull/8843) - Fix ts typing for fullscreen button ([@tonio](https://github.com/tonio))
* [#8841](https://github.com/openlayers/openlayers/pull/8841) - Use super.method instead of prototype.method.call ([@fredj](https://github.com/fredj))
* [#8842](https://github.com/openlayers/openlayers/pull/8842) - Change target type from Element to HTMLElement ([@fredj](https://github.com/fredj))
* [#8840](https://github.com/openlayers/openlayers/pull/8840) - Remove unneeded code in VectorTile renderer ([@elemoine](https://github.com/elemoine))
* [#8844](https://github.com/openlayers/openlayers/pull/8844) - Set crossOrigin to anonymous in mapbox-streets-v6-style ([@elemoine](https://github.com/elemoine))
* [#8776](https://github.com/openlayers/openlayers/pull/8776) - Use setTimeout without the window namespace ([@ahocevar](https://github.com/ahocevar))
* [#8837](https://github.com/openlayers/openlayers/pull/8837) - Re-export MousePosition from ol/control ([@fredj](https://github.com/fredj))
* [#8832](https://github.com/openlayers/openlayers/pull/8832) - Remove source foreachfeatureatcoordinate from ol/renderer/webgl/ImageLayer ([@fredj](https://github.com/fredj))
* [#8833](https://github.com/openlayers/openlayers/pull/8833) - Fix wrong filename in type annotation ([@fredj](https://github.com/fredj))
* [#8827](https://github.com/openlayers/openlayers/pull/8827) - Removed unused forEachFeatureAtCoordinate from ol/source/Source ([@schmidtk](https://github.com/schmidtk))
* [#8830](https://github.com/openlayers/openlayers/pull/8830) - Type annotation fixes in ol/control/ ([@fredj](https://github.com/fredj))
* [#8829](https://github.com/openlayers/openlayers/pull/8829) - Change getUid return type from number to string ([@fredj](https://github.com/fredj))
* [#8825](https://github.com/openlayers/openlayers/pull/8825) - Fix TypeScript errors ([@schmidtk](https://github.com/schmidtk))
* [#8828](https://github.com/openlayers/openlayers/pull/8828) - Re-export VectorTile from ol/source ([@elemoine](https://github.com/elemoine))
* [#8806](https://github.com/openlayers/openlayers/pull/8806) - Preserve button class name list in full screen control on toggle ([@notnotse](https://github.com/notnotse))
* [#8817](https://github.com/openlayers/openlayers/pull/8817) - Clarify format option for ol/source/WMTS ([@romanzoller](https://github.com/romanzoller))
* [#8824](https://github.com/openlayers/openlayers/pull/8824) - Fix TypeScript errors in ol/format/GML ([@schmidtk](https://github.com/schmidtk))
* [#8820](https://github.com/openlayers/openlayers/pull/8820) - Polygon intersectsExtent failure - Issue #8795 ([@hmdavidjunior](https://github.com/hmdavidjunior))
* [#8519](https://github.com/openlayers/openlayers/pull/8519) - GML Format Improvements #8516 #8517 #8518 ([@NielsCharlier](https://github.com/NielsCharlier))
* [#8711](https://github.com/openlayers/openlayers/pull/8711) - Fix TypeScript errors in ol/format/GML ([@schmidtk](https://github.com/schmidtk))
* [#8818](https://github.com/openlayers/openlayers/pull/8818) - Fix the way zoom comes from ([@cs09g](https://github.com/cs09g))
* [#8804](https://github.com/openlayers/openlayers/pull/8804) - Add possibility to disable collapsible attributions from Source ([@notnotse](https://github.com/notnotse))
* [#8787](https://github.com/openlayers/openlayers/pull/8787) - Replace instanceof checks with other logic ([@ahocevar](https://github.com/ahocevar))
* [#8808](https://github.com/openlayers/openlayers/pull/8808) - Fix format and version properties in ol/source/WMTS Options typedef ([@fredj](https://github.com/fredj))
* [#8812](https://github.com/openlayers/openlayers/pull/8812) - Update snap.js ([@rosedo](https://github.com/rosedo))
* [#8809](https://github.com/openlayers/openlayers/pull/8809) - Configurable interval options ([@notnotse](https://github.com/notnotse))
* [#8798](https://github.com/openlayers/openlayers/pull/8798) - Use unpkg.com instead of rawgit.com ([@fredj](https://github.com/fredj))
* [#8805](https://github.com/openlayers/openlayers/pull/8805) - Do not draw image with width or height < 0.5 ([@notnotse](https://github.com/notnotse))
* [#8803](https://github.com/openlayers/openlayers/pull/8803) - Handle zoom slider position with floating point numbers ([@notnotse](https://github.com/notnotse))
* [#8789](https://github.com/openlayers/openlayers/pull/8789) - Spelling and indentation fixes ([@fredj](https://github.com/fredj))
* [#8782](https://github.com/openlayers/openlayers/pull/8782) - Fix getSimplifiedGeometry definition ([@wallw-bits](https://github.com/wallw-bits))
* [#8783](https://github.com/openlayers/openlayers/pull/8783) - Fix missing method declaration ([@wallw-bits](https://github.com/wallw-bits))
* [#8781](https://github.com/openlayers/openlayers/pull/8781) - Fix type check errors ([@schmidtk](https://github.com/schmidtk))
* [#8779](https://github.com/openlayers/openlayers/pull/8779) - Fix additional type check errors ([@schmidtk](https://github.com/schmidtk))
* [#8753](https://github.com/openlayers/openlayers/pull/8753) - Fix type check in ol/PluggableMap.js ([@wallw-bits](https://github.com/wallw-bits))
* [#8762](https://github.com/openlayers/openlayers/pull/8762) - Fix type errors from interaction event handlers ([@schmidtk](https://github.com/schmidtk))
* [#8763](https://github.com/openlayers/openlayers/pull/8763) - Fix type check for ol/events ([@wallw-bits](https://github.com/wallw-bits))
* [#8774](https://github.com/openlayers/openlayers/pull/8774) - Fix type check errors in ol/renderer/webgl ([@schmidtk](https://github.com/schmidtk))
* [#8768](https://github.com/openlayers/openlayers/pull/8768) - Fix type check errors in ol/interaction/Select ([@schmidtk](https://github.com/schmidtk))
* [#8764](https://github.com/openlayers/openlayers/pull/8764) - Fix TypeScript errors in ol/interaction/Draw ([@schmidtk](https://github.com/schmidtk))
* [#8767](https://github.com/openlayers/openlayers/pull/8767) - Fix type check errors in ol/interaction/Modify ([@schmidtk](https://github.com/schmidtk))
* [#8773](https://github.com/openlayers/openlayers/pull/8773) - Fix type check errors in ol/renderer/canvas ([@schmidtk](https://github.com/schmidtk))
* [#8769](https://github.com/openlayers/openlayers/pull/8769) - Fix type check errors in ol/render/canvas ([@schmidtk](https://github.com/schmidtk))
* [#8770](https://github.com/openlayers/openlayers/pull/8770) - Fix type check errors in ol/render/webgl ([@schmidtk](https://github.com/schmidtk))
* [#8765](https://github.com/openlayers/openlayers/pull/8765) - Simplify logic for fixed tile url functions ([@ahocevar](https://github.com/ahocevar))
* [#8766](https://github.com/openlayers/openlayers/pull/8766) - Use FeatureLike typedef ([@fredj](https://github.com/fredj))
* [#8739](https://github.com/openlayers/openlayers/pull/8739) - Fix TypeScript errors in ol/format/WMSGetFeatureInfo ([@schmidtk](https://github.com/schmidtk))
* [#8666](https://github.com/openlayers/openlayers/pull/8666) - Fix condition TypeScript errors ([@schmidtk](https://github.com/schmidtk))
* [#8757](https://github.com/openlayers/openlayers/pull/8757) - Use typeof to simplify JSDoc class types ([@schmidtk](https://github.com/schmidtk))
* [#8759](https://github.com/openlayers/openlayers/pull/8759) - Use es6 class inheritance in examples ([@fredj](https://github.com/fredj))
* [#8761](https://github.com/openlayers/openlayers/pull/8761) - Allow returning RenderFeature in ol/format/Feature ([@schmidtk](https://github.com/schmidtk))
* [#8758](https://github.com/openlayers/openlayers/pull/8758) - Fix TS error and prevent extra string conversion ([@schmidtk](https://github.com/schmidtk))
* [#8736](https://github.com/openlayers/openlayers/pull/8736) - Typescript misc fixes ([@fredj](https://github.com/fredj))
* [#8741](https://github.com/openlayers/openlayers/pull/8741) - Fix TypeScript errors in ol/geom/* ([@schmidtk](https://github.com/schmidtk))
* [#8707](https://github.com/openlayers/openlayers/pull/8707) - Fix TypeScript errors in ol/format/Feature ([@schmidtk](https://github.com/schmidtk))
* [#8754](https://github.com/openlayers/openlayers/pull/8754) - Fix type check in ol/math ([@wallw-bits](https://github.com/wallw-bits))
* [#8747](https://github.com/openlayers/openlayers/pull/8747) - Update doc/faq.md ([@fredj](https://github.com/fredj))
* [#8744](https://github.com/openlayers/openlayers/pull/8744) - Fix type checks in VectorTileSource ([@wallw-bits](https://github.com/wallw-bits))
* [#8740](https://github.com/openlayers/openlayers/pull/8740) - Increase linestring textalign test tolerance to be Firefox compliant. ([@benVigie](https://github.com/benVigie))
* [#8738](https://github.com/openlayers/openlayers/pull/8738) - Cast to parent type to fix TS errors ([@schmidtk](https://github.com/schmidtk))
* [#8737](https://github.com/openlayers/openlayers/pull/8737) - Flag optional param to fix TS error ([@schmidtk](https://github.com/schmidtk))
* [#8742](https://github.com/openlayers/openlayers/pull/8742) - Fix type checks in Vector source ([@wallw-bits](https://github.com/wallw-bits))
* [#8743](https://github.com/openlayers/openlayers/pull/8743) - Fix type check in Raster source ([@wallw-bits](https://github.com/wallw-bits))
* [#8733](https://github.com/openlayers/openlayers/pull/8733) - Fix TypeScript errors in ol/format/WFS ([@schmidtk](https://github.com/schmidtk))
* [#8735](https://github.com/openlayers/openlayers/pull/8735) - Fix TypeScript errors in ol/format/WKT ([@schmidtk](https://github.com/schmidtk))
* [#8730](https://github.com/openlayers/openlayers/pull/8730) - Fix TypeScript errors in ol/format/KML ([@schmidtk](https://github.com/schmidtk))
* [#8732](https://github.com/openlayers/openlayers/pull/8732) - Fix type check in ol/source/Tile ([@wallw-bits](https://github.com/wallw-bits))
* [#8731](https://github.com/openlayers/openlayers/pull/8731) - Dispatch a GeolocationError in Geolocation ([@fredj](https://github.com/fredj))
* [#8729](https://github.com/openlayers/openlayers/pull/8729) - Move functions out of the PointerEvent class ([@fredj](https://github.com/fredj))
* [#8724](https://github.com/openlayers/openlayers/pull/8724) - Typescript misc fixes ([@fredj](https://github.com/fredj))
* [#8717](https://github.com/openlayers/openlayers/pull/8717) - Fix type checks in TileArcGISRest ([@fredj](https://github.com/fredj))
* [#8718](https://github.com/openlayers/openlayers/pull/8718) - Fix TypeScript errors in ol/format/GPX ([@schmidtk](https://github.com/schmidtk))
* [#8706](https://github.com/openlayers/openlayers/pull/8706) - Use EsriJSON types from @types/arcgis-rest-api ([@schmidtk](https://github.com/schmidtk))
* [#8709](https://github.com/openlayers/openlayers/pull/8709) - Fix TypeScript errors in ol/format/GeoJSON ([@schmidtk](https://github.com/schmidtk))
* [#8708](https://github.com/openlayers/openlayers/pull/8708) - Fix type checks in ImageCanvas source ([@wallw-bits](https://github.com/wallw-bits))
* [#8710](https://github.com/openlayers/openlayers/pull/8710) - Fix type checks in ImageArcGISRest ([@wallw-bits](https://github.com/wallw-bits))
* [#8698](https://github.com/openlayers/openlayers/pull/8698) - Fix zoom slider events ([@intouch-smartwater](https://github.com/intouch-smartwater))
* [#8697](https://github.com/openlayers/openlayers/pull/8697) - Remove unused properties from Cluster and Image options ([@fredj](https://github.com/fredj))
* [#8688](https://github.com/openlayers/openlayers/pull/8688) - Fix PointerEventHandler event type ([@fredj](https://github.com/fredj))
* [#8686](https://github.com/openlayers/openlayers/pull/8686) - Remove extra imports in jsdoc ([@fredj](https://github.com/fredj))
* [#8681](https://github.com/openlayers/openlayers/pull/8681) - Check the type of the source before using it ([@wallw-bits](https://github.com/wallw-bits))
* [#8691](https://github.com/openlayers/openlayers/pull/8691) - Fix assertion error documentation URL ([@romanzoller](https://github.com/romanzoller))
* [#8692](https://github.com/openlayers/openlayers/pull/8692) - Type check fixes for Cluster source ([@wallw-bits](https://github.com/wallw-bits))
* [#8677](https://github.com/openlayers/openlayers/pull/8677) - Type check fixes for VectorSource ([@wallw-bits](https://github.com/wallw-bits))
* [#8684](https://github.com/openlayers/openlayers/pull/8684) - Define BingMapsImageryMetadataResponse type ([@wallw-bits](https://github.com/wallw-bits))
* [#8690](https://github.com/openlayers/openlayers/pull/8690) - Fix type checks in CartoDB ([@wallw-bits](https://github.com/wallw-bits))
* [#8693](https://github.com/openlayers/openlayers/pull/8693) - Fix type check errors for Image source ([@wallw-bits](https://github.com/wallw-bits))
* [#8672](https://github.com/openlayers/openlayers/pull/8672) - Fix source type in Raster source ([@fredj](https://github.com/fredj))
* [#8665](https://github.com/openlayers/openlayers/pull/8665) - Fix type check errors in RBush ([@wallw-bits](https://github.com/wallw-bits))
* [#8680](https://github.com/openlayers/openlayers/pull/8680) - TypeScript fixes for ol/events ([@schmidtk](https://github.com/schmidtk))
* [#8678](https://github.com/openlayers/openlayers/pull/8678) - Ensure image is Image or Video before settings src ([@wallw-bits](https://github.com/wallw-bits))
* [#8676](https://github.com/openlayers/openlayers/pull/8676) - Cast tileGrid to WMTSTileGrid for type check ([@wallw-bits](https://github.com/wallw-bits))
* [#8679](https://github.com/openlayers/openlayers/pull/8679) - Type check fixes in Triangulation ([@wallw-bits](https://github.com/wallw-bits))
* [#8657](https://github.com/openlayers/openlayers/pull/8657) - Typescript fixes ([@fgravin](https://github.com/fgravin))
* [#8671](https://github.com/openlayers/openlayers/pull/8671) - Fix typescript in FeatureLoader ([@fgravin](https://github.com/fgravin))
* [#8675](https://github.com/openlayers/openlayers/pull/8675) - Get width as number from number|Size ([@wallw-bits](https://github.com/wallw-bits))
* [#8654](https://github.com/openlayers/openlayers/pull/8654) - Remove extra imports in jsdoc ([@fredj](https://github.com/fredj))
* [#8655](https://github.com/openlayers/openlayers/pull/8655) - Remove webkit specific properties from Touch ([@fredj](https://github.com/fredj))
* [#8663](https://github.com/openlayers/openlayers/pull/8663) - Add vendor-specific TS declarations for the Fullscreen API. ([@schmidtk](https://github.com/schmidtk))
* [#8658](https://github.com/openlayers/openlayers/pull/8658) - Don't define functions in the prototype ([@fredj](https://github.com/fredj))
* [#8662](https://github.com/openlayers/openlayers/pull/8662) - Explicitly define type of 'this' ([@wallw-bits](https://github.com/wallw-bits))
* [#8664](https://github.com/openlayers/openlayers/pull/8664) - Add native Event to ListenerFunction signature. ([@schmidtk](https://github.com/schmidtk))
* [#8668](https://github.com/openlayers/openlayers/pull/8668) - Add missing 'module' annotation ([@fredj](https://github.com/fredj))
* [#8643](https://github.com/openlayers/openlayers/pull/8643) - Fix style TypeScript errors ([@schmidtk](https://github.com/schmidtk))
* [#8638](https://github.com/openlayers/openlayers/pull/8638) - Fix event type in hasListener check ([@ahocevar](https://github.com/ahocevar))
* [#8618](https://github.com/openlayers/openlayers/pull/8618) - Use TopoJSON types from @types/topojson ([@fredj](https://github.com/fredj))
* [#8619](https://github.com/openlayers/openlayers/pull/8619) - Remove wrong Geometry type in KML format ([@fredj](https://github.com/fredj))
* [#8627](https://github.com/openlayers/openlayers/pull/8627) - Fix several type imports ([@ahocevar](https://github.com/ahocevar))
* [#8629](https://github.com/openlayers/openlayers/pull/8629) - Enable circle primitive in draw-shapes example ([@megawac](https://github.com/megawac))
* [#8626](https://github.com/openlayers/openlayers/pull/8626) - Better type annotations / type casts ([@marcjansen](https://github.com/marcjansen))
* [#8622](https://github.com/openlayers/openlayers/pull/8622) - Remove unused method ([@tschaub](https://github.com/tschaub))
* [#8615](https://github.com/openlayers/openlayers/pull/8615) - Use GeoJSON types from @types/geojson ([@tschaub](https://github.com/tschaub))
* [#8609](https://github.com/openlayers/openlayers/pull/8609) - Remove extra imports in jsdoc ([@fredj](https://github.com/fredj))
* [#8613](https://github.com/openlayers/openlayers/pull/8613) - Lazily detect tainted canvas ([@ahocevar](https://github.com/ahocevar))
* [#8610](https://github.com/openlayers/openlayers/pull/8610) - Sensible touch behavior of the MousePosition control ([@ahocevar](https://github.com/ahocevar))
* [#8602](https://github.com/openlayers/openlayers/pull/8602) - Add missing map property in ol/layer/Layer constructor options ([@fredj](https://github.com/fredj))
* [#8607](https://github.com/openlayers/openlayers/pull/8607) - Listener return is boolean or void ([@tschaub](https://github.com/tschaub))
* [#8595](https://github.com/openlayers/openlayers/pull/8595) - Optional arguments and typedef properties ([@tschaub](https://github.com/tschaub))
* [#8594](https://github.com/openlayers/openlayers/pull/8594) - Remove extra imports in jsdoc ([@fredj](https://github.com/fredj))
* [#8596](https://github.com/openlayers/openlayers/pull/8596) - Add types for the UTFGrid and TileJSON JSON responses ([@tschaub](https://github.com/tschaub))
* [#8591](https://github.com/openlayers/openlayers/pull/8591) - Add missing properties in TextState typedef ([@fredj](https://github.com/fredj))
* [#8590](https://github.com/openlayers/openlayers/pull/8590) - Don't import ourselves ([@fredj](https://github.com/fredj))
* [#8586](https://github.com/openlayers/openlayers/pull/8586) - Cast 'originalEvent' in interactions ([@fredj](https://github.com/fredj))
* [#8588](https://github.com/openlayers/openlayers/pull/8588) - Rework createXYZ ([@tschaub](https://github.com/tschaub))
* [#8587](https://github.com/openlayers/openlayers/pull/8587) - Add a statement to trigger TypeScript checking ([@tschaub](https://github.com/tschaub))
* [#8345](https://github.com/openlayers/openlayers/pull/8345) - TypeScript (1/n) ([@tschaub](https://github.com/tschaub))
* [#8579](https://github.com/openlayers/openlayers/pull/8579) - Better type annotation ([@marcjansen](https://github.com/marcjansen))
* [#8580](https://github.com/openlayers/openlayers/pull/8580) - Cast POINTER_ID before comparison ([@marcjansen](https://github.com/marcjansen))
* [#8574](https://github.com/openlayers/openlayers/pull/8574) - Rename Extent to ExtentInteraction ([@fredj](https://github.com/fredj))
* [#8577](https://github.com/openlayers/openlayers/pull/8577) - Remove geojson.js extern inclusion in tasks/generate-info ([@fredj](https://github.com/fredj))
* [#8573](https://github.com/openlayers/openlayers/pull/8573) - Fix freehand polygon drawing ([@fredj](https://github.com/fredj))
* [#8572](https://github.com/openlayers/openlayers/pull/8572) - typescript misc fixes ([@fredj](https://github.com/fredj))
* [#8569](https://github.com/openlayers/openlayers/pull/8569) - Make proj~get simpler and faster ([@ahocevar](https://github.com/ahocevar))
* [#8567](https://github.com/openlayers/openlayers/pull/8567) - Use 'Element' type instead of 'Node' ([@fredj](https://github.com/fredj))
* [#8558](https://github.com/openlayers/openlayers/pull/8558) - Fix default zIndex value and documentation for layer options ([@fredj](https://github.com/fredj))
* [#8555](https://github.com/openlayers/openlayers/pull/8555) - Do not minify examples that inject code into workers ([@ahocevar](https://github.com/ahocevar))
* [#8557](https://github.com/openlayers/openlayers/pull/8557) - Fix typo in release notes ([@ahocevar](https://github.com/ahocevar))
<details>
<summary>Dependency Updates</summary>
* [#8884](https://github.com/openlayers/openlayers/pull/8884) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8880](https://github.com/openlayers/openlayers/pull/8880) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8872](https://github.com/openlayers/openlayers/pull/8872) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8860](https://github.com/openlayers/openlayers/pull/8860) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8855](https://github.com/openlayers/openlayers/pull/8855) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8838](https://github.com/openlayers/openlayers/pull/8838) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8834](https://github.com/openlayers/openlayers/pull/8834) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8799](https://github.com/openlayers/openlayers/pull/8799) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8796](https://github.com/openlayers/openlayers/pull/8796) - Update rollup-plugin-commonjs to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8793](https://github.com/openlayers/openlayers/pull/8793) - Update rollup-plugin-buble to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8794](https://github.com/openlayers/openlayers/pull/8794) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8788](https://github.com/openlayers/openlayers/pull/8788) - Update front-matter to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8785](https://github.com/openlayers/openlayers/pull/8785) - chore(package): update rollup to version 0.66.4 ([@openlayers](https://github.com/openlayers))
* [#8719](https://github.com/openlayers/openlayers/pull/8719) - Update marked to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8714](https://github.com/openlayers/openlayers/pull/8714) - chore(package): update webpack to version 4.20.2 ([@openlayers](https://github.com/openlayers))
* [#8703](https://github.com/openlayers/openlayers/pull/8703) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8646](https://github.com/openlayers/openlayers/pull/8646) - Update mustache to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8645](https://github.com/openlayers/openlayers/pull/8645) - Update rollup-plugin-uglify to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8685](https://github.com/openlayers/openlayers/pull/8685) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8683](https://github.com/openlayers/openlayers/pull/8683) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8656](https://github.com/openlayers/openlayers/pull/8656) - chore(package): update rollup-plugin-commonjs to version 9.1.8 ([@openlayers](https://github.com/openlayers))
* [#8667](https://github.com/openlayers/openlayers/pull/8667) - chore(package): update uglifyjs-webpack-plugin to version 2.0.1 ([@openlayers](https://github.com/openlayers))
* [#8661](https://github.com/openlayers/openlayers/pull/8661) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8644](https://github.com/openlayers/openlayers/pull/8644) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8631](https://github.com/openlayers/openlayers/pull/8631) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8630](https://github.com/openlayers/openlayers/pull/8630) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8617](https://github.com/openlayers/openlayers/pull/8617) - chore(package): update webpack to version 4.18.0 ([@openlayers](https://github.com/openlayers))
* [#8589](https://github.com/openlayers/openlayers/pull/8589) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8581](https://github.com/openlayers/openlayers/pull/8581) - Update rollup-plugin-node-resolve to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8585](https://github.com/openlayers/openlayers/pull/8585) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8578](https://github.com/openlayers/openlayers/pull/8578) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8563](https://github.com/openlayers/openlayers/pull/8563) - Update rollup-plugin-uglify to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8561](https://github.com/openlayers/openlayers/pull/8561) - Update rollup-plugin-uglify to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
</details>

6
changelog/v5.3.1.md Normal file
View File

@@ -0,0 +1,6 @@
# 5.3.1
The 5.3.1 release is a patch that addresses an issue when using `angular-cli` to build an OpenLayers-based application.
* [#9253](https://github.com/openlayers/openlayers/pull/9253) - Add proj.js to the sideEffects list ([@romanzoller](https://github.com/romanzoller))

6
changelog/v5.3.2.md Normal file
View File

@@ -0,0 +1,6 @@
# 5.3.2
The 5.3.2 release is a patch that addresses a tile source issue with old tile data when the source revision changed.
* [#9422](https://github.com/openlayers/openlayers/pull/9422) - Clear context when source revision changed (v5.3.x fix) ([@elemoine](https://github.com/elemoine))

View File

@@ -7,22 +7,23 @@
"allowUnknownTags": true
},
"source": {
"includePattern": ".+\\.js(doc)?$",
"includePattern": ".+\\.js$",
"excludePattern": "(^|\\/|\\\\)_",
"include": [
"src/ol"
]
},
"plugins": [
"plugins/markdown",
"config/jsdoc/api/plugins/normalize-exports",
"config/jsdoc/api/plugins/markdown",
"jsdoc-plugin-typescript",
"config/jsdoc/api/plugins/inline-options",
"config/jsdoc/api/plugins/inheritdoc",
"config/jsdoc/api/plugins/events",
"config/jsdoc/api/plugins/observable",
"config/jsdoc/api/plugins/api"
],
"markdown": {
"parser": "gfm"
"typescript": {
"moduleRoot": "src"
},
"templates": {
"cleverLinks": true,

View File

@@ -8,10 +8,10 @@
<td><p>The view manages the visual parameters of the map view, like resolution or rotation.</p>
[View](module-ol_View-View.html) with center, projection, resolution and rotation</td>
<td><p>Layers are lightweight containers that get their data from [sources](module-ol_source_Source-Source.html).</p>
[layer/Tile](module-ol_layer_Tile-TileLayer.html)<br>
[layer/Image](module-ol_layer_Image-ImageLayer.html)<br>
[layer/Vector](module-ol_layer_Vector-VectorLayer.html)<br>
[layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)</td>
[ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)<br>
[ol/layer/Image](module-ol_layer_Image-ImageLayer.html)<br>
[ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)<br>
[ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)</td>
</tr><tr>
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
</tr><tr>
@@ -21,20 +21,20 @@
<td>
[Map default interactions](module-ol_interaction.html#~defaults)<br>
Interactions for [vector features](module-ol_Feature-Feature.html)
<ul><li>[interaction/Select](module-ol_interaction_Select-Select.html)</li>
<li>[interaction/Draw](module-ol_interaction_Draw-Draw.html)</li>
<li>[interaction/Modify](module-ol_interaction_Modify-Modify.html)</li></ul>
<ul><li>[ol/interaction/Select](module-ol_interaction_Select-Select.html)</li>
<li>[ol/interaction/Draw](module-ol_interaction_Draw-Draw.html)</li>
<li>[ol/interaction/Modify](module-ol_interaction_Modify-Modify.html)</li></ul>
[All interactions](module-ol_interaction_Interaction-Interaction.html)</td>
<td>[Tile sources](module-ol_source_Tile-TileSource.html) for [layer/Tile](module-ol_layer_Tile-TileLayer.html)
<br>[Image sources](module-ol_source_Image-ImageSource.html) for [layer/Image](module-ol_layer_Image-ImageLayer.html)
<br>[Vector sources](module-ol_source_Vector-VectorSource.html) for [layer/Vector](module-ol_layer_Vector-VectorLayer.html)
<br>[Vector tile sources](module-ol_source_VectorTile-VectorTile.html) for [layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)
<td>[Tile sources](module-ol_source_Tile-TileSource.html) for [ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)
<br>[Image sources](module-ol_source_Image-ImageSource.html) for [ol/layer/Image](module-ol_layer_Image-ImageLayer.html)
<br>[Vector sources](module-ol_source_Vector-VectorSource.html) for [ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)
<br>[Vector tile sources](module-ol_source_VectorTile-VectorTile.html) for [ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)
<br>[Formats](module-ol_format_Feature-FeatureFormat.html) for reading/writing vector data
<br>[format/WMSCapabilities](module-ol_format_WMSCapabilities-WMSCapabilities.html)</td></tr>
<br>[ol/format/WMSCapabilities](module-ol_format_WMSCapabilities-WMSCapabilities.html)</td></tr>
<tr><th>Projections</th><th>Observable objects</th><th>Other components</th></tr>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [proj.transform()](module-ol_proj.html#.transform) and [proj.transformExtent()](module-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()](module-ol_proj.html#.transform) and [ol/proj#transformExtent()](module-ol_proj.html#.transformExtent).</p>
[ol/proj](module-ol_proj.html)</td>
<td><p>Changes to all [ol/Object](module-ol_Object-BaseObject.html)s can be observed by calling the [object.on('propertychange')](module-ol_Object-BaseObject.html#on) method. Listeners receive an [ol/Object~ObjectEvent](module-ol_Object-ObjectEvent.html) with information on the changed property and old value.</p>
<td><p>Changes to all [ol/Object](module-ol_Object-BaseObject.html)s can be observed by calling the [object.on('propertychange')](module-ol_Object-BaseObject.html#on) method. Listeners receive an [ol/Object.ObjectEvent](module-ol_Object-ObjectEvent.html) with information on the changed property and old value.</p>
<td>
[ol/Geolocation](module-ol_Geolocation.html)<br>
[ol/Overlay](module-ol_Overlay-Overlay.html)<br></td>

View File

@@ -95,17 +95,20 @@ exports.handlers = {
newDoclet: function(e) {
const doclet = e.doclet;
if (doclet.stability) {
modules[doclet.longname.split('~').shift()] = true;
modules[doclet.longname.split(/[~\.]/).shift()] = true;
api.push(doclet);
}
// Mark explicity defined namespaces - needed in parseComplete to keep
// namespaces that we need as containers for api items.
if (/.*\.jsdoc$/.test(doclet.meta.filename) && doclet.kind == 'namespace') {
doclet.namespace_ = true;
}
if (doclet.kind == 'class') {
modules[doclet.longname.split('~').shift()] = true;
classes[doclet.longname] = doclet;
modules[doclet.longname.split(/[~\.]/).shift()] = true;
if (!(doclet.longname in classes)) {
classes[doclet.longname] = doclet;
} else if ('augments' in doclet) {
classes[doclet.longname].augments = doclet.augments;
}
}
if (doclet.name === doclet.longname && !doclet.memberof) {
// Make sure anonymous default exports are documented
doclet.setMemberof(doclet.longname);
}
},
@@ -113,7 +116,7 @@ exports.handlers = {
const doclets = e.doclets;
for (let i = doclets.length - 1; i >= 0; --i) {
const doclet = doclets[i];
if (doclet.stability || doclet.namespace_) {
if (doclet.stability) {
if (doclet.kind == 'class') {
includeAugments(doclet);
}

View File

@@ -12,7 +12,7 @@ exports.handlers = {
events[cls] = [];
}
events[cls].push(doclet.longname);
} else if (doclet.kind == 'class') {
} else if (doclet.kind == 'class' && !(doclet.longname in classes)) {
classes[doclet.longname] = doclet;
}
},
@@ -29,7 +29,7 @@ exports.handlers = {
event = doclet.fires[j].replace('event:', '');
if (events[event]) {
fires.push.apply(fires, events[event]);
} else {
} else if (doclet.fires[j] !== 'event:ObjectEvent') {
fires.push(doclet.fires[j]);
}
}
@@ -40,4 +40,3 @@ exports.handlers = {
}
};

View File

@@ -0,0 +1,109 @@
/*
* This is a hack to prevent inheritDoc tags from entirely removing
* documentation of the method that inherits the documentation.
*
* TODO: Remove this hack when https://github.com/jsdoc3/jsdoc/issues/53
* is addressed.
*/
exports.defineTags = function(dictionary) {
dictionary.defineTag('inheritDoc', {
mustHaveValue: false,
canHaveType: false,
canHaveName: false,
onTagged: function(doclet, tag) {
doclet.inheritdoc = true;
}
});
};
const lookup = {};
const incompleteByClass = {};
const keepKeys = ['comment', 'meta', 'name', 'memberof', 'longname', 'augment',
'stability'];
exports.handlers = {
newDoclet: function(e) {
const doclet = e.doclet;
let incompletes;
if (!(doclet.longname in lookup)) {
lookup[doclet.longname] = [];
}
lookup[doclet.longname].push(doclet);
if (doclet.inheritdoc) {
if (!(doclet.memberof in incompleteByClass)) {
incompleteByClass[doclet.memberof] = [];
}
incompletes = incompleteByClass[doclet.memberof];
if (incompletes.indexOf(doclet.name) == -1) {
incompletes.push(doclet.name);
}
}
},
parseComplete: function(e) {
let ancestors, candidate, candidates, doclet, i, j, k, l, key;
let incompleteDoclet, stability, incomplete, incompletes;
const doclets = e.doclets;
for (i = doclets.length - 1; i >= 0; --i) {
doclet = doclets[i];
if (doclet.augments) {
ancestors = [].concat(doclet.augments);
}
incompletes = incompleteByClass[doclet.longname];
if (ancestors && incompletes) {
// collect ancestors from the whole hierarchy
for (j = 0; j < ancestors.length; ++j) {
candidates = lookup[ancestors[j]];
if (candidates) {
for (k = candidates.length - 1; k >= 0; --k) {
candidate = candidates[k];
if (candidate.augments) {
ancestors = ancestors.concat(candidate.augments);
}
}
}
}
// walk through all inheritDoc members
for (j = incompletes.length - 1; j >= 0; --j) {
incomplete = incompletes[j];
candidates = lookup[doclet.longname + '#' + incomplete];
if (candidates) {
// get the incomplete doclet that needs to be augmented
for (k = candidates.length - 1; k >= 0; --k) {
incompleteDoclet = candidates[k];
if (incompleteDoclet.inheritdoc) {
break;
}
}
}
// find the documented ancestor
for (k = ancestors.length - 1; k >= 0; --k) {
candidates = lookup[ancestors[k] + '#' + incomplete];
if (candidates) {
for (l = candidates.length - 1; l >= 0; --l) {
candidate = candidates[l];
if (candidate && !candidate.inheritdoc) {
stability = candidate.stability || incompleteDoclet.stability;
if (stability) {
incompleteDoclet.stability = stability;
for (key in candidate) {
if (candidate.hasOwnProperty(key) &&
keepKeys.indexOf(key) == -1) {
incompleteDoclet[key] = candidate[key];
}
}
}
}
}
}
}
}
}
}
}
};

View File

@@ -0,0 +1,111 @@
/**
* Modified from JSDoc's plugins/markdown and lib/jsdoc/util/markdown modules
* (see https://github.com/jsdoc3/jsdoc/), which are licensed under the Apache 2
* license (see http://www.apache.org/licenses/LICENSE-2.0).
*
* This version does not protect http(s) urls from being turned into links, and
* works around an issue with `~` characters in module paths by escaping them.
*/
const marked = require('marked');
const format = require('util').format;
const tags = [
'author',
'classdesc',
'description',
'exceptions',
'params',
'properties',
'returns',
'see',
'summary'
];
const hasOwnProp = Object.prototype.hasOwnProperty;
const markedRenderer = new marked.Renderer();
// Allow prettyprint to work on inline code samples
markedRenderer.code = function(code, language) {
const langClass = language ? ' lang-' + language : '';
return format('<pre class="prettyprint source%s"><code>%s</code></pre>',
langClass, escapeCode(code));
};
function escapeCode(source) {
return source.replace(/</g, '&lt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
function escapeUnderscoresAndTildes(source) {
return source.replace(/\{@[^}\r\n]+\}/g, function(wholeMatch) {
return wholeMatch
.replace(/(^|[^\\])_/g, '$1\\_')
.replace('~', '&tilde;');
});
}
function unencodeQuotesAndTildes(source) {
return source.replace(/\{@[^}\r\n]+\}/g, function(wholeMatch) {
return wholeMatch
.replace(/&quot;/g, '"')
.replace(/&tilde;/g, '~');
});
}
function parse(source) {
let result;
source = escapeUnderscoresAndTildes(source);
result = marked(source, {renderer: markedRenderer})
.replace(/\s+$/, '')
.replace(/&#39;/g, '\'');
result = unencodeQuotesAndTildes(result);
return result;
}
function shouldProcessString(tagName, text) {
let shouldProcess = true;
// we only want to process `@author` and `@see` tags that contain Markdown links
if ((tagName === 'author' || tagName === 'see') && text.indexOf('[') === -1) {
shouldProcess = false;
}
return shouldProcess;
}
function process(doclet) {
tags.forEach(function(tag) {
if (!hasOwnProp.call(doclet, tag)) {
return;
}
if (typeof doclet[tag] === 'string' && shouldProcessString(tag, doclet[tag])) {
doclet[tag] = parse(doclet[tag]);
} else if (Array.isArray(doclet[tag])) {
doclet[tag].forEach(function(value, index, original) {
const inner = {};
inner[tag] = value;
process(inner);
original[index] = inner[tag];
});
} else if (doclet[tag]) {
process(doclet[tag]);
}
});
}
exports.handlers = {
newDoclet: function(e) {
process(e.doclet);
}
};

View File

@@ -1,106 +0,0 @@
/**
* @filedesc
* Expands module path type to point to default export when no name is given
*/
const fs = require('fs');
const path = require('path');
let moduleRoot;
function addDefaultExportPath(obj) {
if (!Array.isArray(obj)) {
obj = obj.names;
}
obj.forEach((name, index) => {
const matches = name.match(/module\:([^>|),\.<]|)+/g);
if (matches) {
matches.forEach(module => {
if (!/[~\.]/.test(module)) {
const checkFile = path.resolve(moduleRoot, module.replace(/^module\:/, ''));
const file = fs.readFileSync(require.resolve(checkFile), 'utf-8');
const lines = file.split('\n');
let hasDefaultExport = false;
for (let i = 0, ii = lines.length; i < ii; ++i) {
hasDefaultExport = hasDefaultExport || /^export default [^\{]/.test(lines[i]);
const match = lines[i].match(/^export default ([A-Za-z_$][A-Za-z0-9_$]+);$/);
if (match) {
// Use variable name if default export is assigned to a variable.
obj[index] = name = name.replace(module, `${module}~${match[1]}`);
return;
}
}
if (hasDefaultExport) {
// Duplicate last part if default export is not assigned to a variable.
obj[index] = name = name.replace(module, `${module}~${module.split('/').pop()}`);
}
}
});
}
});
}
function replaceLinks(comment) {
const matches = comment.match(/\{@link [^\} #]+}/g);
if (matches) {
const modules = matches.map(m => {
const mm = m.match(/(module:[^\}]+)}$/);
if (mm) {
return mm[1];
}
}).filter(m => !!m);
const newModules = modules.concat();
addDefaultExportPath(newModules);
modules.forEach((module, i) => {
comment = comment.replace(module, newModules[i]);
});
}
return comment;
}
exports.handlers = {
/**
* Adds default export to module path types without name
* @param {Object} e Event object.
*/
newDoclet: function(e) {
const doclet = e.doclet;
if (doclet.kind == 'module') {
const levelsUp = doclet.longname.replace(/^module\:/, '').split('/');
if (doclet.meta.filename != 'index.js') {
levelsUp.pop();
}
const pathArgs = [doclet.meta.path].concat(levelsUp.map(() => '../'));
moduleRoot = path.resolve.apply(null, pathArgs);
} else {
if (doclet.description) {
doclet.description = replaceLinks(doclet.description);
}
if (doclet.classdesc) {
doclet.classdesc = replaceLinks(doclet.classdesc);
}
const module = doclet.longname.split('#').shift();
if (module.indexOf('module:') == 0 && module.indexOf('.') !== -1) {
doclet.longname = doclet.longname.replace(module, module.replace('.', '~'));
}
if (doclet.augments) {
addDefaultExportPath(doclet.augments);
}
if (doclet.params) {
doclet.params.forEach(p => addDefaultExportPath(p.type));
}
if (doclet.returns) {
doclet.returns.forEach(r => addDefaultExportPath(r.type));
}
if (doclet.properties) {
doclet.properties.forEach(p => addDefaultExportPath(p.type));
}
if (doclet.type) {
addDefaultExportPath(doclet.type);
}
}
}
};

View File

@@ -5,7 +5,7 @@ exports.handlers = {
newDoclet: function(e) {
const doclet = e.doclet;
if (doclet.kind == 'class') {
if (doclet.kind == 'class' && !(doclet.longname in classes)) {
classes[doclet.longname] = doclet;
}
},
@@ -47,7 +47,7 @@ exports.handlers = {
if (!cls.fires) {
cls.fires = [];
}
event = 'module:ol/Object~ObjectEvent#event:change:' + name;
event = 'module:ol/Object.ObjectEvent#event:change:' + name;
if (cls.fires.indexOf(event) == -1) {
cls.fires.push(event);
}

View File

@@ -1,85 +0,0 @@
/*
* Changes @enum annotations into @typedef.
*/
// types that are undefined or typedefs containing undefined
let undefinedLikes = null;
/**
* Changes the description of the param if it is required.
* @param {Object} doclet The doclet.
* @returns {Object} The modified doclet.
*/
function markRequiredIfNeeded(doclet) {
const memberof = doclet.memberof;
if (!memberof) {
return doclet;
}
const types = doclet.type.names;
let isRequiredParam = true;
// iterate over all types that are like-undefined (see above for explanation)
for (let idx = undefinedLikes.length - 1; idx >= 0; idx--) {
const undefinedLike = undefinedLikes[idx];
// … if the current types contains a type that is undefined-like,
// it is not required.
if (types.indexOf(undefinedLike) != -1) {
isRequiredParam = false;
}
}
if (isRequiredParam) {
const reqSnippet = '<span class="required-option">Required.</span></p>';
const endsWithP = /<\/p>$/i;
let description = doclet.description;
if (description && endsWithP.test(description)) {
description = description.replace(endsWithP, ' ' + reqSnippet);
} else if (doclet.description === undefined) {
description = '<p>' + reqSnippet;
}
doclet.description = description;
}
return doclet;
}
/**
* Iterates over all doclets and finds the names of types that contain
* undefined. Stores the names in the global variable undefinedLikes, so
* that e.g. markRequiredIfNeeded can use these.
* @param {Array} doclets The doclets.
*/
function findTypesLikeUndefined(doclets) {
undefinedLikes = ['undefined']; // include type 'undefined' explicitly
for (let i = doclets.length - 1; i >= 0; --i) {
const doclet = doclets[i];
if (doclet.kind === 'typedef') {
const types = doclet.type.names;
if (types.indexOf('undefined') !== -1) {
// the typedef contains 'undefined', so it self is undefinedLike.
undefinedLikes.push(doclet.longname);
}
}
}
}
exports.handlers = {
newDoclet: function(e) {
const doclet = e.doclet;
if (doclet.isEnum) {
// We never export enums, so we document them like typedefs
doclet.kind = 'typedef';
delete doclet.isEnum;
}
},
parseComplete: function(e) {
const doclets = e.doclets;
findTypesLikeUndefined(doclets);
for (let i = doclets.length - 1; i >= 0; --i) {
markRequiredIfNeeded(doclets[i]);
}
}
};

View File

@@ -30,7 +30,11 @@ $(function () {
});
// Show an item related a current documentation automatically
var filename = $('.page-title').data('filename').replace(/\.[a-z]+$/, '');
var filename = $('.page-title').data('filename')
.replace(/\.[a-z]+$/, '')
.replace('module-', 'module:')
.replace(/_/g, '/')
.replace(/-/g, '~');
var $currentItem = $('.navigation .item[data-name*="' + filename + '"]:eq(0)');
if ($currentItem.length) {
@@ -97,7 +101,8 @@ $(function () {
var anchors = $('.anchor');
var _onHashChange = function () {
var activeHash = window.document.location.hash
.replace(/\./g, '\\.'); // Escape dot in element id
.replace(/\./g, '\\.') // Escape dot in element id
.replace(/\~/g, '\\~'); // Escape tilde in element id
anchors.removeClass('highlighted');

View File

@@ -14,7 +14,7 @@ if (data.type && data.type.names) {
<div class="anchor" id="<?js= id ?>">
</div>
<h4 class="name">
<?js= data.attribs + (data.scope === 'static' ? longname : name) + typeSignature ?>
<?js= data.attribs + (data.scope === 'static' ? longname : name.indexOf('module:') === 0 ? name.split('/').pop() : name) + typeSignature ?>
<?js= this.partial('stability.tmpl', data) ?>
</h4>
</div>
@@ -28,9 +28,9 @@ if (data.type && data.type.names) {
<?js= data.description ?>
</div>
<?js } ?>
<?js= this.partial('details.tmpl', data) ?>
<?js if (data.examples && examples.length) { ?>
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
<?js= this.partial('examples.tmpl', examples) ?>

View File

@@ -77,7 +77,7 @@ var self = this;
(<?js= self.linkto(eventClass.longname) ?>)
<?js } ?>
<?js } ?>
<?js= self.partial('stability.tmpl', eventDoclet || (data.stability ? data : {stability: 'experimental'})) ?>
<?js= self.partial('stability.tmpl', eventDoclet || (data.stability ? data : {})) ?>
<?js if (description) { ?> -
<?js= description ?>
<?js } ?>

View File

@@ -1,5 +1,8 @@
<?js
var self = this;
function toShortName(name) {
return name.indexOf('module:') === 0 ? name.split('/').pop() : name;
}
?>
<div class="navigation">
<div class="search">
@@ -25,7 +28,7 @@ var self = this;
<?js
item.members.forEach(function (v) {
?>
<li data-name="<?js= v.longname ?>"><?js= self.linkto(v.longname, v.name) ?></li>
<li data-name="<?js= v.longname ?>"><?js= self.linkto(v.longname, toShortName(v.name)) ?></li>
<?js
});
}
@@ -40,7 +43,7 @@ var self = this;
item.typedefs.forEach(function (v) {
?>
<li data-name="<?js= v.longname ?>" class="<?js= (v.stability && v.stability !== 'stable') ? 'unstable' : ''?>">
<?js= self.linkto(v.longname, v.name) ?>
<?js= self.linkto(v.longname, toShortName(v.name)) ?>
</li>
<?js
});
@@ -57,7 +60,7 @@ var self = this;
item.methods.forEach(function (v) {
?>
<li data-name="<?js= v.longname ?>" class="<?js= (v.stability && v.stability !== 'stable') ? 'unstable' : ''?>">
<?js= self.linkto(v.longname, v.name) ?>
<?js= self.linkto(v.longname, toShortName(v.name)) ?>
</li>
<?js
});
@@ -74,7 +77,7 @@ var self = this;
v = self.find({longname: v})[0] || {longname: v, name: v.split(/#?event:/)[1]};
?>
<li data-name="<?js= v.longname ?>" class="<?js= (v.stability && v.stability != 'stable') ? 'unstable' : '' ?>">
<?js= self.linkto(v.longname, v.name) ?>
<?js= self.linkto(v.longname, toShortName(v.name)) ?>
</li>
<?js
});

View File

@@ -8,7 +8,7 @@
<th>Name</th>
<th>Type</th>
<th>Settable</th>
<th><a href="module-ol_Object-ObjectEvent.html">ol/Object~ObjectEvent</a> type</th>
<th><a href="module-ol_Object-ObjectEvent.html">ol/Object.ObjectEvent</a> type</th>
<th class="last">Description</th>
</tr>
</thead>

View File

@@ -10,8 +10,12 @@
"includePattern": "\\.js$"
},
"plugins": [
"jsdoc-plugin-typescript",
"config/jsdoc/info/api-plugin",
"config/jsdoc/info/define-plugin",
"config/jsdoc/info/virtual-plugin"
]
],
"typescript": {
"moduleRoot": "src"
}
}

View File

@@ -1,21 +0,0 @@
// Rollup configuration for the full build
import noderesolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import {uglify} from 'rollup-plugin-uglify';
import buble from 'rollup-plugin-buble';
import sourcemaps from 'rollup-plugin-sourcemaps';
export default {
input: 'build/index.js',
output: [
{file: 'build/ol.js', format: 'iife', sourcemap: true}
],
plugins: [
noderesolve(),
commonjs(),
buble(),
uglify(),
sourcemaps()
]
};

View File

@@ -0,0 +1,13 @@
const path = require('path');
module.exports = {
entry: './build/index.js',
devtool: 'source-map',
mode: 'production',
output: {
path: path.resolve('./build/legacy'),
filename: 'ol.js',
library: 'ol',
libraryTarget: 'umd',
libraryExport: 'default'
}
};

View File

@@ -54,9 +54,12 @@ The projection of your map can be set through the `view`-property. Here are some
examples:
```javascript
import Map from 'ol/Map';
import View from 'ol/View';
// OpenLayers comes with support for the World Geodetic System 1984, EPSG:4326:
var map = new ol.Map({
view: new ol.View({
const map = new Map({
view: new View({
projection: 'EPSG:4326'
// other view properties like map center etc.
})
@@ -65,23 +68,29 @@ var map = new ol.Map({
```
```javascript
import Map from 'ol/Map';
import View from 'ol/View';
import proj4 from 'proj4';
import {register} from 'ol/proj/proj4';
import {get as getProjection} from 'ol/proj';
// To use other projections, you have to register the projection in OpenLayers.
// This can easily be done with [https://proj4js.org](proj4)
//
// By default OpenLayers does not know about the EPSG:21781 (Swiss) projection.
// So we create a projection instance for EPSG:21781 and pass it to
// ol.proj.addProjection to make it available to the library for lookup by its
// register to make it available to the library for lookup by its
// code.
proj4.defs('EPSG:21781',
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 ' +
'+x_0=600000 +y_0=200000 +ellps=bessel ' +
'+towgs84=660.077,13.551,369.344,2.484,1.783,2.939,5.66 +units=m +no_defs');
ol.proj.proj4.register(proj4);
var swissProjection = ol.proj.get('EPSG:21781');
register(proj4);
const swissProjection = getProjection('EPSG:21781');
// we can now use the projection:
var map = new ol.Map({
view: new ol.View({
const map = new Map({
view: new View({
projection: swissProjection
// other view properties like map center etc.
})
@@ -104,15 +113,20 @@ coordinates for the center have to be provided in that projection. Chances are
that your map looks like this:
```javascript
var washingtonLonLat = [-77.036667, 38.895];
var map = new ol.Map({
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
const washingtonLonLat = [-77.036667, 38.895];
const map = new Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new ol.View({
view: new View({
center: washingtonLonLat,
zoom: 12
})
@@ -128,31 +142,38 @@ The solution is easy: Provide the coordinates projected into Web Mercator.
OpenLayers has some helpful utility methods to assist you:
```javascript
var washingtonLonLat = [-77.036667, 38.895];
var washingtonWebMercator = ol.proj.fromLonLat(washingtonLonLat);
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import {fromLonLat} from 'ol/proj';
var map = new ol.Map({
const washingtonLonLat = [-77.036667, 38.895];
const washingtonWebMercator = fromLonLat(washingtonLonLat);
const map = new Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new ol.View({
view: new View({
center: washingtonWebMercator,
zoom: 8
})
});
```
The method `ol.proj.fromLonLat()` is available from version 3.5 onwards.
The method `fromLonLat()` is available from version 3.5 onwards.
If you told OpenLayers about a custom projection (see above), you can use the
following method to transform a coordinate from WGS84 to your projection:
```javascript
import {transform} from 'ol/proj';
// assuming that OpenLayers knows about EPSG:21781, see above
var swissCoord = ol.proj.transform([8.23, 46.86], 'EPSG:4326', 'EPSG:21781');
const swissCoord = transform([8.23, 46.86], 'EPSG:4326', 'EPSG:21781');
```
@@ -189,18 +210,24 @@ So the next step would be to put the decimal coordinates into an array and use
it as center:
```javascript
var schladming = [47.394167, 13.689167]; // caution partner, read on...
// since we are using OSM, we have to transform the coordinates...
var schladmingWebMercator = ol.proj.fromLonLat(schladming);
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import {fromLonLat} from 'ol/proj';
var map = new ol.Map({
const schladming = [47.394167, 13.689167]; // caution partner, read on...
// since we are using OSM, we have to transform the coordinates...
const schladmingWebMercator = fromLonLat(schladming);
const map = new Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new ol.View({
view: new View({
center: schladmingWebMercator,
zoom: 9
})
@@ -219,18 +246,24 @@ e.g. try to change the map center.
Ok, then let's flip the coordinates:
```javascript
var schladming = [13.689167, 47.394167]; // longitude first, then latitude
// since we are using OSM, we have to transform the coordinates...
var schladmingWebMercator = ol.proj.fromLonLat(schladming);
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import {fromLonLat} from 'ol/proj';
var map = new ol.Map({
const schladming = [13.689167, 47.394167]; // longitude first, then latitude
// since we are using OSM, we have to transform the coordinates...
const schladmingWebMercator = fromLonLat(schladming);
const map = new Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new ol.View({
view: new View({
center: schladmingWebMercator,
zoom: 9
})
@@ -244,7 +277,7 @@ first, and then the latitude. This behaviour is the same as we had in OpenLayers
2, and it actually makes sense because of the natural axis order in WGS84.
If you cannot remember the correct order, just have a look at the method name
we used: `ol.proj.fromLonLat`; even there we hint that we expect longitude
we used: `fromLonLat`; even there we hint that we expect longitude
first, and then latitude.
@@ -254,8 +287,11 @@ Suppose you want to load a KML file and display the contained features on the
map. Code like the following could be used:
```javascript
var vector = new ol.layer.Vector({
source: new ol.source.KML({
import VectorLayer from 'ol/layer/Vector';
import KMLSource from 'ol/source/KML';
const vector = new VectorLayer({
source: new KMLSource({
projection: 'EPSG:3857',
url: 'data/kml/2012-02-10.kml'
})
@@ -266,13 +302,16 @@ You may ask yourself how many features are in that KML, and try something like
the following:
```javascript
var vector = new ol.layer.Vector({
source: new ol.source.KML({
import VectorLayer from 'ol/layer/Vector';
import KMLSource from 'ol/source/KML';
const vector = new VectorLayer({
source: new KMLSource({
projection: 'EPSG:3857',
url: 'data/kml/2012-02-10.kml'
})
});
var numFeatures = vector.getSource().getFeatures().length;
const numFeatures = vector.getSource().getFeatures().length;
console.log("Count right after construction: " + numFeatures);
```
@@ -284,9 +323,9 @@ been populated with features), you should use an event listener function on the
```javascript
vector.getSource().on('change', function(evt){
var source = evt.target;
const source = evt.target;
if (source.getState() === 'ready') {
var numFeatures = source.getFeatures().length;
const numFeatures = source.getFeatures().length;
console.log("Count after change: " + numFeatures);
}
});
@@ -315,16 +354,17 @@ map.renderSync();
## Why are my features not found?
You are using `ol.Map#forEachFeatureAtPixel` or `ol.Map#hasFeatureAtPixel`, but
You are using `Map#forEachFeatureAtPixel` or `Map#hasFeatureAtPixel`, but
it sometimes does not work for large icons or labels? The *hit detection* only
checks features that are within a certain distance of the given position. For large
icons, the actual geometry of a feature might be too far away and is not considered.
In this case, set the `renderBuffer` property of `ol.layer.Vector` (the default
value is 100px):
In this case, set the `renderBuffer` property of `VectorLayer` (the default value is 100px):
```javascript
var vectorLayer = new ol.layer.Vector({
import VectorLayer from 'ol/layer/Vector';
const vectorLayer = new VectorLayer({
...
renderBuffer: 200
});

View File

@@ -17,7 +17,7 @@ OpenLayers is available as [`ol` npm package](https://npmjs.com/package/ol), whi
## Renderers and Browser Support
By default, OpenLayers uses a performance optimized Canvas renderer. An experimental WebGL renderer (without text rendering support) is also avaialble.
By default, OpenLayers uses a performance optimized Canvas renderer. An experimental WebGL renderer (without text rendering support) is also available.
OpenLayers runs on all modern browsers that support [HTML5](https://html.spec.whatwg.org/multipage/) and [ECMAScript 5](http://www.ecma-international.org/ecma-262/5.1/). This includes Chrome, Firefox, Safari and Edge. For older browsers and platforms like Internet Explorer (down to version 9) and Android 4.x, [polyfills](http://polyfill.io), the application bundle needs to be transpiled (e.g. using [Babel](https://babeljs.io)) and bundled with polyfills for `requestAnimationFrame`, `Element.prototype.classList` and `URL`.

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
@@ -12,11 +11,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat} from '../src/ol/proj.js';
import {OSM, TileDebug} from '../src/ol/source.js';
@@ -20,11 +19,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: fromLonLat([-0.1275, 51.507222]),
zoom: 10

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
@@ -45,11 +44,6 @@ const map = new Map({
vectorLayer
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: view
});

View File

@@ -1,4 +1,3 @@
import {inherits} from '../src/ol/util.js';
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls, Control} from '../src/ol/control.js';
@@ -6,13 +5,6 @@ import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
/**
* Define a namespace for the application.
*/
window.app = {};
const app = window.app;
//
// Define rotate to north control.
//
@@ -23,32 +15,31 @@ const app = window.app;
* @extends {module:ol/control/Control~Control}
* @param {Object=} opt_options Control options.
*/
app.RotateNorthControl = function(opt_options) {
class RotateNorthControl extends Control {
const options = opt_options || {};
constructor(opt_options) {
const options = opt_options || {};
const button = document.createElement('button');
button.innerHTML = 'N';
const button = document.createElement('button');
button.innerHTML = 'N';
const this_ = this;
const handleRotateNorth = function() {
this_.getMap().getView().setRotation(0);
};
const element = document.createElement('div');
element.className = 'rotate-north ol-unselectable ol-control';
element.appendChild(button);
button.addEventListener('click', handleRotateNorth, false);
button.addEventListener('touchstart', handleRotateNorth, false);
super({
element: element,
target: options.target
});
const element = document.createElement('div');
element.className = 'rotate-north ol-unselectable ol-control';
element.appendChild(button);
button.addEventListener('click', this.handleRotateNorth.bind(this), false);
}
Control.call(this, {
element: element,
target: options.target
});
handleRotateNorth() {
this.getMap().getView().setRotation(0);
}
};
inherits(app.RotateNorthControl, Control);
}
//
@@ -57,12 +48,8 @@ inherits(app.RotateNorthControl, Control);
const map = new Map({
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}).extend([
new app.RotateNorthControl()
controls: defaultControls().extend([
new RotateNorthControl()
]),
layers: [
new TileLayer({

View File

@@ -1,4 +1,3 @@
import {inherits} from '../src/ol/util.js';
import Feature from '../src/ol/Feature.js';
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
@@ -9,58 +8,51 @@ import {TileJSON, Vector as VectorSource} from '../src/ol/source.js';
import {Fill, Icon, Stroke, Style} from '../src/ol/style.js';
/**
* Define a namespace for the application.
*/
const app = {};
/**
* @constructor
* @extends {module:ol/interaction/Pointer}
*/
app.Drag = function() {
class Drag extends PointerInteraction {
constructor() {
super({
handleDownEvent: handleDownEvent,
handleDragEvent: handleDragEvent,
handleMoveEvent: handleMoveEvent,
handleUpEvent: handleUpEvent
});
PointerInteraction.call(this, {
handleDownEvent: app.Drag.prototype.handleDownEvent,
handleDragEvent: app.Drag.prototype.handleDragEvent,
handleMoveEvent: app.Drag.prototype.handleMoveEvent,
handleUpEvent: app.Drag.prototype.handleUpEvent
});
/**
* @type {module:ol/pixel~Pixel}
* @private
*/
this.coordinate_ = null;
/**
* @type {module:ol/pixel~Pixel}
* @private
*/
this.coordinate_ = null;
/**
* @type {string|undefined}
* @private
*/
this.cursor_ = 'pointer';
/**
* @type {string|undefined}
* @private
*/
this.cursor_ = 'pointer';
/**
* @type {module:ol/Feature~Feature}
* @private
*/
this.feature_ = null;
/**
* @type {module:ol/Feature~Feature}
* @private
*/
this.feature_ = null;
/**
* @type {string|undefined}
* @private
*/
this.previousCursor_ = undefined;
};
inherits(app.Drag, PointerInteraction);
/**
* @type {string|undefined}
* @private
*/
this.previousCursor_ = undefined;
}
}
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Map browser event.
* @return {boolean} `true` to start the drag sequence.
*/
app.Drag.prototype.handleDownEvent = function(evt) {
function handleDownEvent(evt) {
const map = evt.map;
const feature = map.forEachFeatureAtPixel(evt.pixel,
@@ -74,13 +66,13 @@ app.Drag.prototype.handleDownEvent = function(evt) {
}
return !!feature;
};
}
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Map browser event.
*/
app.Drag.prototype.handleDragEvent = function(evt) {
function handleDragEvent(evt) {
const deltaX = evt.coordinate[0] - this.coordinate_[0];
const deltaY = evt.coordinate[1] - this.coordinate_[1];
@@ -89,13 +81,13 @@ app.Drag.prototype.handleDragEvent = function(evt) {
this.coordinate_[0] = evt.coordinate[0];
this.coordinate_[1] = evt.coordinate[1];
};
}
/**
* @param {module:ol/MapBrowserEvent~MapBrowserEvent} evt Event.
*/
app.Drag.prototype.handleMoveEvent = function(evt) {
function handleMoveEvent(evt) {
if (this.cursor_) {
const map = evt.map;
const feature = map.forEachFeatureAtPixel(evt.pixel,
@@ -113,17 +105,17 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
this.previousCursor_ = undefined;
}
}
};
}
/**
* @return {boolean} `false` to stop the drag sequence.
*/
app.Drag.prototype.handleUpEvent = function() {
function handleUpEvent() {
this.coordinate_ = null;
this.feature_ = null;
return false;
};
}
const pointFeature = new Feature(new Point([0, 0]));
@@ -137,7 +129,7 @@ const polygonFeature = new Feature(
const map = new Map({
interactions: defaultInteractions().extend([new app.Drag()]),
interactions: defaultInteractions().extend([new Drag()]),
layers: [
new TileLayer({
source: new TileJSON({

View File

@@ -8,7 +8,7 @@ docs: >
normalize the events from the browser.
tags: "device, orientation, gyronorm"
resources:
- https://cdn.rawgit.com/dorukeker/gyronorm.js/v2.0.6/dist/gyronorm.complete.min.js
- https://unpkg.com/gyronorm@2.0.6/dist/gyronorm.complete.min.js
---
<div id="map" class="map"></div>
<p>

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {toRadians} from '../src/ol/math.js';
import OSM from '../src/ol/source/OSM.js';
@@ -16,11 +15,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: view
});

View File

@@ -3,7 +3,7 @@ layout: example.html
title: Drag-and-Drop Image Vector
shortdesc: Example of using the drag-and-drop interaction with image vector rendering.
docs: >
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.
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"
cloak:
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5

View File

@@ -4,74 +4,6 @@ import {GPX, GeoJSON, IGC, KML, TopoJSON} from '../src/ol/format.js';
import {defaults as defaultInteractions, DragAndDrop} from '../src/ol/interaction.js';
import {Vector as VectorLayer, Tile as TileLayer} from '../src/ol/layer.js';
import {BingMaps, Vector as VectorSource} from '../src/ol/source.js';
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
const defaultStyle = {
'Point': new Style({
image: new CircleStyle({
fill: new Fill({
color: 'rgba(255,255,0,0.5)'
}),
radius: 5,
stroke: new Stroke({
color: '#ff0',
width: 1
})
})
}),
'LineString': new Style({
stroke: new Stroke({
color: '#f00',
width: 3
})
}),
'Polygon': new Style({
fill: new Fill({
color: 'rgba(0,255,255,0.5)'
}),
stroke: new Stroke({
color: '#0ff',
width: 1
})
}),
'MultiPoint': new Style({
image: new CircleStyle({
fill: new Fill({
color: 'rgba(255,0,255,0.5)'
}),
radius: 5,
stroke: new Stroke({
color: '#f0f',
width: 1
})
})
}),
'MultiLineString': new Style({
stroke: new Stroke({
color: '#0f0',
width: 3
})
}),
'MultiPolygon': new Style({
fill: new Fill({
color: 'rgba(0,0,255,0.5)'
}),
stroke: new Stroke({
color: '#00f',
width: 1
})
})
};
const styleFunction = function(feature, resolution) {
const featureStyleFunction = feature.getStyleFunction();
if (featureStyleFunction) {
return featureStyleFunction.call(feature, resolution);
} else {
return defaultStyle[feature.getGeometry().getType()];
}
};
const dragAndDropInteraction = new DragAndDrop({
formatConstructors: [
@@ -106,8 +38,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
});
map.addLayer(new VectorLayer({
renderMode: 'image',
source: vectorSource,
style: styleFunction
source: vectorSource
}));
map.getView().fit(vectorSource.getExtent());
});

View File

@@ -4,74 +4,6 @@ import {GPX, GeoJSON, IGC, KML, TopoJSON} from '../src/ol/format.js';
import {defaults as defaultInteractions, DragAndDrop} from '../src/ol/interaction.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {BingMaps, Vector as VectorSource} from '../src/ol/source.js';
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
const defaultStyle = {
'Point': new Style({
image: new CircleStyle({
fill: new Fill({
color: 'rgba(255,255,0,0.5)'
}),
radius: 5,
stroke: new Stroke({
color: '#ff0',
width: 1
})
})
}),
'LineString': new Style({
stroke: new Stroke({
color: '#f00',
width: 3
})
}),
'Polygon': new Style({
fill: new Fill({
color: 'rgba(0,255,255,0.5)'
}),
stroke: new Stroke({
color: '#0ff',
width: 1
})
}),
'MultiPoint': new Style({
image: new CircleStyle({
fill: new Fill({
color: 'rgba(255,0,255,0.5)'
}),
radius: 5,
stroke: new Stroke({
color: '#f0f',
width: 1
})
})
}),
'MultiLineString': new Style({
stroke: new Stroke({
color: '#0f0',
width: 3
})
}),
'MultiPolygon': new Style({
fill: new Fill({
color: 'rgba(0,0,255,0.5)'
}),
stroke: new Stroke({
color: '#00f',
width: 1
})
})
};
const styleFunction = function(feature, resolution) {
const featureStyleFunction = feature.getStyleFunction();
if (featureStyleFunction) {
return featureStyleFunction.call(feature, resolution);
} else {
return defaultStyle[feature.getGeometry().getType()];
}
};
const dragAndDropInteraction = new DragAndDrop({
formatConstructors: [
@@ -105,8 +37,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
features: event.features
});
map.addLayer(new VectorLayer({
source: vectorSource,
style: styleFunction
source: vectorSource
}));
map.getView().fit(vectorSource.getExtent());
});

View File

@@ -17,6 +17,7 @@ tags: "draw, edit, freehand, vector"
<form class="form-inline">
<label>Shape type &nbsp;</label>
<select id="type">
<option value="Circle">Circle</option>
<option value="Square">Square</option>
<option value="Box">Box</option>
<option value="Star">Star</option>

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
@@ -18,11 +17,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import WKT from '../src/ol/format/WKT.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
@@ -26,11 +25,6 @@ const vector = new VectorLayer({
const map = new Map({
layers: [raster, vector],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -2,7 +2,6 @@ import Feature from '../src/ol/Feature.js';
import Map from '../src/ol/Map.js';
import {unByKey} from '../src/ol/Observable.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import {easeOut} from '../src/ol/easing.js';
import Point from '../src/ol/geom/Point.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
@@ -19,11 +18,6 @@ const map = new Map({
})
})
],
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
target: 'map',
view: new View({
center: [0, 0],

View File

@@ -1,7 +1,6 @@
import Feature from '../src/ol/Feature.js';
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import Circle from '../src/ol/geom/Circle.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
@@ -174,11 +173,6 @@ const map = new Map({
vectorLayer
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -2,7 +2,6 @@ import Geolocation from '../src/ol/Geolocation.js';
import Map from '../src/ol/Map.js';
import Overlay from '../src/ol/Overlay.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import LineString from '../src/ol/geom/LineString.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat} from '../src/ol/proj.js';
@@ -22,11 +21,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: view
});

View File

@@ -2,7 +2,6 @@ import Feature from '../src/ol/Feature.js';
import Geolocation from '../src/ol/Geolocation.js';
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import Point from '../src/ol/geom/Point.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
@@ -20,11 +19,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: view
});

View File

@@ -1,7 +1,6 @@
import Feature from '../src/ol/Feature.js';
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import IGC from '../src/ol/format/IGC.js';
import {LineString, Point} from '../src/ol/geom.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
@@ -93,11 +92,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [703365.7089403362, 5714629.865071137],
zoom: 9

View File

@@ -7,6 +7,6 @@ docs: >
with OpenLayers.
tags: "vector, jsts, buffer"
resources:
- https://cdn.rawgit.com/bjornharrtell/jsts/gh-pages/1.6.0/jsts.min.js
- https://unpkg.com/jsts@2.0.2/dist/jsts.min.js
---
<div id="map" class="map"></div>

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/WebGLMap.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import {WEBGL} from '../src/ol/has.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
@@ -20,11 +19,6 @@ if (!WEBGL) {
const map = new Map({
layers: [osm],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
@@ -11,11 +10,6 @@ const osm = new TileLayer({
const map = new Map({
layers: [osm],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import BingMaps from '../src/ol/source/BingMaps.js';
import OSM from '../src/ol/source/OSM.js';
@@ -18,11 +17,6 @@ const bing = new TileLayer({
const map = new Map({
layers: [osm, bing],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM, {ATTRIBUTION} from '../src/ol/source/OSM.js';
@@ -34,11 +33,6 @@ const map = new Map({
openSeaMapLayer
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
maxZoom: 18,
center: [-244780.24508882355, 5986452.183179816],

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
import TileJSON from '../src/ol/source/TileJSON.js';
@@ -26,11 +25,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [653600, 5723680],
zoom: 5

View File

@@ -17,11 +17,7 @@ const mousePositionControl = new MousePosition({
});
const map = new Map({
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}).extend([mousePositionControl]),
controls: defaultControls().extend([mousePositionControl]),
layers: [
new TileLayer({
source: new OSM()

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import {getBottomLeft, getTopRight} from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {toLonLat} from '../src/ol/proj.js';
@@ -14,11 +13,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -6,11 +6,7 @@ import OSM from '../src/ol/source/OSM.js';
const map = new Map({
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}).extend([
controls: defaultControls().extend([
new ZoomToExtent({
extent: [
813079.7791264898, 5929220.284081122,

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
@@ -29,11 +28,6 @@ const map = new Map({
source: new OSM()
})
],
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
target: 'map',
view: new View({
center: center,

View File

@@ -15,8 +15,9 @@ function createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) {
var icon = iconCache[iconName];
if (!icon) {
icon = new Style({image: new Icon({
src: 'https://cdn.rawgit.com/mapbox/maki/master/icons/' + iconName + '-15.svg',
imgSize: [15, 15]
src: 'https://unpkg.com/@mapbox/maki@4.0.0/icons/' + iconName + '-15.svg',
imgSize: [15, 15],
crossOrigin: 'anonymous'
})});
iconCache[iconName] = icon;
}

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
@@ -12,11 +11,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [14200000, 4130000],
rotation: Math.PI / 6,

View File

@@ -8,11 +8,7 @@ import OSM from '../src/ol/source/OSM.js';
const scaleLineControl = new ScaleLine();
const map = new Map({
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}).extend([
controls: defaultControls().extend([
scaleLineControl
]),
layers: [

View File

@@ -53,7 +53,9 @@ const ExampleModify = {
const selectedFeatures = this.select.getFeatures();
this.select.on('change:active', function() {
selectedFeatures.forEach(selectedFeatures.remove, selectedFeatures);
selectedFeatures.forEach(function(each) {
selectedFeatures.remove(each);
});
});
},
setActive: function(active) {

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
@@ -11,11 +10,6 @@ const map = new Map({
source: new OSM()
})
],
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [0, 0],
zoom: 2

View File

@@ -7,7 +7,7 @@ docs: >
with OpenLayers, enabling creating and editing topological geometry. Standard interaction draws edges, snapping to existing edges. Delete an edge by drawing a new edge crossing the one to delete.
tags: "draw, edit, vector, topology, topolis"
resources:
- https://cdn.rawgit.com/bjornharrtell/topolis/releases/0.1.1/topolis.min.js
- https://unpkg.com/topolis@0.2.5/dist/topolis.js
- https://code.jquery.com/jquery-3.1.1.min.js
- https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.js
- https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.css

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import OSMXML from '../src/ol/format/OSMXML.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {bbox as bboxStrategy} from '../src/ol/loadingstrategy.js';
@@ -121,11 +120,6 @@ const raster = new TileLayer({
map = new Map({
layers: [raster, vector],
target: document.getElementById('map'),
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [739218, 5906096],
maxZoom: 19,

View File

@@ -35,11 +35,8 @@ module.exports = {
minimizer: [
new UglifyJsPlugin({
sourceMap: true,
uglifyOptions: {
mangle: {
keep_fnames: true
}
}
// Do not minify examples that inject code into workers
exclude: [/(color-manipulation|region-growing|raster)\.js/]
})
],
runtimeChunk: {

View File

@@ -77,7 +77,7 @@ function getJsSource(chunk, jsName) {
return jsSource;
}
}
if (module.identifier.endsWith(jsName)) {
if (module.identifier.endsWith(jsName) && module.source) {
return module.source;
}
}

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import {getWidth} from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {fromLonLat, get as getProjection} from '../src/ol/proj.js';
@@ -10,11 +9,6 @@ import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
const map = new Map({
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
zoom: 5,
center: fromLonLat([5, 45])

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultControls} from '../src/ol/control.js';
import {getWidth, getTopLeft} from '../src/ol/extent.js';
import TileLayer from '../src/ol/layer/Tile.js';
import {get as getProjection} from '../src/ol/proj.js';
@@ -48,11 +47,6 @@ const map = new Map({
})
],
target: 'map',
controls: defaultControls({
attributionOptions: {
collapsible: false
}
}),
view: new View({
center: [-11158582, 4813697],
zoom: 4

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "5.2.0",
"version": "5.3.2",
"description": "OpenLayers mapping library",
"keywords": [
"map",
@@ -12,15 +12,16 @@
"scripts": {
"lint": "eslint tasks test src/ol examples config",
"pretest": "npm run lint",
"test": "npm run karma -- --single-run",
"test": "npm run karma -- --single-run --log-level error",
"karma": "karma start test/karma.config.js",
"serve-examples": "webpack-dev-server --config examples/webpack/config.js --mode development --watch",
"build-examples": "webpack --config examples/webpack/config.js --mode production",
"build-package": "npm run transpile && npm run copy-css && node tasks/prepare-package && cp README.md build/ol",
"build-index": "npm run build-package && node tasks/generate-index",
"build-legacy": "rm -rf build && npm run build-index && rollup --config config/rollup.js && cleancss --source-map src/ol/ol.css -o build/ol.css",
"build-legacy": "rm -rf build && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
"copy-css": "cp src/ol/ol.css build/ol/ol.css",
"transpile": "rm -rf build/ol && mkdir -p build && buble --input src/ol --output build/ol --no modules --sourcemap",
"typecheck": "tsc --pretty",
"apidoc": "jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
},
"main": "index.js",
@@ -38,53 +39,67 @@
"rbush": "2.0.2"
},
"devDependencies": {
"@openlayers/eslint-plugin": "^4.0.0-beta.1",
"@types/arcgis-rest-api": "^10.4.3",
"@types/geojson": "^7946.0.4",
"@types/rbush": "^2.0.2",
"@types/topojson-specification": "^1.0.0",
"buble": "^0.19.3",
"buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.2.1",
"copy-webpack-plugin": "^4.4.1",
"coveralls": "3.0.1",
"eslint": "5.0.1",
"eslint": "^5.8.0",
"eslint-config-openlayers": "^11.0.0",
"expect.js": "0.3.1",
"front-matter": "^2.1.2",
"front-matter": "^3.0.0",
"fs-extra": "^7.0.0",
"glob": "^7.1.2",
"handlebars": "4.0.11",
"istanbul": "0.4.5",
"jquery": "3.3.1",
"jsdoc": "3.5.5",
"karma": "^3.0.0",
"jsdoc-plugin-typescript": "^1.0.2",
"karma": "^3.1.1",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.1",
"karma-coverage": "^1.1.2",
"karma-firefox-launcher": "^1.1.0",
"karma-mocha": "1.3.0",
"karma-sauce-launcher": "1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "4.0.0-beta.0",
"marked": "0.5.0",
"karma-webpack": "^4.0.0-rc.2",
"marked": "0.5.1",
"mocha": "5.2.0",
"mustache": "^2.3.0",
"mustache": "^3.0.0",
"pixelmatch": "^4.0.2",
"proj4": "2.5.0",
"rollup": "0.65.0",
"rollup-plugin-buble": "0.19.2",
"rollup-plugin-commonjs": "9.1.6",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-sourcemaps": "0.4.2",
"rollup-plugin-uglify": "4.0.0",
"rollup": "0.66.6",
"sinon": "^6.0.0",
"uglifyjs-webpack-plugin": "^1.2.5",
"typescript": "^3.1.0-dev.20180905",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-polyfill": "^1.0.13",
"walk": "^2.3.9",
"webpack": "4.17.1",
"webpack": "4.25.1",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4"
},
"eslintConfig": {
"extends": "openlayers"
"extends": "openlayers",
"plugins": [
"@openlayers"
],
"rules": {
"valid-jsdoc": "off",
"@openlayers/valid-tsdoc": [
"error",
{
"requireReturn": false
}
]
}
},
"sideEffects": [
"proj.js",
"ol.css"
]
}

View File

@@ -14,7 +14,7 @@ class AssertionError extends Error {
* @param {number} code Error code.
*/
constructor(code) {
const path = VERSION.split('-')[0];
const path = VERSION === 'latest' ? VERSION : 'v' + VERSION.split('-')[0];
const message = 'Assertion failed. See https://openlayers.org/en/' + path +
'/doc/errors/#' + code + ' for details.';

View File

@@ -24,7 +24,7 @@ const Property = {
export class CollectionEvent extends Event {
/**
* @param {module:ol/CollectionEventType} type Type.
* @param {CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
constructor(type, opt_element) {
@@ -56,6 +56,8 @@ export class CollectionEvent extends Event {
* Collection; they trigger events on the appropriate object, not on the
* Collection as a whole.
*
* @fires CollectionEvent
*
* @template T
* @api
*/
@@ -63,7 +65,7 @@ class Collection extends BaseObject {
/**
* @param {Array<T>=} opt_array Array.
* @param {module:ol/Collection~Options=} opt_options Collection options.
* @param {Options=} opt_options Collection options.
*/
constructor(opt_array, opt_options) {
@@ -107,7 +109,7 @@ class Collection extends BaseObject {
* Add elements to the collection. This pushes each item in the provided array
* to the end of the collection.
* @param {!Array<T>} arr Array.
* @return {module:ol/Collection<T>} This collection.
* @return {Collection<T>} This collection.
* @api
*/
extend(arr) {
@@ -160,7 +162,7 @@ class Collection extends BaseObject {
* @api
*/
getLength() {
return /** @type {number} */ (this.get(Property.LENGTH));
return this.get(Property.LENGTH);
}
/**

View File

@@ -8,13 +8,13 @@
export default {
/**
* Triggered when an item is added to the collection.
* @event module:ol/Collection~CollectionEvent#add
* @event module:ol/Collection.CollectionEvent#add
* @api
*/
ADD: 'add',
/**
* Triggered when an item is removed from the collection.
* @event module:ol/Collection~CollectionEvent#remove
* @event module:ol/Collection.CollectionEvent#remove
* @api
*/
REMOVE: 'remove'

View File

@@ -5,8 +5,14 @@ import {assert} from './asserts.js';
import {listen, unlisten, unlistenByKey} from './events.js';
import EventType from './events/EventType.js';
import BaseObject, {getChangeEventType} from './Object.js';
import Geometry from './geom/Geometry.js';
import Style from './style/Style.js';
/**
* @typedef {typeof Feature|typeof import("./render/Feature.js").default} FeatureClass
*/
/**
* @typedef {Feature|import("./render/Feature.js").default} FeatureLike
*/
/**
* @classdesc
@@ -54,7 +60,7 @@ import Style from './style/Style.js';
*/
class Feature extends BaseObject {
/**
* @param {module:ol/geom/Geometry|Object<string, *>=} opt_geometryOrProperties
* @param {import("./geom/Geometry.js").default|Object<string, *>=} opt_geometryOrProperties
* You may pass a Geometry object directly, or an object literal containing
* properties. If you pass an object literal, you may include a Geometry
* associated with a `geometry` key.
@@ -78,19 +84,19 @@ class Feature extends BaseObject {
/**
* User provided style.
* @private
* @type {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
* @type {import("./style/Style.js").StyleLike}
*/
this.style_ = null;
/**
* @private
* @type {module:ol/style/Style~StyleFunction|undefined}
* @type {import("./style/Style.js").StyleFunction|undefined}
*/
this.styleFunction_ = undefined;
/**
* @private
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
*/
this.geometryChangeKey_ = null;
@@ -98,10 +104,9 @@ class Feature extends BaseObject {
this, getChangeEventType(this.geometryName_),
this.handleGeometryChanged_, this);
if (opt_geometryOrProperties !== undefined) {
if (opt_geometryOrProperties instanceof Geometry ||
!opt_geometryOrProperties) {
const geometry = opt_geometryOrProperties;
if (opt_geometryOrProperties) {
if (typeof /** @type {?} */ (opt_geometryOrProperties).getSimplifiedGeometry === 'function') {
const geometry = /** @type {import("./geom/Geometry.js").default} */ (opt_geometryOrProperties);
this.setGeometry(geometry);
} else {
/** @type {Object<string, *>} */
@@ -114,7 +119,7 @@ class Feature extends BaseObject {
/**
* Clone this feature. If the original feature has a geometry it
* is also cloned. The feature id is not set in the clone.
* @return {module:ol/Feature} The clone.
* @return {Feature} The clone.
* @api
*/
clone() {
@@ -135,13 +140,13 @@ class Feature extends BaseObject {
* Get the feature's default geometry. A feature may have any number of named
* geometries. The "default" geometry (the one that is rendered by default) is
* set when calling {@link module:ol/Feature~Feature#setGeometry}.
* @return {module:ol/geom/Geometry|undefined} The default geometry for the feature.
* @return {import("./geom/Geometry.js").default|undefined} The default geometry for the feature.
* @api
* @observable
*/
getGeometry() {
return (
/** @type {module:ol/geom/Geometry|undefined} */ (this.get(this.geometryName_))
/** @type {import("./geom/Geometry.js").default|undefined} */ (this.get(this.geometryName_))
);
}
@@ -170,7 +175,7 @@ class Feature extends BaseObject {
/**
* Get the feature's style. Will return what was provided to the
* {@link module:ol/Feature~Feature#setStyle} method.
* @return {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} The feature style.
* @return {import("./style/Style.js").StyleLike} The feature style.
* @api
*/
getStyle() {
@@ -179,7 +184,7 @@ class Feature extends BaseObject {
/**
* Get the feature's style function.
* @return {module:ol/style/Style~StyleFunction|undefined} Return a function
* @return {import("./style/Style.js").StyleFunction|undefined} Return a function
* representing the current style of this feature.
* @api
*/
@@ -213,7 +218,7 @@ class Feature extends BaseObject {
/**
* Set the default geometry for the feature. This will update the property
* with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
* @param {module:ol/geom/Geometry|undefined} geometry The new geometry.
* @param {import("./geom/Geometry.js").default|undefined} geometry The new geometry.
* @api
* @observable
*/
@@ -225,7 +230,7 @@ class Feature extends BaseObject {
* Set the style for the feature. This can be a single style object, an array
* of styles, or a function that takes a resolution and returns an array of
* styles. If it is `null` the feature has no style (a `null` style).
* @param {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} style Style for this feature.
* @param {import("./style/Style.js").StyleLike} style Style for this feature.
* @api
* @fires module:ol/events/Event~Event#event:change
*/
@@ -271,26 +276,27 @@ class Feature extends BaseObject {
/**
* Convert the provided object into a feature style function. Functions passed
* through unchanged. Arrays of module:ol/style/Style or single style objects wrapped
* through unchanged. Arrays of Style or single style objects wrapped
* in a new feature style function.
* @param {module:ol/style/Style~StyleFunction|!Array<module:ol/style/Style>|!module:ol/style/Style} obj
* @param {!import("./style/Style.js").StyleFunction|!Array<import("./style/Style.js").default>|!import("./style/Style.js").default} obj
* A feature style function, a single style, or an array of styles.
* @return {module:ol/style/Style~StyleFunction} A style function.
* @return {import("./style/Style.js").StyleFunction} A style function.
*/
export function createStyleFunction(obj) {
if (typeof obj === 'function') {
return obj;
} else {
/**
* @type {Array<module:ol/style/Style>}
* @type {Array<import("./style/Style.js").default>}
*/
let styles;
if (Array.isArray(obj)) {
styles = obj;
} else {
assert(obj instanceof Style,
41); // Expected an `module:ol/style/Style~Style` or an array of `module:ol/style/Style~Style`
styles = [obj];
assert(typeof /** @type {?} */ (obj).getZIndex === 'function',
41); // Expected an `import("./style/Style.js").Style` or an array of `import("./style/Style.js").Style`
const style = /** @type {import("./style/Style.js").default} */ (obj);
styles = [style];
}
return function() {
return styles;

View File

@@ -1,9 +1,9 @@
/**
* @module ol/Geolocation
*/
import GeolocationProperty from './GeolocationProperty.js';
import BaseObject, {getChangeEventType} from './Object.js';
import {listen} from './events.js';
import Event from './events/Event.js';
import EventType from './events/EventType.js';
import {circular as circularPolygon} from './geom/Polygon.js';
import {GEOLOCATION} from './has.js';
@@ -11,13 +11,54 @@ import {toRadians} from './math.js';
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
/**
* @enum {string}
*/
const Property = {
ACCURACY: 'accuracy',
ACCURACY_GEOMETRY: 'accuracyGeometry',
ALTITUDE: 'altitude',
ALTITUDE_ACCURACY: 'altitudeAccuracy',
HEADING: 'heading',
POSITION: 'position',
PROJECTION: 'projection',
SPEED: 'speed',
TRACKING: 'tracking',
TRACKING_OPTIONS: 'trackingOptions'
};
/**
* @classdesc
* Events emitted on Geolocation error.
*/
class GeolocationError extends Event {
/**
* @param {PositionError} error error object.
*/
constructor(error) {
super(EventType.ERROR);
/**
* @type {number}
*/
this.code = error.code;
/**
* @type {string}
*/
this.message = error.message;
}
}
/**
* @typedef {Object} Options
* @property {boolean} [tracking=false] Start Tracking right after
* instantiation.
* @property {PositionOptions} [trackingOptions] Tracking options.
* See http://www.w3.org/TR/geolocation-API/#position_options_interface.
* @property {module:ol/proj~ProjectionLike} [projection] The projection the position
* @property {import("./proj.js").ProjectionLike} [projection] The projection the position
* is reported in.
*/
@@ -48,7 +89,7 @@ import {get as getProjection, getTransformFromProjections, identityTransform} fr
class Geolocation extends BaseObject {
/**
* @param {module:ol/Geolocation~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
@@ -59,13 +100,13 @@ class Geolocation extends BaseObject {
/**
* The unprojected (EPSG:4326) device position.
* @private
* @type {module:ol/coordinate~Coordinate}
* @type {import("./coordinate.js").Coordinate}
*/
this.position_ = null;
/**
* @private
* @type {module:ol/proj~TransformFunction}
* @type {import("./proj.js").TransformFunction}
*/
this.transform_ = identityTransform;
@@ -76,10 +117,10 @@ class Geolocation extends BaseObject {
this.watchId_ = undefined;
listen(
this, getChangeEventType(GeolocationProperty.PROJECTION),
this, getChangeEventType(Property.PROJECTION),
this.handleProjectionChanged_, this);
listen(
this, getChangeEventType(GeolocationProperty.TRACKING),
this, getChangeEventType(Property.TRACKING),
this.handleTrackingChanged_, this);
if (options.projection !== undefined) {
@@ -110,7 +151,7 @@ class Geolocation extends BaseObject {
this.transform_ = getTransformFromProjections(
getProjection('EPSG:4326'), projection);
if (this.position_) {
this.set(GeolocationProperty.POSITION, this.transform_(this.position_));
this.set(Property.POSITION, this.transform_(this.position_));
}
}
}
@@ -139,13 +180,13 @@ class Geolocation extends BaseObject {
*/
positionChange_(position) {
const coords = position.coords;
this.set(GeolocationProperty.ACCURACY, coords.accuracy);
this.set(GeolocationProperty.ALTITUDE,
this.set(Property.ACCURACY, coords.accuracy);
this.set(Property.ALTITUDE,
coords.altitude === null ? undefined : coords.altitude);
this.set(GeolocationProperty.ALTITUDE_ACCURACY,
this.set(Property.ALTITUDE_ACCURACY,
coords.altitudeAccuracy === null ?
undefined : coords.altitudeAccuracy);
this.set(GeolocationProperty.HEADING, coords.heading === null ?
this.set(Property.HEADING, coords.heading === null ?
undefined : toRadians(coords.heading));
if (!this.position_) {
this.position_ = [coords.longitude, coords.latitude];
@@ -154,12 +195,12 @@ class Geolocation extends BaseObject {
this.position_[1] = coords.latitude;
}
const projectedPosition = this.transform_(this.position_);
this.set(GeolocationProperty.POSITION, projectedPosition);
this.set(GeolocationProperty.SPEED,
this.set(Property.POSITION, projectedPosition);
this.set(Property.SPEED,
coords.speed === null ? undefined : coords.speed);
const geometry = circularPolygon(this.position_, coords.accuracy);
geometry.applyTransform(this.transform_);
this.set(GeolocationProperty.ACCURACY_GEOMETRY, geometry);
this.set(Property.ACCURACY_GEOMETRY, geometry);
this.changed();
}
@@ -174,9 +215,8 @@ class Geolocation extends BaseObject {
* @param {PositionError} error error object.
*/
positionError_(error) {
error.type = EventType.ERROR;
this.setTracking(false);
this.dispatchEvent(/** @type {{type: string, target: undefined}} */ (error));
this.dispatchEvent(new GeolocationError(error));
}
/**
@@ -187,18 +227,18 @@ class Geolocation extends BaseObject {
* @api
*/
getAccuracy() {
return /** @type {number|undefined} */ (this.get(GeolocationProperty.ACCURACY));
return /** @type {number|undefined} */ (this.get(Property.ACCURACY));
}
/**
* Get a geometry of the position accuracy.
* @return {?module:ol/geom/Polygon} A geometry of the position accuracy.
* @return {?import("./geom/Polygon.js").default} A geometry of the position accuracy.
* @observable
* @api
*/
getAccuracyGeometry() {
return (
/** @type {?module:ol/geom/Polygon} */ (this.get(GeolocationProperty.ACCURACY_GEOMETRY) || null)
/** @type {?import("./geom/Polygon.js").default} */ (this.get(Property.ACCURACY_GEOMETRY) || null)
);
}
@@ -210,7 +250,7 @@ class Geolocation extends BaseObject {
* @api
*/
getAltitude() {
return /** @type {number|undefined} */ (this.get(GeolocationProperty.ALTITUDE));
return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));
}
/**
@@ -221,7 +261,7 @@ class Geolocation extends BaseObject {
* @api
*/
getAltitudeAccuracy() {
return /** @type {number|undefined} */ (this.get(GeolocationProperty.ALTITUDE_ACCURACY));
return /** @type {number|undefined} */ (this.get(Property.ALTITUDE_ACCURACY));
}
/**
@@ -233,32 +273,32 @@ class Geolocation extends BaseObject {
* @api
*/
getHeading() {
return /** @type {number|undefined} */ (this.get(GeolocationProperty.HEADING));
return /** @type {number|undefined} */ (this.get(Property.HEADING));
}
/**
* Get the position of the device.
* @return {module:ol/coordinate~Coordinate|undefined} The current position of the device reported
* @return {import("./coordinate.js").Coordinate|undefined} The current position of the device reported
* in the current projection.
* @observable
* @api
*/
getPosition() {
return (
/** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(GeolocationProperty.POSITION))
/** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(Property.POSITION))
);
}
/**
* Get the projection associated with the position.
* @return {module:ol/proj/Projection|undefined} The projection the position is
* @return {import("./proj/Projection.js").default|undefined} The projection the position is
* reported in.
* @observable
* @api
*/
getProjection() {
return (
/** @type {module:ol/proj/Projection|undefined} */ (this.get(GeolocationProperty.PROJECTION))
/** @type {import("./proj/Projection.js").default|undefined} */ (this.get(Property.PROJECTION))
);
}
@@ -270,7 +310,7 @@ class Geolocation extends BaseObject {
* @api
*/
getSpeed() {
return /** @type {number|undefined} */ (this.get(GeolocationProperty.SPEED));
return /** @type {number|undefined} */ (this.get(Property.SPEED));
}
/**
@@ -280,7 +320,7 @@ class Geolocation extends BaseObject {
* @api
*/
getTracking() {
return /** @type {boolean} */ (this.get(GeolocationProperty.TRACKING));
return /** @type {boolean} */ (this.get(Property.TRACKING));
}
/**
@@ -293,18 +333,18 @@ class Geolocation extends BaseObject {
* @api
*/
getTrackingOptions() {
return /** @type {PositionOptions|undefined} */ (this.get(GeolocationProperty.TRACKING_OPTIONS));
return /** @type {PositionOptions|undefined} */ (this.get(Property.TRACKING_OPTIONS));
}
/**
* Set the projection to use for transforming the coordinates.
* @param {module:ol/proj~ProjectionLike} projection The projection the position is
* @param {import("./proj.js").ProjectionLike} projection The projection the position is
* reported in.
* @observable
* @api
*/
setProjection(projection) {
this.set(GeolocationProperty.PROJECTION, getProjection(projection));
this.set(Property.PROJECTION, getProjection(projection));
}
/**
@@ -314,7 +354,7 @@ class Geolocation extends BaseObject {
* @api
*/
setTracking(tracking) {
this.set(GeolocationProperty.TRACKING, tracking);
this.set(Property.TRACKING, tracking);
}
/**
@@ -327,7 +367,7 @@ class Geolocation extends BaseObject {
* @api
*/
setTrackingOptions(options) {
this.set(GeolocationProperty.TRACKING_OPTIONS, options);
this.set(Property.TRACKING_OPTIONS, options);
}
}

View File

@@ -1,19 +0,0 @@
/**
* @module ol/GeolocationProperty
*/
/**
* @enum {string}
*/
export default {
ACCURACY: 'accuracy',
ACCURACY_GEOMETRY: 'accuracyGeometry',
ALTITUDE: 'altitude',
ALTITUDE_ACCURACY: 'altitudeAccuracy',
HEADING: 'heading',
POSITION: 'position',
PROJECTION: 'projection',
SPEED: 'speed',
TRACKING: 'tracking',
TRACKING_OPTIONS: 'trackingOptions'
};

View File

@@ -17,7 +17,7 @@ import Text from './style/Text.js';
/**
* @type {module:ol/style/Stroke}
* @type {Stroke}
* @private
* @const
*/
@@ -26,7 +26,6 @@ const DEFAULT_STROKE_STYLE = new Stroke({
});
/**
* TODO can be configurable
* @type {Array<number>}
* @private
*/
@@ -36,13 +35,13 @@ const INTERVALS = [
/**
* @typedef {Object} GraticuleLabelDataType
* @property {module:ol/geom/Point} geom
* @property {Point} geom
* @property {string} text
*/
/**
* @typedef {Object} Options
* @property {module:ol/PluggableMap} [map] Reference to an
* @property {import("./PluggableMap.js").default} [map] Reference to an
* {@link module:ol/Map~Map} object.
* @property {number} [maxLines=100] The maximum number of meridians and
* parallels from the center of the map. The default value of 100 means that at
@@ -50,7 +49,7 @@ const INTERVALS = [
* appropriate for conformal projections like Spherical Mercator. If you
* increase the value, more lines will be drawn and the drawing performance will
* decrease.
* @property {module:ol/style/Stroke} [strokeStyle='rgba(0,0,0,0.2)'] The
* @property {Stroke} [strokeStyle='rgba(0,0,0,0.2)'] The
* stroke style to use for drawing the graticule. If not provided, a not fully
* opaque black will be used.
* @property {number} [targetSize=100] The target size of the graticule cells,
@@ -71,7 +70,7 @@ const INTERVALS = [
* @property {number} [latLabelPosition=1] Latitude label position in fractions
* (0..1) of view extent. 0 means at the left of the viewport, 1 means at the
* right.
* @property {module:ol/style/Text} [lonLabelStyle] Longitude label text
* @property {Text} [lonLabelStyle] Longitude label text
* style. If not provided, the following style will be used:
* ```js
* new Text({
@@ -89,7 +88,7 @@ const INTERVALS = [
* Note that the default's `textBaseline` configuration will not work well for
* `lonLabelPosition` configurations that position labels close to the top of
* the viewport.
* @property {module:ol/style/Text} [latLabelStyle] Latitude label text style.
* @property {Text} [latLabelStyle] Latitude label text style.
* If not provided, the following style will be used:
* ```js
* new Text({
@@ -107,6 +106,11 @@ const INTERVALS = [
* Note that the default's `textAlign` configuration will not work well for
* `latLabelPosition` configurations that position labels close to the left of
* the viewport.
* @property {Array<number>} [intervals=[90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001]]
* Intervals (in degrees) for the graticule. Example to limit graticules to 30 and 10 degrees intervals:
* ```js
* [30, 10]
* ```
*/
@@ -117,25 +121,25 @@ const INTERVALS = [
class Graticule {
/**
* @param {module:ol/Graticule~Options=} opt_options Options.
* @param {Options=} opt_options Options.
*/
constructor(opt_options) {
const options = opt_options || {};
/**
* @type {module:ol/PluggableMap}
* @type {import("./PluggableMap.js").default}
* @private
*/
this.map_ = null;
/**
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
* @private
*/
this.postcomposeListenerKey_ = null;
/**
* @type {module:ol/proj/Projection}
* @type {import("./proj/Projection.js").default}
*/
this.projection_ = null;
@@ -200,49 +204,49 @@ class Graticule {
this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
/**
* @type {Array<module:ol/geom/LineString>}
* @type {Array<LineString>}
* @private
*/
this.meridians_ = [];
/**
* @type {Array<module:ol/geom/LineString>}
* @type {Array<LineString>}
* @private
*/
this.parallels_ = [];
/**
* @type {module:ol/style/Stroke}
* @type {Stroke}
* @private
*/
this.strokeStyle_ = options.strokeStyle !== undefined ? options.strokeStyle : DEFAULT_STROKE_STYLE;
/**
* @type {module:ol/proj~TransformFunction|undefined}
* @type {import("./proj.js").TransformFunction|undefined}
* @private
*/
this.fromLonLatTransform_ = undefined;
/**
* @type {module:ol/proj~TransformFunction|undefined}
* @type {import("./proj.js").TransformFunction|undefined}
* @private
*/
this.toLonLatTransform_ = undefined;
/**
* @type {module:ol/coordinate~Coordinate}
* @type {import("./coordinate.js").Coordinate}
* @private
*/
this.projectionCenterLonLat_ = null;
/**
* @type {Array<module:ol/Graticule~GraticuleLabelDataType>}
* @type {Array<GraticuleLabelDataType>}
* @private
*/
this.meridiansLabels_ = null;
/**
* @type {Array<module:ol/Graticule~GraticuleLabelDataType>}
* @type {Array<GraticuleLabelDataType>}
* @private
*/
this.parallelsLabels_ = null;
@@ -282,7 +286,7 @@ class Graticule {
options.latLabelPosition;
/**
* @type {module:ol/style/Text}
* @type {Text}
* @private
*/
this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle :
@@ -299,7 +303,7 @@ class Graticule {
});
/**
* @type {module:ol/style/Text}
* @type {Text}
* @private
*/
this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle :
@@ -319,6 +323,12 @@ class Graticule {
this.parallelsLabels_ = [];
}
/**
* @type {Array<number>}
* @private
*/
this.intervals_ = options.intervals !== undefined ? options.intervals : INTERVALS;
this.setMap(options.map !== undefined ? options.map : null);
}
@@ -327,7 +337,7 @@ class Graticule {
* @param {number} minLat Minimal latitude.
* @param {number} maxLat Maximal latitude.
* @param {number} squaredTolerance Squared tolerance.
* @param {module:ol/extent~Extent} extent Extent.
* @param {import("./extent.js").Extent} extent Extent.
* @param {number} index Index.
* @return {number} Index.
* @private
@@ -348,10 +358,10 @@ class Graticule {
}
/**
* @param {module:ol/geom/LineString} lineString Meridian
* @param {module:ol/extent~Extent} extent Extent.
* @param {LineString} lineString Meridian
* @param {import("./extent.js").Extent} extent Extent.
* @param {number} index Index.
* @return {module:ol/geom/Point} Meridian point.
* @return {Point} Meridian point.
* @private
*/
getMeridianPoint_(lineString, extent, index) {
@@ -377,7 +387,7 @@ class Graticule {
* @param {number} minLon Minimal longitude.
* @param {number} maxLon Maximal longitude.
* @param {number} squaredTolerance Squared tolerance.
* @param {module:ol/extent~Extent} extent Extent.
* @param {import("./extent.js").Extent} extent Extent.
* @param {number} index Index.
* @return {number} Index.
* @private
@@ -398,10 +408,10 @@ class Graticule {
}
/**
* @param {module:ol/geom/LineString} lineString Parallels.
* @param {module:ol/extent~Extent} extent Extent.
* @param {LineString} lineString Parallels.
* @param {import("./extent.js").Extent} extent Extent.
* @param {number} index Index.
* @return {module:ol/geom/Point} Parallel point.
* @return {Point} Parallel point.
* @private
*/
getParallelPoint_(lineString, extent, index) {
@@ -423,8 +433,8 @@ class Graticule {
}
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {module:ol/coordinate~Coordinate} center Center.
* @param {import("./extent.js").Extent} extent Extent.
* @param {import("./coordinate.js").Coordinate} center Center.
* @param {number} resolution Resolution.
* @param {number} squaredTolerance Squared tolerance.
* @private
@@ -530,8 +540,8 @@ class Graticule {
const p1 = [];
/** @type {Array<number>} **/
const p2 = [];
for (let i = 0, ii = INTERVALS.length; i < ii; ++i) {
const delta = INTERVALS[i] / 2;
for (let i = 0, ii = this.intervals_.length; i < ii; ++i) {
const delta = this.intervals_[i] / 2;
p1[0] = centerLon - delta;
p1[1] = centerLat - delta;
p2[0] = centerLon + delta;
@@ -542,14 +552,14 @@ class Graticule {
if (dist <= target) {
break;
}
interval = INTERVALS[i];
interval = this.intervals_[i];
}
return interval;
}
/**
* Get the map associated with this graticule.
* @return {module:ol/PluggableMap} The map.
* @return {import("./PluggableMap.js").default} The map.
* @api
*/
getMap() {
@@ -561,7 +571,7 @@ class Graticule {
* @param {number} minLat Minimal latitude.
* @param {number} maxLat Maximal latitude.
* @param {number} squaredTolerance Squared tolerance.
* @return {module:ol/geom/LineString} The meridian line string.
* @return {LineString} The meridian line string.
* @param {number} index Index.
* @private
*/
@@ -579,7 +589,7 @@ class Graticule {
/**
* Get the list of meridians. Meridians are lines of equal longitude.
* @return {Array<module:ol/geom/LineString>} The meridians.
* @return {Array<LineString>} The meridians.
* @api
*/
getMeridians() {
@@ -591,7 +601,7 @@ class Graticule {
* @param {number} minLon Minimal longitude.
* @param {number} maxLon Maximal longitude.
* @param {number} squaredTolerance Squared tolerance.
* @return {module:ol/geom/LineString} The parallel line string.
* @return {LineString} The parallel line string.
* @param {number} index Index.
* @private
*/
@@ -609,7 +619,7 @@ class Graticule {
/**
* Get the list of parallels. Parallels are lines of equal latitude.
* @return {Array<module:ol/geom/LineString>} The parallels.
* @return {Array<LineString>} The parallels.
* @api
*/
getParallels() {
@@ -617,7 +627,7 @@ class Graticule {
}
/**
* @param {module:ol/render/Event} e Event.
* @param {import("./render/Event.js").default} e Event.
* @private
*/
handlePostCompose_(e) {
@@ -672,7 +682,7 @@ class Graticule {
}
/**
* @param {module:ol/proj/Projection} projection Projection.
* @param {import("./proj/Projection.js").default} projection Projection.
* @private
*/
updateProjectionInfo_(projection) {
@@ -703,7 +713,7 @@ class Graticule {
/**
* Set the map for this graticule. The graticule will be rendered on the
* provided map.
* @param {module:ol/PluggableMap} map Map.
* @param {import("./PluggableMap.js").default} map Map.
* @api
*/
setMap(map) {

View File

@@ -22,7 +22,7 @@ import {getHeight} from './extent.js';
* post requests or - in general - through XHR requests, where the src of the
* image element would be set to a data URI when the content is loaded.
*
* @typedef {function(module:ol/Image, string)} LoadFunction
* @typedef {function(ImageWrapper, string)} LoadFunction
* @api
*/
@@ -30,12 +30,12 @@ import {getHeight} from './extent.js';
class ImageWrapper extends ImageBase {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {import("./extent.js").Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function.
* @param {LoadFunction} imageLoadFunction Image load function.
*/
constructor(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
@@ -58,19 +58,19 @@ class ImageWrapper extends ImageBase {
/**
* @private
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("./events.js").EventsKey>}
*/
this.imageListenerKeys_ = null;
/**
* @protected
* @type {module:ol/ImageState}
* @type {ImageState}
*/
this.state = ImageState.IDLE;
/**
* @private
* @type {module:ol/Image~LoadFunction}
* @type {LoadFunction}
*/
this.imageLoadFunction_ = imageLoadFunction;

View File

@@ -1,6 +1,7 @@
/**
* @module ol/ImageBase
*/
import {abstract} from './util.js';
import EventTarget from './events/Target.js';
import EventType from './events/EventType.js';
@@ -10,10 +11,10 @@ import EventType from './events/EventType.js';
class ImageBase extends EventTarget {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {import("./extent.js").Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {module:ol/ImageState} state State.
* @param {import("./ImageState.js").default} state State.
*/
constructor(extent, resolution, pixelRatio, state) {
@@ -21,7 +22,7 @@ class ImageBase extends EventTarget {
/**
* @protected
* @type {module:ol/extent~Extent}
* @type {import("./extent.js").Extent}
*/
this.extent = extent;
@@ -39,7 +40,7 @@ class ImageBase extends EventTarget {
/**
* @protected
* @type {module:ol/ImageState}
* @type {import("./ImageState.js").default}
*/
this.state = state;
@@ -53,7 +54,7 @@ class ImageBase extends EventTarget {
}
/**
* @return {module:ol/extent~Extent} Extent.
* @return {import("./extent.js").Extent} Extent.
*/
getExtent() {
return this.extent;
@@ -63,7 +64,9 @@ class ImageBase extends EventTarget {
* @abstract
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
*/
getImage() {}
getImage() {
return abstract();
}
/**
* @return {number} PixelRatio.
@@ -80,7 +83,7 @@ class ImageBase extends EventTarget {
}
/**
* @return {module:ol/ImageState} State.
* @return {import("./ImageState.js").default} State.
*/
getState() {
return this.state;
@@ -90,7 +93,9 @@ class ImageBase extends EventTarget {
* Load not yet loaded URI.
* @abstract
*/
load() {}
load() {
abstract();
}
}

View File

@@ -11,18 +11,18 @@ import ImageState from './ImageState.js';
* If any error occurs during drawing, the "done" callback should be called with
* that error.
*
* @typedef {function(function(Error))} Loader
* @typedef {function(function(Error=))} Loader
*/
class ImageCanvas extends ImageBase {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {import("./extent.js").Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {HTMLCanvasElement} canvas Canvas.
* @param {module:ol/ImageCanvas~Loader=} opt_loader Optional loader function to
* @param {Loader=} opt_loader Optional loader function to
* support asynchronous canvas drawing.
*/
constructor(extent, resolution, pixelRatio, canvas, opt_loader) {
@@ -33,7 +33,7 @@ class ImageCanvas extends ImageBase {
/**
* Optional canvas loader function.
* @type {?module:ol/ImageCanvas~Loader}
* @type {?Loader}
* @private
*/
this.loader_ = opt_loader !== undefined ? opt_loader : null;
@@ -62,7 +62,7 @@ class ImageCanvas extends ImageBase {
/**
* Handle async drawing complete.
* @param {Error} err Any error during drawing.
* @param {Error=} err Any error during drawing.
* @private
*/
handleLoad_(err) {

View File

@@ -7,21 +7,16 @@ import {createCanvasContext2D} from './dom.js';
import {listenOnce, unlistenByKey} from './events.js';
import EventType from './events/EventType.js';
/**
* @typedef {function(new: module:ol/ImageTile, module:ol/tilecoord~TileCoord,
* module:ol/TileState, string, ?string, module:ol/Tile~LoadFunction)} TileClass
* @api
*/
class ImageTile extends Tile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @param {TileState} state State.
* @param {string} src Image source URI.
* @param {?string} crossOrigin Cross origin.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
* @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
* @param {import("./Tile.js").Options=} opt_options Tile options.
*/
constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
@@ -52,13 +47,13 @@ class ImageTile extends Tile {
/**
* @private
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("./events.js").EventsKey>}
*/
this.imageListenerKeys_ = null;
/**
* @private
* @type {module:ol/Tile~LoadFunction}
* @type {import("./Tile.js").LoadFunction}
*/
this.tileLoadFunction_ = tileLoadFunction;
@@ -114,7 +109,8 @@ class ImageTile extends Tile {
* @private
*/
handleImageLoad_() {
if (this.image_.naturalWidth && this.image_.naturalHeight) {
const image = /** @type {HTMLImageElement} */ (this.image_);
if (image.naturalWidth && image.naturalHeight) {
this.state = TileState.LOADED;
} else {
this.state = TileState.EMPTY;

View File

@@ -56,8 +56,8 @@ import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'
* options or added with `addLayer` can be groups, which can contain further
* groups, and so on.
*
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires import("./MapBrowserEvent.js").MapBrowserEvent
* @fires import("./MapEvent.js").MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @api
@@ -65,7 +65,7 @@ import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'
class Map extends PluggableMap {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @param {import("./PluggableMap.js").MapOptions} options Map options.
*/
constructor(options) {
options = assign({}, options);

View File

@@ -12,10 +12,10 @@ class MapBrowserEvent extends MapEvent {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {import("./PluggableMap.js").default} map Map.
* @param {Event} browserEvent Browser event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
* @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
*/
constructor(type, map, browserEvent, opt_dragging, opt_frameState) {
@@ -31,14 +31,14 @@ class MapBrowserEvent extends MapEvent {
/**
* The map pixel relative to the viewport corresponding to the original browser event.
* @type {module:ol/pixel~Pixel}
* @type {import("./pixel.js").Pixel}
* @api
*/
this.pixel = map.getEventPixel(browserEvent);
/**
* The coordinate in view projection corresponding to the original browser event.
* @type {module:ol/coordinate~Coordinate}
* @type {import("./coordinate.js").Coordinate}
* @api
*/
this.coordinate = map.getCoordinateFromPixel(this.pixel);

View File

@@ -12,7 +12,7 @@ import PointerEventHandler from './pointer/PointerEventHandler.js';
class MapBrowserEventHandler extends EventTarget {
/**
* @param {module:ol/PluggableMap} map The map with the viewport to listen to events on.
* @param {import("./PluggableMap.js").default} map The map with the viewport to listen to events on.
* @param {number=} moveTolerance The minimal distance the pointer must travel to trigger a move.
*/
constructor(map, moveTolerance) {
@@ -21,16 +21,16 @@ class MapBrowserEventHandler extends EventTarget {
/**
* This is the element that we will listen to the real events on.
* @type {module:ol/PluggableMap}
* @type {import("./PluggableMap.js").default}
* @private
*/
this.map_ = map;
/**
* @type {number}
* @type {any}
* @private
*/
this.clickTimeoutId_ = 0;
this.clickTimeoutId_;
/**
* @type {boolean}
@@ -39,7 +39,7 @@ class MapBrowserEventHandler extends EventTarget {
this.dragging_ = false;
/**
* @type {!Array<module:ol/events~EventsKey>}
* @type {!Array<import("./events.js").EventsKey>}
* @private
*/
this.dragListenerKeys_ = [];
@@ -54,7 +54,7 @@ class MapBrowserEventHandler extends EventTarget {
/**
* The most recent "down" type event (or null if none have occurred).
* Set on pointerdown.
* @type {module:ol/pointer/PointerEvent}
* @type {import("./pointer/PointerEvent.js").default}
* @private
*/
this.down_ = null;
@@ -77,7 +77,7 @@ class MapBrowserEventHandler extends EventTarget {
* Event handler which generates pointer events for
* the viewport element.
*
* @type {module:ol/pointer/PointerEventHandler}
* @type {PointerEventHandler}
* @private
*/
this.pointerEventHandler_ = new PointerEventHandler(element);
@@ -86,13 +86,13 @@ class MapBrowserEventHandler extends EventTarget {
* Event handler which generates pointer events for
* the document (used when dragging).
*
* @type {module:ol/pointer/PointerEventHandler}
* @type {PointerEventHandler}
* @private
*/
this.documentPointerEventHandler_ = null;
/**
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
* @private
*/
this.pointerdownListenerKey_ = listen(this.pointerEventHandler_,
@@ -100,7 +100,7 @@ class MapBrowserEventHandler extends EventTarget {
this.handlePointerDown_, this);
/**
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
* @private
*/
this.relayedListenerKey_ = listen(this.pointerEventHandler_,
@@ -110,7 +110,7 @@ class MapBrowserEventHandler extends EventTarget {
}
/**
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @private
*/
@@ -118,17 +118,17 @@ class MapBrowserEventHandler extends EventTarget {
let newEvent = new MapBrowserPointerEvent(
MapBrowserEventType.CLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
if (this.clickTimeoutId_ !== 0) {
if (this.clickTimeoutId_ !== undefined) {
// double-click
clearTimeout(this.clickTimeoutId_);
this.clickTimeoutId_ = 0;
this.clickTimeoutId_ = undefined;
newEvent = new MapBrowserPointerEvent(
MapBrowserEventType.DBLCLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
} else {
// click
this.clickTimeoutId_ = setTimeout(function() {
this.clickTimeoutId_ = 0;
this.clickTimeoutId_ = undefined;
const newEvent = new MapBrowserPointerEvent(
MapBrowserEventType.SINGLECLICK, this.map_, pointerEvent);
this.dispatchEvent(newEvent);
@@ -139,7 +139,7 @@ class MapBrowserEventHandler extends EventTarget {
/**
* Keeps track on how many pointers are currently active.
*
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @private
*/
@@ -156,7 +156,7 @@ class MapBrowserEventHandler extends EventTarget {
}
/**
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @private
*/
@@ -187,7 +187,7 @@ class MapBrowserEventHandler extends EventTarget {
}
/**
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @return {boolean} If the left mouse button was pressed.
* @private
@@ -197,7 +197,7 @@ class MapBrowserEventHandler extends EventTarget {
}
/**
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @private
*/
@@ -245,7 +245,7 @@ class MapBrowserEventHandler extends EventTarget {
}
/**
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @private
*/
@@ -271,7 +271,7 @@ class MapBrowserEventHandler extends EventTarget {
/**
* Wrap and relay a pointer event. Note that this requires that the type
* string for the MapBrowserPointerEvent matches the PointerEvent type.
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @private
*/
@@ -282,7 +282,7 @@ class MapBrowserEventHandler extends EventTarget {
}
/**
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer
* event.
* @return {boolean} Is moving.
* @private

View File

@@ -7,10 +7,10 @@ class MapBrowserPointerEvent extends MapBrowserEvent {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {module:ol/pointer/PointerEvent} pointerEvent Pointer event.
* @param {import("./PluggableMap.js").default} map Map.
* @param {import("./pointer/PointerEvent.js").default} pointerEvent Pointer event.
* @param {boolean=} opt_dragging Is the map currently being dragged?
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
* @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
*/
constructor(type, map, pointerEvent, opt_dragging, opt_frameState) {
@@ -18,7 +18,7 @@ class MapBrowserPointerEvent extends MapBrowserEvent {
/**
* @const
* @type {module:ol/pointer/PointerEvent}
* @type {import("./pointer/PointerEvent.js").default}
*/
this.pointerEvent = pointerEvent;

View File

@@ -12,8 +12,8 @@ class MapEvent extends Event {
/**
* @param {string} type Event type.
* @param {module:ol/PluggableMap} map Map.
* @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
* @param {import("./PluggableMap.js").default} map Map.
* @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
*/
constructor(type, map, opt_frameState) {
@@ -21,14 +21,14 @@ class MapEvent extends Event {
/**
* The map where the event occurred.
* @type {module:ol/PluggableMap}
* @type {import("./PluggableMap.js").default}
* @api
*/
this.map = map;
/**
* The frame state at the time of the event.
* @type {?module:ol/PluggableMap~FrameState}
* @type {?import("./PluggableMap.js").FrameState}
* @api
*/
this.frameState = opt_frameState !== undefined ? opt_frameState : null;

View File

@@ -11,8 +11,8 @@ import {assign} from './obj.js';
/**
* @classdesc
* Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
*/
class ObjectEvent extends Event {
*/
export class ObjectEvent extends Event {
/**
* @param {string} type The event type.
@@ -82,7 +82,7 @@ class ObjectEvent extends Event {
* Properties can be deleted by using the unset method. E.g.
* object.unset('foo').
*
* @fires module:ol/Object~ObjectEvent
* @fires ObjectEvent
* @api
*/
class BaseObject extends Observable {

View File

@@ -8,7 +8,7 @@
export default {
/**
* Triggered when a property is changed.
* @event module:ol/Object~ObjectEvent#propertychange
* @event module:ol/Object.ObjectEvent#propertychange
* @api
*/
PROPERTYCHANGE: 'propertychange'

View File

@@ -13,7 +13,7 @@ import EventType from './events/EventType.js';
* and unregistration. A generic `change` event is always available through
* {@link module:ol/Observable~Observable#changed}.
*
* @fires module:ol/events/Event~Event
* @fires import("./events/Event.js").Event
* @api
*/
class Observable extends EventTarget {
@@ -52,7 +52,7 @@ class Observable extends EventTarget {
* Listen for a certain type of event.
* @param {string|Array<string>} type The event type or array of event types.
* @param {function(?): ?} listener The listener function.
* @return {module:ol/events~EventsKey|Array<module:ol/events~EventsKey>} Unique key for the listener. If
* @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
* called with an array of event types as the first argument, the return
* will be an array of keys.
* @api
@@ -74,7 +74,7 @@ class Observable extends EventTarget {
* Listen once for a certain type of event.
* @param {string|Array<string>} type The event type or array of event types.
* @param {function(?): ?} listener The listener function.
* @return {module:ol/events~EventsKey|Array<module:ol/events~EventsKey>} Unique key for the listener. If
* @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
* called with an array of event types as the first argument, the return
* will be an array of keys.
* @api
@@ -113,7 +113,7 @@ class Observable extends EventTarget {
/**
* Removes an event listener using the key returned by `on()` or `once()`.
* @param {module:ol/events~EventsKey|Array<module:ol/events~EventsKey>} key The key returned by `on()`
* @param {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} key The key returned by `on()`
* or `once()` (or an array of keys).
* @api
*/
@@ -123,7 +123,7 @@ export function unByKey(key) {
unlistenByKey(key[i]);
}
} else {
unlistenByKey(/** @type {module:ol/events~EventsKey} */ (key));
unlistenByKey(/** @type {import("./events.js").EventsKey} */ (key));
}
}

View File

@@ -20,9 +20,9 @@ import {containsExtent} from './extent.js';
* array is the horizontal offset. A positive value shifts the overlay right.
* The second element in the array is the vertical offset. A positive value
* shifts the overlay down.
* @property {module:ol/coordinate~Coordinate} [position] The overlay position
* @property {import("./coordinate.js").Coordinate} [position] The overlay position
* in map projection.
* @property {module:ol/OverlayPositioning} [positioning='top-left'] Defines how
* @property {OverlayPositioning} [positioning='top-left'] Defines how
* the overlay is actually positioned with respect to its `position` property.
* Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
* `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
@@ -40,7 +40,7 @@ import {containsExtent} from './extent.js';
* @property {boolean} [autoPan=false] If set to `true` the map is panned when
* calling `setPosition`, so that the overlay is entirely visible in the current
* viewport.
* @property {module:ol/Overlay~PanOptions} [autoPanAnimation] The
* @property {PanOptions} [autoPanAnimation] The
* animation options used to pan the overlay into view. This animation is only
* used when `autoPan` is enabled. A `duration` and `easing` may be provided to
* customize the animation.
@@ -97,7 +97,7 @@ const Property = {
class Overlay extends BaseObject {
/**
* @param {module:ol/Overlay~Options} options Overlay options.
* @param {Options} options Overlay options.
*/
constructor(options) {
@@ -105,7 +105,7 @@ class Overlay extends BaseObject {
/**
* @protected
* @type {module:ol/Overlay~Options}
* @type {Options}
*/
this.options = options;
@@ -145,9 +145,9 @@ class Overlay extends BaseObject {
/**
* @protected
* @type {module:ol/Overlay~PanOptions}
* @type {PanOptions}
*/
this.autoPanAnimation = options.autoPanAnimation || /** @type {module:ol/Overlay~PanOptions} */ ({});
this.autoPanAnimation = options.autoPanAnimation || /** @type {PanOptions} */ ({});
/**
* @protected
@@ -174,7 +174,7 @@ class Overlay extends BaseObject {
/**
* @protected
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
*/
this.mapPostrenderListenerKey = null;
@@ -205,7 +205,7 @@ class Overlay extends BaseObject {
this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);
this.setPositioning(options.positioning !== undefined ?
/** @type {module:ol/OverlayPositioning} */ (options.positioning) :
/** @type {OverlayPositioning} */ (options.positioning) :
OverlayPositioning.TOP_LEFT);
if (options.position !== undefined) {
@@ -235,14 +235,14 @@ class Overlay extends BaseObject {
/**
* Get the map associated with this overlay.
* @return {module:ol/PluggableMap|undefined} The map that the
* @return {import("./PluggableMap.js").default|undefined} The map that the
* overlay is part of.
* @observable
* @api
*/
getMap() {
return (
/** @type {module:ol/PluggableMap|undefined} */ (this.get(Property.MAP))
/** @type {import("./PluggableMap.js").default|undefined} */ (this.get(Property.MAP))
);
}
@@ -258,27 +258,27 @@ class Overlay extends BaseObject {
/**
* Get the current position of this overlay.
* @return {module:ol/coordinate~Coordinate|undefined} The spatial point that the overlay is
* @return {import("./coordinate.js").Coordinate|undefined} The spatial point that the overlay is
* anchored at.
* @observable
* @api
*/
getPosition() {
return (
/** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(Property.POSITION))
/** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(Property.POSITION))
);
}
/**
* Get the current positioning of this overlay.
* @return {module:ol/OverlayPositioning} How the overlay is positioned
* @return {OverlayPositioning} How the overlay is positioned
* relative to its point on the map.
* @observable
* @api
*/
getPositioning() {
return (
/** @type {module:ol/OverlayPositioning} */ (this.get(Property.POSITIONING))
/** @type {OverlayPositioning} */ (this.get(Property.POSITIONING))
);
}
@@ -360,7 +360,7 @@ class Overlay extends BaseObject {
/**
* Set the map to be associated with this overlay.
* @param {module:ol/PluggableMap|undefined} map The map that the
* @param {import("./PluggableMap.js").default|undefined} map The map that the
* overlay is part of.
* @observable
* @api
@@ -382,7 +382,7 @@ class Overlay extends BaseObject {
/**
* Set the position for this overlay. If the position is `undefined` the
* overlay is hidden.
* @param {module:ol/coordinate~Coordinate|undefined} position The spatial point that the overlay
* @param {import("./coordinate.js").Coordinate|undefined} position The spatial point that the overlay
* is anchored at.
* @observable
* @api
@@ -432,7 +432,7 @@ class Overlay extends BaseObject {
}
if (delta[0] !== 0 || delta[1] !== 0) {
const center = /** @type {module:ol/coordinate~Coordinate} */ (map.getView().getCenter());
const center = /** @type {import("./coordinate.js").Coordinate} */ (map.getView().getCenter());
const centerPx = map.getPixelFromCoordinate(center);
const newCenterPx = [
centerPx[0] + delta[0],
@@ -451,8 +451,8 @@ class Overlay extends BaseObject {
/**
* Get the extent of an element relative to the document
* @param {HTMLElement|undefined} element The element.
* @param {module:ol/size~Size|undefined} size The size of the element.
* @return {module:ol/extent~Extent} The extent.
* @param {import("./size.js").Size|undefined} size The size of the element.
* @return {import("./extent.js").Extent} The extent.
* @protected
*/
getRect(element, size) {
@@ -469,7 +469,7 @@ class Overlay extends BaseObject {
/**
* Set the positioning for this overlay.
* @param {module:ol/OverlayPositioning} positioning how the overlay is
* @param {OverlayPositioning} positioning how the overlay is
* positioned relative to its point on the map.
* @observable
* @api
@@ -508,8 +508,8 @@ class Overlay extends BaseObject {
}
/**
* @param {module:ol/pixel~Pixel} pixel The pixel location.
* @param {module:ol/size~Size|undefined} mapSize The map size.
* @param {import("./pixel.js").Pixel} pixel The pixel location.
* @param {import("./size.js").Size|undefined} mapSize The map size.
* @protected
*/
updateRenderedPosition(pixel, mapSize) {
@@ -574,7 +574,7 @@ class Overlay extends BaseObject {
/**
* returns the options this Overlay has been created with
* @return {module:ol/Overlay~Options} overlay options
* @return {Options} overlay options
*/
getOptions() {
return this.options;

View File

@@ -36,33 +36,33 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @typedef {Object} FrameState
* @property {number} pixelRatio The pixel ratio of the frame.
* @property {number} time The time when rendering of the frame was requested.
* @property {module:ol/View~State} viewState The state of the current view.
* @property {import("./View.js").State} viewState The state of the current view.
* @property {boolean} animate
* @property {module:ol/transform~Transform} coordinateToPixelTransform
* @property {null|module:ol/extent~Extent} extent
* @property {module:ol/coordinate~Coordinate} focus
* @property {import("./transform.js").Transform} coordinateToPixelTransform
* @property {null|import("./extent.js").Extent} extent
* @property {import("./coordinate.js").Coordinate} focus
* @property {number} index
* @property {Object<number, module:ol/layer/Layer~State>} layerStates
* @property {Array<module:ol/layer/Layer~State>} layerStatesArray
* @property {module:ol/transform~Transform} pixelToCoordinateTransform
* @property {Array<module:ol/PluggableMap~PostRenderFunction>} postRenderFunctions
* @property {module:ol/size~Size} size
* @property {Object<string, import("./layer/Layer.js").State>} layerStates
* @property {Array<import("./layer/Layer.js").State>} layerStatesArray
* @property {import("./transform.js").Transform} pixelToCoordinateTransform
* @property {Array<PostRenderFunction>} postRenderFunctions
* @property {import("./size.js").Size} size
* @property {!Object<string, boolean>} skippedFeatureUids
* @property {module:ol/TileQueue} tileQueue
* @property {Object<string, Object<string, module:ol/TileRange>>} usedTiles
* @property {TileQueue} tileQueue
* @property {Object<string, Object<string, import("./TileRange.js").default>>} usedTiles
* @property {Array<number>} viewHints
* @property {!Object<string, Object<string, boolean>>} wantedTiles
*/
/**
* @typedef {function(module:ol/PluggableMap, ?module:ol/PluggableMap~FrameState): boolean} PostRenderFunction
* @typedef {function(PluggableMap, ?FrameState): boolean} PostRenderFunction
*/
/**
* @typedef {Object} AtPixelOptions
* @property {undefined|function(module:ol/layer/Layer): boolean} layerFilter Layer filter
* @property {undefined|function(import("./layer/Layer.js").default): boolean} layerFilter Layer filter
* function. The filter function will receive one argument, the
* {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value.
* Only layers which are visible and for which this function returns `true`
@@ -75,10 +75,10 @@ import {create as createTransform, apply as applyTransform} from './transform.js
/**
* @typedef {Object} MapOptionsInternal
* @property {module:ol/Collection<module:ol/control/Control>} [controls]
* @property {module:ol/Collection<module:ol/interaction/Interaction>} [interactions]
* @property {Collection<import("./control/Control.js").default>} [controls]
* @property {Collection<import("./interaction/Interaction.js").default>} [interactions]
* @property {HTMLElement|Document} keyboardEventTarget
* @property {module:ol/Collection<module:ol/Overlay>} overlays
* @property {Collection<import("./Overlay.js").default>} overlays
* @property {Object<string, *>} values
*/
@@ -86,12 +86,12 @@ import {create as createTransform, apply as applyTransform} from './transform.js
/**
* Object literal with config options for the map.
* @typedef {Object} MapOptions
* @property {module:ol/Collection<module:ol/control/Control>|Array<module:ol/control/Control>} [controls]
* @property {Collection<import("./control/Control.js").default>|Array<import("./control/Control.js").default>} [controls]
* Controls initially added to the map. If not specified,
* {@link module:ol/control/util~defaults} is used.
* {@link module:ol/control~defaults} is used.
* @property {number} [pixelRatio=window.devicePixelRatio] The ratio between
* physical pixels and device-independent pixels (dips) on the device.
* @property {module:ol/Collection<module:ol/interaction/Interaction>|Array<module:ol/interaction/Interaction>} [interactions]
* @property {Collection<import("./interaction/Interaction.js").default>|Array<import("./interaction/Interaction.js").default>} [interactions]
* Interactions that are initially added to the map. If not specified,
* {@link module:ol/interaction~defaults} is used.
* @property {HTMLElement|Document|string} [keyboardEventTarget] The element to
@@ -102,7 +102,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* map target (i.e. the user-provided div for the map). If this is not
* `document`, the target element needs to be focused for key events to be
* emitted, requiring that the target element has a `tabindex` attribute.
* @property {Array<module:ol/layer/Base>|module:ol/Collection<module:ol/layer/Base>} [layers]
* @property {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>|LayerGroup} [layers]
* Layers. If this is not defined, a map with no layers will be rendered. Note
* that layers are rendered in the order supplied, so if you want, for example,
* a vector layer to appear on top of a tile layer, it must come after the tile
@@ -119,21 +119,21 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @property {number} [moveTolerance=1] The minimum distance in pixels the
* cursor must move to be detected as a map move event instead of a click.
* Increasing this value can make it easier to click on the map.
* @property {module:ol/Collection<module:ol/Overlay>|Array<module:ol/Overlay>} [overlays]
* @property {Collection<import("./Overlay.js").default>|Array<import("./Overlay.js").default>} [overlays]
* Overlays initially added to the map. By default, no overlays are added.
* @property {HTMLElement|string} [target] The container for the map, either the
* element itself or the `id` of the element. If not specified at construction
* time, {@link module:ol/Map~Map#setTarget} must be called for the map to be
* rendered.
* @property {module:ol/View} [view] The map's view. No layer sources will be
* @property {View} [view] The map's view. No layer sources will be
* fetched unless this is specified at construction time or through
* {@link module:ol/Map~Map#setView}.
*/
/**
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires import("./MapBrowserEvent.js").MapBrowserEvent
* @fires import("./MapEvent.js").MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @fires module:ol/render/Event~RenderEvent#rendercomplete
@@ -142,7 +142,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
class PluggableMap extends BaseObject {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @param {MapOptions} options Map options.
*/
constructor(options) {
@@ -195,13 +195,13 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {module:ol/transform~Transform}
* @type {import("./transform.js").Transform}
*/
this.coordinateToPixelTransform_ = createTransform();
/**
* @private
* @type {module:ol/transform~Transform}
* @type {import("./transform.js").Transform}
*/
this.pixelToCoordinateTransform_ = createTransform();
@@ -213,32 +213,32 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {?module:ol/PluggableMap~FrameState}
* @type {?FrameState}
*/
this.frameState_ = null;
/**
* The extent at the previous 'moveend' event.
* @private
* @type {module:ol/extent~Extent}
* @type {import("./extent.js").Extent}
*/
this.previousExtent_ = null;
/**
* @private
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
*/
this.viewPropertyListenerKey_ = null;
/**
* @private
* @type {?module:ol/events~EventsKey}
* @type {?import("./events.js").EventsKey}
*/
this.viewChangeListenerKey_ = null;
/**
* @private
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("./events.js").EventsKey>}
*/
this.layerGroupPropertyListenerKeys_ = null;
@@ -287,7 +287,7 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {module:ol/MapBrowserEventHandler}
* @type {MapBrowserEventHandler}
*/
this.mapBrowserEventHandler_ = new MapBrowserEventHandler(this, options.moveTolerance);
for (const key in MapBrowserEventType) {
@@ -303,7 +303,7 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("./events.js").EventsKey>}
*/
this.keyHandlerKeys_ = null;
@@ -312,19 +312,19 @@ class PluggableMap extends BaseObject {
listen(this.viewport_, EventType.MOUSEWHEEL, this.handleBrowserEvent, this);
/**
* @type {module:ol/Collection<module:ol/control/Control>}
* @type {Collection<import("./control/Control.js").default>}
* @protected
*/
this.controls = optionsInternal.controls || new Collection();
/**
* @type {module:ol/Collection<module:ol/interaction/Interaction>}
* @type {Collection<import("./interaction/Interaction.js").default>}
* @protected
*/
this.interactions = optionsInternal.interactions || new Collection();
/**
* @type {module:ol/Collection<module:ol/Overlay>}
* @type {Collection<import("./Overlay.js").default>}
* @private
*/
this.overlays_ = optionsInternal.overlays;
@@ -332,12 +332,12 @@ class PluggableMap extends BaseObject {
/**
* A lookup of overlays by id.
* @private
* @type {Object<string, module:ol/Overlay>}
* @type {Object<string, import("./Overlay.js").default>}
*/
this.overlayIdIndex_ = {};
/**
* @type {module:ol/renderer/Map}
* @type {import("./renderer/Map.js").default}
* @private
*/
this.renderer_ = this.createRenderer();
@@ -350,19 +350,19 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {module:ol/coordinate~Coordinate}
* @type {import("./coordinate.js").Coordinate}
*/
this.focus_ = null;
/**
* @private
* @type {!Array<module:ol/PluggableMap~PostRenderFunction>}
* @type {!Array<PostRenderFunction>}
*/
this.postRenderFunctions_ = [];
/**
* @private
* @type {module:ol/TileQueue}
* @type {TileQueue}
*/
this.tileQueue_ = new TileQueue(
this.getTilePriority.bind(this),
@@ -391,8 +391,8 @@ class PluggableMap extends BaseObject {
this.controls.forEach(
/**
* @param {module:ol/control/Control} control Control.
* @this {module:ol/PluggableMap}
* @param {import("./control/Control.js").default} control Control.
* @this {PluggableMap}
*/
(function(control) {
control.setMap(this);
@@ -400,7 +400,7 @@ class PluggableMap extends BaseObject {
listen(this.controls, CollectionEventType.ADD,
/**
* @param {module:ol/Collection~CollectionEvent} event CollectionEvent.
* @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(this);
@@ -408,7 +408,7 @@ class PluggableMap extends BaseObject {
listen(this.controls, CollectionEventType.REMOVE,
/**
* @param {module:ol/Collection~CollectionEvent} event CollectionEvent.
* @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(null);
@@ -416,8 +416,8 @@ class PluggableMap extends BaseObject {
this.interactions.forEach(
/**
* @param {module:ol/interaction/Interaction} interaction Interaction.
* @this {module:ol/PluggableMap}
* @param {import("./interaction/Interaction.js").default} interaction Interaction.
* @this {PluggableMap}
*/
(function(interaction) {
interaction.setMap(this);
@@ -425,7 +425,7 @@ class PluggableMap extends BaseObject {
listen(this.interactions, CollectionEventType.ADD,
/**
* @param {module:ol/Collection~CollectionEvent} event CollectionEvent.
* @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(this);
@@ -433,7 +433,7 @@ class PluggableMap extends BaseObject {
listen(this.interactions, CollectionEventType.REMOVE,
/**
* @param {module:ol/Collection~CollectionEvent} event CollectionEvent.
* @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
*/
function(event) {
event.element.setMap(null);
@@ -443,18 +443,18 @@ class PluggableMap extends BaseObject {
listen(this.overlays_, CollectionEventType.ADD,
/**
* @param {module:ol/Collection~CollectionEvent} event CollectionEvent.
* @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
*/
function(event) {
this.addOverlayInternal_(/** @type {module:ol/Overlay} */ (event.element));
this.addOverlayInternal_(/** @type {import("./Overlay.js").default} */ (event.element));
}, this);
listen(this.overlays_, CollectionEventType.REMOVE,
/**
* @param {module:ol/Collection~CollectionEvent} event CollectionEvent.
* @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
*/
function(event) {
const overlay = /** @type {module:ol/Overlay} */ (event.element);
const overlay = /** @type {import("./Overlay.js").default} */ (event.element);
const id = overlay.getId();
if (id !== undefined) {
delete this.overlayIdIndex_[id.toString()];
@@ -464,13 +464,17 @@ class PluggableMap extends BaseObject {
}
/**
* @abstract
* @return {import("./renderer/Map.js").default} The map renderer
*/
createRenderer() {
throw new Error('Use a map type that has a createRenderer method');
}
/**
* Add the given control to the map.
* @param {module:ol/control/Control} control Control.
* @param {import("./control/Control.js").default} control Control.
* @api
*/
addControl(control) {
@@ -479,7 +483,7 @@ class PluggableMap extends BaseObject {
/**
* Add the given interaction to the map.
* @param {module:ol/interaction/Interaction} interaction Interaction to add.
* @param {import("./interaction/Interaction.js").default} interaction Interaction to add.
* @api
*/
addInteraction(interaction) {
@@ -490,7 +494,7 @@ class PluggableMap extends BaseObject {
* Adds the given layer to the top of this map. If you want to add a layer
* elsewhere in the stack, use `getLayers()` and the methods available on
* {@link module:ol/Collection~Collection}.
* @param {module:ol/layer/Base} layer Layer.
* @param {import("./layer/Base.js").default} layer Layer.
* @api
*/
addLayer(layer) {
@@ -500,7 +504,7 @@ class PluggableMap extends BaseObject {
/**
* Add the given overlay to the map.
* @param {module:ol/Overlay} overlay Overlay.
* @param {import("./Overlay.js").default} overlay Overlay.
* @api
*/
addOverlay(overlay) {
@@ -509,7 +513,7 @@ class PluggableMap extends BaseObject {
/**
* This deals with map's overlay collection changes.
* @param {module:ol/Overlay} overlay Overlay.
* @param {import("./Overlay.js").default} overlay Overlay.
* @private
*/
addOverlayInternal_(overlay) {
@@ -545,16 +549,16 @@ class PluggableMap extends BaseObject {
* Detect features that intersect a pixel on the viewport, and execute a
* callback with each intersecting feature. Layers included in the detection can
* be configured through the `layerFilter` option in `opt_options`.
* @param {module:ol/pixel~Pixel} pixel Pixel.
* @param {function(this: S, (module:ol/Feature|module:ol/render/Feature),
* module:ol/layer/Layer): T} callback Feature callback. The callback will be
* @param {import("./pixel.js").Pixel} pixel Pixel.
* @param {function(this: S, import("./Feature.js").FeatureLike,
* import("./layer/Layer.js").default): T} callback Feature callback. The callback will be
* called with two arguments. The first argument is one
* {@link module:ol/Feature feature} or
* {@link module:ol/render/Feature render feature} at the pixel, the second is
* the {@link module:ol/layer/Layer layer} of the feature and will be null for
* unmanaged layers. To stop detection, callback functions can return a
* truthy value.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options.
* @param {AtPixelOptions=} opt_options Optional options.
* @return {T|undefined} Callback result, i.e. the return value of last
* callback execution, or the first truthy callback return value.
* @template S,T
@@ -565,7 +569,8 @@ class PluggableMap extends BaseObject {
return;
}
const coordinate = this.getCoordinateFromPixel(pixel);
opt_options = opt_options !== undefined ? opt_options : {};
opt_options = opt_options !== undefined ? opt_options :
/** @type {AtPixelOptions} */ ({});
const hitTolerance = opt_options.hitTolerance !== undefined ?
opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
const layerFilter = opt_options.layerFilter !== undefined ?
@@ -577,9 +582,9 @@ class PluggableMap extends BaseObject {
/**
* Get all features that intersect a pixel on the viewport.
* @param {module:ol/pixel~Pixel} pixel Pixel.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options.
* @return {Array<module:ol/Feature|module:ol/render/Feature>} The detected features or
* @param {import("./pixel.js").Pixel} pixel Pixel.
* @param {AtPixelOptions=} opt_options Optional options.
* @return {Array<import("./Feature.js").FeatureLike>} The detected features or
* `null` if none were found.
* @api
*/
@@ -598,14 +603,14 @@ class PluggableMap extends BaseObject {
* Detect layers that have a color value at a pixel on the viewport, and
* execute a callback with each matching layer. Layers included in the
* detection can be configured through `opt_layerFilter`.
* @param {module:ol/pixel~Pixel} pixel Pixel.
* @param {function(this: S, module:ol/layer/Layer, (Uint8ClampedArray|Uint8Array)): T} callback
* @param {import("./pixel.js").Pixel} pixel Pixel.
* @param {function(this: S, import("./layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback
* Layer callback. This callback will receive two arguments: first is the
* {@link module:ol/layer/Layer layer}, second argument is an array representing
* [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types
* that do not currently support this argument. To stop detection, callback
* functions can return a truthy value.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Configuration options.
* @param {AtPixelOptions=} opt_options Configuration options.
* @return {T|undefined} Callback result, i.e. the return value of last
* callback execution, or the first truthy callback return value.
* @template S,T
@@ -615,7 +620,7 @@ class PluggableMap extends BaseObject {
if (!this.frameState_) {
return;
}
const options = opt_options || {};
const options = opt_options || /** @type {AtPixelOptions} */ ({});
const hitTolerance = options.hitTolerance !== undefined ?
opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
const layerFilter = options.layerFilter || TRUE;
@@ -626,8 +631,8 @@ class PluggableMap extends BaseObject {
/**
* Detect if features intersect a pixel on the viewport. Layers included in the
* detection can be configured through `opt_layerFilter`.
* @param {module:ol/pixel~Pixel} pixel Pixel.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options.
* @param {import("./pixel.js").Pixel} pixel Pixel.
* @param {AtPixelOptions=} opt_options Optional options.
* @return {boolean} Is there a feature at the given pixel?
* @template U
* @api
@@ -637,7 +642,8 @@ class PluggableMap extends BaseObject {
return false;
}
const coordinate = this.getCoordinateFromPixel(pixel);
opt_options = opt_options !== undefined ? opt_options : {};
opt_options = opt_options !== undefined ? opt_options :
/** @type {AtPixelOptions} */ ({});
const layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : TRUE;
const hitTolerance = opt_options.hitTolerance !== undefined ?
opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
@@ -648,7 +654,7 @@ class PluggableMap extends BaseObject {
/**
* Returns the coordinate in view projection for a browser event.
* @param {Event} event Event.
* @return {module:ol/coordinate~Coordinate} Coordinate.
* @return {import("./coordinate.js").Coordinate} Coordinate.
* @api
*/
getEventCoordinate(event) {
@@ -657,13 +663,16 @@ class PluggableMap extends BaseObject {
/**
* Returns the map pixel position for a browser event relative to the viewport.
* @param {Event} event Event.
* @return {module:ol/pixel~Pixel} Pixel.
* @param {Event|TouchEvent} event Event.
* @return {import("./pixel.js").Pixel} Pixel.
* @api
*/
getEventPixel(event) {
const viewportPosition = this.viewport_.getBoundingClientRect();
const eventPosition = event.changedTouches ? event.changedTouches[0] : event;
const eventPosition = 'changedTouches' in event ?
/** @type {TouchEvent} */ (event).changedTouches[0] :
/** @type {MouseEvent} */ (event);
return [
eventPosition.clientX - viewportPosition.left,
eventPosition.clientY - viewportPosition.top
@@ -702,8 +711,8 @@ class PluggableMap extends BaseObject {
/**
* Get the coordinate for a given pixel. This returns a coordinate in the
* map view projection.
* @param {module:ol/pixel~Pixel} pixel Pixel position in the map viewport.
* @return {module:ol/coordinate~Coordinate} The coordinate for the pixel position.
* @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
* @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
* @api
*/
getCoordinateFromPixel(pixel) {
@@ -718,7 +727,7 @@ class PluggableMap extends BaseObject {
/**
* Get the map controls. Modifying this collection changes the controls
* associated with the map.
* @return {module:ol/Collection<module:ol/control/Control>} Controls.
* @return {Collection<import("./control/Control.js").default>} Controls.
* @api
*/
getControls() {
@@ -728,7 +737,7 @@ class PluggableMap extends BaseObject {
/**
* Get the map overlays. Modifying this collection changes the overlays
* associated with the map.
* @return {module:ol/Collection<module:ol/Overlay>} Overlays.
* @return {Collection<import("./Overlay.js").default>} Overlays.
* @api
*/
getOverlays() {
@@ -740,7 +749,7 @@ class PluggableMap extends BaseObject {
* Note that the index treats string and numeric identifiers as the same. So
* `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.
* @param {string|number} id Overlay identifier.
* @return {module:ol/Overlay} Overlay.
* @return {import("./Overlay.js").default} Overlay.
* @api
*/
getOverlayById(id) {
@@ -753,7 +762,7 @@ class PluggableMap extends BaseObject {
* associated with the map.
*
* Interactions are used for e.g. pan, zoom and rotate.
* @return {module:ol/Collection<module:ol/interaction/Interaction>} Interactions.
* @return {Collection<import("./interaction/Interaction.js").default>} Interactions.
* @api
*/
getInteractions() {
@@ -762,19 +771,19 @@ class PluggableMap extends BaseObject {
/**
* Get the layergroup associated with this map.
* @return {module:ol/layer/Group} A layer group containing the layers in this map.
* @return {LayerGroup} A layer group containing the layers in this map.
* @observable
* @api
*/
getLayerGroup() {
return (
/** @type {module:ol/layer/Group} */ (this.get(MapProperty.LAYERGROUP))
/** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP))
);
}
/**
* Get the collection of layers associated with this map.
* @return {!module:ol/Collection<module:ol/layer/Base>} Layers.
* @return {!Collection<import("./layer/Base.js").default>} Layers.
* @api
*/
getLayers() {
@@ -785,8 +794,8 @@ class PluggableMap extends BaseObject {
/**
* Get the pixel for a coordinate. This takes a coordinate in the map view
* projection and returns the corresponding pixel.
* @param {module:ol/coordinate~Coordinate} coordinate A map coordinate.
* @return {module:ol/pixel~Pixel} A pixel position in the map viewport.
* @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
* @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
* @api
*/
getPixelFromCoordinate(coordinate) {
@@ -800,7 +809,7 @@ class PluggableMap extends BaseObject {
/**
* Get the map renderer.
* @return {module:ol/renderer/Map} Renderer
* @return {import("./renderer/Map.js").default} Renderer
*/
getRenderer() {
return this.renderer_;
@@ -808,26 +817,26 @@ class PluggableMap extends BaseObject {
/**
* Get the size of this map.
* @return {module:ol/size~Size|undefined} The size in pixels of the map in the DOM.
* @return {import("./size.js").Size|undefined} The size in pixels of the map in the DOM.
* @observable
* @api
*/
getSize() {
return (
/** @type {module:ol/size~Size|undefined} */ (this.get(MapProperty.SIZE))
/** @type {import("./size.js").Size|undefined} */ (this.get(MapProperty.SIZE))
);
}
/**
* Get the view associated with this map. A view manages properties such as
* center and resolution.
* @return {module:ol/View} The view that controls this map.
* @return {View} The view that controls this map.
* @observable
* @api
*/
getView() {
return (
/** @type {module:ol/View} */ (this.get(MapProperty.VIEW))
/** @type {View} */ (this.get(MapProperty.VIEW))
);
}
@@ -863,9 +872,9 @@ class PluggableMap extends BaseObject {
}
/**
* @param {module:ol/Tile} tile Tile.
* @param {import("./Tile.js").default} tile Tile.
* @param {string} tileSourceKey Tile source key.
* @param {module:ol/coordinate~Coordinate} tileCenter Tile center.
* @param {import("./coordinate.js").Coordinate} tileCenter Tile center.
* @param {number} tileResolution Tile resolution.
* @return {number} Tile priority.
*/
@@ -902,7 +911,7 @@ class PluggableMap extends BaseObject {
}
/**
* @param {module:ol/MapBrowserEvent} mapBrowserEvent The event to handle.
* @param {MapBrowserEvent} mapBrowserEvent The event to handle.
*/
handleMapBrowserEvent(mapBrowserEvent) {
if (!this.frameState_) {
@@ -963,7 +972,7 @@ class PluggableMap extends BaseObject {
tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);
}
}
if (frameState && this.hasListener(MapEventType.RENDERCOMPLETE) && !frameState.animate &&
if (frameState && this.hasListener(RenderEventType.RENDERCOMPLETE) && !frameState.animate &&
!this.tileQueue_.getTilesLoading() && !getLoading(this.getLayers().getArray())) {
this.renderer_.dispatchRenderEvent(RenderEventType.RENDERCOMPLETE, frameState);
}
@@ -1122,8 +1131,8 @@ class PluggableMap extends BaseObject {
/**
* Remove the given control from the map.
* @param {module:ol/control/Control} control Control.
* @return {module:ol/control/Control|undefined} The removed control (or undefined
* @param {import("./control/Control.js").default} control Control.
* @return {import("./control/Control.js").default|undefined} The removed control (or undefined
* if the control was not found).
* @api
*/
@@ -1133,8 +1142,8 @@ class PluggableMap extends BaseObject {
/**
* Remove the given interaction from the map.
* @param {module:ol/interaction/Interaction} interaction Interaction to remove.
* @return {module:ol/interaction/Interaction|undefined} The removed interaction (or
* @param {import("./interaction/Interaction.js").default} interaction Interaction to remove.
* @return {import("./interaction/Interaction.js").default|undefined} The removed interaction (or
* undefined if the interaction was not found).
* @api
*/
@@ -1144,8 +1153,8 @@ class PluggableMap extends BaseObject {
/**
* Removes the given layer from the map.
* @param {module:ol/layer/Base} layer Layer.
* @return {module:ol/layer/Base|undefined} The removed layer (or undefined if the
* @param {import("./layer/Base.js").default} layer Layer.
* @return {import("./layer/Base.js").default|undefined} The removed layer (or undefined if the
* layer was not found).
* @api
*/
@@ -1156,8 +1165,8 @@ class PluggableMap extends BaseObject {
/**
* Remove the given overlay from the map.
* @param {module:ol/Overlay} overlay Overlay.
* @return {module:ol/Overlay|undefined} The removed overlay (or undefined
* @param {import("./Overlay.js").default} overlay Overlay.
* @return {import("./Overlay.js").default|undefined} The removed overlay (or undefined
* if the overlay was not found).
* @api
*/
@@ -1176,7 +1185,7 @@ class PluggableMap extends BaseObject {
const view = this.getView();
const extent = createEmpty();
const previousFrameState = this.frameState_;
/** @type {?module:ol/PluggableMap~FrameState} */
/** @type {?FrameState} */
let frameState = null;
if (size !== undefined && hasArea(size) && view && view.isDef()) {
const viewHints = view.getHints(this.frameState_ ? this.frameState_.viewHints : undefined);
@@ -1186,7 +1195,7 @@ class PluggableMap extends BaseObject {
layerStates[getUid(layerStatesArray[i].layer)] = layerStatesArray[i];
}
viewState = view.getState(this.pixelRatio_);
frameState = /** @type {module:ol/PluggableMap~FrameState} */ ({
frameState = /** @type {FrameState} */ ({
animate: false,
coordinateToPixelTransform: this.coordinateToPixelTransform_,
extent: extent,
@@ -1252,7 +1261,7 @@ class PluggableMap extends BaseObject {
/**
* Sets the layergroup of this map.
* @param {module:ol/layer/Group} layerGroup A layer group containing the layers in this map.
* @param {LayerGroup} layerGroup A layer group containing the layers in this map.
* @observable
* @api
*/
@@ -1262,7 +1271,7 @@ class PluggableMap extends BaseObject {
/**
* Set the size of this map.
* @param {module:ol/size~Size|undefined} size The size in pixels of the map in the DOM.
* @param {import("./size.js").Size|undefined} size The size in pixels of the map in the DOM.
* @observable
* @api
*/
@@ -1283,7 +1292,7 @@ class PluggableMap extends BaseObject {
/**
* Set the view for this map.
* @param {module:ol/View} view The view that controls this map.
* @param {View} view The view that controls this map.
* @observable
* @api
*/
@@ -1292,11 +1301,10 @@ class PluggableMap extends BaseObject {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("./Feature.js").default} feature Feature.
*/
skipFeature(feature) {
const featureUid = getUid(feature).toString();
this.skippedFeatureUids_[featureUid] = true;
this.skippedFeatureUids_[getUid(feature)] = true;
this.render();
}
@@ -1328,11 +1336,10 @@ class PluggableMap extends BaseObject {
}
/**
* @param {module:ol/Feature} feature Feature.
* @param {import("./Feature.js").default} feature Feature.
*/
unskipFeature(feature) {
const featureUid = getUid(feature).toString();
delete this.skippedFeatureUids_[featureUid];
delete this.skippedFeatureUids_[getUid(feature)];
this.render();
}
}
@@ -1340,7 +1347,7 @@ class PluggableMap extends BaseObject {
/**
* @param {MapOptions} options Map options.
* @return {module:ol/PluggableMap~MapOptionsInternal} Internal map options.
* @return {MapOptionsInternal} Internal map options.
*/
function createOptionsInternal(options) {
@@ -1359,8 +1366,8 @@ function createOptionsInternal(options) {
*/
const values = {};
const layerGroup = (options.layers instanceof LayerGroup) ?
options.layers : new LayerGroup({layers: options.layers});
const layerGroup = options.layers && typeof /** @type {?} */ (options.layers).getLayers === 'function' ?
/** @type {LayerGroup} */ (options.layers) : new LayerGroup({layers: /** @type {Collection} */ (options.layers)});
values[MapProperty.LAYERGROUP] = layerGroup;
values[MapProperty.TARGET] = options.target;
@@ -1373,9 +1380,9 @@ function createOptionsInternal(options) {
if (Array.isArray(options.controls)) {
controls = new Collection(options.controls.slice());
} else {
assert(options.controls instanceof Collection,
47); // Expected `controls` to be an array or an `module:ol/Collection~Collection`
controls = options.controls;
assert(typeof /** @type {?} */ (options.controls).getArray === 'function',
47); // Expected `controls` to be an array or an `import("./Collection.js").Collection`
controls = /** @type {Collection} */ (options.controls);
}
}
@@ -1384,9 +1391,9 @@ function createOptionsInternal(options) {
if (Array.isArray(options.interactions)) {
interactions = new Collection(options.interactions.slice());
} else {
assert(options.interactions instanceof Collection,
48); // Expected `interactions` to be an array or an `module:ol/Collection~Collection`
interactions = options.interactions;
assert(typeof /** @type {?} */ (options.interactions).getArray === 'function',
48); // Expected `interactions` to be an array or an `import("./Collection.js").Collection`
interactions = /** @type {Collection} */ (options.interactions);
}
}
@@ -1395,8 +1402,8 @@ function createOptionsInternal(options) {
if (Array.isArray(options.overlays)) {
overlays = new Collection(options.overlays.slice());
} else {
assert(options.overlays instanceof Collection,
49); // Expected `overlays` to be an array or an `module:ol/Collection~Collection`
assert(typeof /** @type {?} */ (options.overlays).getArray === 'function',
49); // Expected `overlays` to be an array or an `import("./Collection.js").Collection`
overlays = options.overlays;
}
} else {
@@ -1415,18 +1422,20 @@ function createOptionsInternal(options) {
export default PluggableMap;
/**
* @param {Array<module:ol/layer/Base>} layers Layers.
* @param {Array<import("./layer/Base.js").default>} layers Layers.
* @return {boolean} Layers have sources that are still loading.
*/
function getLoading(layers) {
for (let i = 0, ii = layers.length; i < ii; ++i) {
const layer = layers[i];
if (layer instanceof LayerGroup) {
return getLoading(layer.getLayers().getArray());
}
const source = layers[i].getSource();
if (source && source.loading) {
return true;
if (typeof /** @type {?} */ (layer).getLayers === 'function') {
return getLoading(/** @type {LayerGroup} */ (layer).getLayers().getArray());
} else {
const source = /** @type {import("./layer/Layer.js").default} */ (
layer).getSource();
if (source && source.loading) {
return true;
}
}
}
return false;

View File

@@ -40,7 +40,7 @@ import EventType from './events/EventType.js';
* });
* ```
*
* @typedef {function(module:ol/Tile, string)} LoadFunction
* @typedef {function(Tile, string)} LoadFunction
* @api
*/
@@ -54,8 +54,8 @@ import EventType from './events/EventType.js';
* and returns a `{string}` representing the tile URL, or undefined if no tile
* should be requested for the passed tile coordinate.
*
* @typedef {function(module:ol/tilecoord~TileCoord, number,
* module:ol/proj/Projection): (string|undefined)} UrlFunction
* @typedef {function(import("./tilecoord.js").TileCoord, number,
* import("./proj/Projection.js").default): (string|undefined)} UrlFunction
* @api
*/
@@ -77,9 +77,9 @@ import EventType from './events/EventType.js';
class Tile extends EventTarget {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {module:ol/Tile~Options=} opt_options Tile options.
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @param {TileState} state State.
* @param {Options=} opt_options Tile options.
*/
constructor(tileCoord, state, opt_options) {
super();
@@ -87,13 +87,13 @@ class Tile extends EventTarget {
const options = opt_options ? opt_options : {};
/**
* @type {module:ol/tilecoord~TileCoord}
* @type {import("./tilecoord.js").TileCoord}
*/
this.tileCoord = tileCoord;
/**
* @protected
* @type {module:ol/TileState}
* @type {TileState}
*/
this.state = state;
@@ -101,7 +101,7 @@ class Tile extends EventTarget {
* An "interim" tile for this tile. The interim tile may be used while this
* one is loading, for "smooth" transitions when changing params/dimensions
* on the source.
* @type {module:ol/Tile}
* @type {Tile}
*/
this.interimTile = null;
@@ -122,7 +122,7 @@ class Tile extends EventTarget {
/**
* Lookup of start times for rendering transitions. If the start time is
* equal to -1, the transition is complete.
* @type {Object<number, number>}
* @type {Object<string, number>}
*/
this.transitionStarts_ = {};
@@ -146,7 +146,7 @@ class Tile extends EventTarget {
* Get the interim tile most suitable for rendering using the chain of interim
* tiles. This corresponds to the most recent tile that has been loaded, if no
* such tile exists, the original tile is returned.
* @return {!module:ol/Tile} Best tile for rendering.
* @return {!Tile} Best tile for rendering.
*/
getInterimTile() {
if (!this.interimTile) {
@@ -180,7 +180,7 @@ class Tile extends EventTarget {
}
let tile = this.interimTile;
let prev = this;
let prev = /** @type {Tile} */ (this);
do {
if (tile.getState() == TileState.LOADED) {
@@ -206,7 +206,7 @@ class Tile extends EventTarget {
/**
* Get the tile coordinate for this tile.
* @return {module:ol/tilecoord~TileCoord} The tile coordinate.
* @return {import("./tilecoord.js").TileCoord} The tile coordinate.
* @api
*/
getTileCoord() {
@@ -214,7 +214,7 @@ class Tile extends EventTarget {
}
/**
* @return {module:ol/TileState} State.
* @return {TileState} State.
*/
getState() {
return this.state;
@@ -225,7 +225,7 @@ class Tile extends EventTarget {
* it is important to set the state correctly to {@link module:ol/TileState~ERROR}
* when the tile cannot be loaded. Otherwise the tile cannot be removed from
* the tile queue and will block other requests.
* @param {module:ol/TileState} state State.
* @param {TileState} state State.
* @api
*/
setState(state) {
@@ -244,7 +244,7 @@ class Tile extends EventTarget {
/**
* Get the alpha value for rendering.
* @param {number} id An id for the renderer.
* @param {string} id An id for the renderer.
* @param {number} time The render frame time.
* @return {number} A number between 0 and 1.
*/
@@ -272,7 +272,7 @@ class Tile extends EventTarget {
* Determine if a tile is in an alpha transition. A tile is considered in
* transition if tile.getAlpha() has not yet been called or has been called
* and returned 1.
* @param {number} id An id for the renderer.
* @param {string} id An id for the renderer.
* @return {boolean} The tile is in transition.
*/
inTransition(id) {
@@ -284,7 +284,7 @@ class Tile extends EventTarget {
/**
* Mark a transition as complete.
* @param {number} id An id for the renderer.
* @param {string} id An id for the renderer.
*/
endTransition(id) {
if (this.transition_) {

View File

@@ -16,7 +16,7 @@ class TileCache extends LRUCache {
}
/**
* @param {!Object<string, module:ol/TileRange>} usedTiles Used tiles.
* @param {!Object<string, import("./TileRange.js").default>} usedTiles Used tiles.
*/
expireCache(usedTiles) {
while (this.canExpireCache()) {

View File

@@ -8,14 +8,14 @@ import PriorityQueue from './structs/PriorityQueue.js';
/**
* @typedef {function(module:ol/Tile, string, module:ol/coordinate~Coordinate, number): number} PriorityFunction
* @typedef {function(import("./Tile.js").default, string, import("./coordinate.js").Coordinate, number): number} PriorityFunction
*/
class TileQueue extends PriorityQueue {
/**
* @param {module:ol/TileQueue~PriorityFunction} tilePriorityFunction Tile priority function.
* @param {PriorityFunction} tilePriorityFunction Tile priority function.
* @param {function(): ?} tileChangeCallback Function called on each tile change event.
*/
constructor(tilePriorityFunction, tileChangeCallback) {
@@ -33,7 +33,7 @@ class TileQueue extends PriorityQueue {
* @return {string} Key.
*/
function(element) {
return (/** @type {module:ol/Tile} */ (element[0]).getKey());
return (/** @type {import("./Tile.js").default} */ (element[0]).getKey());
});
/**
@@ -76,11 +76,11 @@ class TileQueue extends PriorityQueue {
}
/**
* @param {module:ol/events/Event} event Event.
* @param {import("./events/Event.js").default} event Event.
* @protected
*/
handleTileChange(event) {
const tile = /** @type {module:ol/Tile} */ (event.target);
const tile = /** @type {import("./Tile.js").default} */ (event.target);
const state = tile.getState();
if (state === TileState.LOADED || state === TileState.ERROR ||
state === TileState.EMPTY || state === TileState.ABORT) {
@@ -104,7 +104,7 @@ class TileQueue extends PriorityQueue {
let state, tile, tileKey;
while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads &&
this.getCount() > 0) {
tile = /** @type {module:ol/Tile} */ (this.dequeue()[0]);
tile = /** @type {import("./Tile.js").default} */ (this.dequeue()[0]);
tileKey = tile.getKey();
state = tile.getState();
if (state === TileState.ABORT) {

View File

@@ -39,7 +39,7 @@ class TileRange {
}
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @return {boolean} Contains tile coordinate.
*/
contains(tileCoord) {
@@ -47,7 +47,7 @@ class TileRange {
}
/**
* @param {module:ol/TileRange} tileRange Tile range.
* @param {TileRange} tileRange Tile range.
* @return {boolean} Contains.
*/
containsTileRange(tileRange) {
@@ -65,7 +65,7 @@ class TileRange {
}
/**
* @param {module:ol/TileRange} tileRange Tile range.
* @param {TileRange} tileRange Tile range.
* @return {boolean} Equals.
*/
equals(tileRange) {
@@ -74,7 +74,7 @@ class TileRange {
}
/**
* @param {module:ol/TileRange} tileRange Tile range.
* @param {TileRange} tileRange Tile range.
*/
extend(tileRange) {
if (tileRange.minX < this.minX) {
@@ -92,30 +92,30 @@ class TileRange {
}
/**
* @return {number} Height.
*/
* @return {number} Height.
*/
getHeight() {
return this.maxY - this.minY + 1;
}
/**
* @return {module:ol/size~Size} Size.
*/
* @return {import("./size.js").Size} Size.
*/
getSize() {
return [this.getWidth(), this.getHeight()];
}
/**
* @return {number} Width.
*/
* @return {number} Width.
*/
getWidth() {
return this.maxX - this.minX + 1;
}
/**
* @param {module:ol/TileRange} tileRange Tile range.
* @return {boolean} Intersects.
*/
* @param {TileRange} tileRange Tile range.
* @return {boolean} Intersects.
*/
intersects(tileRange) {
return this.minX <= tileRange.maxX &&
this.maxX >= tileRange.minX &&
@@ -130,8 +130,8 @@ class TileRange {
* @param {number} maxX Maximum X.
* @param {number} minY Minimum Y.
* @param {number} maxY Maximum Y.
* @param {module:ol/TileRange=} tileRange TileRange.
* @return {module:ol/TileRange} Tile range.
* @param {TileRange=} tileRange TileRange.
* @return {TileRange} Tile range.
*/
export function createOrUpdate(minX, maxX, minY, maxY, tileRange) {
if (tileRange !== undefined) {

View File

@@ -12,7 +12,6 @@ export default {
/**
* Indicates that tile loading failed
* @type {number}
* @api
*/
ERROR: 3,
EMPTY: 4,

View File

@@ -15,7 +15,7 @@ import {VOID} from './functions.js';
/**
* @typedef {Object} ReplayState
* @property {boolean} dirty
* @property {null|module:ol/render~OrderFunction} renderedRenderOrder
* @property {null|import("./render.js").OrderFunction} renderedRenderOrder
* @property {number} renderedTileRevision
* @property {number} renderedRevision
*/
@@ -24,22 +24,21 @@ import {VOID} from './functions.js';
class VectorImageTile extends Tile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @param {TileState} state State.
* @param {number} sourceRevision Source revision.
* @param {module:ol/format/Feature} format Feature format.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/tilecoord~TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
* @param {module:ol/Tile~UrlFunction} tileUrlFunction Tile url function.
* @param {module:ol/tilegrid/TileGrid} sourceTileGrid Tile grid of the source.
* @param {module:ol/tilegrid/TileGrid} tileGrid Tile grid of the renderer.
* @param {Object<string, module:ol/VectorTile>} sourceTiles Source tiles.
* @param {import("./format/Feature.js").default} format Feature format.
* @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
* @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
* @param {import("./Tile.js").UrlFunction} tileUrlFunction Tile url function.
* @param {import("./tilegrid/TileGrid.js").default} sourceTileGrid Tile grid of the source.
* @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid of the renderer.
* @param {Object<string, import("./VectorTile.js").default>} sourceTiles Source tiles.
* @param {number} pixelRatio Pixel ratio.
* @param {module:ol/proj/Projection} projection Projection.
* @param {function(new: module:ol/VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState, string,
* module:ol/format/Feature, module:ol/Tile~LoadFunction)} tileClass Class to
* @param {import("./proj/Projection.js").default} projection Projection.
* @param {typeof import("./VectorTile.js").default} tileClass Class to
* instantiate for source tiles.
* @param {function(this: module:ol/source/VectorTile, module:ol/events/Event)} handleTileChange
* @param {function(this: import("./source/VectorTile.js").default, import("./events/Event.js").default)} handleTileChange
* Function to call when a source tile's state changes.
* @param {number} zoom Integer zoom to render the tile for.
*/
@@ -57,19 +56,19 @@ class VectorImageTile extends Tile {
/**
* @private
* @type {module:ol/featureloader~FeatureLoader}
* @type {import("./featureloader.js").FeatureLoader}
*/
this.loader_;
/**
* @private
* @type {!Object<string, module:ol/VectorImageTile~ReplayState>}
* @type {!Object<string, ReplayState>}
*/
this.replayState_ = {};
/**
* @private
* @type {Object<string, module:ol/VectorTile>}
* @type {Object<string, import("./VectorTile.js").default>}
*/
this.sourceTiles_ = sourceTiles;
@@ -80,7 +79,7 @@ class VectorImageTile extends Tile {
this.tileKeys = [];
/**
* @type {module:ol/extent~Extent}
* @type {import("./extent.js").Extent}
*/
this.extent = null;
@@ -90,17 +89,17 @@ class VectorImageTile extends Tile {
this.sourceRevision_ = sourceRevision;
/**
* @type {module:ol/tilecoord~TileCoord}
* @type {import("./tilecoord.js").TileCoord}
*/
this.wrappedTileCoord = urlTileCoord;
/**
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("./events.js").EventsKey>}
*/
this.loadListenerKeys_ = [];
/**
* @type {Array<module:ol/events~EventsKey>}
* @type {Array<import("./events.js").EventsKey>}
*/
this.sourceTileListenerKeys_ = [];
@@ -188,11 +187,11 @@ class VectorImageTile extends Tile {
}
/**
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {CanvasRenderingContext2D} The rendering context.
*/
getContext(layer) {
const key = getUid(layer).toString();
const key = getUid(layer);
if (!(key in this.context_)) {
this.context_[key] = createCanvasContext2D();
}
@@ -201,7 +200,7 @@ class VectorImageTile extends Tile {
/**
* Get the Canvas for this tile.
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {HTMLCanvasElement} Canvas.
*/
getImage(layer) {
@@ -210,11 +209,11 @@ class VectorImageTile extends Tile {
}
/**
* @param {module:ol/layer/Layer} layer Layer.
* @return {module:ol/VectorImageTile~ReplayState} The replay state.
* @param {import("./layer/Layer.js").default} layer Layer.
* @return {ReplayState} The replay state.
*/
getReplayState(layer) {
const key = getUid(layer).toString();
const key = getUid(layer);
if (!(key in this.replayState_)) {
this.replayState_[key] = {
dirty: false,
@@ -235,7 +234,7 @@ class VectorImageTile extends Tile {
/**
* @param {string} tileKey Key (tileCoord) of the source tile.
* @return {module:ol/VectorTile} Source tile.
* @return {import("./VectorTile.js").default} Source tile.
*/
getTile(tileKey) {
return this.sourceTiles_[tileKey];
@@ -319,7 +318,7 @@ export default VectorImageTile;
/**
* Sets the loader for a tile.
* @param {module:ol/VectorTile} tile Vector tile.
* @param {import("./VectorTile.js").default} tile Vector tile.
* @param {string} url URL.
*/
export function defaultLoadFunction(tile, url) {

View File

@@ -7,26 +7,20 @@ import TileState from './TileState.js';
/**
* @const
* @type {module:ol/extent~Extent}
* @type {import("./extent.js").Extent}
*/
const DEFAULT_EXTENT = [0, 0, 4096, 4096];
/**
* @typedef {function(new: module:ol/VectorTile, module:ol/tilecoord~TileCoord,
* module:ol/TileState, string, ?string, module:ol/Tile~LoadFunction)} TileClass
* @api
*/
class VectorTile extends Tile {
/**
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/TileState} state State.
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
* @param {TileState} state State.
* @param {string} src Data source url.
* @param {module:ol/format/Feature} format Feature format.
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
* @param {import("./format/Feature.js").default} format Feature format.
* @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
* @param {import("./Tile.js").Options=} opt_options Tile options.
*/
constructor(tileCoord, state, src, format, tileLoadFunction, opt_options) {
@@ -39,44 +33,44 @@ class VectorTile extends Tile {
/**
* @private
* @type {module:ol/extent~Extent}
* @type {import("./extent.js").Extent}
*/
this.extent_ = null;
/**
* @private
* @type {module:ol/format/Feature}
* @type {import("./format/Feature.js").default}
*/
this.format_ = format;
/**
* @private
* @type {Array<module:ol/Feature>}
* @type {Array<import("./Feature.js").default>}
*/
this.features_ = null;
/**
* @private
* @type {module:ol/featureloader~FeatureLoader}
* @type {import("./featureloader.js").FeatureLoader}
*/
this.loader_;
/**
* Data projection
* @private
* @type {module:ol/proj/Projection}
* @type {import("./proj/Projection.js").default}
*/
this.projection_ = null;
/**
* @private
* @type {Object<string, module:ol/render/ReplayGroup>}
* @type {Object<string, import("./render/ReplayGroup.js").default>}
*/
this.replayGroups_ = {};
/**
* @private
* @type {module:ol/Tile~LoadFunction}
* @type {import("./Tile.js").LoadFunction}
*/
this.tileLoadFunction_ = tileLoadFunction;
@@ -101,7 +95,7 @@ class VectorTile extends Tile {
/**
* Gets the extent of the vector tile.
* @return {module:ol/extent~Extent} The extent.
* @return {import("./extent.js").Extent} The extent.
* @api
*/
getExtent() {
@@ -110,7 +104,7 @@ class VectorTile extends Tile {
/**
* Get the feature format assigned for reading this tile's features.
* @return {module:ol/format/Feature} Feature format.
* @return {import("./format/Feature.js").default} Feature format.
* @api
*/
getFormat() {
@@ -120,7 +114,7 @@ class VectorTile extends Tile {
/**
* Get the features for this tile. Geometries will be in the projection returned
* by {@link module:ol/VectorTile~VectorTile#getProjection}.
* @return {Array<module:ol/Feature|module:ol/render/Feature>} Features.
* @return {Array<import("./Feature.js").FeatureLike>} Features.
* @api
*/
getFeatures() {
@@ -137,7 +131,7 @@ class VectorTile extends Tile {
/**
* Get the feature projection of features returned by
* {@link module:ol/VectorTile~VectorTile#getFeatures}.
* @return {module:ol/proj/Projection} Feature projection.
* @return {import("./proj/Projection.js").default} Feature projection.
* @api
*/
getProjection() {
@@ -145,9 +139,9 @@ class VectorTile extends Tile {
}
/**
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("./layer/Layer.js").default} layer Layer.
* @param {string} key Key.
* @return {module:ol/render/ReplayGroup} Replay group.
* @return {import("./render/ReplayGroup.js").default} Replay group.
*/
getReplayGroup(layer, key) {
return this.replayGroups_[getUid(layer) + ',' + key];
@@ -166,9 +160,9 @@ class VectorTile extends Tile {
/**
* Handler for successful tile load.
* @param {Array<module:ol/Feature>} features The loaded features.
* @param {module:ol/proj/Projection} dataProjection Data projection.
* @param {module:ol/extent~Extent} extent Extent.
* @param {Array<import("./Feature.js").default>} features The loaded features.
* @param {import("./proj/Projection.js").default} dataProjection Data projection.
* @param {import("./extent.js").Extent} extent Extent.
*/
onLoad(features, dataProjection, extent) {
this.setProjection(dataProjection);
@@ -192,7 +186,7 @@ class VectorTile extends Tile {
* sources using {@link module:ol/format/MVT~MVT} as feature format, the
* {@link module:ol/format/MVT~MVT#getLastExtent} method will return the correct
* extent. The default is `[0, 0, 4096, 4096]`.
* @param {module:ol/extent~Extent} extent The extent.
* @param {import("./extent.js").Extent} extent The extent.
* @api
*/
setExtent(extent) {
@@ -202,7 +196,7 @@ class VectorTile extends Tile {
/**
* Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.
* Sets the features for the tile.
* @param {Array<module:ol/Feature>} features Features.
* @param {Array<import("./Feature.js").default>} features Features.
* @api
*/
setFeatures(features) {
@@ -214,7 +208,7 @@ class VectorTile extends Tile {
* Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.
* Sets the projection of the features that were added with
* {@link module:ol/VectorTile~VectorTile#setFeatures}.
* @param {module:ol/proj/Projection} projection Feature projection.
* @param {import("./proj/Projection.js").default} projection Feature projection.
* @api
*/
setProjection(projection) {
@@ -222,9 +216,9 @@ class VectorTile extends Tile {
}
/**
* @param {module:ol/layer/Layer} layer Layer.
* @param {import("./layer/Layer.js").default} layer Layer.
* @param {string} key Key.
* @param {module:ol/render/ReplayGroup} replayGroup Replay group.
* @param {import("./render/ReplayGroup.js").default} replayGroup Replay group.
*/
setReplayGroup(layer, key, replayGroup) {
this.replayGroups_[getUid(layer) + ',' + key] = replayGroup;
@@ -232,7 +226,7 @@ class VectorTile extends Tile {
/**
* Set the feature loader for reading this tile's features.
* @param {module:ol/featureloader~FeatureLoader} loader Feature loader.
* @param {import("./featureloader.js").FeatureLoader} loader Feature loader.
* @api
*/
setLoader(loader) {

View File

@@ -17,7 +17,6 @@ import {inAndOut} from './easing.js';
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
import GeometryType from './geom/GeometryType.js';
import {fromExtent as polygonFromExtent} from './geom/Polygon.js';
import SimpleGeometry from './geom/SimpleGeometry.js';
import {clamp, modulo} from './math.js';
import {assign} from './obj.js';
import {createProjection, METERS_PER_UNIT} from './proj.js';
@@ -28,13 +27,13 @@ import Units from './proj/Units.js';
* An animation configuration
*
* @typedef {Object} Animation
* @property {module:ol/coordinate~Coordinate} [sourceCenter]
* @property {module:ol/coordinate~Coordinate} [targetCenter]
* @property {import("./coordinate.js").Coordinate} [sourceCenter]
* @property {import("./coordinate.js").Coordinate} [targetCenter]
* @property {number} [sourceResolution]
* @property {number} [targetResolution]
* @property {number} [sourceRotation]
* @property {number} [targetRotation]
* @property {module:ol/coordinate~Coordinate} [anchor]
* @property {import("./coordinate.js").Coordinate} [anchor]
* @property {number} start
* @property {number} duration
* @property {boolean} complete
@@ -45,15 +44,15 @@ import Units from './proj/Units.js';
/**
* @typedef {Object} Constraints
* @property {module:ol/centerconstraint~Type} center
* @property {module:ol/resolutionconstraint~Type} resolution
* @property {module:ol/rotationconstraint~Type} rotation
* @property {import("./centerconstraint.js").Type} center
* @property {import("./resolutionconstraint.js").Type} resolution
* @property {import("./rotationconstraint.js").Type} rotation
*/
/**
* @typedef {Object} FitOptions
* @property {module:ol/size~Size} [size] The size in pixels of the box to fit
* @property {import("./size.js").Size} [size] The size in pixels of the box to fit
* the extent into. Default is the current size of the first map in the DOM that
* uses this view, or `[100, 100]` if no such map is found.
* @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be
@@ -80,7 +79,7 @@ import Units from './proj/Units.js';
/**
* @typedef {Object} ViewOptions
* @property {module:ol/coordinate~Coordinate} [center] The initial center for
* @property {import("./coordinate.js").Coordinate} [center] The initial center for
* the view. The coordinate system for the center is specified with the
* `projection` option. Layer sources will not be fetched if this is not set,
* but the center can be set later with {@link #setCenter}.
@@ -92,7 +91,7 @@ import Units from './proj/Units.js';
* If `false`, a rotation constraint that always sets the rotation to zero is
* used. The `constrainRotation` option has no effect if `enableRotation` is
* `false`.
* @property {module:ol/extent~Extent} [extent] The extent that constrains the
* @property {import("./extent.js").Extent} [extent] The extent that constrains the
* center, in other words, center cannot be set outside this extent.
* @property {number} [maxResolution] The maximum resolution used to determine
* the resolution constraint. It is used together with `minResolution` (or
@@ -114,7 +113,7 @@ import Units from './proj/Units.js';
* resolution constraint. It is used together with `maxZoom` (or
* `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also
* provided, it is given precedence over `minZoom`.
* @property {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] The
* @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
* projection. The default is Spherical Mercator.
* @property {number} [resolution] The initial resolution for the view. The
* units are `projection` units per pixel (e.g. meters per pixel). An
@@ -136,15 +135,15 @@ import Units from './proj/Units.js';
/**
* @typedef {Object} AnimationOptions
* @property {module:ol/coordinate~Coordinate|undefined} center The center of the view at the end of
* @property {import("./coordinate.js").Coordinate} [center] The center of the view at the end of
* the animation.
* @property {number|undefined} zoom The zoom level of the view at the end of the
* @property {number} [zoom] The zoom level of the view at the end of the
* animation. This takes precedence over `resolution`.
* @property {number|undefined} resolution The resolution of the view at the end
* @property {number} [resolution] The resolution of the view at the end
* of the animation. If `zoom` is also provided, this option will be ignored.
* @property {number|undefined} rotation The rotation of the view at the end of
* @property {number} [rotation] The rotation of the view at the end of
* the animation.
* @property {module:ol/coordinate~Coordinate|undefined} anchor Optional anchor to remained fixed
* @property {import("./coordinate.js").Coordinate} [anchor] Optional anchor to remained fixed
* during a rotation or resolution animation.
* @property {number} [duration=1000] The duration of the animation in milliseconds.
* @property {function(number):number} [easing] The easing function used
@@ -157,8 +156,8 @@ import Units from './proj/Units.js';
/**
* @typedef {Object} State
* @property {module:ol/coordinate~Coordinate} center
* @property {module:ol/proj/Projection} projection
* @property {import("./coordinate.js").Coordinate} center
* @property {import("./proj/Projection.js").default} projection
* @property {number} resolution
* @property {number} rotation
* @property {number} zoom
@@ -229,7 +228,7 @@ const DEFAULT_MIN_ZOOM = 0;
class View extends BaseObject {
/**
* @param {module:ol/View~ViewOptions=} opt_options View options.
* @param {ViewOptions=} opt_options View options.
*/
constructor(opt_options) {
super();
@@ -244,7 +243,7 @@ class View extends BaseObject {
/**
* @private
* @type {Array<Array<module:ol/View~Animation>>}
* @type {Array<Array<Animation>>}
*/
this.animations_ = [];
@@ -259,7 +258,7 @@ class View extends BaseObject {
/**
* @private
* @const
* @type {module:ol/proj/Projection}
* @type {import("./proj/Projection.js").default}
*/
this.projection_ = createProjection(options.projection, 'EPSG:3857');
@@ -268,7 +267,7 @@ class View extends BaseObject {
/**
* Set up the view with the given options.
* @param {module:ol/View~ViewOptions} options View options.
* @param {ViewOptions} options View options.
*/
applyOptions_(options) {
@@ -317,7 +316,7 @@ class View extends BaseObject {
/**
* @private
* @type {module:ol/View~Constraints}
* @type {Constraints}
*/
this.constraints_ = {
center: centerConstraint,
@@ -342,7 +341,7 @@ class View extends BaseObject {
/**
* @private
* @type {module:ol/View~ViewOptions}
* @type {ViewOptions}
*/
this.options_ = options;
@@ -353,8 +352,8 @@ class View extends BaseObject {
* current resolution (or zoom), center, and rotation are applied to any stored
* options. The provided options can be used to apply new min/max zoom or
* resolution limits.
* @param {module:ol/View~ViewOptions} newOptions New options to be applied.
* @return {module:ol/View~ViewOptions} New options updated with the current view state.
* @param {ViewOptions} newOptions New options to be applied.
* @return {ViewOptions} New options updated with the current view state.
*/
getUpdatedOptions_(newOptions) {
const options = assign({}, this.options_);
@@ -400,7 +399,7 @@ class View extends BaseObject {
* calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
* (or another method that calls one of these).
*
* @param {...(module:ol/View~AnimationOptions|function(boolean))} var_args Animation
* @param {...(AnimationOptions|function(boolean))} var_args Animation
* options. Multiple animations can be run in series by passing multiple
* options objects. To run multiple animations in parallel, call the method
* multiple times. An optional callback can be provided as a final
@@ -438,9 +437,9 @@ class View extends BaseObject {
let rotation = this.getRotation();
const series = [];
for (let i = 0; i < animationCount; ++i) {
const options = /** @type {module:ol/View~AnimationOptions} */ (arguments[i]);
const options = /** @type {AnimationOptions} */ (arguments[i]);
const animation = /** @type {module:ol/View~Animation} */ ({
const animation = /** @type {Animation} */ ({
start: start,
complete: false,
anchor: options.anchor,
@@ -603,8 +602,8 @@ class View extends BaseObject {
/**
* @param {number} rotation Target rotation.
* @param {module:ol/coordinate~Coordinate} anchor Rotation anchor.
* @return {module:ol/coordinate~Coordinate|undefined} Center for rotation and anchor.
* @param {import("./coordinate.js").Coordinate} anchor Rotation anchor.
* @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor.
*/
calculateCenterRotate(rotation, anchor) {
let center;
@@ -619,8 +618,8 @@ class View extends BaseObject {
/**
* @param {number} resolution Target resolution.
* @param {module:ol/coordinate~Coordinate} anchor Zoom anchor.
* @return {module:ol/coordinate~Coordinate|undefined} Center for resolution and anchor.
* @param {import("./coordinate.js").Coordinate} anchor Zoom anchor.
* @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor.
*/
calculateCenterZoom(resolution, anchor) {
let center;
@@ -636,7 +635,7 @@ class View extends BaseObject {
/**
* @private
* @return {module:ol/size~Size} Viewport size or `[100, 100]` when no viewport is found.
* @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
*/
getSizeFromViewport_() {
const size = [100, 100];
@@ -652,8 +651,8 @@ class View extends BaseObject {
/**
* Get the constrained center of this view.
* @param {module:ol/coordinate~Coordinate|undefined} center Center.
* @return {module:ol/coordinate~Coordinate|undefined} Constrained center.
* @param {import("./coordinate.js").Coordinate|undefined} center Center.
* @return {import("./coordinate.js").Coordinate|undefined} Constrained center.
* @api
*/
constrainCenter(center) {
@@ -688,18 +687,18 @@ class View extends BaseObject {
/**
* Get the view center.
* @return {module:ol/coordinate~Coordinate|undefined} The center of the view.
* @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
* @observable
* @api
*/
getCenter() {
return (
/** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(ViewProperty.CENTER))
/** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(ViewProperty.CENTER))
);
}
/**
* @return {module:ol/View~Constraints} Constraints.
* @return {Constraints} Constraints.
*/
getConstraints() {
return this.constraints_;
@@ -724,14 +723,14 @@ class View extends BaseObject {
* The size is the pixel dimensions of the box into which the calculated extent
* should fit. In most cases you want to get the extent of the entire map,
* that is `map.getSize()`.
* @param {module:ol/size~Size=} opt_size Box pixel size. If not provided, the size of the
* @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size of the
* first map that uses this view will be used.
* @return {module:ol/extent~Extent} Extent.
* @return {import("./extent.js").Extent} Extent.
* @api
*/
calculateExtent(opt_size) {
const size = opt_size || this.getSizeFromViewport_();
const center = /** @type {!module:ol/coordinate~Coordinate} */ (this.getCenter());
const center = /** @type {!import("./coordinate.js").Coordinate} */ (this.getCenter());
assert(center, 1); // The view center is not defined
const resolution = /** @type {!number} */ (this.getResolution());
assert(resolution !== undefined, 2); // The view resolution is not defined
@@ -797,7 +796,7 @@ class View extends BaseObject {
/**
* Get the view projection.
* @return {module:ol/proj/Projection} The projection of the view.
* @return {import("./proj/Projection.js").default} The projection of the view.
* @api
*/
getProjection() {
@@ -826,8 +825,8 @@ class View extends BaseObject {
/**
* Get the resolution for a provided extent (in map units) and size (in pixels).
* @param {module:ol/extent~Extent} extent Extent.
* @param {module:ol/size~Size=} opt_size Box pixel size.
* @param {import("./extent.js").Extent} extent Extent.
* @param {import("./size.js").Size=} opt_size Box pixel size.
* @return {number} The resolution at which the provided extent will render at
* the given size.
* @api
@@ -895,16 +894,16 @@ class View extends BaseObject {
/**
* @param {number} pixelRatio Pixel ratio for center rounding.
* @return {module:ol/View~State} View state.
* @return {State} View state.
*/
getState(pixelRatio) {
const center = /** @type {module:ol/coordinate~Coordinate} */ (this.getCenter());
const center = /** @type {import("./coordinate.js").Coordinate} */ (this.getCenter());
const projection = this.getProjection();
const resolution = /** @type {number} */ (this.getResolution());
const pixelResolution = resolution / pixelRatio;
const rotation = this.getRotation();
return (
/** @type {module:ol/View~State} */ ({
/** @type {State} */ ({
center: [
Math.round(center[0] / pixelResolution) * pixelResolution,
Math.round(center[1] / pixelResolution) * pixelResolution
@@ -974,9 +973,9 @@ class View extends BaseObject {
* The size is pixel dimensions of the box to fit the extent into.
* In most cases you will want to use the map size, that is `map.getSize()`.
* Takes care of the map angle.
* @param {module:ol/geom/SimpleGeometry|module:ol/extent~Extent} geometryOrExtent The geometry or
* @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
* extent to fit the view to.
* @param {module:ol/View~FitOptions=} opt_options Options.
* @param {FitOptions=} opt_options Options.
* @api
*/
fit(geometryOrExtent, opt_options) {
@@ -985,11 +984,11 @@ class View extends BaseObject {
if (!size) {
size = this.getSizeFromViewport_();
}
/** @type {module:ol/geom/SimpleGeometry} */
/** @type {import("./geom/SimpleGeometry.js").default} */
let geometry;
if (!(geometryOrExtent instanceof SimpleGeometry)) {
assert(Array.isArray(geometryOrExtent),
24); // Invalid extent or geometry provided as `geometry`
assert(Array.isArray(geometryOrExtent) || typeof /** @type {?} */ (geometryOrExtent).getSimplifiedGeometry === 'function',
24); // Invalid extent or geometry provided as `geometry`
if (Array.isArray(geometryOrExtent)) {
assert(!isEmpty(geometryOrExtent),
25); // Cannot fit empty extent provided as `geometry`
geometry = polygonFromExtent(geometryOrExtent);
@@ -1076,9 +1075,9 @@ class View extends BaseObject {
/**
* Center on coordinate and view position.
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @param {module:ol/size~Size} size Box pixel size.
* @param {module:ol/pixel~Pixel} position Position on the view to center on.
* @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
* @param {import("./size.js").Size} size Box pixel size.
* @param {import("./pixel.js").Pixel} position Position on the view to center on.
* @api
*/
centerOn(coordinate, size, position) {
@@ -1110,7 +1109,7 @@ class View extends BaseObject {
/**
* Rotate the view around a given coordinate.
* @param {number} rotation New rotation value for the view.
* @param {module:ol/coordinate~Coordinate=} opt_anchor The rotation center.
* @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center.
* @api
*/
rotate(rotation, opt_anchor) {
@@ -1123,7 +1122,7 @@ class View extends BaseObject {
/**
* Set the center of the current view.
* @param {module:ol/coordinate~Coordinate|undefined} center The center of the view.
* @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
* @observable
* @api
*/
@@ -1135,7 +1134,7 @@ class View extends BaseObject {
}
/**
* @param {module:ol/ViewHint} hint Hint.
* @param {ViewHint} hint Hint.
* @param {number} delta Delta.
* @return {number} New value.
*/
@@ -1194,8 +1193,8 @@ function animationCallback(callback, returnValue) {
/**
* @param {module:ol/View~ViewOptions} options View options.
* @return {module:ol/centerconstraint~Type} The constraint.
* @param {ViewOptions} options View options.
* @return {import("./centerconstraint.js").Type} The constraint.
*/
export function createCenterConstraint(options) {
if (options.extent !== undefined) {
@@ -1207,8 +1206,8 @@ export function createCenterConstraint(options) {
/**
* @param {module:ol/View~ViewOptions} options View options.
* @return {{constraint: module:ol/resolutionconstraint~Type, maxResolution: number,
* @param {ViewOptions} options View options.
* @return {{constraint: import("./resolutionconstraint.js").Type, maxResolution: number,
* minResolution: number, minZoom: number, zoomFactor: number}} The constraint.
*/
export function createResolutionConstraint(options) {
@@ -1289,8 +1288,8 @@ export function createResolutionConstraint(options) {
/**
* @param {module:ol/View~ViewOptions} options View options.
* @return {module:ol/rotationconstraint~Type} Rotation constraint.
* @param {ViewOptions} options View options.
* @return {import("./rotationconstraint.js").Type} Rotation constraint.
*/
export function createRotationConstraint(options) {
const enableRotation = options.enableRotation !== undefined ?
@@ -1314,7 +1313,7 @@ export function createRotationConstraint(options) {
/**
* Determine if an animation involves no view change.
* @param {module:ol/View~Animation} animation The animation.
* @param {Animation} animation The animation.
* @return {boolean} The animation involves no view change.
*/
export function isNoopAnimation(animation) {

View File

@@ -56,8 +56,8 @@ import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js';
* {@link module:ol/layer/Base}, so layers entered in the options or added
* with `addLayer` can be groups, which can contain further groups, and so on.
*
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires import("./MapBrowserEvent.js").MapBrowserEvent
* @fires import("./MapEvent.js").MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @api
@@ -65,7 +65,7 @@ import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js';
class WebGLMap extends PluggableMap {
/**
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @param {import("./PluggableMap.js").MapOptions} options Map options.
*/
constructor(options) {
options = assign({}, options);

View File

@@ -5,19 +5,19 @@ import {clamp} from './math.js';
/**
* @typedef {function((module:ol/coordinate~Coordinate|undefined)): (module:ol/coordinate~Coordinate|undefined)} Type
* @typedef {function((import("./coordinate.js").Coordinate|undefined)): (import("./coordinate.js").Coordinate|undefined)} Type
*/
/**
* @param {module:ol/extent~Extent} extent Extent.
* @return {module:ol/centerconstraint~Type} The constraint.
* @param {import("./extent.js").Extent} extent Extent.
* @return {Type} The constraint.
*/
export function createExtent(extent) {
return (
/**
* @param {module:ol/coordinate~Coordinate=} center Center.
* @return {module:ol/coordinate~Coordinate|undefined} Center.
* @param {import("./coordinate.js").Coordinate=} center Center.
* @return {import("./coordinate.js").Coordinate|undefined} Center.
*/
function(center) {
if (center) {
@@ -34,8 +34,8 @@ export function createExtent(extent) {
/**
* @param {module:ol/coordinate~Coordinate=} center Center.
* @return {module:ol/coordinate~Coordinate|undefined} Center.
* @param {import("./coordinate.js").Coordinate=} center Center.
* @return {import("./coordinate.js").Coordinate|undefined} Center.
*/
export function none(center) {
return center;

View File

@@ -35,7 +35,7 @@ const NAMED_COLOR_RE_ = /^([a-z]*)$/i;
/**
* Return the color as an rgba string.
* @param {module:ol/color~Color|string} color Color.
* @param {Color|string} color Color.
* @return {string} Rgba string.
* @api
*/
@@ -68,7 +68,7 @@ function fromNamed(color) {
/**
* @param {string} s String.
* @return {module:ol/color~Color} Color.
* @return {Color} Color.
*/
export const fromString = (
function() {
@@ -84,7 +84,7 @@ export const fromString = (
const MAX_CACHE_SIZE = 1024;
/**
* @type {Object<string, module:ol/color~Color>}
* @type {Object<string, Color>}
*/
const cache = {};
@@ -96,7 +96,7 @@ export const fromString = (
return (
/**
* @param {string} s String.
* @return {module:ol/color~Color} Color.
* @return {Color} Color.
*/
function(s) {
let color;
@@ -125,22 +125,22 @@ export const fromString = (
/**
* Return the color as an array. This function maintains a cache of calculated
* arrays which means the result should not be modified.
* @param {module:ol/color~Color|string} color Color.
* @return {module:ol/color~Color} Color.
* @param {Color|string} color Color.
* @return {Color} Color.
* @api
*/
export function asArray(color) {
if (Array.isArray(color)) {
return color;
} else {
return fromString(/** @type {string} */ (color));
return fromString(color);
}
}
/**
* @param {string} s String.
* @private
* @return {module:ol/color~Color} Color.
* @return {Color} Color.
*/
function fromStringInternal_(s) {
let r, g, b, a, color;
@@ -185,16 +185,14 @@ function fromStringInternal_(s) {
} else {
assert(false, 14); // Invalid color
}
return (
/** @type {module:ol/color~Color} */ (color)
);
return color;
}
/**
* TODO this function is only used in the test, we probably shouldn't export it
* @param {module:ol/color~Color} color Color.
* @return {module:ol/color~Color} Clamped color.
* @param {Color} color Color.
* @return {Color} Clamped color.
*/
export function normalize(color) {
color[0] = clamp((color[0] + 0.5) | 0, 0, 255);
@@ -206,7 +204,7 @@ export function normalize(color) {
/**
* @param {module:ol/color~Color} color Color.
* @param {Color} color Color.
* @return {string} String.
*/
export function toString(color) {

View File

@@ -18,27 +18,14 @@ import {toString} from './color.js';
/**
* @param {module:ol/color~Color|module:ol/colorlike~ColorLike} color Color.
* @return {module:ol/colorlike~ColorLike} The color as an {@link ol/colorlike~ColorLike}.
* @param {import("./color.js").Color|ColorLike} color Color.
* @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}.
* @api
*/
export function asColorLike(color) {
if (isColorLike(color)) {
return /** @type {string|CanvasPattern|CanvasGradient} */ (color);
if (Array.isArray(color)) {
return toString(color);
} else {
return toString(/** @type {module:ol/color~Color} */ (color));
return color;
}
}
/**
* @param {?} color The value that is potentially an {@link ol/colorlike~ColorLike}.
* @return {boolean} The color is an {@link ol/colorlike~ColorLike}.
*/
export function isColorLike(color) {
return (
typeof color === 'string' ||
color instanceof CanvasPattern ||
color instanceof CanvasGradient
);
}

View File

@@ -5,6 +5,7 @@
export {default as Attribution} from './control/Attribution.js';
export {default as Control} from './control/Control.js';
export {default as FullScreen} from './control/FullScreen.js';
export {default as MousePosition} from './control/MousePosition.js';
export {default as OverviewMap} from './control/OverviewMap.js';
export {default as Rotate} from './control/Rotate.js';
export {default as ScaleLine} from './control/ScaleLine.js';

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