Compare commits

...

146 Commits

Author SHA1 Message Date
Andreas Hocevar
badc350746 Merge pull request #8554 from openlayers/release-v5.2.0
Release v5.2.0
2018-08-28 21:39:23 +02:00
Andreas Hocevar
50293200d7 Merge pull request #8504 from ahocevar/browserify-readme
Link to Browserify example project
2018-08-28 21:35:18 +02:00
ahocevar
b2b3d6b05c Update package version to 5.2.0 2018-08-28 21:32:36 +02:00
ahocevar
34fefe3103 Changelog for v5.2.0 2018-08-28 21:32:36 +02:00
Pierre GIRAUD
27dadef8ef Merge pull request #8511 from openlayers/pgiraud-patch-1
Update IGN API key
2018-08-27 10:36:35 +02:00
Pierre GIRAUD
f456c56ddd Merge pull request #8547 from pgiraud/serve-examples
Fix port number in developing doc
2018-08-27 09:32:44 +02:00
Pierre GIRAUD
bdb80d3368 Fix port number in developing doc 2018-08-27 09:14:23 +02:00
Pierre GIRAUD
b039e17015 Update IGN API key
Fixes #8509
2018-08-27 09:11:26 +02:00
Andreas Hocevar
bd9635f6ef Merge pull request #8546 from ahocevar/proj-faq
Update projection FAQ for v5
2018-08-27 08:14:28 +02:00
ahocevar
a0e72c7d42 Update projection FAQ for v5 2018-08-26 21:41:16 +02:00
Andreas Hocevar
bb77fbe703 Merge pull request #8543 from openlayers/greenkeeper/rollup-0.65.0
Update rollup to the latest version 🚀
2018-08-26 07:21:28 +02:00
greenkeeper[bot]
0c47890bdd chore(package): update rollup to version 0.65.0 2018-08-25 14:41:44 +00:00
Andreas Hocevar
2d974c6f1f Merge pull request #8541 from openlayers/greenkeeper/proj4-2.5.0
Update proj4 to the latest version 🚀
2018-08-25 00:37:38 +02:00
Andreas Hocevar
d95b2bc2ae Merge pull request #8542 from openlayers/greenkeeper/rollup-plugin-commonjs-9.1.6
Update rollup-plugin-commonjs to the latest version 🚀
2018-08-25 00:36:35 +02:00
greenkeeper[bot]
0ada02f12a chore(package): update rollup-plugin-commonjs to version 9.1.6 2018-08-24 22:10:50 +00:00
greenkeeper[bot]
786bb608b9 chore(package): update proj4 to version 2.5.0 2018-08-24 21:25:55 +00:00
Frédéric Junod
2342ec90aa Merge pull request #8481 from gberaudo/expose_some_internal_functions
Expose some internal functions
2018-08-23 10:42:19 +02:00
Andreas Hocevar
7a05b671d8 Merge pull request #8533 from openlayers/greenkeeper/webpack-4.17.1
Update webpack to the latest version 🚀
2018-08-22 13:32:22 +02:00
Andreas Hocevar
ea9517ffd5 Merge pull request #8510 from gberaudo/fix_WMTS_dimensions_handling
Fix WMTS URLs with dimensions
2018-08-22 13:31:53 +02:00
Frédéric Junod
d84c64b3e7 Merge pull request #8524 from NeoRaider/xhtml-fixes
Fix compatiblity with XHTML content type
2018-08-22 13:13:22 +02:00
greenkeeper[bot]
017d2e4802 chore(package): update webpack to version 4.17.1 2018-08-22 10:49:35 +00:00
Andreas Hocevar
3b36477fc3 Merge pull request #8532 from ahocevar/rendercomplete
Add 'rendercomplete' event
2018-08-22 11:01:00 +02:00
ahocevar
1baa8be269 Add 'rendercomplete' event 2018-08-22 09:53:24 +02:00
Andreas Hocevar
158b54156a Merge pull request #8530 from openlayers/greenkeeper/webpack-4.17.0
Update webpack to the latest version 🚀
2018-08-21 19:34:45 +02:00
greenkeeper[bot]
5752bd0028 chore(package): update webpack to version 4.17.0 2018-08-21 09:50:38 +00:00
Andreas Hocevar
3f98094d9d Merge pull request #8529 from TDesjardins/patch-1
Update link to base class in docs
2018-08-20 17:56:50 +02:00
Tino Desjardins
b56a7c0fa3 Update link to base class in docs 2018-08-20 17:03:59 +02:00
Tim Schaub
b7aa6c6513 Merge pull request #8528 from TDesjardins/patch-1
Update link to base class in docs
2018-08-20 05:36:47 -06:00
Tino Desjardins
1605741a92 Update link to base class in docs 2018-08-20 10:23:22 +02:00
Tim Schaub
a18da7d55a Merge pull request #8525 from tschaub/re-export-projection
Re-export Projection from ol/proj for convenience
2018-08-19 19:52:17 -06:00
Tim Schaub
68cf960028 Re-export Projection from ol/proj for convenience 2018-08-18 14:14:10 -06:00
Matthias Schiffer
94c6afd65d Avoid HTML entities like   and ©
Use numerical entities instead for XHTML compatiblity.
2018-08-18 13:13:27 +02:00
Matthias Schiffer
321166849b Consistently use lowercase HTML tag names
Unlike HTML, XHTML is case-sensitive.
2018-08-18 12:48:14 +02:00
Andreas Hocevar
26cc0a3ded Merge pull request #8522 from openlayers/greenkeeper/marked-0.5.0
Update marked to the latest version 🚀
2018-08-17 11:30:38 +02:00
greenkeeper[bot]
fffcf4415c chore(package): update marked to version 0.5.0 2018-08-17 09:00:28 +00:00
Andreas Hocevar
07cb678271 Merge pull request #8499 from ahocevar/focus
Round center in viewState to pixels
2018-08-16 16:41:15 +02:00
Guillaume Beraudo
315cfa1033 Fix WMTS layers URLs with dimensions 2018-08-16 15:34:56 +02:00
Andreas Hocevar
38349d8c37 Merge pull request #8520 from openlayers/redundant-if
Remove redundant if block
2018-08-16 08:31:29 +02:00
Andreas Hocevar
adce78e19e Remove redundant if block 2018-08-16 07:04:53 +02:00
Andreas Hocevar
eb0fcdb588 Merge pull request #8515 from ahocevar/getoverlay
More convenient select and sketch layer management
2018-08-15 13:21:48 +02:00
ahocevar
161c5b0105 Better documentation of the zIndex default 2018-08-15 11:24:29 +02:00
ahocevar
8ab1589f9a Add getOverlay method to access sketch and selection layers 2018-08-15 10:59:38 +02:00
ahocevar
95533e2425 Use configured zIndex for unmanaged layers 2018-08-15 10:58:52 +02:00
Andreas Hocevar
a94dff2c06 Merge pull request #8505 from openlayers/greenkeeper/karma-3.0.0
Update karma to the latest version 🚀
2018-08-10 11:34:21 +02:00
greenkeeper[bot]
fc75fc691b chore(package): update karma to version 3.0.0 2018-08-09 21:20:04 +00:00
ahocevar
b9aceb23ac Let renderer decide whether to snapToPixel or not, also for text 2018-08-09 18:16:58 +02:00
ahocevar
f382ddf230 Remove snapToPixel option and deprecate getters/setters 2018-08-09 18:16:58 +02:00
ahocevar
dbdaa73cf2 Only change interacting flag when dragging 2018-08-09 18:16:58 +02:00
ahocevar
f3cd1d8dfd Round center in viewState 2018-08-09 18:16:58 +02:00
Andreas Hocevar
e5944682df Merge pull request #8503 from ahocevar/callback-closure
Avoid block scope issues in transpiled code
2018-08-09 13:55:17 +02:00
Andreas Hocevar
147a86c867 Merge pull request #8501 from openlayers/greenkeeper/rollup-plugin-commonjs-9.1.5
Update rollup-plugin-commonjs to the latest version 🚀
2018-08-09 10:57:34 +02:00
ahocevar
2d08811485 Link to Browserify example project 2018-08-09 10:34:31 +02:00
ahocevar
fc19e3e12e Avoid block scope issues in transpiled code 2018-08-09 10:22:42 +02:00
greenkeeper[bot]
a5fc8bdd25 chore(package): update rollup-plugin-commonjs to version 9.1.5 2018-08-09 05:49:21 +00:00
Andreas Hocevar
7f8b2d2e1f Merge pull request #8495 from openlayers/greenkeeper/rollup-0.64.1
Update rollup to the latest version 🚀
2018-08-07 21:43:35 +02:00
greenkeeper[bot]
80a00fce47 chore(package): update rollup to version 0.64.1 2018-08-07 19:20:14 +00:00
Andreas Hocevar
ee8ed5193c Merge pull request #8493 from openlayers/greenkeeper/clean-css-cli-4.2.1
Update clean-css-cli to the latest version 🚀
2018-08-07 11:26:54 +02:00
greenkeeper[bot]
cc7d825a13 chore(package): update clean-css-cli to version 4.2.1 2018-08-07 09:02:18 +00:00
Andreas Hocevar
fd4e0f14cc Merge pull request #8490 from MarquesDeAzevedo/patch-1
WMTS getCapabilities readCoodinates more than one whitespace delimiter
2018-08-07 10:46:28 +02:00
MarquesDeAzevedo
85e1f11adb WMTS getCapabilities readCoodinates more than one whitespace delimiter
remove not required regexp modifier
2018-08-07 10:40:08 +02:00
MarquesDeAzevedo
47c4e1a165 WMTS getCapabilities readCoodinates more than one whitespace delimiter
combine split and replace
2018-08-07 09:56:17 +02:00
Andreas Hocevar
0bff75a067 Merge pull request #8491 from openlayers/greenkeeper/rollup-0.64.0
Update rollup to the latest version 🚀
2018-08-07 09:21:42 +02:00
greenkeeper[bot]
ab81deb242 chore(package): update rollup to version 0.64.0 2018-08-07 07:12:54 +00:00
MarquesDeAzevedo
654073cd3d WMTS getCapabilities readCoodinates more than one whitespace delimiter
Some WMTS getCapabilities return <MatrixSet><TopLeftCorner> with more than one whitespace as delimiter between the coordinates. This leads to the layer not being displayed, because the origin_ property of ol.tilegrid.TileGrid is not set.
Error in ol.tilegrid.TileGrid.prototype.getTileCoordForXYAndZ_: JavaScript runtime error: Unable to get property '0' of undefined or null reference
2018-08-07 08:40:42 +02:00
Andreas Hocevar
a354e842ab Merge pull request #8489 from ahocevar/prototype
Use .prototype. only where necessary
2018-08-06 15:44:06 +02:00
ahocevar
1eeea2aa4d Use class method syntax instead of .prototype.method = function 2018-08-06 15:30:17 +02:00
ahocevar
2f92e48e93 Use super.method instead of prototype.method.call 2018-08-06 15:30:17 +02:00
ahocevar
c5b42c49d5 Fix Disposable's prototype handling 2018-08-06 15:30:17 +02:00
Andreas Hocevar
03d47e49ed Merge pull request #8486 from openlayers/greenkeeper/webpack-4.16.5
Update webpack to the latest version 🚀
2018-08-06 11:40:44 +02:00
Guillaume Beraudo
abbfb5c653 Document the stableSort function 2018-08-06 10:50:18 +02:00
greenkeeper[bot]
a78c163a4f chore(package): update webpack to version 4.16.5 2018-08-06 08:14:58 +00:00
Guillaume Beraudo
a4178d05ef Expose the stableSort function
This is a low level function, essential to OpenLayers so it is always
shipped with OpenLayers.
2018-08-06 09:18:56 +02:00
Guillaume Beraudo
dbf9048d8f Expose the getUid function
It is often useful in application code to have a way to uniquely identify
and object.

Exposing the OpenLayers mechanism allows for best performance and avoid
unneccessary dirt.
2018-08-06 09:18:56 +02:00
Andreas Hocevar
824ad48488 Merge pull request #8478 from ahocevar/available-font-weights
Check font availability with multiple font weights
2018-08-06 06:52:53 +02:00
Frédéric Junod
8cd9eabe68 Merge pull request #8483 from fredj/draw-shapes-null-coordinates
Don't create Polygon with null coordinates
2018-08-05 19:30:34 +02:00
Frederic Junod
a50a4efeca Don't create Polygon with null coordinates 2018-08-04 07:35:19 +02:00
Frédéric Junod
d49be1393e Merge pull request #8471 from samuel-girard/imagestatic_properties
Add getUrl and getImageExtent to ImageStatic API
2018-08-03 09:22:53 +02:00
Andreas Hocevar
a991bb21d6 Merge pull request #8470 from scroach/tile-api-doc
Update Tile loading API docs
2018-08-03 09:13:48 +02:00
Andreas Hocevar
df848d6673 Add basic tileLoadFunction example and refine advanced example 2018-08-03 09:04:24 +02:00
scroach
68ce6de0ca Updated Tile loading API docs 2018-08-03 09:01:47 +02:00
Tim Schaub
141fe5fe49 Merge pull request #8477 from gberaudo/expose_gutter
Expose original getGutter
2018-08-02 22:33:23 -06:00
Andreas Hocevar
57baa15cc3 Merge pull request #8476 from openlayers/greenkeeper/webpack-4.16.4
Update webpack to the latest version 🚀
2018-08-02 22:46:57 +02:00
Andreas Hocevar
64138bb94f Merge pull request #8475 from openlayers/greenkeeper/clean-css-cli-4.2.0
Update clean-css-cli to the latest version 🚀
2018-08-02 22:41:09 +02:00
ahocevar
62188502e9 Check font availability in 3 different weight ranges 2018-08-02 18:57:26 +02:00
Guillaume Beraudo
fe86d2e7f7 Expose original getGutter
TileWMS objects take a gutter option but do not have a public getter
for it. This makes it convoluted for user code to recreate the object
(ex: in the case of serialization/deserialization).

- the getGutterInternal() method is renamed to getGutter;
- the getGutter(projection) method is renamed to getGutterForProjection,
  which is also more explicit.

The getGutter method was not API and is only used by the renderer.
2018-08-02 17:12:41 +02:00
greenkeeper[bot]
69ae9d7180 chore(package): update webpack to version 4.16.4 2018-08-02 14:55:46 +00:00
greenkeeper[bot]
adc83ba484 chore(package): update clean-css-cli to version 4.2.0 2018-08-02 13:08:28 +00:00
Samuel Girard
4012280ad4 Use class property for url 2018-08-02 09:02:04 +02:00
Samuel Girard
e48c85a689 Add getUrl and getImageExtent to ImageStatic API 2018-08-01 12:23:38 +02:00
Andreas Hocevar
c74faaa7ca Merge pull request #8469 from openlayers/greenkeeper/rollup-0.63.5
Update rollup to the latest version 🚀
2018-08-01 10:52:23 +02:00
greenkeeper[bot]
236b6832fb chore(package): update rollup to version 0.63.5 2018-08-01 07:39:36 +00:00
Andreas Hocevar
93b92d3990 Merge pull request #8466 from ahocevar/on-focus-only
Add onFocusOnly option to interaction defaults
2018-07-31 13:27:14 +02:00
Andreas Hocevar
a36ab978e7 Merge pull request #8465 from ahocevar/no-prevent-default-on-pointermove
Do not prevent default on pointermove
2018-07-31 13:26:46 +02:00
ahocevar
55fb62c551 Add onFocusOnly option to interaction defaults 2018-07-31 09:01:42 +02:00
ahocevar
c74b9c1d55 Do not prevent default on pointermove
Instead, only prevent default on handled pointerdown events. This makes 
the `focus` condition work with interactions that involve dragging on 
touch devices.
2018-07-31 08:33:15 +02:00
Andreas Hocevar
a56ca57ac6 Merge pull request #8461 from lionralfs/lionralfs-patch-1
Fix double backtick typo
2018-07-28 14:40:33 +02:00
Lion Ralfs
1aadd51c57 Fix double backtick typo 2018-07-28 12:58:37 +02:00
Tim Schaub
a1391a2083 Merge pull request #8453 from openlayers/greenkeeper/webpack-4.16.3
Update webpack to the latest version 🚀
2018-07-27 17:55:28 -06:00
Frédéric Junod
5adf0be4a3 Merge pull request #8452 from fredj/f_8409
Remove extra translate function in Geometry, add missing api tag
2018-07-27 15:53:53 +02:00
Frédéric Junod
4c71ddb3c7 Merge pull request #8451 from fredj/rm_f
Remove unimplemented functions
2018-07-27 13:22:35 +02:00
greenkeeper[bot]
efe15402cc chore(package): update webpack to version 4.16.3 2018-07-27 11:19:38 +00:00
Frederic Junod
b3586bed8d Remove extra translate function in Geometry, add missing api tag 2018-07-27 13:19:12 +02:00
Frederic Junod
1e332f52d6 Remove unimplemented functions
The TypeScript checker complain about it.
It was a workaround for closure-compiler, it's not needed anymore.
2018-07-27 13:10:45 +02:00
Frédéric Junod
c0f44f6d9d Merge pull request #8450 from fredj/types
Mark properties of ReadOptions and WriteOptions as optional
2018-07-27 11:45:25 +02:00
Andreas Hocevar
efe0dd7fbf Merge pull request #8447 from openlayers/greenkeeper/rollup-plugin-commonjs-9.1.4
Update rollup-plugin-commonjs to the latest version 🚀
2018-07-27 11:39:47 +02:00
Frederic Junod
219629458b Mark properties of ReadOptions and WriteOptions as optional 2018-07-27 11:25:52 +02:00
greenkeeper[bot]
b13feb0046 chore(package): update rollup-plugin-commonjs to version 9.1.4 2018-07-27 06:27:33 +00:00
Tim Schaub
df293d8a2e Merge pull request #8443 from tschaub/void
Explicit void
2018-07-26 17:28:26 -06:00
Tim Schaub
6cfa2b22a7 Explicit void 2018-07-26 10:46:39 -06:00
Tim Schaub
8346bb7454 Merge pull request #8437 from tschaub/target
Avoid shadowing EventTarget
2018-07-26 09:21:57 -07:00
Tim Schaub
40486a0ecc Avoid shadowing EventTarget 2018-07-26 10:14:58 -06:00
Tim Schaub
d8efa569d9 Merge pull request #8439 from tschaub/dotless
Fewer dots in types
2018-07-26 06:16:33 -07:00
Frédéric Junod
adfb3dd229 Merge pull request #8441 from fredj/f_8440
Fix loaded script for the example-verbatim examples
2018-07-26 14:02:33 +02:00
Frederic Junod
3c0be4e611 Fix loaded script for the example-verbatim examples 2018-07-26 13:46:17 +02:00
Tim Schaub
2eb07aa081 Use Template<Foo> instead of Template.<Foo> 2018-07-25 18:37:08 -07:00
Tim Schaub
affbf59b77 Use Object<Foo, Bar> instead of Object.<Foo, Bar> 2018-07-25 18:33:49 -07:00
Tim Schaub
d12ef20b12 Use Array<Foo> instead of Array.<Foo> 2018-07-25 18:32:43 -07:00
Frédéric Junod
5a6502572f Merge pull request #8435 from fredj/f_8434
Call setCoordinates on the point instance
2018-07-25 16:55:05 +02:00
Frederic Junod
d7adf0b4f3 Call setCoordinates on the point instance 2018-07-25 16:10:56 +02:00
Tim Schaub
f7551623e7 Merge pull request #8428 from tschaub/ts-fixes
Type name on same line as type
2018-07-24 07:24:13 -07:00
Tim Schaub
6f22f1b7ac Param name on same line as type 2018-07-23 16:28:22 -07:00
Tim Schaub
6cdfbe3116 Merge pull request #8422 from jkoelewijn/improveJsDocForAngularCli
Improve JSDoc such that `ng build --prod` with angular/cli 6.0.8 succeeds again
2018-07-23 14:40:50 -07:00
Jaap Koelewijn
704845e37a Use alternative JSDoc annotation for optional parameter which passes the tests. 2018-07-23 21:29:52 +02:00
Jaap Koelewijn
fd9219f035 Incorporate review comments of ahocevar and tschaub. 2018-07-23 21:12:43 +02:00
Tim Schaub
f3786f9cff Merge pull request #8426 from openlayers/greenkeeper/webpack-4.16.2
Update webpack to the latest version 🚀
2018-07-23 07:23:19 -07:00
greenkeeper[bot]
436633b990 chore(package): update webpack to version 4.16.2 2018-07-23 12:03:50 +00:00
Andreas Hocevar
a89ae25134 Merge pull request #8396 from iamplex/fix-createRegularPolygon
Fix ol.interaction.Draw~createRegularPolygon
2018-07-23 10:51:32 +02:00
Jaap Koelewijn
2769953204 Fix JSDoc such that ng build --prod with angular/cli 6.0.8 succeeds again. 2018-07-23 01:05:26 +02:00
Andreas Hocevar
14ead39440 Merge pull request #8420 from ahocevar/raster-lib-fn-names
Keep function names when building examples
2018-07-22 22:55:05 +02:00
ahocevar
39261af940 Keep function names when building examples 2018-07-22 17:39:20 +02:00
Tim Schaub
9ec623380a Merge pull request #8419 from tschaub/release-v5.1.3
Release v5.1.3
2018-07-21 08:45:16 -07:00
Tim Schaub
28104527b0 Updates for v5.1.3 2018-07-21 09:44:10 -06:00
Tim Schaub
b50bc1febf Merge pull request #8417 from tschaub/bad-info
Minor doc updates
2018-07-21 08:34:01 -07:00
Andreas Hocevar
c046c2a1ba Merge pull request #8418 from ahocevar/classdesc-constructor-api
Set api annotation on classdesc, not constructor
2018-07-21 17:33:30 +02:00
ahocevar
bbe0a66d07 Set api annotation on classdesc, not constructor 2018-07-21 17:25:22 +02:00
Tim Schaub
d8b290966b Tracking 2018-07-21 09:11:30 -06:00
Tim Schaub
0edb39c8ab Single quote instead of backtick 2018-07-21 08:40:03 -06:00
Tim Schaub
f0ffb48633 Update concepts 2018-07-21 08:37:38 -06:00
Tim Schaub
171195a836 Remove broken link to sources 2018-07-21 08:24:44 -06:00
ahocevar
45cf296ed4 Simplify calculation and add tests 2018-07-21 10:22:42 +02:00
plex
b377bbac59 fix: change the start angle of the regular polygon to match the sketch 2018-07-21 09:44:00 +02:00
Tim Schaub
2767ddfdc7 Merge pull request #8414 from tschaub/release-v5.1.2
Updates for 5.1.2
2018-07-20 19:04:08 -07:00
Tim Schaub
cd85e30d08 Updates for 5.1.2 2018-07-20 20:03:15 -06:00
Tim Schaub
139fcd7bae Merge pull request #8413 from tschaub/jsdoc-fix
Remove extra curly in type
2018-07-20 19:00:34 -07:00
Tim Schaub
2a04415264 Remove extra curly in type 2018-07-20 19:57:49 -06:00
Tim Schaub
515eca797f Correct link to release notes 2018-07-20 19:44:04 -06:00
317 changed files with 4321 additions and 3887 deletions

View File

@@ -30,7 +30,7 @@ To run the examples you first need to start the dev server:
$ npm run serve-examples
Then, load <http://localhost:5000/> in your browser.
Then, load <http://localhost:8080/> in your browser.
## Running tests

View File

@@ -39,6 +39,7 @@ See the following examples for more detail on bundling OpenLayers with your appl
* Using [Rollup](https://github.com/openlayers/ol-rollup)
* Using [Webpack](https://github.com/openlayers/ol-webpack)
* Using [Parcel](https://github.com/openlayers/ol-parcel)
* Using [Browserify](https://github.com/openlayers/ol-browserify)
## Supported Browsers

View File

@@ -1,5 +1,17 @@
## Upgrade notes
### Next version
### v5.2.0
#### Removal of the `snapToPixel` option for `ol/style/Image` subclasses
The `snapToPixel` option has been removed, and the `getSnapToPixel` and `setSnapToPixel` methods are deprecated.
The renderer now snaps to integer pixels when no interaction or animation is running to get crisp rendering. During interaction or animation, it does not snap to integer pixels to avoid jitter.
When rendering with the Immediate API, symbols will no longer be snapped to integer pixels. To get crisp images, set `context.imageSmoothingEnabled = false` before rendering with the Immediate API, and `context.imageSmoothingEnabled = true` afterwards.
### v5.1.0
#### Geometry constructor and `setCoordinates` no longer accept `null` coordinates

View File

@@ -1,3 +1,3 @@
# 5.1.1
The 5.1.1 release is a patch to include the readme in the package. See the [5.1.0 notes](https://github.com/openlayers/openlayers/releases/tag/v5.0.3) for detail on the 5.1 release.
The 5.1.1 release is a patch to include the readme in the package. See the [5.1.0 notes](https://github.com/openlayers/openlayers/releases/tag/v5.1.0) for detail on the 5.1 release.

5
changelog/v5.1.2.md Normal file
View File

@@ -0,0 +1,5 @@
# 5.1.2
The 5.1.2 release is a patch to fix the API docs. See the [5.1.0 notes](https://github.com/openlayers/openlayers/releases/tag/v5.1.0) for detail on the 5.1 release.
* [#8413](https://github.com/openlayers/openlayers/pull/8413) - Remove extra curly in type ([@tschaub](https://github.com/tschaub))

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

@@ -0,0 +1,6 @@
# 5.1.3
The 5.1.3 release is a patch to fix the API docs and the legacy full build. See the [5.1.0 notes](https://github.com/openlayers/openlayers/releases/tag/v5.1.0) for detail on the 5.1 release.
* [#8417](https://github.com/openlayers/openlayers/pull/8417) - Minor doc updates ([@tschaub](https://github.com/tschaub))
* [#8418](https://github.com/openlayers/openlayers/pull/8418) - Set api annotation on classdesc, not constructor ([@ahocevar](https://github.com/ahocevar))

86
changelog/v5.2.0.md Normal file
View File

@@ -0,0 +1,86 @@
# v5.1.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.
We're still working toward type checking with TypeScript. Until that is complete, we apologize for some flwas in the online API documentation. We're excited about the improved experience for application developers when the effort is finished, and will highlight some of the benefit in upcoming releases.
### Upgrade Notes
#### Removal of the `snapToPixel` option for `ol/style/Image` subclasses
The `snapToPixel` option has been removed, and the `getSnapToPixel` and `setSnapToPixel` methods are deprecated.
The renderer now snaps to integer pixels when no interaction or animation is running to get crisp rendering. During interaction or animation, it does not snap to integer pixels to avoid jitter.
When rendering with the Immediate API, symbols will no longer be snapped to integer pixels. To get crisp images, set `context.imageSmoothingEnabled = false` before rendering with the Immediate API, and `context.imageSmoothingEnabled = true` afterwards.
### New Features and Fixes
* [#8511](https://github.com/openlayers/openlayers/pull/8511) - Update IGN API key ([@openlayers](https://github.com/openlayers))
* [#8547](https://github.com/openlayers/openlayers/pull/8547) - Fix port number in developing doc ([@pgiraud](https://github.com/pgiraud))
* [#8546](https://github.com/openlayers/openlayers/pull/8546) - Update projection FAQ for v5 ([@ahocevar](https://github.com/ahocevar))
* [#8481](https://github.com/openlayers/openlayers/pull/8481) - Expose some internal functions ([@gberaudo](https://github.com/gberaudo))
* [#8510](https://github.com/openlayers/openlayers/pull/8510) - Fix WMTS URLs with dimensions ([@gberaudo](https://github.com/gberaudo))
* [#8524](https://github.com/openlayers/openlayers/pull/8524) - Fix compatiblity with XHTML content type ([@NeoRaider](https://github.com/NeoRaider))
* [#8532](https://github.com/openlayers/openlayers/pull/8532) - Add 'rendercomplete' event ([@ahocevar](https://github.com/ahocevar))
* [#8529](https://github.com/openlayers/openlayers/pull/8529) - Update link to base class in docs ([@TDesjardins](https://github.com/TDesjardins))
* [#8528](https://github.com/openlayers/openlayers/pull/8528) - Update link to base class in docs ([@TDesjardins](https://github.com/TDesjardins))
* [#8525](https://github.com/openlayers/openlayers/pull/8525) - Re-export Projection from ol/proj for convenience ([@tschaub](https://github.com/tschaub))
* [#8499](https://github.com/openlayers/openlayers/pull/8499) - Round center in viewState to pixels ([@ahocevar](https://github.com/ahocevar))
* [#8520](https://github.com/openlayers/openlayers/pull/8520) - Remove redundant if block ([@openlayers](https://github.com/openlayers))
* [#8515](https://github.com/openlayers/openlayers/pull/8515) - More convenient select and sketch layer management ([@ahocevar](https://github.com/ahocevar))
* [#8503](https://github.com/openlayers/openlayers/pull/8503) - Avoid block scope issues in transpiled code ([@ahocevar](https://github.com/ahocevar))
* [#8490](https://github.com/openlayers/openlayers/pull/8490) - WMTS getCapabilities readCoodinates more than one whitespace delimiter ([@MarquesDeAzevedo](https://github.com/MarquesDeAzevedo))
* [#8489](https://github.com/openlayers/openlayers/pull/8489) - Use .prototype. only where necessary ([@ahocevar](https://github.com/ahocevar))
* [#8478](https://github.com/openlayers/openlayers/pull/8478) - Check font availability with multiple font weights ([@ahocevar](https://github.com/ahocevar))
* [#8483](https://github.com/openlayers/openlayers/pull/8483) - Don't create Polygon with null coordinates ([@fredj](https://github.com/fredj))
* [#8471](https://github.com/openlayers/openlayers/pull/8471) - Add getUrl and getImageExtent to ImageStatic API ([@samuel-girard](https://github.com/samuel-girard))
* [#8470](https://github.com/openlayers/openlayers/pull/8470) - Update Tile loading API docs ([@scroach](https://github.com/scroach))
* [#8477](https://github.com/openlayers/openlayers/pull/8477) - Expose original getGutter ([@gberaudo](https://github.com/gberaudo))
* [#8466](https://github.com/openlayers/openlayers/pull/8466) - Add onFocusOnly option to interaction defaults ([@ahocevar](https://github.com/ahocevar))
* [#8465](https://github.com/openlayers/openlayers/pull/8465) - Do not prevent default on pointermove ([@ahocevar](https://github.com/ahocevar))
* [#8461](https://github.com/openlayers/openlayers/pull/8461) - Fix double backtick typo ([@lionralfs](https://github.com/lionralfs))
* [#8452](https://github.com/openlayers/openlayers/pull/8452) - Remove extra translate function in Geometry, add missing api tag ([@fredj](https://github.com/fredj))
* [#8451](https://github.com/openlayers/openlayers/pull/8451) - Remove unimplemented functions ([@fredj](https://github.com/fredj))
* [#8450](https://github.com/openlayers/openlayers/pull/8450) - Mark properties of ReadOptions and WriteOptions as optional ([@fredj](https://github.com/fredj))
* [#8443](https://github.com/openlayers/openlayers/pull/8443) - Explicit void ([@tschaub](https://github.com/tschaub))
* [#8437](https://github.com/openlayers/openlayers/pull/8437) - Avoid shadowing EventTarget ([@tschaub](https://github.com/tschaub))
* [#8439](https://github.com/openlayers/openlayers/pull/8439) - Fewer dots in types ([@tschaub](https://github.com/tschaub))
* [#8441](https://github.com/openlayers/openlayers/pull/8441) - Fix loaded script for the example-verbatim examples ([@fredj](https://github.com/fredj))
* [#8435](https://github.com/openlayers/openlayers/pull/8435) - Call setCoordinates on the point instance ([@fredj](https://github.com/fredj))
* [#8428](https://github.com/openlayers/openlayers/pull/8428) - Type name on same line as type ([@tschaub](https://github.com/tschaub))
* [#8422](https://github.com/openlayers/openlayers/pull/8422) - Improve JSDoc such that `ng build --prod` with angular/cli 6.0.8 succeeds again ([@jkoelewijn](https://github.com/jkoelewijn))
* [#8396](https://github.com/openlayers/openlayers/pull/8396) - Fix ol.interaction.Draw~createRegularPolygon ([@iamplex](https://github.com/iamplex))
* [#8420](https://github.com/openlayers/openlayers/pull/8420) - Keep function names when building examples ([@ahocevar](https://github.com/ahocevar))
* [#8419](https://github.com/openlayers/openlayers/pull/8419) - Release v5.1.3 ([@tschaub](https://github.com/tschaub))
* [#8417](https://github.com/openlayers/openlayers/pull/8417) - Minor doc updates ([@tschaub](https://github.com/tschaub))
* [#8418](https://github.com/openlayers/openlayers/pull/8418) - Set api annotation on classdesc, not constructor ([@ahocevar](https://github.com/ahocevar))
* [#8414](https://github.com/openlayers/openlayers/pull/8414) - Updates for 5.1.2 ([@tschaub](https://github.com/tschaub))
* [#8413](https://github.com/openlayers/openlayers/pull/8413) - Remove extra curly in type ([@tschaub](https://github.com/tschaub))
* [#8412](https://github.com/openlayers/openlayers/pull/8412) - Changes for 5.1.1. ([@tschaub](https://github.com/tschaub))
<details>
<summary>Dependency Updates</summary>
* [#8543](https://github.com/openlayers/openlayers/pull/8543) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8541](https://github.com/openlayers/openlayers/pull/8541) - Update proj4 to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8542](https://github.com/openlayers/openlayers/pull/8542) - Update rollup-plugin-commonjs to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8533](https://github.com/openlayers/openlayers/pull/8533) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8530](https://github.com/openlayers/openlayers/pull/8530) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8522](https://github.com/openlayers/openlayers/pull/8522) - Update marked to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8505](https://github.com/openlayers/openlayers/pull/8505) - Update karma to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8501](https://github.com/openlayers/openlayers/pull/8501) - Update rollup-plugin-commonjs to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8495](https://github.com/openlayers/openlayers/pull/8495) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8493](https://github.com/openlayers/openlayers/pull/8493) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8491](https://github.com/openlayers/openlayers/pull/8491) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8486](https://github.com/openlayers/openlayers/pull/8486) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8476](https://github.com/openlayers/openlayers/pull/8476) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8475](https://github.com/openlayers/openlayers/pull/8475) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8469](https://github.com/openlayers/openlayers/pull/8469) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8453](https://github.com/openlayers/openlayers/pull/8453) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8447](https://github.com/openlayers/openlayers/pull/8447) - Update rollup-plugin-commonjs to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#8426](https://github.com/openlayers/openlayers/pull/8426) - Update webpack to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
</details>

View File

@@ -168,9 +168,9 @@ function generateSourceFiles(sourceFiles) {
* for display purposes. This function mutates the original arrays.
*
* @private
* @param {Array.<module:jsdoc/doclet.Doclet>} doclets - The array of classes and functions to
* @param {Array<module:jsdoc/doclet.Doclet>} doclets - The array of classes and functions to
* check.
* @param {Array.<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.
* @param {Array<module:jsdoc/doclet.Doclet>} modules - The array of module doclets to search.
*/
function attachModuleSymbols(doclets, modules) {
const symbols = {};

View File

@@ -4,6 +4,13 @@ var version = obj.packageInfo.version;
<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-2577926-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-2577926-1');
</script>
<meta charset="utf-8">
<title>OpenLayers v<?js= version ?> API - <?js= title ?></title>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>

View File

@@ -65,20 +65,19 @@ var map = new ol.Map({
```
```javascript
// To use other projections, you have to register the projection in OpenLayers:
// 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
// code.
var swissProjection = new ol.proj.Projection({
code: 'EPSG:21781',
// The extent is used to determine zoom level 0. Recommended values for a
// projection's validity extent can be found at https://epsg.io/.
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
units: 'm'
});
ol.proj.addProjection(swissProjection);
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');
// we can now use the projection:
var map = new ol.Map({

View File

@@ -130,7 +130,7 @@ The `layers: [ ... ]` array is used to define the list of layers available in th
]
```
Layers in OpenLayers are defined with a type (Image, Tile or Vector) which contains a source. The source is the protocol used to get the map tiles. You can consult the list of [available layer sources here](/en/{{ latest }}/apidoc/ol.source.html)
Layers in OpenLayers are defined with a type (Image, Tile or Vector) which contains a source. The source is the protocol used to get the map tiles.
The next part of the `Map` object is the `View`. The view allows to specify the center, resolution, and rotation of the map. The simplest way to define a view is to define a center point and a zoom level. Note that zoom level 0 is zoomed out.

View File

@@ -45,7 +45,7 @@ const map = new Map({
});
```
You will also need an `ìndex.html` file that will use your bundle. Here is a simple example:
You will also need an `index.html` file that will use your bundle. Here is a simple example:
```html
<!DOCTYPE html>

View File

@@ -6,19 +6,26 @@ layout: doc.hbs
# Basic Concepts
## Map
The core component of OpenLayers is the map (`Map`). It is rendered to a `target` container (e.g. a `div` element on the web page that contains the map). All map properties can either be configured at construction time, or by using setter methods, e.g. `setTarget()`.
The core component of OpenLayers is the map (`ol/Map`). It is rendered to a `target` container (e.g. a `div` element on the web page that contains the map). All map properties can either be configured at construction time, or by using setter methods, e.g. `setTarget()`.
The markup below could be used to create a `<div>` that contains your map.
```xml
<div id="map" style="width: 100%, height: 400px"></div>
<script>
```
The script below constructs a map that is rendered in the `<div>` above, using the `map` id of the element as a selector.
```js
import Map from 'ol/Map';
var map = new Map({target: 'map'});
</script>
```
## View
`Map` is not responsible for things like center, zoom level and projection of the map. Instead, these are properties of a `View` instance.
The map is not responsible for things like center, zoom level and projection of the map. Instead, these are properties of a `ol/View` instance.
```js
import View from 'ol/View';
@@ -35,7 +42,8 @@ The `zoom` option is a convenient way to specify the map resolution. The availab
## Source
To get remote data for a layer, OpenLayers uses `source/Source` subclasses. These are available for free and commercial map tile services like OpenStreetMap or Bing, for OGC sources like WMS or WMTS, and for vector data in formats like GeoJSON or KML.
To get remote data for a layer, OpenLayers uses `ol/source/Source` subclasses. These are available for free and commercial map tile services like OpenStreetMap or Bing, for OGC sources like WMS or WMTS, and for vector data in formats like GeoJSON or KML.
```js
import OSM from 'ol/source/OSM';
@@ -44,15 +52,13 @@ To get remote data for a layer, OpenLayers uses `source/Source` subclasses. Thes
```
## Layer
A layer is a visual representation of data from a `source`. OpenLayers has four basic types of layers: `layer/Tile`, `layer/Image`, `layer/Vector` and `layer/VectorTile`.
`layer/Tile` is for layer sources that provide pre-rendered, tiled images in grids that are organized by zoom levels for specific resolutions.
A layer is a visual representation of data from a `source`. OpenLayers has four basic types of layers:
`layer/Image` is for server rendered images that are available for arbitrary extents and resolutions.
`layer/Vector` is for vector data that is rendered client-side.
`layer/VectorTile` is for tiled vector data that is rendered client-side.
* `ol/layer/Tile` - Renders sources that provide tiled images in grids that are organized by zoom levels for specific resolutions.
* `ol/layer/Image` - Renders sources that provide map images at arbitrary extents and resolutions.
* `ol/layer/Vector` - Renders vector data client-side.
* `ol/layer/VectorTile` - Renders data that is provided as vector tiles.
```js
import TileLayer from 'ol/layer/Tile';
@@ -63,12 +69,9 @@ A layer is a visual representation of data from a `source`. OpenLayers has four
## Putting it all together
The above snippets can be combined into a single script that renders a map with a single tile layer:
The above snippets can be conflated to a self contained map configuration with view and layers:
```xml
<div id="map" style="width: 100%, height: 400px"></div>
<script>
```js
import Map from 'ol/Map';
import View from 'ol/View';
import OSM from 'ol/source/OSM';
@@ -76,7 +79,7 @@ The above snippets can be conflated to a self contained map configuration with v
new Map({
layers: [
new TileLayer({source: new ol.source.OSM()})
new TileLayer({source: new OSM()})
],
view: new View({
center: [0, 0],
@@ -84,5 +87,4 @@ The above snippets can be conflated to a self contained map configuration with v
}),
target: 'map'
});
</script>
```

View File

@@ -12,9 +12,9 @@ The view in any Proj4js supported coordinate reference system is possible and pr
# Usage
The API usage is very simple. Just specify proper projection (e.g. using [EPSG](https://epsg.io) code) on `ol/View`:
```js
import {Map, View} from `ol`;
import TileLayer from `ol/layer/Tile`;
import TileWMS from `ol/source/TileWMS`;
import {Map, View} from 'ol';
import TileLayer from 'ol/layer/Tile';
import TileWMS from 'ol/source/TileWMS';
var map = new Map({
target: 'map',

View File

@@ -20,8 +20,8 @@ const twoPi = 2 * Math.PI;
/**
* Convert an RGB pixel into an HCL pixel.
* @param {Array.<number>} pixel A pixel in RGB space.
* @return {Array.<number>} A pixel in HCL space.
* @param {Array<number>} pixel A pixel in RGB space.
* @return {Array<number>} A pixel in HCL space.
*/
function rgb2hcl(pixel) {
const red = rgb2xyz(pixel[0]);
@@ -55,8 +55,8 @@ function rgb2hcl(pixel) {
/**
* Convert an HCL pixel into an RGB pixel.
* @param {Array.<number>} pixel A pixel in HCL space.
* @return {Array.<number>} A pixel in RGB space.
* @param {Array<number>} pixel A pixel in HCL space.
* @return {Array<number>} A pixel in RGB space.
*/
function hcl2rgb(pixel) {
const h = pixel[0];

View File

@@ -40,9 +40,6 @@ function addInteraction() {
} else if (value === 'Star') {
value = 'Circle';
geometryFunction = function(coordinates, geometry) {
if (!geometry) {
geometry = new Polygon(null);
}
const center = coordinates[0];
const last = coordinates[1];
const dx = center[0] - last[0];
@@ -59,7 +56,11 @@ function addInteraction() {
newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
}
newCoordinates.push(newCoordinates[0].slice());
if (!geometry) {
geometry = new Polygon([newCoordinates]);
} else {
geometry.setCoordinates([newCoordinates]);
}
return geometry;
};
}

View File

@@ -22,7 +22,6 @@ const map = new Map({
const imageStyle = new Style({
image: new CircleStyle({
radius: 5,
snapToPixel: false,
fill: new Fill({color: 'yellow'}),
stroke: new Stroke({color: 'red', width: 1})
})
@@ -31,7 +30,6 @@ const imageStyle = new Style({
const headInnerImageStyle = new Style({
image: new CircleStyle({
radius: 2,
snapToPixel: false,
fill: new Fill({color: 'blue'})
})
});
@@ -39,7 +37,6 @@ const headInnerImageStyle = new Style({
const headOuterImageStyle = new Style({
image: new CircleStyle({
radius: 5,
snapToPixel: false,
fill: new Fill({color: 'black'})
})
});

View File

@@ -30,7 +30,7 @@ const map = new Map({
});
document.getElementById('export-png').addEventListener('click', function() {
map.once('postcompose', function(event) {
map.once('rendercomplete', function(event) {
const canvas = event.context.canvas;
if (navigator.msSaveBlob) {
navigator.msSaveBlob(canvas.msToBlob(), 'map.png');

View File

@@ -3,7 +3,6 @@ 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 {unByKey} from '../src/ol/Observable.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
const raster = new TileLayer({
@@ -48,9 +47,6 @@ const dims = {
a5: [210, 148]
};
let loading = 0;
let loaded = 0;
const exportButton = document.getElementById('export-pdf');
exportButton.addEventListener('click', function() {
@@ -66,57 +62,22 @@ exportButton.addEventListener('click', function() {
const size = /** @type {module:ol/size~Size} */ (map.getSize());
const extent = map.getView().calculateExtent(size);
const source = raster.getSource();
const tileLoadStart = function() {
++loading;
};
let timer;
let keys = [];
function tileLoadEndFactory(canvas) {
return () => {
++loaded;
if (timer) {
clearTimeout(timer);
timer = null;
}
if (loading === loaded) {
timer = window.setTimeout(() => {
loading = 0;
loaded = 0;
map.once('rendercomplete', function(event) {
const canvas = event.context.canvas;
const data = canvas.toDataURL('image/jpeg');
const pdf = new jsPDF('landscape', undefined, format);
pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
pdf.save('map.pdf');
keys.forEach(unByKey);
keys = [];
// Reset original map size
map.setSize(size);
map.getView().fit(extent, {size});
map.renderSync();
exportButton.disabled = false;
document.body.style.cursor = 'auto';
}, 500);
}
};
}
map.once('postcompose', function(event) {
const canvas = event.context.canvas;
const tileLoadEnd = tileLoadEndFactory(canvas);
keys = [
source.on('tileloadstart', tileLoadStart),
source.on('tileloadend', tileLoadEnd),
source.on('tileloaderror', tileLoadEnd)
];
tileLoadEnd();
});
// Set print size
const printSize = [width, height];
map.setSize(printSize);
map.getView().fit(extent, {size: printSize});
loaded = -1;
map.renderSync();
}, false);

View File

@@ -65,7 +65,6 @@ function flash(feature) {
const style = new Style({
image: new CircleStyle({
radius: radius,
snapToPixel: false,
stroke: new Stroke({
color: 'rgba(255, 0, 0, ' + opacity + ')',
width: 0.25 + opacity

View File

@@ -94,7 +94,6 @@ const styles = {
'geoMarker': new Style({
image: new CircleStyle({
radius: 7,
snapToPixel: false,
fill: new Fill({color: 'black'}),
stroke: new Stroke({
color: 'white', width: 2

View File

@@ -44,7 +44,7 @@ tags: "fullscreen, geolocation, orientation, mobile"
<button id="geolocate">Geolocate Me!</button>
<button id="simulate">Simulate</button>
</div>
<script src="./resources/common.js" type="text/javascript"></script>
<script src="loader.js?id=geolocation-orientation" type="text/javascript"></script>
<script src="common.js"></script>
<script src="geolocation-orientation.js"></script>
</body>
</html>

View File

@@ -101,7 +101,7 @@ imagery.on('postcompose', function(event) {
* Apply a convolution kernel to canvas. This works for any size kernel, but
* performance starts degrading above 3 x 3.
* @param {CanvasRenderingContext2D} context Canvas 2d context.
* @param {Array.<number>} kernel Kernel.
* @param {Array<number>} kernel Kernel.
*/
function convolve(context, kernel) {
const canvas = context.canvas;

View File

@@ -0,0 +1,19 @@
---
layout: example.html
title: Interaction Options
shortdesc: Shows interaction options for custom scroll and zoom behavior.
docs: >
This example uses a custom `ol/interaction/defaults` configuration:
* By default, wheel/trackpad zoom and drag panning is always active, which
can be unexpected on pages with a lot of scrollable content and an embedded
map. To perform wheel/trackpad zoom and drag-pan actions only when the map
has the focus, set `onFocusOnly: true` as option. This requires a map div
with a `tabindex` attribute set.
* By default, pinch-zoom and wheel/trackpad zoom interactions can leave the
map at fractional zoom levels. If instead you want to constrain
wheel/trackpad zooming to integer zoom levels, set
`constrainResolution: true`.
tags: "trackpad, mousewheel, zoom, scroll, interaction, fractional"
---
<div tabindex="1" id="map" class="map"></div>

View File

@@ -0,0 +1,22 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
const map = new Map({
interactions: defaultInteractions({
constrainResolution: true, onFocusOnly: true
}),
layers: [
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -25,8 +25,7 @@ cloak:
</head>
<body>
<div id="map" class="map"></div>
<script src="https://code.jquery.com/jquery-2.2.3.min.js" type="text/javascript"></script>
<script src="./resources/common.js" type="text/javascript"></script>
<script src="loader.js?id=mobile-full-screen" type="text/javascript"></script>
<script src="common.js"></script>
<script src="mobile-full-screen.js"></script>
</body>
</html>

View File

@@ -1,18 +0,0 @@
---
layout: example.html
title: Mousewheel/Trackpad Zoom
shortdesc: Shows advanced wheel/trackpad zoom options.
docs: >
This example uses a custom `ol/interaction/MouseWheelZoom` configuration:
* By default, wheel/trackpad zoom is always active, which can be unexpected
on pages with a lot of scrollable content and an embedded map. To perform
wheel/trackpad zoom actions only when the map has the focus, set
`condition: focus` as constructor option. This requires
a map div with a `tabindex` attribute set.
* By default, the interaction can leave the map at fractional zoom levels. If
instead you want to constrain wheel/trackpad zooming to integer zoom
levels, set `constrainResolution: true`.
tags: "trackpad, mousewheel, zoom, scroll, interaction"
---
<div tabindex="1" id="map" class="map"></div>

View File

@@ -1,26 +0,0 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {defaults as defaultInteractions, MouseWheelZoom} from '../src/ol/interaction.js';
import {focus} from '../src/ol/events/condition.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
const map = new Map({
interactions: defaultInteractions({mouseWheelZoom: false}).extend([
new MouseWheelZoom({
constrainResolution: true, // force zooming to a integer zoom
condition: focus // only wheel/trackpad zoom when the map has the focus
})
]),
layers: [
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -12,7 +12,7 @@ const bins = 10;
/**
* Calculate the Vegetation Greenness Index (VGI) from an input pixel. This
* is a rough estimate assuming that pixel values correspond to reflectance.
* @param {Array.<number>} pixel An array of [R, G, B, A] values.
* @param {Array<number>} pixel An array of [R, G, B, A] values.
* @return {number} The VGI value for the given pixel.
*/
function vgi(pixel) {

View File

@@ -7,7 +7,7 @@ import {OSM, Raster, XYZ} from '../src/ol/source.js';
/**
* Generates a shaded relief image given elevation data. Uses a 3x3
* neighborhood for determining slope and aspect.
* @param {Array.<ImageData>} inputs Array of input images.
* @param {Array<ImageData>} inputs Array of input images.
* @param {Object} data Data added in the "beforeoperations" event.
* @return {ImageData} Output image.
*/

View File

@@ -1,7 +1,7 @@
---
layout: example.html
title: Street Labels
shortdesc: Render street names with a custom render.
shortdesc: Render street names.
docs: >
Example showing the use of a text style with `placement: 'line'` to render text along a path.
tags: "vector, label, streets"

View File

@@ -1,6 +1,13 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-2577926-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-2577926-1');
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">

View File

@@ -1,3 +1,4 @@
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const ExampleBuilder = require('./example-builder');
const fs = require('fs');
@@ -31,6 +32,16 @@ module.exports = {
}]
},
optimization: {
minimizer: [
new UglifyJsPlugin({
sourceMap: true,
uglifyOptions: {
mangle: {
keep_fnames: true
}
}
})
],
runtimeChunk: {
name: 'common'
},

View File

@@ -26,7 +26,7 @@ handlebars.registerHelper('indent', (text, options) => {
* Create an inverted index of keywords from examples. Property names are
* lowercased words. Property values are objects mapping example index to word
* count.
* @param {Array.<Object>} exampleData Array of example data objects.
* @param {Array<Object>} exampleData Array of example data objects.
* @return {Object} Word index.
*/
function createWordIndex(exampleData) {

View File

@@ -37,12 +37,11 @@ const tileGrid = new WMTSTileGrid({
matrixIds: matrixIds
});
// API key valid for 'openlayers.org' and 'localhost'.
// Expiration date is 06/29/2018.
const key = '2mqbg0z6cx7ube8gsou10nrt';
// For more information about the IGN API key see
// https://geoservices.ign.fr/blog/2017/06/28/geoportail_sans_compte.html
const ign_source = new WMTS({
url: 'https://wxs.ign.fr/' + key + '/wmts',
url: 'https://wxs.ign.fr/pratique/geoportail/wmts',
layer: 'GEOGRAPHICALGRIDSYSTEMS.MAPS',
matrixSet: 'PM',
format: 'image/jpeg',

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "5.1.1",
"version": "5.2.0",
"description": "OpenLayers mapping library",
"keywords": [
"map",
@@ -41,7 +41,7 @@
"buble": "^0.19.3",
"buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.1.11",
"clean-css-cli": "4.2.1",
"copy-webpack-plugin": "^4.4.1",
"coveralls": "3.0.1",
"eslint": "5.0.1",
@@ -54,7 +54,7 @@
"istanbul": "0.4.5",
"jquery": "3.3.1",
"jsdoc": "3.5.5",
"karma": "^2.0.0",
"karma": "^3.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.1.0",
@@ -62,14 +62,14 @@
"karma-sauce-launcher": "1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "4.0.0-beta.0",
"marked": "0.4.0",
"marked": "0.5.0",
"mocha": "5.2.0",
"mustache": "^2.3.0",
"pixelmatch": "^4.0.2",
"proj4": "2.4.4",
"rollup": "0.63.4",
"proj4": "2.5.0",
"rollup": "0.65.0",
"rollup-plugin-buble": "0.19.2",
"rollup-plugin-commonjs": "9.1.3",
"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",
@@ -77,7 +77,7 @@
"uglifyjs-webpack-plugin": "^1.2.5",
"url-polyfill": "^1.0.13",
"walk": "^2.3.9",
"webpack": "4.16.1",
"webpack": "4.17.1",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4"
},

View File

@@ -62,7 +62,7 @@ export class CollectionEvent extends Event {
class Collection extends BaseObject {
/**
* @param {Array.<T>=} opt_array Array.
* @param {Array<T>=} opt_array Array.
* @param {module:ol/Collection~Options=} opt_options Collection options.
*/
constructor(opt_array, opt_options) {
@@ -79,7 +79,7 @@ class Collection extends BaseObject {
/**
* @private
* @type {!Array.<T>}
* @type {!Array<T>}
*/
this.array_ = opt_array ? opt_array : [];
@@ -106,8 +106,8 @@ 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.
* @param {!Array<T>} arr Array.
* @return {module:ol/Collection<T>} This collection.
* @api
*/
extend(arr) {
@@ -119,7 +119,7 @@ class Collection extends BaseObject {
/**
* Iterate over each element, calling the provided callback.
* @param {function(T, number, Array.<T>): *} f The function to call
* @param {function(T, number, Array<T>): *} f The function to call
* for every element. This function takes 3 arguments (the element, the
* index and the array). The return value is ignored.
* @api
@@ -136,7 +136,7 @@ class Collection extends BaseObject {
* is mutated, no events will be dispatched by the collection, and the
* collection's "length" property won't be in sync with the actual length
* of the array.
* @return {!Array.<T>} Array.
* @return {!Array<T>} Array.
* @api
*/
getArray() {

View File

@@ -1,12 +1,22 @@
/**
* @module ol/Disposable
*/
import {UNDEFINED} from './functions.js';
/**
* @classdesc
* Objects that need to clean up after themselves.
*/
class Disposable {
constructor() {
/**
* The object has already been disposed.
* @type {boolean}
* @private
*/
this.disposed_ = false;
}
/**
* Clean up.
*/
@@ -16,18 +26,12 @@ class Disposable {
this.disposeInternal();
}
}
}
/**
* The object has already been disposed.
* @type {boolean}
* @private
*/
Disposable.prototype.disposed_ = false;
/**
* Extension point for disposable objects.
* @protected
*/
Disposable.prototype.disposeInternal = UNDEFINED;
disposeInternal() {}
}
export default Disposable;

View File

@@ -53,9 +53,8 @@ import Style from './style/Style.js';
* @api
*/
class Feature extends BaseObject {
/**
* @param {module:ol/geom/Geometry|Object.<string, *>=} opt_geometryOrProperties
* @param {module:ol/geom/Geometry|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.
@@ -79,7 +78,7 @@ class Feature extends BaseObject {
/**
* User provided style.
* @private
* @type {module:ol/style/Style|Array.<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
* @type {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction}
*/
this.style_ = null;
@@ -105,7 +104,7 @@ class Feature extends BaseObject {
const geometry = opt_geometryOrProperties;
this.setGeometry(geometry);
} else {
/** @type {Object.<string, *>} */
/** @type {Object<string, *>} */
const properties = opt_geometryOrProperties;
this.setProperties(properties);
}
@@ -171,7 +170,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 {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} The feature style.
* @api
*/
getStyle() {
@@ -226,7 +225,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 {module:ol/style/Style|Array<module:ol/style/Style>|module:ol/style/Style~StyleFunction} style Style for this feature.
* @api
* @fires module:ol/events/Event~Event#event:change
*/
@@ -274,7 +273,7 @@ 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
* in a new feature style function.
* @param {module:ol/style/Style~StyleFunction|!Array.<module:ol/style/Style>|!module:ol/style/Style} obj
* @param {module:ol/style/Style~StyleFunction|!Array<module:ol/style/Style>|!module:ol/style/Style} obj
* A feature style function, a single style, or an array of styles.
* @return {module:ol/style/Style~StyleFunction} A style function.
*/
@@ -283,7 +282,7 @@ export function createStyleFunction(obj) {
return obj;
} else {
/**
* @type {Array.<module:ol/style/Style>}
* @type {Array<module:ol/style/Style>}
*/
let styles;
if (Array.isArray(obj)) {

View File

@@ -27,7 +27,7 @@ const DEFAULT_STROKE_STYLE = new Stroke({
/**
* TODO can be configurable
* @type {Array.<number>}
* @type {Array<number>}
* @private
*/
const INTERVALS = [
@@ -200,13 +200,13 @@ class Graticule {
this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
/**
* @type {Array.<module:ol/geom/LineString>}
* @type {Array<module:ol/geom/LineString>}
* @private
*/
this.meridians_ = [];
/**
* @type {Array.<module:ol/geom/LineString>}
* @type {Array<module:ol/geom/LineString>}
* @private
*/
this.parallels_ = [];
@@ -236,13 +236,13 @@ class Graticule {
this.projectionCenterLonLat_ = null;
/**
* @type {Array.<module:ol/Graticule~GraticuleLabelDataType>}
* @type {Array<module:ol/Graticule~GraticuleLabelDataType>}
* @private
*/
this.meridiansLabels_ = null;
/**
* @type {Array.<module:ol/Graticule~GraticuleLabelDataType>}
* @type {Array<module:ol/Graticule~GraticuleLabelDataType>}
* @private
*/
this.parallelsLabels_ = null;
@@ -364,7 +364,7 @@ class Graticule {
const coordinate = [flatCoordinates[0], lat];
let point;
if (index in this.meridiansLabels_) {
point = this.meridiansLabels_[index];
point = this.meridiansLabels_[index].geom;
point.setCoordinates(coordinate);
} else {
point = new Point(coordinate);
@@ -414,7 +414,7 @@ class Graticule {
const coordinate = [lon, flatCoordinates[1]];
let point;
if (index in this.parallelsLabels_) {
point = this.parallelsLabels_[index];
point = this.parallelsLabels_[index].geom;
point.setCoordinates(coordinate);
} else {
point = new Point(coordinate);
@@ -526,9 +526,9 @@ class Graticule {
const centerLat = this.projectionCenterLonLat_[1];
let interval = -1;
const target = Math.pow(this.targetSize_ * resolution, 2);
/** @type {Array.<number>} **/
/** @type {Array<number>} **/
const p1 = [];
/** @type {Array.<number>} **/
/** @type {Array<number>} **/
const p2 = [];
for (let i = 0, ii = INTERVALS.length; i < ii; ++i) {
const delta = INTERVALS[i] / 2;
@@ -579,7 +579,7 @@ class Graticule {
/**
* Get the list of meridians. Meridians are lines of equal longitude.
* @return {Array.<module:ol/geom/LineString>} The meridians.
* @return {Array<module:ol/geom/LineString>} The meridians.
* @api
*/
getMeridians() {
@@ -609,7 +609,7 @@ class Graticule {
/**
* Get the list of parallels. Parallels are lines of equal latitude.
* @return {Array.<module:ol/geom/LineString>} The parallels.
* @return {Array<module:ol/geom/LineString>} The parallels.
* @api
*/
getParallels() {

View File

@@ -58,7 +58,7 @@ class ImageWrapper extends ImageBase {
/**
* @private
* @type {Array.<module:ol/events~EventsKey>}
* @type {Array<module:ol/events~EventsKey>}
*/
this.imageListenerKeys_ = null;

View File

@@ -1,7 +1,7 @@
/**
* @module ol/ImageBase
*/
import EventTarget from './events/EventTarget.js';
import EventTarget from './events/Target.js';
import EventType from './events/EventType.js';
/**

View File

@@ -52,7 +52,7 @@ class ImageTile extends Tile {
/**
* @private
* @type {Array.<module:ol/events~EventsKey>}
* @type {Array<module:ol/events~EventsKey>}
*/
this.imageListenerKeys_ = null;

View File

@@ -38,7 +38,7 @@ class Kinetic {
/**
* @private
* @type {Array.<number>}
* @type {Array<number>}
*/
this.points_ = [];

View File

@@ -6,7 +6,7 @@ import MapEvent from './MapEvent.js';
/**
* @classdesc
* Events emitted as map browser events are instances of this type.
* See {@link module:ol/Map~Map} for which events trigger a map browser event.
* See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event.
*/
class MapBrowserEvent extends MapEvent {

View File

@@ -5,7 +5,7 @@ import {DEVICE_PIXEL_RATIO} from './has.js';
import MapBrowserEventType from './MapBrowserEventType.js';
import MapBrowserPointerEvent from './MapBrowserPointerEvent.js';
import {listen, unlistenByKey} from './events.js';
import EventTarget from './events/EventTarget.js';
import EventTarget from './events/Target.js';
import PointerEventType from './pointer/EventType.js';
import PointerEventHandler from './pointer/PointerEventHandler.js';
@@ -39,7 +39,7 @@ class MapBrowserEventHandler extends EventTarget {
this.dragging_ = false;
/**
* @type {!Array.<module:ol/events~EventsKey>}
* @type {!Array<module:ol/events~EventsKey>}
* @private
*/
this.dragListenerKeys_ = [];
@@ -68,7 +68,7 @@ class MapBrowserEventHandler extends EventTarget {
this.activePointers_ = 0;
/**
* @type {!Object.<number, boolean>}
* @type {!Object<number, boolean>}
* @private
*/
this.trackedTouches_ = {};

View File

@@ -6,7 +6,7 @@ import Event from './events/Event.js';
/**
* @classdesc
* Events emitted as map events are instances of this type.
* See {@link module:ol/Map~Map} for which events trigger a map event.
* See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event.
*/
class MapEvent extends Event {

View File

@@ -88,7 +88,7 @@ class ObjectEvent extends Event {
class BaseObject extends Observable {
/**
* @param {Object.<string, *>=} opt_values An object with key-value pairs.
* @param {Object<string, *>=} opt_values An object with key-value pairs.
*/
constructor(opt_values) {
super();
@@ -101,7 +101,7 @@ class BaseObject extends Observable {
/**
* @private
* @type {!Object.<string, *>}
* @type {!Object<string, *>}
*/
this.values_ = {};
@@ -126,7 +126,7 @@ class BaseObject extends Observable {
/**
* Get a list of object property names.
* @return {Array.<string>} List of property names.
* @return {Array<string>} List of property names.
* @api
*/
getKeys() {
@@ -135,7 +135,7 @@ class BaseObject extends Observable {
/**
* Get an object of all property names and values.
* @return {Object.<string, *>} Object.
* @return {Object<string, *>} Object.
* @api
*/
getProperties() {
@@ -176,7 +176,7 @@ class BaseObject extends Observable {
/**
* Sets a collection of key-value pairs. Note that this changes any existing
* properties and adds new ones (it does not remove any existing properties).
* @param {Object.<string, *>} values Values.
* @param {Object<string, *>} values Values.
* @param {boolean=} opt_silent Update without triggering an event.
* @api
*/
@@ -205,7 +205,7 @@ class BaseObject extends Observable {
/**
* @type {Object.<string, string>}
* @type {Object<string, string>}
*/
const changeEventTypeCache = {};

View File

@@ -2,7 +2,7 @@
* @module ol/Observable
*/
import {listen, unlistenByKey, unlisten, listenOnce} from './events.js';
import EventTarget from './events/EventTarget.js';
import EventTarget from './events/Target.js';
import EventType from './events/EventType.js';
/**
@@ -50,9 +50,9 @@ 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 {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 {module:ol/events~EventsKey|Array<module:ol/events~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
@@ -72,9 +72,9 @@ 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 {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 {module:ol/events~EventsKey|Array<module:ol/events~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
@@ -94,7 +94,7 @@ class Observable extends EventTarget {
/**
* Unlisten for a certain type of event.
* @param {string|Array.<string>} type The event type or array of event types.
* @param {string|Array<string>} type The event type or array of event types.
* @param {function(?): ?} listener The listener function.
* @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 {module:ol/events~EventsKey|Array<module:ol/events~EventsKey>} key The key returned by `on()`
* or `once()` (or an array of keys).
* @api
*/

View File

@@ -15,7 +15,7 @@ import {containsExtent} from './extent.js';
* @property {number|string} [id] Set the overlay id. The overlay id can be used
* with the {@link module:ol/Map~Map#getOverlayById} method.
* @property {HTMLElement} [element] The overlay element.
* @property {Array.<number>} [offset=[0, 0]] Offsets in pixels used when positioning
* @property {Array<number>} [offset=[0, 0]] Offsets in pixels used when positioning
* the overlay. The first element in the
* 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
@@ -132,7 +132,7 @@ class Overlay extends BaseObject {
* @protected
* @type {HTMLElement}
*/
this.element = document.createElement('DIV');
this.element = document.createElement('div');
this.element.className = options.className !== undefined ?
options.className : 'ol-overlay-container ' + CLASS_SELECTABLE;
this.element.style.position = 'absolute';
@@ -248,12 +248,12 @@ class Overlay extends BaseObject {
/**
* Get the offset of this overlay.
* @return {Array.<number>} The offset.
* @return {Array<number>} The offset.
* @observable
* @api
*/
getOffset() {
return /** @type {Array.<number>} */ (this.get(Property.OFFSET));
return /** @type {Array<number>} */ (this.get(Property.OFFSET));
}
/**
@@ -371,7 +371,7 @@ class Overlay extends BaseObject {
/**
* Set the offset for this overlay.
* @param {Array.<number>} offset Offset.
* @param {Array<number>} offset Offset.
* @observable
* @api
*/

View File

@@ -10,6 +10,7 @@ import MapBrowserEventType from './MapBrowserEventType.js';
import MapEvent from './MapEvent.js';
import MapEventType from './MapEventType.js';
import MapProperty from './MapProperty.js';
import RenderEventType from './render/EventType.js';
import BaseObject, {getChangeEventType} from './Object.js';
import ObjectEventType from './ObjectEventType.js';
import TileQueue from './TileQueue.js';
@@ -41,16 +42,16 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @property {null|module:ol/extent~Extent} extent
* @property {module:ol/coordinate~Coordinate} focus
* @property {number} index
* @property {Object.<number, module:ol/layer/Layer~State>} layerStates
* @property {Array.<module:ol/layer/Layer~State>} layerStatesArray
* @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 {Array<module:ol/PluggableMap~PostRenderFunction>} postRenderFunctions
* @property {module:ol/size~Size} size
* @property {!Object.<string, boolean>} skippedFeatureUids
* @property {!Object<string, boolean>} skippedFeatureUids
* @property {module:ol/TileQueue} tileQueue
* @property {Object.<string, Object.<string, module:ol/TileRange>>} usedTiles
* @property {Array.<number>} viewHints
* @property {!Object.<string, Object.<string, boolean>>} wantedTiles
* @property {Object<string, Object<string, module:ol/TileRange>>} usedTiles
* @property {Array<number>} viewHints
* @property {!Object<string, Object<string, boolean>>} wantedTiles
*/
@@ -61,7 +62,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
/**
* @typedef {Object} AtPixelOptions
* @property {((function(module:ol/layer/Layer): boolean)|undefined)} layerFilter Layer filter
* @property {undefined|function(module:ol/layer/Layer): 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`
@@ -74,23 +75,23 @@ 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 {module:ol/Collection<module:ol/control/Control>} [controls]
* @property {module:ol/Collection<module:ol/interaction/Interaction>} [interactions]
* @property {HTMLElement|Document} keyboardEventTarget
* @property {module:ol/Collection.<module:ol/Overlay>} overlays
* @property {Object.<string, *>} values
* @property {module:ol/Collection<module:ol/Overlay>} overlays
* @property {Object<string, *>} values
*/
/**
* 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 {module:ol/Collection<module:ol/control/Control>|Array<module:ol/control/Control>} [controls]
* Controls initially added to the map. If not specified,
* {@link module:ol/control/util~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 {module:ol/Collection<module:ol/interaction/Interaction>|Array<module:ol/interaction/Interaction>} [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
@@ -101,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<module:ol/layer/Base>|module:ol/Collection<module:ol/layer/Base>} [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
@@ -118,7 +119,7 @@ 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 {module:ol/Collection<module:ol/Overlay>|Array<module:ol/Overlay>} [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
@@ -135,6 +136,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @fires module:ol/render/Event~RenderEvent#rendercomplete
* @api
*/
class PluggableMap extends BaseObject {
@@ -236,7 +238,7 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {Array.<module:ol/events~EventsKey>}
* @type {Array<module:ol/events~EventsKey>}
*/
this.layerGroupPropertyListenerKeys_ = null;
@@ -244,7 +246,7 @@ class PluggableMap extends BaseObject {
* @private
* @type {!HTMLElement}
*/
this.viewport_ = document.createElement('DIV');
this.viewport_ = document.createElement('div');
this.viewport_.className = 'ol-viewport' + (TOUCH ? ' ol-touch' : '');
this.viewport_.style.position = 'relative';
this.viewport_.style.overflow = 'hidden';
@@ -258,7 +260,7 @@ class PluggableMap extends BaseObject {
* @private
* @type {!HTMLElement}
*/
this.overlayContainer_ = document.createElement('DIV');
this.overlayContainer_ = document.createElement('div');
this.overlayContainer_.className = 'ol-overlaycontainer';
this.viewport_.appendChild(this.overlayContainer_);
@@ -266,7 +268,7 @@ class PluggableMap extends BaseObject {
* @private
* @type {!HTMLElement}
*/
this.overlayContainerStopEvent_ = document.createElement('DIV');
this.overlayContainerStopEvent_ = document.createElement('div');
this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';
const overlayEvents = [
EventType.CLICK,
@@ -301,7 +303,7 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {Array.<module:ol/events~EventsKey>}
* @type {Array<module:ol/events~EventsKey>}
*/
this.keyHandlerKeys_ = null;
@@ -310,19 +312,19 @@ class PluggableMap extends BaseObject {
listen(this.viewport_, EventType.MOUSEWHEEL, this.handleBrowserEvent, this);
/**
* @type {module:ol/Collection.<module:ol/control/Control>}
* @type {module:ol/Collection<module:ol/control/Control>}
* @protected
*/
this.controls = optionsInternal.controls || new Collection();
/**
* @type {module:ol/Collection.<module:ol/interaction/Interaction>}
* @type {module:ol/Collection<module:ol/interaction/Interaction>}
* @protected
*/
this.interactions = optionsInternal.interactions || new Collection();
/**
* @type {module:ol/Collection.<module:ol/Overlay>}
* @type {module:ol/Collection<module:ol/Overlay>}
* @private
*/
this.overlays_ = optionsInternal.overlays;
@@ -330,7 +332,7 @@ class PluggableMap extends BaseObject {
/**
* A lookup of overlays by id.
* @private
* @type {Object.<string, module:ol/Overlay>}
* @type {Object<string, module:ol/Overlay>}
*/
this.overlayIdIndex_ = {};
@@ -354,7 +356,7 @@ class PluggableMap extends BaseObject {
/**
* @private
* @type {!Array.<module:ol/PluggableMap~PostRenderFunction>}
* @type {!Array<module:ol/PluggableMap~PostRenderFunction>}
*/
this.postRenderFunctions_ = [];
@@ -368,7 +370,7 @@ class PluggableMap extends BaseObject {
/**
* Uids of features to skip at rendering time.
* @type {Object.<string, boolean>}
* @type {Object<string, boolean>}
* @private
*/
this.skippedFeatureUids_ = {};
@@ -577,7 +579,7 @@ 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
* @return {Array<module:ol/Feature|module:ol/render/Feature>} The detected features or
* `null` if none were found.
* @api
*/
@@ -716,7 +718,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 {module:ol/Collection<module:ol/control/Control>} Controls.
* @api
*/
getControls() {
@@ -726,7 +728,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 {module:ol/Collection<module:ol/Overlay>} Overlays.
* @api
*/
getOverlays() {
@@ -751,7 +753,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 {module:ol/Collection<module:ol/interaction/Interaction>} Interactions.
* @api
*/
getInteractions() {
@@ -772,7 +774,7 @@ class PluggableMap extends BaseObject {
/**
* Get the collection of layers associated with this map.
* @return {!module:ol/Collection.<module:ol/layer/Base>} Layers.
* @return {!module:ol/Collection<module:ol/layer/Base>} Layers.
* @api
*/
getLayers() {
@@ -961,6 +963,10 @@ class PluggableMap extends BaseObject {
tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);
}
}
if (frameState && this.hasListener(MapEventType.RENDERCOMPLETE) && !frameState.animate &&
!this.tileQueue_.getTilesLoading() && !getLoading(this.getLayers().getArray())) {
this.renderer_.dispatchRenderEvent(RenderEventType.RENDERCOMPLETE, frameState);
}
const postRenderFunctions = this.postRenderFunctions_;
for (let i = 0, ii = postRenderFunctions.length; i < ii; ++i) {
@@ -1179,19 +1185,12 @@ class PluggableMap extends BaseObject {
for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {
layerStates[getUid(layerStatesArray[i].layer)] = layerStatesArray[i];
}
viewState = view.getState();
let focus = this.focus_;
if (!focus) {
focus = viewState.center;
const pixelResolution = viewState.resolution / this.pixelRatio_;
focus[0] = Math.round(focus[0] / pixelResolution) * pixelResolution;
focus[1] = Math.round(focus[1] / pixelResolution) * pixelResolution;
}
viewState = view.getState(this.pixelRatio_);
frameState = /** @type {module:ol/PluggableMap~FrameState} */ ({
animate: false,
coordinateToPixelTransform: this.coordinateToPixelTransform_,
extent: extent,
focus: focus,
focus: this.focus_ ? this.focus_ : viewState.center,
index: this.frameIndex_++,
layerStates: layerStates,
layerStatesArray: layerStatesArray,
@@ -1356,7 +1355,7 @@ function createOptionsInternal(options) {
}
/**
* @type {Object.<string, *>}
* @type {Object<string, *>}
*/
const values = {};
@@ -1414,3 +1413,21 @@ function createOptionsInternal(options) {
}
export default PluggableMap;
/**
* @param {Array<module:ol/layer/Base>} 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;
}
}
return false;
}

View File

@@ -3,13 +3,42 @@
*/
import TileState from './TileState.js';
import {easeIn} from './easing.js';
import EventTarget from './events/EventTarget.js';
import EventTarget from './events/Target.js';
import EventType from './events/EventType.js';
/**
* A function that takes an {@link module:ol/Tile} for the tile and a
* `{string}` for the url as arguments.
* `{string}` for the url as arguments. The default is
* ```js
* source.setTileLoadFunction(function(tile, src) {
* tile.getImage().src = src;
* });
* ```
* For more fine grained control, the load function can use fetch or XMLHttpRequest and involve
* error handling:
*
* ```js
* import TileState from 'ol/TileState';
*
* source.setTileLoadFunction(function(tile, src) {
* var xhr = new XMLHttpRequest();
* xhr.responseType = 'blob';
* xhr.addEventListener('loadend', function (evt) {
* var data = this.response;
* if (data !== undefined) {
* tile.getImage().src = URL.createObjectURL(data);
* } else {
* tile.setState(TileState.ERROR);
* }
* });
* xhr.addEventListener('error', function () {
* tile.setState(TileState.ERROR);
* });
* xhr.open('GET', src);
* xhr.send();
* });
* ```
*
* @typedef {function(module:ol/Tile, string)} LoadFunction
* @api
@@ -93,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<number, number>}
*/
this.transitionStarts_ = {};
@@ -192,7 +221,12 @@ class Tile extends EventTarget {
}
/**
* Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,
* 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.
* @api
*/
setState(state) {
this.state = state;

View File

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

View File

@@ -50,7 +50,7 @@ class TileQueue extends PriorityQueue {
/**
* @private
* @type {!Object.<string,boolean>}
* @type {!Object<string,boolean>}
*/
this.tilesLoadingKeys_ = {};

View File

@@ -9,6 +9,11 @@ export default {
IDLE: 0,
LOADING: 1,
LOADED: 2,
/**
* Indicates that tile loading failed
* @type {number}
* @api
*/
ERROR: 3,
EMPTY: 4,
ABORT: 5

View File

@@ -9,7 +9,7 @@ import {listen, unlistenByKey} from './events.js';
import {getHeight, getIntersection, getWidth} from './extent.js';
import EventType from './events/EventType.js';
import {loadFeaturesXhr} from './featureloader.js';
import {UNDEFINED} from './functions.js';
import {VOID} from './functions.js';
/**
@@ -33,7 +33,7 @@ class VectorImageTile extends Tile {
* @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 {Object<string, module:ol/VectorTile>} 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,
@@ -51,7 +51,7 @@ class VectorImageTile extends Tile {
/**
* @private
* @type {!Object.<string, CanvasRenderingContext2D>}
* @type {!Object<string, CanvasRenderingContext2D>}
*/
this.context_ = {};
@@ -63,19 +63,19 @@ class VectorImageTile extends Tile {
/**
* @private
* @type {!Object.<string, module:ol/VectorImageTile~ReplayState>}
* @type {!Object<string, module:ol/VectorImageTile~ReplayState>}
*/
this.replayState_ = {};
/**
* @private
* @type {Object.<string, module:ol/VectorTile>}
* @type {Object<string, module:ol/VectorTile>}
*/
this.sourceTiles_ = sourceTiles;
/**
* Keys of source tiles used by this tile. Use with {@link #getTile}.
* @type {Array.<string>}
* @type {Array<string>}
*/
this.tileKeys = [];
@@ -95,12 +95,12 @@ class VectorImageTile extends Tile {
this.wrappedTileCoord = urlTileCoord;
/**
* @type {Array.<module:ol/events~EventsKey>}
* @type {Array<module:ol/events~EventsKey>}
*/
this.loadListenerKeys_ = [];
/**
* @type {Array.<module:ol/events~EventsKey>}
* @type {Array<module:ol/events~EventsKey>}
*/
this.sourceTileListenerKeys_ = [];
@@ -148,7 +148,7 @@ class VectorImageTile extends Tile {
const tile = new VectorImageTile(tileCoord, state, sourceRevision,
format, tileLoadFunction, urlTileCoord, tileUrlFunction,
sourceTileGrid, tileGrid, sourceTiles, pixelRatio, projection,
tileClass, UNDEFINED, --zoom);
tileClass, VOID, --zoom);
if (tile.state == TileState.LOADED) {
this.interimTile = tile;
break;

View File

@@ -51,7 +51,7 @@ class VectorTile extends Tile {
/**
* @private
* @type {Array.<module:ol/Feature>}
* @type {Array<module:ol/Feature>}
*/
this.features_ = null;
@@ -70,7 +70,7 @@ class VectorTile extends Tile {
/**
* @private
* @type {Object.<string, module:ol/render/ReplayGroup>}
* @type {Object<string, module:ol/render/ReplayGroup>}
*/
this.replayGroups_ = {};
@@ -120,7 +120,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<module:ol/Feature|module:ol/render/Feature>} Features.
* @api
*/
getFeatures() {
@@ -166,7 +166,7 @@ class VectorTile extends Tile {
/**
* Handler for successful tile load.
* @param {Array.<module:ol/Feature>} features The loaded features.
* @param {Array<module:ol/Feature>} features The loaded features.
* @param {module:ol/proj/Projection} dataProjection Data projection.
* @param {module:ol/extent~Extent} extent Extent.
*/
@@ -202,7 +202,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<module:ol/Feature>} features Features.
* @api
*/
setFeatures(features) {

View File

@@ -3,7 +3,7 @@
*/
import {DEFAULT_TILE_SIZE} from './tilegrid/common.js';
import {getUid} from './util.js';
import {UNDEFINED} from './functions.js';
import {VOID} from './functions.js';
import {createExtent, none as centerNone} from './centerconstraint.js';
import BaseObject from './Object.js';
import {createSnapToResolutions, createSnapToPower} from './resolutionconstraint.js';
@@ -56,7 +56,7 @@ import Units from './proj/Units.js';
* @property {module:ol/size~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
* @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be
* cleared inside the view. Values in the array are top, right, bottom and left
* padding.
* @property {boolean} [constrainResolution=true] Constrain the resolution.
@@ -121,7 +121,7 @@ import Units from './proj/Units.js';
* alternative to setting this is to set `zoom`. Layer sources will not be
* fetched if neither this nor `zoom` are defined, but they can be set later
* with {@link #setZoom} or {@link #setResolution}.
* @property {Array.<number>} [resolutions] Resolutions to determine the
* @property {Array<number>} [resolutions] Resolutions to determine the
* resolution constraint. If set the `maxResolution`, `minResolution`,
* `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.
* @property {number} [rotation=0] The initial rotation for the view in radians
@@ -238,13 +238,13 @@ class View extends BaseObject {
/**
* @private
* @type {Array.<number>}
* @type {Array<number>}
*/
this.hints_ = [0, 0];
/**
* @private
* @type {Array.<Array.<module:ol/View~Animation>>}
* @type {Array<Array<module:ol/View~Animation>>}
*/
this.animations_ = [];
@@ -273,7 +273,7 @@ class View extends BaseObject {
applyOptions_(options) {
/**
* @type {Object.<string, *>}
* @type {Object<string, *>}
*/
const properties = {};
properties[ViewProperty.CENTER] = options.center !== undefined ?
@@ -301,7 +301,7 @@ class View extends BaseObject {
/**
* @private
* @type {Array.<number>|undefined}
* @type {Array<number>|undefined}
*/
this.resolutions_ = options.resolutions;
@@ -428,9 +428,7 @@ class View extends BaseObject {
this.setRotation(state.rotation);
}
if (callback) {
setTimeout(function() {
callback(true);
}, 0);
animationCallback(callback, true);
}
return;
}
@@ -517,7 +515,7 @@ class View extends BaseObject {
for (let i = 0, ii = this.animations_.length; i < ii; ++i) {
const series = this.animations_[i];
if (series[0].callback) {
series[0].callback(false);
animationCallback(series[0].callback, false);
}
}
this.animations_.length = 0;
@@ -592,9 +590,7 @@ class View extends BaseObject {
this.setHint(ViewHint.ANIMATING, -1);
const callback = series[0].callback;
if (callback) {
setTimeout(function() {
callback(true);
}, 0);
animationCallback(callback, true);
}
}
}
@@ -710,8 +706,8 @@ class View extends BaseObject {
}
/**
* @param {Array.<number>=} opt_hints Destination array.
* @return {Array.<number>} Hint.
* @param {Array<number>=} opt_hints Destination array.
* @return {Array<number>} Hint.
*/
getHints(opt_hints) {
if (opt_hints !== undefined) {
@@ -821,7 +817,7 @@ class View extends BaseObject {
/**
* Get the resolutions for the view. This returns the array of resolutions
* passed to the constructor of the View, or undefined if none were given.
* @return {Array.<number>|undefined} The resolutions of the view.
* @return {Array<number>|undefined} The resolutions of the view.
* @api
*/
getResolutions() {
@@ -898,16 +894,21 @@ class View extends BaseObject {
}
/**
* @param {number} pixelRatio Pixel ratio for center rounding.
* @return {module:ol/View~State} View state.
*/
getState() {
getState(pixelRatio) {
const center = /** @type {module:ol/coordinate~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} */ ({
center: center.slice(),
center: [
Math.round(center[0] / pixelResolution) * pixelResolution,
Math.round(center[1] / pixelResolution) * pixelResolution
],
projection: projection !== undefined ? projection : null,
resolution: resolution,
rotation: rotation,
@@ -1057,7 +1058,7 @@ class View extends BaseObject {
const centerX = centerRotX * cosAngle - centerRotY * sinAngle;
const centerY = centerRotY * cosAngle + centerRotX * sinAngle;
const center = [centerX, centerY];
const callback = options.callback ? options.callback : UNDEFINED;
const callback = options.callback ? options.callback : VOID;
if (options.duration !== undefined) {
this.animate({
@@ -1069,7 +1070,7 @@ class View extends BaseObject {
} else {
this.setResolution(resolution);
this.setCenter(center);
setTimeout(callback.bind(undefined, true), 0);
animationCallback(callback, true);
}
}
@@ -1181,6 +1182,17 @@ class View extends BaseObject {
}
/**
* @param {Function} callback Callback.
* @param {*} returnValue Return value.
*/
function animationCallback(callback, returnValue) {
setTimeout(function() {
callback(returnValue);
}, 0);
}
/**
* @param {module:ol/View~ViewOptions} options View options.
* @return {module:ol/centerconstraint~Type} The constraint.

View File

@@ -7,7 +7,7 @@
* Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.
* https://github.com/darkskyapp/binary-search
*
* @param {Array.<*>} haystack Items to search through.
* @param {Array<*>} haystack Items to search through.
* @param {*} needle The item to look for.
* @param {Function=} opt_comparator Comparator function.
* @return {number} The index of the item if found, -1 if not.
@@ -53,7 +53,7 @@ export function numberSafeCompareFunction(a, b) {
/**
* Whether the array contains the given object.
* @param {Array.<*>} arr The array to test for the presence of the element.
* @param {Array<*>} arr The array to test for the presence of the element.
* @param {*} obj The object for which to test.
* @return {boolean} The object is in the array.
*/
@@ -63,7 +63,7 @@ export function includes(arr, obj) {
/**
* @param {Array.<number>} arr Array.
* @param {Array<number>} arr Array.
* @param {number} target Target.
* @param {number} direction 0 means return the nearest, > 0
* means return the largest nearest, < 0 means return the
@@ -109,7 +109,7 @@ export function linearFindNearest(arr, target, direction) {
/**
* @param {Array.<*>} arr Array.
* @param {Array<*>} arr Array.
* @param {number} begin Begin index.
* @param {number} end End index.
*/
@@ -125,8 +125,8 @@ export function reverseSubArray(arr, begin, end) {
/**
* @param {Array.<VALUE>} arr The array to modify.
* @param {!Array.<VALUE>|VALUE} data The elements or arrays of elements to add to arr.
* @param {Array<VALUE>} arr The array to modify.
* @param {!Array<VALUE>|VALUE} data The elements or arrays of elements to add to arr.
* @template VALUE
*/
export function extend(arr, data) {
@@ -139,7 +139,7 @@ export function extend(arr, data) {
/**
* @param {Array.<VALUE>} arr The array to modify.
* @param {Array<VALUE>} arr The array to modify.
* @param {VALUE} obj The element to remove.
* @template VALUE
* @return {boolean} If the element was removed.
@@ -155,7 +155,7 @@ export function remove(arr, obj) {
/**
* @param {Array.<VALUE>} arr The array to search in.
* @param {Array<VALUE>} arr The array to search in.
* @param {function(VALUE, number, ?) : boolean} func The function to compare.
* @template VALUE
* @return {VALUE|null} The element found or null.
@@ -194,8 +194,11 @@ export function equals(arr1, arr2) {
/**
* @param {Array.<*>} arr The array to sort (modifies original).
* @param {Function} compareFnc Comparison function.
* Sort the passed array such that the relative order of equal elements is preverved.
* See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.
* @param {Array<*>} arr The array to sort (modifies original).
* @param {!function(*, *): number} compareFnc Comparison function.
* @api
*/
export function stableSort(arr, compareFnc) {
const length = arr.length;
@@ -214,7 +217,7 @@ export function stableSort(arr, compareFnc) {
/**
* @param {Array.<*>} arr The array to search in.
* @param {Array<*>} arr The array to search in.
* @param {Function} func Comparison function.
* @return {number} Return index.
*/
@@ -229,7 +232,7 @@ export function findIndex(arr, func) {
/**
* @param {Array.<*>} arr The array to test.
* @param {Array<*>} arr The array to test.
* @param {Function=} opt_func Comparison function.
* @param {boolean=} opt_strict Strictly sorted (default false).
* @return {boolean} Return index.

View File

@@ -10,7 +10,7 @@ import {clamp} from './math.js';
* red, green, and blue should be integers in the range 0..255 inclusive.
* alpha should be a float in the range 0..1 inclusive. If no alpha value is
* given then `1` will be used.
* @typedef {Array.<number>} Color
* @typedef {Array<number>} Color
* @api
*/
@@ -84,7 +84,7 @@ export const fromString = (
const MAX_CACHE_SIZE = 1024;
/**
* @type {Object.<string, module:ol/color~Color>}
* @type {Object<string, module:ol/color~Color>}
*/
const cache = {};

View File

@@ -62,7 +62,7 @@ class Attribution extends Control {
* @private
* @type {HTMLElement}
*/
this.ulElement_ = document.createElement('UL');
this.ulElement_ = document.createElement('ul');
/**
* @private
@@ -131,7 +131,7 @@ class Attribution extends Control {
/**
* A list of currently rendered resolutions.
* @type {Array.<string>}
* @type {Array<string>}
* @private
*/
this.renderedAttributions_ = [];
@@ -147,19 +147,19 @@ class Attribution extends Control {
/**
* Get a list of visible attributions.
* @param {module:ol/PluggableMap~FrameState} frameState Frame state.
* @return {Array.<string>} Attributions.
* @return {Array<string>} Attributions.
* @private
*/
getSourceAttributions_(frameState) {
/**
* Used to determine if an attribution already exists.
* @type {!Object.<string, boolean>}
* @type {!Object<string, boolean>}
*/
const lookup = {};
/**
* A list of visible attributions.
* @type {Array.<string>}
* @type {Array<string>}
*/
const visibleAttributions = [];
@@ -232,7 +232,7 @@ class Attribution extends Control {
// append the attributions
for (let i = 0, ii = attributions.length; i < ii; ++i) {
const element = document.createElement('LI');
const element = document.createElement('li');
element.innerHTML = attributions[i];
this.ulElement_.appendChild(element);
}

View File

@@ -1,7 +1,7 @@
/**
* @module ol/control/Control
*/
import {UNDEFINED} from '../functions.js';
import {VOID} from '../functions.js';
import MapEventType from '../MapEventType.js';
import BaseObject from '../Object.js';
import {removeNode} from '../dom.js';
@@ -74,14 +74,14 @@ class Control extends BaseObject {
/**
* @protected
* @type {!Array.<module:ol/events~EventsKey>}
* @type {!Array<module:ol/events~EventsKey>}
*/
this.listenerKeys = [];
/**
* @type {function(module:ol/MapEvent)}
*/
this.render = options.render ? options.render : UNDEFINED;
this.render = options.render ? options.render : VOID;
if (options.target) {
this.setTarget(options.target);
@@ -126,7 +126,7 @@ class Control extends BaseObject {
const target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element);
if (this.render !== UNDEFINED) {
if (this.render !== VOID) {
this.listenerKeys.push(listen(map,
MapEventType.POSTRENDER, this.render, this));
}

View File

@@ -29,9 +29,9 @@ const COORDINATE_FORMAT = 'coordinateFormat';
* callback.
* @property {Element|string} [target] Specify a target if you want the
* control to be rendered outside of the map's viewport.
* @property {string} [undefinedHTML='&nbsp;'] Markup to show when coordinates are not
* @property {string} [undefinedHTML='&#160;'] Markup to show when coordinates are not
* available (e.g. when the pointer leaves the map viewport). By default, the last position
* will be replaced with `'&nbsp;'` when the pointer leaves the viewport. To
* will be replaced with `'&#160;'` (`&nbsp;`) when the pointer leaves the viewport. To
* retain the last rendered position, set this option to something falsey (like an empty
* string `''`).
*/
@@ -55,7 +55,7 @@ class MousePosition extends Control {
const options = opt_options ? opt_options : {};
const element = document.createElement('DIV');
const element = document.createElement('div');
element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
super({
@@ -79,7 +79,7 @@ class MousePosition extends Control {
* @private
* @type {string}
*/
this.undefinedHTML_ = 'undefinedHTML' in options ? options.undefinedHTML : '&nbsp;';
this.undefinedHTML_ = 'undefinedHTML' in options ? options.undefinedHTML : '&#160;';
/**
* @private

View File

@@ -44,7 +44,7 @@ const MIN_RATIO = 0.1;
* @property {boolean} [collapsible=true] Whether the control can be collapsed or not.
* @property {string|HTMLElement} [label='»'] Text label to use for the collapsed
* overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
* @property {Array.<module:ol/layer/Layer>|module:ol/Collection.<module:ol/layer/Layer>} [layers]
* @property {Array<module:ol/layer/Layer>|module:ol/Collection<module:ol/layer/Layer>} [layers]
* Layers for the overview map. If not set, then all main map layers are used
* instead.
* @property {function(module:ol/MapEvent)} [render] Function called when the control
@@ -140,7 +140,7 @@ class OverviewMap extends Control {
* @type {HTMLElement}
* @private
*/
this.ovmapDiv_ = document.createElement('DIV');
this.ovmapDiv_ = document.createElement('div');
this.ovmapDiv_.className = 'ol-overviewmap-map';
/**
@@ -164,7 +164,7 @@ class OverviewMap extends Control {
}).bind(this));
}
const box = document.createElement('DIV');
const box = document.createElement('div');
box.className = 'ol-overviewmap-box';
box.style.boxSizing = 'border-box';

View File

@@ -31,7 +31,7 @@ export const Units = {
/**
* @const
* @type {Array.<number>}
* @type {Array<number>}
*/
const LEADING_DIGITS = [1, 2, 5];
@@ -72,7 +72,7 @@ class ScaleLine extends Control {
const className = options.className !== undefined ? options.className : 'ol-scale-line';
super({
element: document.createElement('DIV'),
element: document.createElement('div'),
render: options.render || render,
target: options.target
});
@@ -81,7 +81,7 @@ class ScaleLine extends Control {
* @private
* @type {HTMLElement}
*/
this.innerElement_ = document.createElement('DIV');
this.innerElement_ = document.createElement('div');
this.innerElement_.className = className + '-inner';
this.element.className = className + ' ' + CLASS_UNSELECTABLE;

View File

@@ -34,7 +34,7 @@ import Zoom from './Zoom.js';
*
* @param {module:ol/control/util~DefaultsOptions=} opt_options
* Defaults options.
* @return {module:ol/Collection.<module:ol/control/Control>}
* @return {module:ol/Collection<module:ol/control/Control>}
* Controls.
* @function module:ol/control.defaults
* @api

View File

@@ -7,7 +7,7 @@ import {padNumber} from './string.js';
/**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`.
* @typedef {Array.<number>} Coordinate
* @typedef {Array<number>} Coordinate
* @api
*/
@@ -82,7 +82,7 @@ export function closestOnCircle(coordinate, circle) {
* is outside the segment.
*
* @param {module:ol/coordinate~Coordinate} coordinate The coordinate.
* @param {Array.<module:ol/coordinate~Coordinate>} segment The two coordinates
* @param {Array<module:ol/coordinate~Coordinate>} segment The two coordinates
* of the segment.
* @return {module:ol/coordinate~Coordinate} The foot of the perpendicular of
* the coordinate to the segment.
@@ -328,7 +328,7 @@ export function distance(coord1, coord2) {
* Calculate the squared distance from a coordinate to a line segment.
*
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate of the point.
* @param {Array.<module:ol/coordinate~Coordinate>} segment Line segment (2
* @param {Array<module:ol/coordinate~Coordinate>} segment Line segment (2
* coordinates).
* @return {number} Squared distance from the point to the line segment.
*/

View File

@@ -62,7 +62,7 @@ export const CLASS_COLLAPSED = 'ol-collapsed';
* Get the list of font families from a font spec. Note that this doesn't work
* for font families that have commas in them.
* @param {string} The CSS font property.
* @return {Object.<string>} The font families (or null if the input spec is invalid).
* @return {Object<string>} The font families (or null if the input spec is invalid).
*/
export const getFontFamilies = (function() {
let style;

View File

@@ -10,7 +10,7 @@
* @return {CanvasRenderingContext2D} The context.
*/
export function createCanvasContext2D(opt_width, opt_height) {
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('CANVAS'));
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
if (opt_width) {
canvas.width = opt_width;
}

View File

@@ -12,7 +12,7 @@ import {clear} from './obj.js';
* @property {boolean} callOnce
* @property {number} [deleteIndex]
* @property {module:ol/events~ListenerFunction} listener
* @property {EventTarget|module:ol/events/EventTarget} target
* @property {module:ol/events/Target~EventTargetLike} target
* @property {string} type
* @api
*/
@@ -73,9 +73,9 @@ export function findListener(listeners, listener, opt_this, opt_setDeleteIndex)
/**
* @param {module:ol/events/EventTarget~EventTargetLike} target Target.
* @param {module:ol/events/Target~EventTargetLike} target Target.
* @param {string} type Type.
* @return {Array.<module:ol/events~EventsKey>|undefined} Listeners.
* @return {Array<module:ol/events~EventsKey>|undefined} Listeners.
*/
export function getListeners(target, type) {
const listenerMap = target.ol_lm;
@@ -86,8 +86,8 @@ export function getListeners(target, type) {
/**
* Get the lookup of listeners. If one does not exist on the target, it is
* created.
* @param {module:ol/events/EventTarget~EventTargetLike} target Target.
* @return {!Object.<string, Array.<module:ol/events~EventsKey>>} Map of
* @param {module:ol/events/Target~EventTargetLike} target Target.
* @return {!Object<string, Array<module:ol/events~EventsKey>>} Map of
* listeners by event type.
*/
function getListenerMap(target) {
@@ -103,7 +103,7 @@ function getListenerMap(target) {
* Clean up all listener objects of the given type. All properties on the
* listener objects will be removed, and if no listeners remain in the listener
* map, it will be removed from the target.
* @param {module:ol/events/EventTarget~EventTargetLike} target Target.
* @param {module:ol/events/Target~EventTargetLike} target Target.
* @param {string} type Type.
*/
function removeListeners(target, type) {
@@ -132,7 +132,7 @@ function removeListeners(target, type) {
* This function efficiently binds a `listener` to a `this` object, and returns
* a key for use with {@link module:ol/events~unlistenByKey}.
*
* @param {module:ol/events/EventTarget~EventTargetLike} target Event target.
* @param {module:ol/events/Target~EventTargetLike} target Event target.
* @param {string} type Event type.
* @param {module:ol/events~ListenerFunction} listener Listener.
* @param {Object=} opt_this Object referenced by the `this` keyword in the
@@ -181,7 +181,7 @@ export function listen(target, type, listener, opt_this, opt_once) {
* function, the self-unregistering listener will be turned into a permanent
* listener.
*
* @param {module:ol/events/EventTarget~EventTargetLike} target Event target.
* @param {module:ol/events/Target~EventTargetLike} target Event target.
* @param {string} type Event type.
* @param {module:ol/events~ListenerFunction} listener Listener.
* @param {Object=} opt_this Object referenced by the `this` keyword in the
@@ -200,7 +200,7 @@ export function listenOnce(target, type, listener, opt_this) {
* To return a listener, this function needs to be called with the exact same
* arguments that were used for a previous {@link module:ol/events~listen} call.
*
* @param {module:ol/events/EventTarget~EventTargetLike} target Event target.
* @param {module:ol/events/Target~EventTargetLike} target Event target.
* @param {string} type Event type.
* @param {module:ol/events~ListenerFunction} listener Listener.
* @param {Object=} opt_this Object referenced by the `this` keyword in the
@@ -248,7 +248,7 @@ export function unlistenByKey(key) {
* Unregisters all event listeners on an event target. Inspired by
* https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
*
* @param {module:ol/events/EventTarget~EventTargetLike} target Target.
* @param {module:ol/events/Target~EventTargetLike} target Target.
*/
export function unlistenAll(target) {
const listenerMap = getListenerMap(target);

View File

@@ -10,7 +10,7 @@
* This implementation only provides `type` and `target` properties, and
* `stopPropagation` and `preventDefault` methods. It is meant as base class
* for higher level events defined in the library, and works with
* {@link module:ol/events/EventTarget~EventTarget}.
* {@link module:ol/events/Target~Target}.
*/
class Event {

View File

@@ -1,14 +1,14 @@
/**
* @module ol/events/EventTarget
* @module ol/events/Target
*/
import Disposable from '../Disposable.js';
import {unlistenAll} from '../events.js';
import {UNDEFINED} from '../functions.js';
import {VOID} from '../functions.js';
import Event from '../events/Event.js';
/**
* @typedef {EventTarget|module:ol/events/EventTarget} EventTargetLike
* @typedef {EventTarget|module:ol/events/Target} EventTargetLike
*/
@@ -27,26 +27,26 @@ import Event from '../events/Event.js';
* more listeners after this one will be called. Same as when the listener
* returns false.
*/
class EventTarget extends Disposable {
class Target extends Disposable {
constructor() {
super();
/**
* @private
* @type {!Object.<string, number>}
* @type {!Object<string, number>}
*/
this.pendingRemovals_ = {};
/**
* @private
* @type {!Object.<string, number>}
* @type {!Object<string, number>}
*/
this.dispatching_ = {};
/**
* @private
* @type {!Object.<string, Array.<module:ol/events~ListenerFunction>>}
* @type {!Object<string, Array<module:ol/events~ListenerFunction>>}
*/
this.listeners_ = {};
@@ -72,7 +72,7 @@ class EventTarget extends Disposable {
* Object with a `type` property.
*
* @param {{type: string,
* target: (EventTarget|module:ol/events/EventTarget|undefined)}|
* target: (module:ol/events/Target~EventTargetLike|undefined)}|
* module:ol/events/Event|string} event Event object.
* @return {boolean|undefined} `false` if anyone called preventDefault on the
* event object or if any of the listeners returned false.
@@ -102,7 +102,7 @@ class EventTarget extends Disposable {
let pendingRemovals = this.pendingRemovals_[type];
delete this.pendingRemovals_[type];
while (pendingRemovals--) {
this.removeEventListener(type, UNDEFINED);
this.removeEventListener(type, VOID);
}
delete this.dispatching_[type];
}
@@ -122,7 +122,7 @@ class EventTarget extends Disposable {
* order that they will be called in.
*
* @param {string} type Type.
* @return {Array.<module:ol/events~ListenerFunction>} Listeners.
* @return {Array<module:ol/events~ListenerFunction>} Listeners.
*/
getListeners(type) {
return this.listeners_[type];
@@ -130,7 +130,7 @@ class EventTarget extends Disposable {
/**
* @param {string=} opt_type Type. If not provided,
* `true` will be returned if this EventTarget has any listeners.
* `true` will be returned if this event target has any listeners.
* @return {boolean} Has listeners.
*/
hasListener(opt_type) {
@@ -149,7 +149,7 @@ class EventTarget extends Disposable {
const index = listeners.indexOf(listener);
if (type in this.pendingRemovals_) {
// make listener a no-op, and remove later in #dispatchEvent()
listeners[index] = UNDEFINED;
listeners[index] = VOID;
++this.pendingRemovals_[type];
} else {
listeners.splice(index, 1);
@@ -162,4 +162,4 @@ class EventTarget extends Disposable {
}
export default EventTarget;
export default Target;

View File

@@ -8,14 +8,14 @@ import Relationship from './extent/Relationship.js';
/**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
* @typedef {Array.<number>} Extent
* @typedef {Array<number>} Extent
* @api
*/
/**
* Build an extent that includes all given coordinates.
*
* @param {Array.<module:ol/coordinate~Coordinate>} coordinates Coordinates.
* @param {Array<module:ol/coordinate~Coordinate>} coordinates Coordinates.
* @return {module:ol/extent~Extent} Bounding extent.
* @api
*/
@@ -29,8 +29,8 @@ export function boundingExtent(coordinates) {
/**
* @param {Array.<number>} xs Xs.
* @param {Array.<number>} ys Ys.
* @param {Array<number>} xs Xs.
* @param {Array<number>} ys Ys.
* @param {module:ol/extent~Extent=} opt_extent Destination extent.
* @private
* @return {module:ol/extent~Extent} Extent.
@@ -249,7 +249,7 @@ export function createOrUpdateFromCoordinate(coordinate, opt_extent) {
/**
* @param {Array.<module:ol/coordinate~Coordinate>} coordinates Coordinates.
* @param {Array<module:ol/coordinate~Coordinate>} coordinates Coordinates.
* @param {module:ol/extent~Extent=} opt_extent Extent.
* @return {module:ol/extent~Extent} Extent.
*/
@@ -260,7 +260,7 @@ export function createOrUpdateFromCoordinates(coordinates, opt_extent) {
/**
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
@@ -273,7 +273,7 @@ export function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end,
}
/**
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} rings Rings.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} rings Rings.
* @param {module:ol/extent~Extent=} opt_extent Extent.
* @return {module:ol/extent~Extent} Extent.
*/
@@ -342,7 +342,7 @@ export function extendCoordinate(extent, coordinate) {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {Array.<module:ol/coordinate~Coordinate>} coordinates Coordinates.
* @param {Array<module:ol/coordinate~Coordinate>} coordinates Coordinates.
* @return {module:ol/extent~Extent} Extent.
*/
export function extendCoordinates(extent, coordinates) {
@@ -355,7 +355,7 @@ export function extendCoordinates(extent, coordinates) {
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
@@ -371,7 +371,7 @@ export function extendFlatCoordinates(extent, flatCoordinates, offset, end, stri
/**
* @param {module:ol/extent~Extent} extent Extent.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} rings Rings.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} rings Rings.
* @return {module:ol/extent~Extent} Extent.
*/
export function extendRings(extent, rings) {

View File

@@ -1,7 +1,7 @@
/**
* @module ol/featureloader
*/
import {UNDEFINED} from './functions.js';
import {VOID} from './functions.js';
import FormatType from './format/FormatType.js';
@@ -39,7 +39,7 @@ import FormatType from './format/FormatType.js';
/**
* @param {string|module:ol/featureloader~FeatureUrlFunction} url Feature URL service.
* @param {module:ol/format/Feature} format Feature format.
* @param {function(this:module:ol/VectorTile, Array.<module:ol/Feature>, module:ol/proj/Projection, module:ol/extent~Extent)|function(this:module:ol/source/Vector, Array.<module:ol/Feature>)} success
* @param {function(this:module:ol/VectorTile, Array<module:ol/Feature>, module:ol/proj/Projection, module:ol/extent~Extent)|function(this:module:ol/source/Vector, Array<module:ol/Feature>)} success
* Function called with the loaded features and optionally with the data
* projection. Called with the vector tile or source as `this`.
* @param {function(this:module:ol/VectorTile)|function(this:module:ol/source/Vector)} failure
@@ -118,12 +118,12 @@ export function loadFeaturesXhr(url, format, success, failure) {
export function xhr(url, format) {
return loadFeaturesXhr(url, format,
/**
* @param {Array.<module:ol/Feature>} features The loaded features.
* @param {Array<module:ol/Feature>} features The loaded features.
* @param {module:ol/proj/Projection} dataProjection Data
* projection.
* @this {module:ol/source/Vector}
*/
function(features, dataProjection) {
this.addFeatures(features);
}, /* FIXME handle error */ UNDEFINED);
}, /* FIXME handle error */ VOID);
}

View File

@@ -23,7 +23,7 @@ import {get as getProjection} from '../proj.js';
/**
* @const
* @type {Object.<module:ol/geom/GeometryType, function(EsriJSONGeometry): module:ol/geom/Geometry>}
* @type {Object<module:ol/geom/GeometryType, function(EsriJSONGeometry): module:ol/geom/Geometry>}
*/
const GEOMETRY_READERS = {};
GEOMETRY_READERS[GeometryType.POINT] = readPointGeometry;
@@ -36,7 +36,7 @@ GEOMETRY_READERS[GeometryType.MULTI_POLYGON] = readMultiPolygonGeometry;
/**
* @const
* @type {Object.<string, function(module:ol/geom/Geometry, module:ol/format/Feature~WriteOptions=): (EsriJSONGeometry)>}
* @type {Object<string, function(module:ol/geom/Geometry, module:ol/format/Feature~WriteOptions=): (EsriJSONGeometry)>}
*/
const GEOMETRY_WRITERS = {};
GEOMETRY_WRITERS[GeometryType.POINT] = writePointGeometry;
@@ -108,7 +108,7 @@ class EsriJSON extends JSONFeature {
const options = opt_options ? opt_options : {};
if (esriJSONObject.features) {
const esriJSONFeatureCollection = /** @type {EsriJSONFeatureCollection} */ (object);
/** @type {Array.<module:ol/Feature>} */
/** @type {Array<module:ol/Feature>} */
const features = [];
const esriJSONFeatures = esriJSONFeatureCollection.features;
options.idField = object.objectIdFieldName;
@@ -188,7 +188,7 @@ class EsriJSON extends JSONFeature {
/**
* Encode an array of features as a EsriJSON object.
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} EsriJSON Object.
* @override
@@ -252,9 +252,9 @@ function readGeometry(object, opt_options) {
* Checks if any polygons in this array contain any other polygons in this
* array. It is used for checking for holes.
* Logic inspired by: https://github.com/Esri/terraformer-arcgis-parser
* @param {Array.<!Array.<!Array.<number>>>} rings Rings.
* @param {Array<!Array<!Array<number>>>} rings Rings.
* @param {module:ol/geom/GeometryLayout} layout Geometry layout.
* @return {Array.<!Array.<!Array.<number>>>} Transformed rings.
* @return {Array<!Array<!Array<number>>>} Transformed rings.
*/
function convertRings(rings, layout) {
const flatRing = [];
@@ -376,7 +376,7 @@ function readMultiPointGeometry(object) {
function readMultiPolygonGeometry(object) {
const layout = getGeometryLayout(object);
return new MultiPolygon(
/** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings),
/** @type {Array<Array<Array<Array<number>>>>} */(object.rings),
layout);
}

View File

@@ -8,14 +8,14 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
/**
* @typedef {Object} ReadOptions
* @property {module:ol/proj~ProjectionLike} dataProjection Projection of the data we are reading.
* @property {module:ol/proj~ProjectionLike} [dataProjection] Projection of the data we are reading.
* If not provided, the projection will be derived from the data (where possible) or
* the `dataProjection` of the format is assigned (where set). If the projection
* can not be derived from the data and if no `dataProjection` is set for a format,
* the features will not be reprojected.
* @property {module:ol/extent~Extent} extent Tile extent of the tile being read. This is only used and
* @property {module:ol/extent~Extent} [extent] Tile extent of the tile being read. This is only used and
* required for {@link module:ol/format/MVT}.
* @property {module:ol/proj~ProjectionLike} featureProjection Projection of the feature geometries
* @property {module:ol/proj~ProjectionLike} [featureProjection] Projection of the feature geometries
* created by the format reader. If not provided, features will be returned in the
* `dataProjection`.
*/
@@ -23,11 +23,11 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
/**
* @typedef {Object} WriteOptions
* @property {module:ol/proj~ProjectionLike} dataProjection Projection of the data we are writing.
* @property {module:ol/proj~ProjectionLike} [dataProjection] Projection of the data we are writing.
* If not provided, the `dataProjection` of the format is assigned (where set).
* If no `dataProjection` is set for a format, the features will be returned
* in the `featureProjection`.
* @property {module:ol/proj~ProjectionLike} featureProjection Projection of the feature geometries
* @property {module:ol/proj~ProjectionLike} [featureProjection] Projection of the feature geometries
* that will be serialized by the format writer. If not provided, geometries are assumed
* to be in the `dataProjection` if that is set; in other words, they are not transformed.
* @property {boolean} [rightHanded] When writing geometries, follow the right-hand
@@ -141,7 +141,7 @@ class FeatureFormat {
* @abstract
* @param {Document|Node|ArrayBuffer|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
*/
readFeatures(source, opt_options) {}
@@ -178,7 +178,7 @@ class FeatureFormat {
* Encode an array of features in this format.
*
* @abstract
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
@@ -200,7 +200,7 @@ export default FeatureFormat;
/**
* @param {module:ol/geom/Geometry|module:ol/extent~Extent} geometry Geometry.
* @param {boolean} write Set to true for writing, false for reading.
* @param {(module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options
* @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} opt_options
* Options.
* @return {module:ol/geom/Geometry|module:ol/extent~Extent} Transformed geometry.
*/
@@ -234,8 +234,8 @@ export function transformWithOptions(geometry, write, opt_options) {
const power = Math.pow(10, opt_options.decimals);
// if decimals option on write, round each coordinate appropriately
/**
* @param {Array.<number>} coordinates Coordinates.
* @return {Array.<number>} Transformed coordinates.
* @param {Array<number>} coordinates Coordinates.
* @return {Array<number>} Transformed coordinates.
*/
const transform = function(coordinates) {
for (let i = 0, ii = coordinates.length; i < ii; ++i) {

View File

@@ -20,7 +20,7 @@ const GML = GML3;
* Encode an array of features in GML 3.1.1 Simple Features.
*
* @function
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {string} Result.
* @api
@@ -32,7 +32,7 @@ GML.prototype.writeFeatures;
* Encode an array of features in the GML 3.1.1 format as an XML node.
*
* @function
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node.
* @api

View File

@@ -21,7 +21,7 @@ const schemaLocation = GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xs
/**
* @const
* @type {Object.<string, string>}
* @type {Object<string, string>}
*/
const MULTIGEOMETRY_TO_MEMBER_NODENAME = {
'MultiLineString': 'lineStringMember',
@@ -63,9 +63,9 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} Flat coordinates.
* @return {Array<number>|undefined} Flat coordinates.
*/
readFlatCoordinates_(node, objectStack) {
const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
@@ -96,12 +96,12 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {module:ol/extent~Extent|undefined} Envelope.
*/
readBox_(node, objectStack) {
/** @type {Array.<number>} */
/** @type {Array<number>} */
const flatCoordinates = pushParseAndPop([null],
this.BOX_PARSERS_, node, objectStack, this);
return createOrUpdate(flatCoordinates[1][0],
@@ -111,15 +111,15 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
innerBoundaryIsParser_(node, objectStack) {
/** @type {Array.<number>|undefined} */
/** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
const flatLinearRings = /** @type {Array.<Array.<number>>} */
const flatLinearRings = /** @type {Array<Array<number>>} */
(objectStack[objectStack.length - 1]);
flatLinearRings.push(flatLinearRing);
}
@@ -127,15 +127,15 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
outerBoundaryIsParser_(node, objectStack) {
/** @type {Array.<number>|undefined} */
/** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
const flatLinearRings = /** @type {Array.<Array.<number>>} */
const flatLinearRings = /** @type {Array<Array<number>>} */
(objectStack[objectStack.length - 1]);
flatLinearRings[0] = flatLinearRing;
}
@@ -144,7 +144,7 @@ class GML2 extends GMLBase {
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
@@ -174,7 +174,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
writeFeatureElement(node, feature, objectStack) {
const fid = feature.getId();
@@ -220,7 +220,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} geometry LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeCurveOrLineString_(node, geometry, objectStack) {
@@ -245,7 +245,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeLineStringOrCurveMember_(node, line, objectStack) {
@@ -259,7 +259,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/MultiLineString} geometry MultiLineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeMultiCurveOrLineString_(node, geometry, objectStack) {
@@ -280,7 +280,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Geometry|module:ol/extent~Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
writeGeometryElement(node, geometry, objectStack) {
const context = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[objectStack.length - 1]);
@@ -320,7 +320,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString|module:ol/geom/LinearRing} value Geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeCoordinates_(node, value, objectStack) {
@@ -341,7 +341,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeCurveSegments_(node, line, objectStack) {
@@ -353,7 +353,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Polygon} geometry Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeSurfaceOrPolygon_(node, geometry, objectStack) {
@@ -380,7 +380,7 @@ class GML2 extends GMLBase {
/**
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node} Node.
* @private
@@ -399,7 +399,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeSurfacePatches_(node, polygon, objectStack) {
@@ -411,7 +411,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LinearRing} ring LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeRing_(node, ring, objectStack) {
@@ -421,7 +421,7 @@ class GML2 extends GMLBase {
}
/**
* @param {Array.<number>} point Point geometry.
* @param {Array<number>} point Point geometry.
* @param {string=} opt_srsName Optional srsName
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string.
@@ -447,7 +447,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Point} geometry Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writePoint_(node, geometry, objectStack) {
@@ -467,7 +467,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/MultiPoint} geometry MultiPoint geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeMultiPoint_(node, geometry, objectStack) {
@@ -487,7 +487,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Point} point Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writePointMember_(node, point, objectStack) {
@@ -499,7 +499,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LinearRing} geometry LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeLinearRing_(node, geometry, objectStack) {
@@ -516,7 +516,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/MultiPolygon} geometry MultiPolygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeMultiSurfaceOrPolygon_(node, geometry, objectStack) {
@@ -537,7 +537,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeSurfaceOrPolygonMember_(node, polygon, objectStack) {
@@ -552,7 +552,7 @@ class GML2 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/extent~Extent} extent Extent.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeEnvelope(node, extent, objectStack) {
@@ -573,7 +573,7 @@ class GML2 extends GMLBase {
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
@@ -587,7 +587,7 @@ class GML2 extends GMLBase {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
@@ -598,7 +598,7 @@ GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
@@ -610,7 +610,7 @@ GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML2.prototype.BOX_PARSERS_ = {
@@ -622,7 +622,7 @@ GML2.prototype.BOX_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML2.prototype.GEOMETRY_PARSERS_ = {
@@ -645,7 +645,7 @@ GML2.prototype.GEOMETRY_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML2.prototype.GEOMETRY_SERIALIZERS_ = {
@@ -677,7 +677,7 @@ GML2.prototype.GEOMETRY_SERIALIZERS_ = {
};
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
@@ -690,7 +690,7 @@ GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
};
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML2.prototype.RING_SERIALIZERS_ = {
@@ -701,7 +701,7 @@ GML2.prototype.RING_SERIALIZERS_ = {
};
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML2.prototype.POINTMEMBER_SERIALIZERS_ = {
@@ -713,7 +713,7 @@ GML2.prototype.POINTMEMBER_SERIALIZERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
@@ -726,7 +726,7 @@ GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
};
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML2.prototype.ENVELOPE_SERIALIZERS_ = {

View File

@@ -31,7 +31,7 @@ const schemaLocation = GMLNS +
/**
* @const
* @type {Object.<string, string>}
* @type {Object<string, string>}
*/
const MULTIGEOMETRY_TO_MEMBER_NODENAME = {
'MultiLineString': 'lineStringMember',
@@ -103,12 +103,12 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {module:ol/geom/MultiLineString|undefined} MultiLineString.
*/
readMultiCurve_(node, objectStack) {
/** @type {Array.<module:ol/geom/LineString>} */
/** @type {Array<module:ol/geom/LineString>} */
const lineStrings = pushParseAndPop([],
this.MULTICURVE_PARSERS_, node, objectStack, this);
if (lineStrings) {
@@ -121,12 +121,12 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {module:ol/geom/MultiPolygon|undefined} MultiPolygon.
*/
readMultiSurface_(node, objectStack) {
/** @type {Array.<module:ol/geom/Polygon>} */
/** @type {Array<module:ol/geom/Polygon>} */
const polygons = pushParseAndPop([],
this.MULTISURFACE_PARSERS_, node, objectStack, this);
if (polygons) {
@@ -136,7 +136,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
curveMemberParser_(node, objectStack) {
@@ -145,7 +145,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
surfaceMemberParser_(node, objectStack) {
@@ -155,9 +155,9 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<(Array.<number>)>|undefined} flat coordinates.
* @return {Array<(Array<number>)>|undefined} flat coordinates.
*/
readPatch_(node, objectStack) {
return pushParseAndPop([null],
@@ -166,9 +166,9 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} flat coordinates.
* @return {Array<number>|undefined} flat coordinates.
*/
readSegment_(node, objectStack) {
return pushParseAndPop([null],
@@ -177,9 +177,9 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<(Array.<number>)>|undefined} flat coordinates.
* @return {Array<(Array<number>)>|undefined} flat coordinates.
*/
readPolygonPatch_(node, objectStack) {
return pushParseAndPop([null],
@@ -188,9 +188,9 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} flat coordinates.
* @return {Array<number>|undefined} flat coordinates.
*/
readLineStringSegment_(node, objectStack) {
return pushParseAndPop([null],
@@ -200,15 +200,15 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
interiorParser_(node, objectStack) {
/** @type {Array.<number>|undefined} */
/** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
const flatLinearRings = /** @type {Array.<Array.<number>>} */
const flatLinearRings = /** @type {Array<Array<number>>} */
(objectStack[objectStack.length - 1]);
flatLinearRings.push(flatLinearRing);
}
@@ -216,15 +216,15 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
exteriorParser_(node, objectStack) {
/** @type {Array.<number>|undefined} */
/** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
const flatLinearRings = /** @type {Array.<Array.<number>>} */
const flatLinearRings = /** @type {Array<Array<number>>} */
(objectStack[objectStack.length - 1]);
flatLinearRings[0] = flatLinearRing;
}
@@ -232,12 +232,12 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {module:ol/geom/Polygon|undefined} Polygon.
*/
readSurface_(node, objectStack) {
/** @type {Array.<Array.<number>>} */
/** @type {Array<Array<number>>} */
const flatLinearRings = pushParseAndPop([null],
this.SURFACE_PARSERS_, node, objectStack, this);
if (flatLinearRings && flatLinearRings[0]) {
@@ -256,12 +256,12 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {module:ol/geom/LineString|undefined} LineString.
*/
readCurve_(node, objectStack) {
/** @type {Array.<number>} */
/** @type {Array<number>} */
const flatCoordinates = pushParseAndPop([null],
this.CURVE_PARSERS_, node, objectStack, this);
if (flatCoordinates) {
@@ -274,12 +274,12 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {module:ol/extent~Extent|undefined} Envelope.
*/
readEnvelope_(node, objectStack) {
/** @type {Array.<number>} */
/** @type {Array<number>} */
const flatCoordinates = pushParseAndPop([null],
this.ENVELOPE_PARSERS_, node, objectStack, this);
return createOrUpdate(flatCoordinates[1][0],
@@ -289,14 +289,14 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} Flat coordinates.
* @return {Array<number>|undefined} Flat coordinates.
*/
readFlatPos_(node, objectStack) {
let s = getAllTextContent(node, false);
const re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
/** @type {Array.<number>} */
/** @type {Array<number>} */
const flatCoordinates = [];
let m;
while ((m = re.exec(s))) {
@@ -334,9 +334,9 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} Flat coordinates.
* @return {Array<number>|undefined} Flat coordinates.
*/
readFlatPosList_(node, objectStack) {
const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
@@ -381,7 +381,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Point} value Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writePos_(node, value, objectStack) {
@@ -411,7 +411,7 @@ class GML3 extends GMLBase {
}
/**
* @param {Array.<number>} point Point geometry.
* @param {Array<number>} point Point geometry.
* @param {string=} opt_srsName Optional srsName
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string.
@@ -437,7 +437,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString|module:ol/geom/LinearRing} value Geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writePosList_(node, value, objectStack) {
@@ -461,7 +461,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Point} geometry Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writePoint_(node, geometry, objectStack) {
@@ -478,7 +478,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/extent~Extent} extent Extent.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
writeEnvelope(node, extent, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -498,7 +498,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LinearRing} geometry LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeLinearRing_(node, geometry, objectStack) {
@@ -514,7 +514,7 @@ class GML3 extends GMLBase {
/**
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node} Node.
* @private
@@ -533,7 +533,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Polygon} geometry Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeSurfaceOrPolygon_(node, geometry, objectStack) {
@@ -561,7 +561,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} geometry LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeCurveOrLineString_(node, geometry, objectStack) {
@@ -586,7 +586,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/MultiPolygon} geometry MultiPolygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeMultiSurfaceOrPolygon_(node, geometry, objectStack) {
@@ -607,7 +607,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/MultiPoint} geometry MultiPoint geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeMultiPoint_(node, geometry, objectStack) {
@@ -627,7 +627,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/MultiLineString} geometry MultiLineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeMultiCurveOrLineString_(node, geometry, objectStack) {
@@ -648,7 +648,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LinearRing} ring LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeRing_(node, ring, objectStack) {
@@ -660,7 +660,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeSurfaceOrPolygonMember_(node, polygon, objectStack) {
@@ -675,7 +675,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Point} point Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writePointMember_(node, point, objectStack) {
@@ -687,7 +687,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeLineStringOrCurveMember_(node, line, objectStack) {
@@ -701,7 +701,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeSurfacePatches_(node, polygon, objectStack) {
@@ -713,7 +713,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeCurveSegments_(node, line, objectStack) {
@@ -726,7 +726,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/geom/Geometry|module:ol/extent~Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
writeGeometryElement(node, geometry, objectStack) {
const context = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[objectStack.length - 1]);
@@ -752,7 +752,7 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
writeFeatureElement(node, feature, objectStack) {
const fid = feature.getId();
@@ -797,8 +797,8 @@ class GML3 extends GMLBase {
/**
* @param {Node} node Node.
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<module:ol/Feature>} features Features.
* @param {Array<*>} objectStack Node stack.
* @private
*/
writeFeatureMembers_(node, features, objectStack) {
@@ -821,7 +821,7 @@ class GML3 extends GMLBase {
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
@@ -835,7 +835,7 @@ class GML3 extends GMLBase {
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
@@ -890,7 +890,7 @@ class GML3 extends GMLBase {
/**
* Encode an array of features in the GML 3.1.1 format as an XML node.
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node.
* @override
@@ -920,7 +920,7 @@ class GML3 extends GMLBase {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
@@ -933,7 +933,7 @@ GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
@@ -946,7 +946,7 @@ GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.GEOMETRY_PARSERS_ = {
@@ -976,7 +976,7 @@ GML3.prototype.GEOMETRY_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.MULTICURVE_PARSERS_ = {
@@ -991,7 +991,7 @@ GML3.prototype.MULTICURVE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.MULTISURFACE_PARSERS_ = {
@@ -1006,7 +1006,7 @@ GML3.prototype.MULTISURFACE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.CURVEMEMBER_PARSERS_ = {
@@ -1020,7 +1020,7 @@ GML3.prototype.CURVEMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.SURFACEMEMBER_PARSERS_ = {
@@ -1033,7 +1033,7 @@ GML3.prototype.SURFACEMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.SURFACE_PARSERS_ = {
@@ -1045,7 +1045,7 @@ GML3.prototype.SURFACE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.CURVE_PARSERS_ = {
@@ -1057,7 +1057,7 @@ GML3.prototype.CURVE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.ENVELOPE_PARSERS_ = {
@@ -1072,7 +1072,7 @@ GML3.prototype.ENVELOPE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.PATCHES_PARSERS_ = {
@@ -1085,7 +1085,7 @@ GML3.prototype.PATCHES_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GML3.prototype.SEGMENTS_PARSERS_ = {
@@ -1100,7 +1100,7 @@ GML3.prototype.SEGMENTS_PARSERS_ = {
* Encode an array of features in GML 3.1.1 Simple Features.
*
* @function
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {string} Result.
* @api
@@ -1109,7 +1109,7 @@ GML3.prototype.writeFeatures;
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML3.prototype.RING_SERIALIZERS_ = {
@@ -1121,7 +1121,7 @@ GML3.prototype.RING_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML3.prototype.ENVELOPE_SERIALIZERS_ = {
@@ -1133,7 +1133,7 @@ GML3.prototype.ENVELOPE_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
@@ -1147,7 +1147,7 @@ GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML3.prototype.POINTMEMBER_SERIALIZERS_ = {
@@ -1159,7 +1159,7 @@ GML3.prototype.POINTMEMBER_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
@@ -1173,7 +1173,7 @@ GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
* @private
*/
GML3.prototype.GEOMETRY_SERIALIZERS_ = {

View File

@@ -44,7 +44,7 @@ const ONLY_WHITESPACE_RE = /^[\s\xa0]*$/;
/**
* @typedef {Object} Options
* @property {Object.<string, string>|string} [featureNS] Feature
* @property {Object<string, string>|string} [featureNS] Feature
* namespace. If not defined will be derived from GML. If multiple
* feature types have been configured which come from different feature
* namespaces, this will be an object with the keys being the prefixes used
@@ -52,7 +52,7 @@ const ONLY_WHITESPACE_RE = /^[\s\xa0]*$/;
* feature namespaces themselves. So for instance there might be a featureType
* item `topp:states` in the `featureType` array and then there will be a key
* `topp` in the featureNS object with value `http://www.openplans.org/topp`.
* @property {Array.<string>|string} [featureType] Feature type(s) to parse.
* @property {Array<string>|string} [featureType] Feature type(s) to parse.
* If multiple feature types need to be configured
* which come from different feature namespaces, `featureNS` will be an object
* with the keys being the prefixes used in the entries of featureType array.
@@ -96,13 +96,13 @@ class GMLBase extends XMLFeature {
/**
* @protected
* @type {Array.<string>|string|undefined}
* @type {Array<string>|string|undefined}
*/
this.featureType = options.featureType;
/**
* @protected
* @type {Object.<string, string>|string|undefined}
* @type {Object<string, string>|string|undefined}
*/
this.featureNS = options.featureNS;
@@ -119,7 +119,7 @@ class GMLBase extends XMLFeature {
this.schemaLocation = '';
/**
* @type {Object.<string, Object.<string, Object>>}
* @type {Object<string, Object<string, Object>>}
*/
this.FEATURE_COLLECTION_PARSERS = {};
this.FEATURE_COLLECTION_PARSERS[GMLNS] = {
@@ -131,8 +131,8 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<module:ol/Feature> | undefined} Features.
* @param {Array<*>} objectStack Object stack.
* @return {Array<module:ol/Feature> | undefined} Features.
*/
readFeaturesInternal(node, objectStack) {
const localName = node.localName;
@@ -219,7 +219,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/Geometry|undefined} Geometry.
*/
readGeometryElement(node, objectStack) {
@@ -239,7 +239,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/Feature} Feature.
*/
readFeatureElement(node, objectStack) {
@@ -280,7 +280,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/Point|undefined} Point.
*/
readPoint(node, objectStack) {
@@ -292,11 +292,11 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/MultiPoint|undefined} MultiPoint.
*/
readMultiPoint(node, objectStack) {
/** @type {Array.<Array.<number>>} */
/** @type {Array<Array<number>>} */
const coordinates = pushParseAndPop([],
this.MULTIPOINT_PARSERS_, node, objectStack, this);
if (coordinates) {
@@ -308,11 +308,11 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/MultiLineString|undefined} MultiLineString.
*/
readMultiLineString(node, objectStack) {
/** @type {Array.<module:ol/geom/LineString>} */
/** @type {Array<module:ol/geom/LineString>} */
const lineStrings = pushParseAndPop([],
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
if (lineStrings) {
@@ -322,11 +322,11 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/MultiPolygon|undefined} MultiPolygon.
*/
readMultiPolygon(node, objectStack) {
/** @type {Array.<module:ol/geom/Polygon>} */
/** @type {Array<module:ol/geom/Polygon>} */
const polygons = pushParseAndPop([], this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
if (polygons) {
return new MultiPolygon(polygons);
@@ -335,7 +335,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
pointMemberParser_(node, objectStack) {
@@ -344,7 +344,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
lineStringMemberParser_(node, objectStack) {
@@ -353,7 +353,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
*/
polygonMemberParser_(node, objectStack) {
@@ -362,7 +362,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/LineString|undefined} LineString.
*/
readLineString(node, objectStack) {
@@ -377,9 +377,9 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>|undefined} LinearRing flat coordinates.
* @return {Array<number>|undefined} LinearRing flat coordinates.
*/
readFlatLinearRing_(node, objectStack) {
const ring = pushParseAndPop(null,
@@ -394,7 +394,7 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/LinearRing|undefined} LinearRing.
*/
readLinearRing(node, objectStack) {
@@ -406,11 +406,11 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/geom/Polygon|undefined} Polygon.
*/
readPolygon(node, objectStack) {
/** @type {Array.<Array.<number>>} */
/** @type {Array<Array<number>>} */
const flatLinearRings = pushParseAndPop([null],
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
if (flatLinearRings && flatLinearRings[0]) {
@@ -429,9 +429,9 @@ class GMLBase extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @private
* @return {Array.<number>} Flat coordinates.
* @return {Array<number>} Flat coordinates.
*/
readFlatCoordinatesFromNode_(node, objectStack) {
return pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this);
@@ -471,7 +471,7 @@ class GMLBase extends XMLFeature {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GMLBase.prototype.MULTIPOINT_PARSERS_ = {
@@ -484,7 +484,7 @@ GMLBase.prototype.MULTIPOINT_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
@@ -497,7 +497,7 @@ GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
@@ -510,7 +510,7 @@ GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GMLBase.prototype.POINTMEMBER_PARSERS_ = {
@@ -522,7 +522,7 @@ GMLBase.prototype.POINTMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
@@ -534,7 +534,7 @@ GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @private
*/
GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
@@ -546,7 +546,7 @@ GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
* @protected
*/
GMLBase.prototype.RING_PARSERS = {

View File

@@ -19,7 +19,7 @@ import {createElementNS, makeArrayPusher, makeArraySerializer, makeChildAppender
/**
* @const
* @type {Array.<null|string>}
* @type {Array<null|string>}
*/
const NAMESPACE_URIS = [
null,
@@ -38,7 +38,7 @@ const SCHEMA_LOCATION = 'http://www.topografix.com/GPX/1/1 ' +
/**
* @const
* @type {Object.<string, function(Node, Array.<*>): (module:ol/Feature|undefined)>}
* @type {Object<string, function(Node, Array<*>): (module:ol/Feature|undefined)>}
*/
const FEATURE_READER = {
'rte': readRte,
@@ -49,7 +49,7 @@ const FEATURE_READER = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const GPX_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -61,7 +61,7 @@ const GPX_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const LINK_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -72,7 +72,7 @@ const LINK_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const GPX_SERIALIZERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -138,7 +138,7 @@ class GPX extends XMLFeature {
}
/**
* @param {Array.<module:ol/Feature>} features List of features.
* @param {Array<module:ol/Feature>} features List of features.
* @private
*/
handleReadExtensions_(features) {
@@ -182,7 +182,7 @@ class GPX extends XMLFeature {
return [];
}
if (node.localName == 'gpx') {
/** @type {Array.<module:ol/Feature>} */
/** @type {Array<module:ol/Feature>} */
const features = pushParseAndPop([], GPX_PARSERS,
node, [this.getReadOptions(node, opt_options)]);
if (features) {
@@ -200,7 +200,7 @@ class GPX extends XMLFeature {
* LineString geometries are output as routes (`<rte>`), and MultiLineString
* as tracks (`<trk>`).
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node.
* @override
@@ -225,7 +225,7 @@ class GPX extends XMLFeature {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const RTE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -243,7 +243,7 @@ const RTE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const RTEPT_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -254,7 +254,7 @@ const RTEPT_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TRK_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -272,7 +272,7 @@ const TRK_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TRKSEG_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -282,7 +282,7 @@ const TRKSEG_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TRKPT_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -293,7 +293,7 @@ const TRKPT_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const WPT_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -321,14 +321,14 @@ const WPT_PARSERS = makeStructureNS(
/**
* @const
* @type {Array.<string>}
* @type {Array<string>}
*/
const LINK_SEQUENCE = ['text', 'type'];
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const LINK_SERIALIZERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -339,7 +339,7 @@ const LINK_SERIALIZERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Array.<string>>}
* @type {Object<string, Array<string>>}
*/
const RTE_SEQUENCE = makeStructureNS(
NAMESPACE_URIS, [
@@ -349,7 +349,7 @@ const RTE_SEQUENCE = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const RTE_SERIALIZERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -366,7 +366,7 @@ const RTE_SERIALIZERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Array.<string>>}
* @type {Object<string, Array<string>>}
*/
const RTEPT_TYPE_SEQUENCE = makeStructureNS(
NAMESPACE_URIS, [
@@ -376,7 +376,7 @@ const RTEPT_TYPE_SEQUENCE = makeStructureNS(
/**
* @const
* @type {Object.<string, Array.<string>>}
* @type {Object<string, Array<string>>}
*/
const TRK_SEQUENCE = makeStructureNS(
NAMESPACE_URIS, [
@@ -386,7 +386,7 @@ const TRK_SEQUENCE = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const TRK_SERIALIZERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -403,14 +403,14 @@ const TRK_SERIALIZERS = makeStructureNS(
/**
* @const
* @type {function(*, Array.<*>, string=): (Node|undefined)}
* @type {function(*, Array<*>, string=): (Node|undefined)}
*/
const TRKSEG_NODE_FACTORY = makeSimpleNodeFactory('trkpt');
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const TRKSEG_SERIALIZERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -420,7 +420,7 @@ const TRKSEG_SERIALIZERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Array.<string>>}
* @type {Object<string, Array<string>>}
*/
const WPT_TYPE_SEQUENCE = makeStructureNS(
NAMESPACE_URIS, [
@@ -432,7 +432,7 @@ const WPT_TYPE_SEQUENCE = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const WPT_TYPE_SERIALIZERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -459,7 +459,7 @@ const WPT_TYPE_SERIALIZERS = makeStructureNS(
/**
* @const
* @type {Object.<string, string>}
* @type {Object<string, string>}
*/
const GEOMETRY_TYPE_TO_NODENAME = {
'Point': 'wpt',
@@ -470,7 +470,7 @@ const GEOMETRY_TYPE_TO_NODENAME = {
/**
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
*/
@@ -487,11 +487,11 @@ function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) {
/**
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {module:ol/format/GPX~LayoutOptions} layoutOptions Layout options.
* @param {Node} node Node.
* @param {!Object} values Values.
* @return {Array.<number>} Flat coordinates.
* @return {Array<number>} Flat coordinates.
*/
function appendCoordinate(flatCoordinates, layoutOptions, node, values) {
flatCoordinates.push(
@@ -520,8 +520,8 @@ function appendCoordinate(flatCoordinates, layoutOptions, node, values) {
* and ends arrays by shrinking them accordingly (removing unused zero entries).
*
* @param {module:ol/format/GPX~LayoutOptions} layoutOptions Layout options.
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {Array.<number>=} ends Ends.
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {Array<number>=} ends Ends.
* @return {module:ol/geom/GeometryLayout} Layout.
*/
function applyLayoutOptions(layoutOptions, flatCoordinates, ends) {
@@ -561,7 +561,7 @@ function applyLayoutOptions(layoutOptions, flatCoordinates, ends) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function parseLink(node, objectStack) {
const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
@@ -575,7 +575,7 @@ function parseLink(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function parseExtensions(node, objectStack) {
const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
@@ -585,13 +585,13 @@ function parseExtensions(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function parseRtePt(node, objectStack) {
const values = pushParseAndPop({}, RTEPT_PARSERS, node, objectStack);
if (values) {
const rteValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
const flatCoordinates = /** @type {Array.<number>} */ (rteValues['flatCoordinates']);
const flatCoordinates = /** @type {Array<number>} */ (rteValues['flatCoordinates']);
const layoutOptions = /** @type {module:ol/format/GPX~LayoutOptions} */ (rteValues['layoutOptions']);
appendCoordinate(flatCoordinates, layoutOptions, node, values);
}
@@ -600,13 +600,13 @@ function parseRtePt(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function parseTrkPt(node, objectStack) {
const values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack);
if (values) {
const trkValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
const flatCoordinates = /** @type {Array.<number>} */ (trkValues['flatCoordinates']);
const flatCoordinates = /** @type {Array<number>} */ (trkValues['flatCoordinates']);
const layoutOptions = /** @type {module:ol/format/GPX~LayoutOptions} */ (trkValues['layoutOptions']);
appendCoordinate(flatCoordinates, layoutOptions, node, values);
}
@@ -615,21 +615,21 @@ function parseTrkPt(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function parseTrkSeg(node, objectStack) {
const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
parseNode(TRKSEG_PARSERS, node, objectStack);
const flatCoordinates = /** @type {Array.<number>} */
const flatCoordinates = /** @type {Array<number>} */
(values['flatCoordinates']);
const ends = /** @type {Array.<number>} */ (values['ends']);
const ends = /** @type {Array<number>} */ (values['ends']);
ends.push(flatCoordinates.length);
}
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/Feature|undefined} Track.
*/
function readRte(node, objectStack) {
@@ -641,7 +641,7 @@ function readRte(node, objectStack) {
if (!values) {
return undefined;
}
const flatCoordinates = /** @type {Array.<number>} */
const flatCoordinates = /** @type {Array<number>} */
(values['flatCoordinates']);
delete values['flatCoordinates'];
const layoutOptions = /** @type {module:ol/format/GPX~LayoutOptions} */ (values['layoutOptions']);
@@ -657,7 +657,7 @@ function readRte(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/Feature|undefined} Track.
*/
function readTrk(node, objectStack) {
@@ -670,10 +670,10 @@ function readTrk(node, objectStack) {
if (!values) {
return undefined;
}
const flatCoordinates = /** @type {Array.<number>} */
const flatCoordinates = /** @type {Array<number>} */
(values['flatCoordinates']);
delete values['flatCoordinates'];
const ends = /** @type {Array.<number>} */ (values['ends']);
const ends = /** @type {Array<number>} */ (values['ends']);
delete values['ends'];
const layoutOptions = /** @type {module:ol/format/GPX~LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
@@ -688,7 +688,7 @@ function readTrk(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/Feature|undefined} Waypoint.
*/
function readWpt(node, objectStack) {
@@ -711,7 +711,7 @@ function readWpt(node, objectStack) {
/**
* @param {Node} node Node.
* @param {string} value Value for the link's `href` attribute.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeLink(node, value, objectStack) {
node.setAttribute('href', value);
@@ -730,7 +730,7 @@ function writeLink(node, value, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function writeWptType(node, coordinate, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -774,7 +774,7 @@ function writeWptType(node, coordinate, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function writeRte(node, feature, objectStack) {
const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);
@@ -798,7 +798,7 @@ function writeRte(node, feature, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function writeTrk(node, feature, objectStack) {
const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);
@@ -823,7 +823,7 @@ function writeTrk(node, feature, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/geom/LineString} lineString LineString.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function writeTrkSeg(node, lineString, objectStack) {
/** @type {module:ol/xml~NodeStackItem} */
@@ -838,7 +838,7 @@ function writeTrkSeg(node, lineString, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function writeWpt(node, feature, objectStack) {
const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]);

View File

@@ -115,7 +115,7 @@ class GeoJSON extends JSONFeature {
*/
readFeaturesFromObject(object, opt_options) {
const geoJSONObject = /** @type {GeoJSONObject} */ (object);
/** @type {Array.<module:ol/Feature>} */
/** @type {Array<module:ol/Feature>} */
let features = null;
if (geoJSONObject.type === 'FeatureCollection') {
const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (object);
@@ -196,7 +196,7 @@ class GeoJSON extends JSONFeature {
/**
* Encode an array of features as a GeoJSON object.
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {GeoJSONFeatureCollection} GeoJSON Object.
* @override
@@ -231,7 +231,7 @@ class GeoJSON extends JSONFeature {
/**
* @const
* @type {Object.<string, function(GeoJSONObject): module:ol/geom/Geometry>}
* @type {Object<string, function(GeoJSONObject): module:ol/geom/Geometry>}
*/
const GEOMETRY_READERS = {
'Point': readPointGeometry,
@@ -246,7 +246,7 @@ const GEOMETRY_READERS = {
/**
* @const
* @type {Object.<string, function(module:ol/geom/Geometry, module:ol/format/Feature~WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
* @type {Object<string, function(module:ol/geom/Geometry, module:ol/format/Feature~WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/
const GEOMETRY_WRITERS = {
'Point': writePointGeometry,

View File

@@ -94,7 +94,7 @@ class IGC extends TextFeature {
readFeatureFromText(text, opt_options) {
const altitudeMode = this.altitudeMode_;
const lines = text.split(NEWLINE_RE);
/** @type {Object.<string, string>} */
/** @type {Object<string, string>} */
const properties = {};
const flatCoordinates = [];
let year = 2000;
@@ -175,29 +175,6 @@ class IGC extends TextFeature {
}
}
/**
* Not implemented.
* @inheritDoc
*/
writeFeatureText(feature, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeFeaturesText(features, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeGeometryText(geometry, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
readGeometryFromText(text, opt_options) {}
}
export default IGC;

View File

@@ -44,7 +44,7 @@ class JSONFeature extends FeatureFormat {
*
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
* @api
*/
readFeatures(source, opt_options) {
@@ -66,7 +66,7 @@ class JSONFeature extends FeatureFormat {
* @param {Object} object Object.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @protected
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
*/
readFeaturesFromObject(object, opt_options) {}
@@ -134,7 +134,7 @@ class JSONFeature extends FeatureFormat {
/**
* Encode an array of features as string.
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Encoded features.
* @api
@@ -145,7 +145,7 @@ class JSONFeature extends FeatureFormat {
/**
* @abstract
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ import RenderFeature from '../render/Feature.js';
/**
* @typedef {Object} Options
* @property {function((module:ol/geom/Geometry|Object.<string,*>)=)|function(module:ol/geom/GeometryType,Array.<number>,(Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)} [featureClass]
* @property {function((module:ol/geom/Geometry|Object<string,*>)=)|function(module:ol/geom/GeometryType,Array<number>,(Array<number>|Array<Array<number>>),Object<string,*>,number)} [featureClass]
* Class for features returned by {@link module:ol/format/MVT#readFeatures}. Set to
* {@link module:ol/Feature~Feature} to get full editing and geometry support at the cost of
* decreased rendering performance. The default is {@link module:ol/render/Feature~RenderFeature},
@@ -32,7 +32,7 @@ import RenderFeature from '../render/Feature.js';
* features.
* @property {string} [layerName='layer'] Name of the feature attribute that
* holds the layer name.
* @property {Array.<string>} [layers] Layers to read features from. If not
* @property {Array<string>} [layers] Layers to read features from. If not
* provided, features will be read from all layers.
*/
@@ -64,9 +64,9 @@ class MVT extends FeatureFormat {
/**
* @private
* @type {function((module:ol/geom/Geometry|Object.<string,*>)=)|
* function(module:ol/geom/GeometryType,Array.<number>,
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
* @type {function((module:ol/geom/Geometry|Object<string,*>)=)|
* function(module:ol/geom/GeometryType,Array<number>,
* (Array<number>|Array<Array<number>>),Object<string,*>,number)}
*/
this.featureClass_ = options.featureClass ?
options.featureClass : RenderFeature;
@@ -85,7 +85,7 @@ class MVT extends FeatureFormat {
/**
* @private
* @type {Array.<string>}
* @type {Array<string>}
*/
this.layers_ = options.layers ? options.layers : null;
@@ -103,8 +103,8 @@ class MVT extends FeatureFormat {
* @suppress {missingProperties}
* @param {Object} pbf PBF.
* @param {Object} feature Raw feature.
* @param {Array.<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array.<number>} ends Array to store ends in.
* @param {Array<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array<number>} ends Array to store ends in.
* @private
*/
readRawGeometry_(pbf, feature, flatCoordinates, ends) {
@@ -252,7 +252,7 @@ class MVT extends FeatureFormat {
const pbf = new PBF(/** @type {ArrayBuffer} */ (source));
const pbfLayers = pbf.readFields(layersPBFReader, {});
/** @type {Array.<module:ol/Feature|module:ol/render/Feature>} */
/** @type {Array<module:ol/Feature|module:ol/render/Feature>} */
const features = [];
for (const name in pbfLayers) {
if (layers && layers.indexOf(name) == -1) {
@@ -280,42 +280,13 @@ class MVT extends FeatureFormat {
/**
* Sets the layers that features will be read from.
* @param {Array.<string>} layers Layers.
* @param {Array<string>} layers Layers.
* @api
*/
setLayers(layers) {
this.layers_ = layers;
}
/**
* Not implemented.
* @override
*/
readFeature() {}
/**
* Not implemented.
* @override
*/
readGeometry() {}
/**
* Not implemented.
* @override
*/
writeFeature() {}
/**
* Not implemented.
* @override
*/
writeGeometry() {}
/**
* Not implemented.
* @override
*/
writeFeatures() {}
}

View File

@@ -17,14 +17,14 @@ import {pushParseAndPop, makeStructureNS} from '../xml.js';
/**
* @const
* @type {Array.<null>}
* @type {Array<null>}
*/
const NAMESPACE_URIS = [null];
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const WAY_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -35,7 +35,7 @@ const WAY_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -75,7 +75,7 @@ class OSMXML extends XMLFeature {
// parse nodes in ways
for (let j = 0; j < state.ways.length; j++) {
const values = /** @type {Object} */ (state.ways[j]);
/** @type {Array.<number>} */
/** @type {Array<number>} */
const flatCoordinates = [];
for (let i = 0, ii = values.ndrefs.length; i < ii; i++) {
const point = state.nodes[values.ndrefs[i]];
@@ -101,29 +101,12 @@ class OSMXML extends XMLFeature {
return [];
}
/**
* Not implemented.
* @inheritDoc
*/
writeFeatureNode(feature, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeFeaturesNode(features, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeGeometryNode(geometry, opt_options) {}
}
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const NODE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -133,7 +116,7 @@ const NODE_PARSERS = makeStructureNS(
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function readNode(node, objectStack) {
const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]);
@@ -162,7 +145,7 @@ function readNode(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function readWay(node, objectStack) {
const id = node.getAttribute('id');
@@ -178,7 +161,7 @@ function readWay(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function readNd(node, objectStack) {
const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
@@ -188,7 +171,7 @@ function readNd(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function readTag(node, objectStack) {
const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);

View File

@@ -9,14 +9,14 @@ import {makeObjectPropertyPusher, makeObjectPropertySetter, makeStructureNS, pus
/**
* @const
* @type {Array.<null|string>}
* @type {Array<null|string>}
*/
const NAMESPACE_URIS = [null, 'http://www.opengis.net/ows/1.1'];
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -56,7 +56,7 @@ class OWS extends XML {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const ADDRESS_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -71,7 +71,7 @@ const ADDRESS_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const ALLOWED_VALUES_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -81,7 +81,7 @@ const ALLOWED_VALUES_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CONSTRAINT_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -91,7 +91,7 @@ const CONSTRAINT_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CONTACT_INFO_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -102,7 +102,7 @@ const CONTACT_INFO_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const DCP_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -112,7 +112,7 @@ const DCP_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const HTTP_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -123,7 +123,7 @@ const HTTP_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const OPERATION_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -133,7 +133,7 @@ const OPERATION_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const OPERATIONS_METADATA_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -143,7 +143,7 @@ const OPERATIONS_METADATA_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const PHONE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -154,7 +154,7 @@ const PHONE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const REQUEST_METHOD_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -164,7 +164,7 @@ const REQUEST_METHOD_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const SERVICE_CONTACT_PARSERS =
makeStructureNS(
@@ -177,7 +177,7 @@ const SERVICE_CONTACT_PARSERS =
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const SERVICE_IDENTIFICATION_PARSERS =
makeStructureNS(
@@ -193,7 +193,7 @@ const SERVICE_IDENTIFICATION_PARSERS =
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const SERVICE_PROVIDER_PARSERS =
makeStructureNS(
@@ -206,7 +206,7 @@ const SERVICE_PROVIDER_PARSERS =
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The address.
*/
function readAddress(node, objectStack) {
@@ -217,7 +217,7 @@ function readAddress(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The values.
*/
function readAllowedValues(node, objectStack) {
@@ -228,7 +228,7 @@ function readAllowedValues(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The constraint.
*/
function readConstraint(node, objectStack) {
@@ -244,7 +244,7 @@ function readConstraint(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The contact info.
*/
function readContactInfo(node, objectStack) {
@@ -255,7 +255,7 @@ function readContactInfo(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The DCP.
*/
function readDcp(node, objectStack) {
@@ -266,7 +266,7 @@ function readDcp(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The GET object.
*/
function readGet(node, objectStack) {
@@ -281,7 +281,7 @@ function readGet(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The HTTP object.
*/
function readHttp(node, objectStack) {
@@ -291,7 +291,7 @@ function readHttp(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The operation.
*/
function readOperation(node, objectStack) {
@@ -309,7 +309,7 @@ function readOperation(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The operations metadata.
*/
function readOperationsMetadata(node, objectStack) {
@@ -321,7 +321,7 @@ function readOperationsMetadata(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The phone.
*/
function readPhone(node, objectStack) {
@@ -332,7 +332,7 @@ function readPhone(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The service identification.
*/
function readServiceIdentification(node, objectStack) {
@@ -344,7 +344,7 @@ function readServiceIdentification(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The service contact.
*/
function readServiceContact(node, objectStack) {
@@ -356,7 +356,7 @@ function readServiceContact(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} The service provider.
*/
function readServiceProvider(node, objectStack) {
@@ -368,7 +368,7 @@ function readServiceProvider(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {string|undefined} The value.
*/
function readValue(node, objectStack) {

View File

@@ -138,7 +138,7 @@ class Polyline extends TextFeature {
*
* Attention: This function will modify the passed array!
*
* @param {Array.<number>} numbers A list of n-dimensional points.
* @param {Array<number>} numbers A list of n-dimensional points.
* @param {number} stride The number of dimension of the points in the list.
* @param {number=} opt_factor The factor by which the numbers will be
* multiplied. The remaining decimal places will get rounded away.
@@ -177,14 +177,14 @@ export function encodeDeltas(numbers, stride, opt_factor) {
* encoded string.
* @param {number=} opt_factor The factor by which the resulting numbers will
* be divided. Default is `1e5`.
* @return {Array.<number>} A list of n-dimensional points.
* @return {Array<number>} A list of n-dimensional points.
* @api
*/
export function decodeDeltas(encoded, stride, opt_factor) {
const factor = opt_factor ? opt_factor : 1e5;
let d;
/** @type {Array.<number>} */
/** @type {Array<number>} */
const lastNumbers = new Array(stride);
for (d = 0; d < stride; ++d) {
lastNumbers[d] = 0;
@@ -209,7 +209,7 @@ export function decodeDeltas(encoded, stride, opt_factor) {
*
* Attention: This function will modify the passed array!
*
* @param {Array.<number>} numbers A list of floating point numbers.
* @param {Array<number>} numbers A list of floating point numbers.
* @param {number=} opt_factor The factor by which the numbers will be
* multiplied. The remaining decimal places will get rounded away.
* Default is `1e5`.
@@ -232,7 +232,7 @@ export function encodeFloats(numbers, opt_factor) {
* @param {string} encoded An encoded string.
* @param {number=} opt_factor The factor by which the result will be divided.
* Default is `1e5`.
* @return {Array.<number>} A list of floating point numbers.
* @return {Array<number>} A list of floating point numbers.
* @api
*/
export function decodeFloats(encoded, opt_factor) {
@@ -250,7 +250,7 @@ export function decodeFloats(encoded, opt_factor) {
*
* Attention: This function will modify the passed array!
*
* @param {Array.<number>} numbers A list of signed integers.
* @param {Array<number>} numbers A list of signed integers.
* @return {string} The encoded string.
*/
export function encodeSignedIntegers(numbers) {
@@ -266,7 +266,7 @@ export function encodeSignedIntegers(numbers) {
* Decode a list of signed integers from an encoded string
*
* @param {string} encoded An encoded string.
* @return {Array.<number>} A list of signed integers.
* @return {Array<number>} A list of signed integers.
*/
export function decodeSignedIntegers(encoded) {
const numbers = decodeUnsignedIntegers(encoded);
@@ -281,7 +281,7 @@ export function decodeSignedIntegers(encoded) {
/**
* Encode a list of unsigned integers and return an encoded string
*
* @param {Array.<number>} numbers A list of unsigned integers.
* @param {Array<number>} numbers A list of unsigned integers.
* @return {string} The encoded string.
*/
export function encodeUnsignedIntegers(numbers) {
@@ -297,7 +297,7 @@ export function encodeUnsignedIntegers(numbers) {
* Decode a list of unsigned integers from an encoded string
*
* @param {string} encoded An encoded string.
* @return {Array.<number>} A list of unsigned integers.
* @return {Array<number>} A list of unsigned integers.
*/
export function decodeUnsignedIntegers(encoded) {
const numbers = [];

View File

@@ -50,7 +50,7 @@ class TextFeature extends FeatureFormat {
*
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
* @api
*/
readFeatures(source, opt_options) {
@@ -62,7 +62,7 @@ class TextFeature extends FeatureFormat {
* @param {string} text Text.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @protected
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
*/
readFeaturesFromText(text, opt_options) {}
@@ -133,7 +133,7 @@ class TextFeature extends FeatureFormat {
/**
* Encode an array of features as string.
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Encoded features.
* @api
@@ -144,7 +144,7 @@ class TextFeature extends FeatureFormat {
/**
* @abstract
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.

View File

@@ -32,7 +32,7 @@ import {get as getProjection} from '../proj.js';
* ```
* will result in features that have a property `'layer'` set to `'example'`.
* When not set, no property will be added to features.
* @property {Array.<string>} [layers] Names of the TopoJSON topology's
* @property {Array<string>} [layers] Names of the TopoJSON topology's
* `objects`'s children to read features from. If not provided, features will
* be read from all children.
*/
@@ -62,7 +62,7 @@ class TopoJSON extends JSONFeature {
/**
* @private
* @type {Array.<string>}
* @type {Array<string>}
*/
this.layers_ = options.layers ? options.layers : null;
@@ -91,7 +91,7 @@ class TopoJSON extends JSONFeature {
if (transform) {
transformArcs(arcs, scale, translate);
}
/** @type {Array.<module:ol/Feature>} */
/** @type {Array<module:ol/Feature>} */
const features = [];
const topoJSONFeatures = topoJSONTopology.objects;
const property = this.layerName_;
@@ -123,41 +123,12 @@ class TopoJSON extends JSONFeature {
return this.dataProjection;
}
/**
* Not implemented.
* @inheritDoc
*/
writeFeatureObject(feature, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeFeaturesObject(features, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeGeometryObject(geometry, opt_options) {}
/**
* Not implemented.
* @override
*/
readGeometryFromObject() {}
/**
* Not implemented.
* @override
*/
readFeatureFromObject() {}
}
/**
* @const
* @type {Object.<string, function(TopoJSONGeometry, Array, ...Array): module:ol/geom/Geometry>}
* @type {Object<string, function(TopoJSONGeometry, Array, ...Array): module:ol/geom/Geometry>}
*/
const GEOMETRY_READERS = {
'Point': readPointGeometry,
@@ -171,14 +142,14 @@ const GEOMETRY_READERS = {
/**
* Concatenate arcs into a coordinate array.
* @param {Array.<number>} indices Indices of arcs to concatenate. Negative
* @param {Array<number>} indices Indices of arcs to concatenate. Negative
* values indicate arcs need to be reversed.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs (already
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs (already
* transformed).
* @return {Array.<module:ol/coordinate~Coordinate>} Coordinates array.
* @return {Array<module:ol/coordinate~Coordinate>} Coordinates array.
*/
function concatenateArcs(indices, arcs) {
/** @type {Array.<module:ol/coordinate~Coordinate>} */
/** @type {Array<module:ol/coordinate~Coordinate>} */
const coordinates = [];
let index, arc;
for (let i = 0, ii = indices.length; i < ii; ++i) {
@@ -208,8 +179,8 @@ function concatenateArcs(indices, arcs) {
* Create a point from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
* @return {module:ol/geom/Point} Geometry.
*/
function readPointGeometry(object, scale, translate) {
@@ -225,8 +196,8 @@ function readPointGeometry(object, scale, translate) {
* Create a multi-point from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
* @return {module:ol/geom/MultiPoint} Geometry.
*/
function readMultiPointGeometry(object, scale, translate) {
@@ -244,7 +215,7 @@ function readMultiPointGeometry(object, scale, translate) {
* Create a linestring from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @return {module:ol/geom/LineString} Geometry.
*/
function readLineStringGeometry(object, arcs) {
@@ -257,7 +228,7 @@ function readLineStringGeometry(object, arcs) {
* Create a multi-linestring from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @return {module:ol/geom/MultiLineString} Geometry.
*/
function readMultiLineStringGeometry(object, arcs) {
@@ -273,7 +244,7 @@ function readMultiLineStringGeometry(object, arcs) {
* Create a polygon from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @return {module:ol/geom/Polygon} Geometry.
*/
function readPolygonGeometry(object, arcs) {
@@ -289,7 +260,7 @@ function readPolygonGeometry(object, arcs) {
* Create a multi-polygon from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON object.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @return {module:ol/geom/MultiPolygon} Geometry.
*/
function readMultiPolygonGeometry(object, arcs) {
@@ -313,14 +284,14 @@ function readMultiPolygonGeometry(object, arcs) {
*
* @param {TopoJSONGeometryCollection} collection TopoJSON Geometry
* object.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
* object to.
* @param {string} name Name of the `Topology`'s child object.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Read options.
* @return {Array.<module:ol/Feature>} Array of features.
* @return {Array<module:ol/Feature>} Array of features.
*/
function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) {
const geometries = collection.geometries;
@@ -337,9 +308,9 @@ function readFeaturesFromGeometryCollection(collection, arcs, scale, translate,
* Create a feature from a TopoJSON geometry object.
*
* @param {TopoJSONGeometry} object TopoJSON geometry object.
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
* object to.
* @param {string} name Name of the `Topology`'s child object.
@@ -379,9 +350,9 @@ function readFeatureFromGeometry(object, arcs, scale, translate, property, name,
* Apply a linear transform to array of arcs. The provided array of arcs is
* modified in place.
*
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<Array<module:ol/coordinate~Coordinate>>} arcs Array of arcs.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
*/
function transformArcs(arcs, scale, translate) {
for (let i = 0, ii = arcs.length; i < ii; ++i) {
@@ -393,9 +364,9 @@ function transformArcs(arcs, scale, translate) {
/**
* Apply a linear transform to an arc. The provided arc is modified in place.
*
* @param {Array.<module:ol/coordinate~Coordinate>} arc Arc.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<module:ol/coordinate~Coordinate>} arc Arc.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
*/
function transformArc(arc, scale, translate) {
let x = 0;
@@ -416,8 +387,8 @@ function transformArc(arc, scale, translate) {
* place.
*
* @param {module:ol/coordinate~Coordinate} vertex Vertex.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {Array<number>} scale Scale for each dimension.
* @param {Array<number>} translate Translation for each dimension.
*/
function transformVertex(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0];

View File

@@ -18,7 +18,7 @@ import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender,
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const FEATURE_COLLECTION_PARSERS = {
'http://www.opengis.net/gml': {
@@ -30,7 +30,7 @@ const FEATURE_COLLECTION_PARSERS = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TRANSACTION_SUMMARY_PARSERS = {
'http://www.opengis.net/wfs': {
@@ -43,7 +43,7 @@ const TRANSACTION_SUMMARY_PARSERS = {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TRANSACTION_RESPONSE_PARSERS = {
'http://www.opengis.net/wfs': {
@@ -56,7 +56,7 @@ const TRANSACTION_RESPONSE_PARSERS = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const QUERY_SERIALIZERS = {
'http://www.opengis.net/wfs': {
@@ -66,7 +66,7 @@ const QUERY_SERIALIZERS = {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const TRANSACTION_SERIALIZERS = {
'http://www.opengis.net/wfs': {
@@ -81,8 +81,8 @@ const TRANSACTION_SERIALIZERS = {
/**
* @typedef {Object} Options
* @property {Object.<string, string>|string} [featureNS] The namespace URI used for features.
* @property {Array.<string>|string} [featureType] The feature type to parse. Only used for read operations.
* @property {Object<string, string>|string} [featureNS] The namespace URI used for features.
* @property {Array<string>|string} [featureType] The feature type to parse. Only used for read operations.
* @property {module:ol/format/GMLBase} [gmlFormat] The GML format to use to parse the response. Default is `ol/format/GML3`.
* @property {string} [schemaLocation] Optional schemaLocation to use for serialization, this will override the default.
*/
@@ -92,14 +92,14 @@ const TRANSACTION_SERIALIZERS = {
* @typedef {Object} WriteGetFeatureOptions
* @property {string} featureNS The namespace URI used for features.
* @property {string} featurePrefix The prefix for the feature namespace.
* @property {Array.<string>} featureTypes The feature type names.
* @property {Array<string>} featureTypes The feature type names.
* @property {string} [srsName] SRS name. No srsName attribute will be set on
* geometries when this is not provided.
* @property {string} [handle] Handle.
* @property {string} [outputFormat] Output format.
* @property {number} [maxFeatures] Maximum number of features to fetch.
* @property {string} [geometryName] Geometry name to use in a BBOX filter.
* @property {Array.<string>} [propertyNames] Optional list of property names to serialize.
* @property {Array<string>} [propertyNames] Optional list of property names to serialize.
* @property {number} [startIndex] Start index to use for WFS paging. This is a
* WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services.
* @property {number} [count] Number of features to retrieve when paging. This is a
@@ -123,7 +123,7 @@ const TRANSACTION_SERIALIZERS = {
* @property {string} [handle] Handle.
* @property {boolean} [hasZ] Must be set to true if the transaction is for
* a 3D layer. This will allow the Z coordinate to be included in the transaction.
* @property {Array.<Object>} nativeElements Native elements. Currently not supported.
* @property {Array<Object>} nativeElements Native elements. Currently not supported.
* @property {module:ol/format/GMLBase~Options} [gmlOptions] GML options for the WFS transaction writer.
* @property {string} [version='1.1.0'] WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`.
*/
@@ -143,7 +143,7 @@ const TRANSACTION_SERIALIZERS = {
* @property {number} totalDeleted
* @property {number} totalInserted
* @property {number} totalUpdated
* @property {Array.<string>} insertIds
* @property {Array<string>} insertIds
*/
@@ -178,7 +178,7 @@ const FESNS = 'http://www.opengis.net/fes';
/**
* @type {Object.<string, string>}
* @type {Object<string, string>}
*/
const SCHEMA_LOCATIONS = {
'1.1.0': 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
@@ -214,13 +214,13 @@ class WFS extends XMLFeature {
/**
* @private
* @type {Array.<string>|string|undefined}
* @type {Array<string>|string|undefined}
*/
this.featureType_ = options.featureType;
/**
* @private
* @type {Object.<string, string>|string|undefined}
* @type {Object<string, string>|string|undefined}
*/
this.featureNS_ = options.featureNS;
@@ -240,14 +240,14 @@ class WFS extends XMLFeature {
}
/**
* @return {Array.<string>|string|undefined} featureType
* @return {Array<string>|string|undefined} featureType
*/
getFeatureType() {
return this.featureType_;
}
/**
* @param {Array.<string>|string|undefined} featureType Feature type(s) to parse.
* @param {Array<string>|string|undefined} featureType Feature type(s) to parse.
*/
setFeatureType(featureType) {
this.featureType_ = featureType;
@@ -429,16 +429,16 @@ class WFS extends XMLFeature {
};
assert(Array.isArray(options.featureTypes),
11); // `options.featureTypes` should be an Array
writeGetFeature(node, /** @type {!Array.<string>} */ (options.featureTypes), [context]);
writeGetFeature(node, /** @type {!Array<string>} */ (options.featureTypes), [context]);
return node;
}
/**
* Encode format as WFS `Transaction` and return the Node.
*
* @param {Array.<module:ol/Feature>} inserts The features to insert.
* @param {Array.<module:ol/Feature>} updates The features to update.
* @param {Array.<module:ol/Feature>} deletes The features to delete.
* @param {Array<module:ol/Feature>} inserts The features to insert.
* @param {Array<module:ol/Feature>} updates The features to update.
* @param {Array<module:ol/Feature>} deletes The features to delete.
* @param {module:ol/format/WFS~WriteTransactionOptions} options Write options.
* @return {Node} Result.
* @api
@@ -538,7 +538,7 @@ class WFS extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Transaction Summary.
*/
function readTransactionSummary(node, objectStack) {
@@ -549,7 +549,7 @@ function readTransactionSummary(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const OGC_FID_PARSERS = {
'http://www.opengis.net/ogc': {
@@ -562,7 +562,7 @@ const OGC_FID_PARSERS = {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function fidParser(node, objectStack) {
parseNode(OGC_FID_PARSERS, node, objectStack);
@@ -571,7 +571,7 @@ function fidParser(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const INSERT_RESULTS_PARSERS = {
'http://www.opengis.net/wfs': {
@@ -582,8 +582,8 @@ const INSERT_RESULTS_PARSERS = {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<string>|undefined} Insert results.
* @param {Array<*>} objectStack Object stack.
* @return {Array<string>|undefined} Insert results.
*/
function readInsertResults(node, objectStack) {
return pushParseAndPop(
@@ -594,7 +594,7 @@ function readInsertResults(node, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeFeature(node, feature, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -614,7 +614,7 @@ function writeFeature(node, feature, objectStack) {
/**
* @param {Node} node Node.
* @param {number|string} fid Feature identifier.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeOgcFidFilter(node, fid, objectStack) {
const filter = createElementNS(OGCNS, 'Filter');
@@ -645,7 +645,7 @@ function getTypeName(featurePrefix, featureType) {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeDelete(node, feature, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -666,7 +666,7 @@ function writeDelete(node, feature, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeUpdate(node, feature, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -706,7 +706,7 @@ function writeUpdate(node, feature, objectStack) {
/**
* @param {Node} node Node.
* @param {Object} pair Property name and value.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeProperty(node, pair, objectStack) {
const name = createElementNS(WFSNS, 'Name');
@@ -734,9 +734,8 @@ function writeProperty(node, pair, objectStack) {
/**
* @param {Node} node Node.
* @param {{vendorId: string, safeToIgnore: boolean, value: string}}
* nativeElement The native element.
* @param {Array.<*>} objectStack Node stack.
* @param {{vendorId: string, safeToIgnore: boolean, value: string}} nativeElement The native element.
* @param {Array<*>} objectStack Node stack.
*/
function writeNative(node, nativeElement, objectStack) {
if (nativeElement.vendorId) {
@@ -752,7 +751,7 @@ function writeNative(node, nativeElement, objectStack) {
/**
* @type {Object.<string, Object.<string, module:ol/xml~Serializer>>}
* @type {Object<string, Object<string, module:ol/xml~Serializer>>}
*/
const GETFEATURE_SERIALIZERS = {
'http://www.opengis.net/wfs': {
@@ -783,7 +782,7 @@ const GETFEATURE_SERIALIZERS = {
/**
* @param {Node} node Node.
* @param {string} featureType Feature type.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeQuery(node, featureType, objectStack) {
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
@@ -823,7 +822,7 @@ function writeQuery(node, featureType, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeFilterCondition(node, filter, objectStack) {
/** @type {module:ol/xml~NodeStackItem} */
@@ -838,7 +837,7 @@ function writeFilterCondition(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/Bbox} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeBboxFilter(node, filter, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -852,7 +851,7 @@ function writeBboxFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/Contains} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeContainsFilter(node, filter, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -866,7 +865,7 @@ function writeContainsFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/Intersects} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeIntersectsFilter(node, filter, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -880,7 +879,7 @@ function writeIntersectsFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/Within} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeWithinFilter(node, filter, objectStack) {
const context = objectStack[objectStack.length - 1];
@@ -894,7 +893,7 @@ function writeWithinFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/During} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeDuringFilter(node, filter, objectStack) {
@@ -919,7 +918,7 @@ function writeDuringFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/LogicalNary} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeLogicalFilter(node, filter, objectStack) {
/** @type {module:ol/xml~NodeStackItem} */
@@ -938,7 +937,7 @@ function writeLogicalFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/Not} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeNotFilter(node, filter, objectStack) {
/** @type {module:ol/xml~NodeStackItem} */
@@ -954,7 +953,7 @@ function writeNotFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/ComparisonBinary} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeComparisonFilter(node, filter, objectStack) {
if (filter.matchCase !== undefined) {
@@ -968,7 +967,7 @@ function writeComparisonFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/IsNull} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeIsNullFilter(node, filter, objectStack) {
writeOgcPropertyName(node, filter.propertyName);
@@ -978,7 +977,7 @@ function writeIsNullFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/IsBetween} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeIsBetweenFilter(node, filter, objectStack) {
writeOgcPropertyName(node, filter.propertyName);
@@ -996,7 +995,7 @@ function writeIsBetweenFilter(node, filter, objectStack) {
/**
* @param {Node} node Node.
* @param {module:ol/format/filter/IsLike} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<*>} objectStack Node stack.
*/
function writeIsLikeFilter(node, filter, objectStack) {
node.setAttribute('wildCard', filter.wildCard);
@@ -1070,8 +1069,8 @@ export function writeFilter(filter) {
/**
* @param {Node} node Node.
* @param {Array.<string>} featureTypes Feature types.
* @param {Array.<*>} objectStack Node stack.
* @param {Array<string>} featureTypes Feature types.
* @param {Array<*>} objectStack Node stack.
*/
function writeGetFeature(node, featureTypes, objectStack) {
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);

View File

@@ -85,7 +85,7 @@ const TokenType = {
/**
* @const
* @type {Object.<string, string>}
* @type {Object<string, string>}
*/
const WKTGeometryType = {};
for (const type in GeometryType) {
@@ -321,7 +321,7 @@ class Parser {
}
/**
* @return {!Array.<module:ol/geom/Geometry>} A collection of geometries.
* @return {!Array<module:ol/geom/Geometry>} A collection of geometries.
* @private
*/
parseGeometryCollectionText_() {
@@ -340,7 +340,7 @@ class Parser {
}
/**
* @return {Array.<number>} All values in a point.
* @return {Array<number>} All values in a point.
* @private
*/
parsePointText_() {
@@ -356,7 +356,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} All points in a linestring.
* @return {!Array<!Array<number>>} All points in a linestring.
* @private
*/
parseLineStringText_() {
@@ -372,7 +372,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} All points in a polygon.
* @return {!Array<!Array<number>>} All points in a polygon.
* @private
*/
parsePolygonText_() {
@@ -388,7 +388,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} All points in a multipoint.
* @return {!Array<!Array<number>>} All points in a multipoint.
* @private
*/
parseMultiPointText_() {
@@ -409,7 +409,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} All linestring points
* @return {!Array<!Array<number>>} All linestring points
* in a multilinestring.
* @private
*/
@@ -426,7 +426,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} All polygon points in a multipolygon.
* @return {!Array<!Array<number>>} All polygon points in a multipolygon.
* @private
*/
parseMultiPolygonText_() {
@@ -442,7 +442,7 @@ class Parser {
}
/**
* @return {!Array.<number>} A point.
* @return {!Array<number>} A point.
* @private
*/
parsePoint_() {
@@ -463,7 +463,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} An array of points.
* @return {!Array<!Array<number>>} An array of points.
* @private
*/
parsePointList_() {
@@ -475,7 +475,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} An array of points.
* @return {!Array<!Array<number>>} An array of points.
* @private
*/
parsePointTextList_() {
@@ -487,7 +487,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} An array of points.
* @return {!Array<!Array<number>>} An array of points.
* @private
*/
parseLineStringTextList_() {
@@ -499,7 +499,7 @@ class Parser {
}
/**
* @return {!Array.<!Array.<number>>} An array of points.
* @return {!Array<!Array<number>>} An array of points.
* @private
*/
parsePolygonTextList_() {
@@ -838,7 +838,7 @@ function encodeGeometryLayout(geom) {
/**
* @const
* @type {Object.<string, function(module:ol/geom/Geometry): string>}
* @type {Object<string, function(module:ol/geom/Geometry): string>}
*/
const GeometryEncoder = {
'Point': encodePointGeometry,

View File

@@ -10,7 +10,7 @@ import {makeArrayPusher, makeObjectPropertyPusher, makeObjectPropertySetter,
/**
* @const
* @type {Array.<null|string>}
* @type {Array<null|string>}
*/
const NAMESPACE_URIS = [
null,
@@ -20,7 +20,7 @@ const NAMESPACE_URIS = [
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -31,7 +31,7 @@ const PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CAPABILITY_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -84,7 +84,7 @@ class WMSCapabilities extends XML {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const SERVICE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -104,7 +104,7 @@ const SERVICE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CONTACT_INFORMATION_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -119,7 +119,7 @@ const CONTACT_INFORMATION_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CONTACT_PERSON_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -130,7 +130,7 @@ const CONTACT_PERSON_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CONTACT_ADDRESS_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -145,7 +145,7 @@ const CONTACT_ADDRESS_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const EXCEPTION_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -155,7 +155,7 @@ const EXCEPTION_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const LAYER_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -182,7 +182,7 @@ const LAYER_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const ATTRIBUTION_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -194,7 +194,7 @@ const ATTRIBUTION_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS =
makeStructureNS(NAMESPACE_URIS, {
@@ -207,7 +207,7 @@ const EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS =
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const REQUEST_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -219,7 +219,7 @@ const REQUEST_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const OPERATIONTYPE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -230,7 +230,7 @@ const OPERATIONTYPE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const DCPTYPE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -240,7 +240,7 @@ const DCPTYPE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const HTTP_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -251,7 +251,7 @@ const HTTP_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const STYLE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -266,7 +266,7 @@ const STYLE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const FORMAT_ONLINERESOURCE_PARSERS =
makeStructureNS(NAMESPACE_URIS, {
@@ -277,7 +277,7 @@ const FORMAT_ONLINERESOURCE_PARSERS =
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const KEYWORDLIST_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -287,7 +287,7 @@ const KEYWORDLIST_PARSERS = makeStructureNS(
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object.
*/
function readAttribution(node, objectStack) {
@@ -297,7 +297,7 @@ function readAttribution(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object} Bounding box object.
*/
function readBoundingBox(node, objectStack) {
@@ -323,7 +323,7 @@ function readBoundingBox(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {module:ol/extent~Extent|undefined} Bounding box object.
*/
function readEXGeographicBoundingBox(node, objectStack) {
@@ -355,7 +355,7 @@ function readEXGeographicBoundingBox(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Capability object.
*/
function readCapability(node, objectStack) {
@@ -365,7 +365,7 @@ function readCapability(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Service object.
*/
function readService(node, objectStack) {
@@ -375,7 +375,7 @@ function readService(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Contact information object.
*/
function readContactInformation(node, objectStack) {
@@ -385,7 +385,7 @@ function readContactInformation(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Contact person object.
*/
function readContactPersonPrimary(node, objectStack) {
@@ -395,7 +395,7 @@ function readContactPersonPrimary(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Contact address object.
*/
function readContactAddress(node, objectStack) {
@@ -405,8 +405,8 @@ function readContactAddress(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<string>|undefined} Format array.
* @param {Array<*>} objectStack Object stack.
* @return {Array<string>|undefined} Format array.
*/
function readException(node, objectStack) {
return pushParseAndPop([], EXCEPTION_PARSERS, node, objectStack);
@@ -415,7 +415,7 @@ function readException(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Layer object.
*/
function readCapabilityLayer(node, objectStack) {
@@ -425,11 +425,11 @@ function readCapabilityLayer(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Layer object.
*/
function readLayer(node, objectStack) {
const parentLayerObject = /** @type {!Object.<string,*>} */ (objectStack[objectStack.length - 1]);
const parentLayerObject = /** @type {!Object<string,*>} */ (objectStack[objectStack.length - 1]);
const layerObject = pushParseAndPop({}, LAYER_PARSERS, node, objectStack);
@@ -497,7 +497,7 @@ function readLayer(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object} Dimension object.
*/
function readDimension(node, objectStack) {
@@ -517,7 +517,7 @@ function readDimension(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object.
*/
function readFormatOnlineresource(node, objectStack) {
@@ -527,7 +527,7 @@ function readFormatOnlineresource(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Request object.
*/
function readRequest(node, objectStack) {
@@ -537,7 +537,7 @@ function readRequest(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} DCP type object.
*/
function readDCPType(node, objectStack) {
@@ -547,7 +547,7 @@ function readDCPType(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} HTTP object.
*/
function readHTTP(node, objectStack) {
@@ -557,7 +557,7 @@ function readHTTP(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Operation type object.
*/
function readOperationType(node, objectStack) {
@@ -567,7 +567,7 @@ function readOperationType(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object.
*/
function readSizedFormatOnlineresource(node, objectStack) {
@@ -586,7 +586,7 @@ function readSizedFormatOnlineresource(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Authority URL object.
*/
function readAuthorityURL(node, objectStack) {
@@ -601,7 +601,7 @@ function readAuthorityURL(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Metadata URL object.
*/
function readMetadataURL(node, objectStack) {
@@ -616,7 +616,7 @@ function readMetadataURL(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Style object.
*/
function readStyle(node, objectStack) {
@@ -626,8 +626,8 @@ function readStyle(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<string>|undefined} Keyword list.
* @param {Array<*>} objectStack Object stack.
* @return {Array<string>|undefined} Keyword list.
*/
function readKeywordList(node, objectStack) {
return pushParseAndPop([], KEYWORDLIST_PARSERS, node, objectStack);

View File

@@ -10,7 +10,7 @@ import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';
/**
* @typedef {Object} Options
* @property {Array.<string>} [layers] If set, only features of the given layers will be returned by the format when read.
* @property {Array<string>} [layers] If set, only features of the given layers will be returned by the format when read.
*/
@@ -61,20 +61,20 @@ class WMSGetFeatureInfo extends XMLFeature {
/**
* @private
* @type {Array.<string>}
* @type {Array<string>}
*/
this.layers_ = options.layers ? options.layers : null;
}
/**
* @return {Array.<string>} layers
* @return {Array<string>} layers
*/
getLayers() {
return this.layers_;
}
/**
* @param {Array.<string>} layers Layers to parse.
* @param {Array<string>} layers Layers to parse.
*/
setLayers(layers) {
this.layers_ = layers;
@@ -82,14 +82,14 @@ class WMSGetFeatureInfo extends XMLFeature {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<module:ol/Feature>} Features.
* @param {Array<*>} objectStack Object stack.
* @return {Array<module:ol/Feature>} Features.
* @private
*/
readFeatures_(node, objectStack) {
node.setAttribute('namespaceURI', this.featureNS_);
const localName = node.localName;
/** @type {Array.<module:ol/Feature>} */
/** @type {Array<module:ol/Feature>} */
let features = [];
if (node.childNodes.length === 0) {
return features;
@@ -150,23 +150,6 @@ class WMSGetFeatureInfo extends XMLFeature {
return this.readFeatures_(node, [options]);
}
/**
* Not implemented.
* @inheritDoc
*/
writeFeatureNode(feature, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeFeaturesNode(features, opt_options) {}
/**
* Not implemented.
* @inheritDoc
*/
writeGeometryNode(geometry, opt_options) {}
}

View File

@@ -12,7 +12,7 @@ import {pushParseAndPop, makeStructureNS,
/**
* @const
* @type {Array.<null|string>}
* @type {Array<null|string>}
*/
const NAMESPACE_URIS = [
null,
@@ -22,7 +22,7 @@ const NAMESPACE_URIS = [
/**
* @const
* @type {Array.<null|string>}
* @type {Array<null|string>}
*/
const OWS_NAMESPACE_URIS = [
null,
@@ -32,7 +32,7 @@ const OWS_NAMESPACE_URIS = [
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -87,7 +87,7 @@ class WMTSCapabilities extends XML {
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const CONTENTS_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -98,7 +98,7 @@ const CONTENTS_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const LAYER_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -117,7 +117,7 @@ const LAYER_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const STYLE_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -130,7 +130,7 @@ const STYLE_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TMS_LINKS_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -140,7 +140,7 @@ const TMS_LINKS_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TMS_LIMITS_LIST_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -150,7 +150,7 @@ const TMS_LIMITS_LIST_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TMS_LIMITS_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -164,7 +164,7 @@ const TMS_LIMITS_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const DIMENSION_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -177,7 +177,7 @@ const DIMENSION_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const WGS84_BBOX_READERS = makeStructureNS(
OWS_NAMESPACE_URIS, {
@@ -188,7 +188,7 @@ const WGS84_BBOX_READERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TMS_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -202,7 +202,7 @@ const TMS_PARSERS = makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, module:ol/xml~Parser>>}
* @type {Object<string, Object<string, module:ol/xml~Parser>>}
*/
const TM_PARSERS = makeStructureNS(
NAMESPACE_URIS, {
@@ -219,7 +219,7 @@ const TM_PARSERS = makeStructureNS(
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object.
*/
function readContents(node, objectStack) {
@@ -229,7 +229,7 @@ function readContents(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Layers object.
*/
function readLayer(node, objectStack) {
@@ -239,7 +239,7 @@ function readLayer(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set object.
*/
function readTileMatrixSet(node, objectStack) {
@@ -249,7 +249,7 @@ function readTileMatrixSet(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Style object.
*/
function readStyle(node, objectStack) {
@@ -266,7 +266,7 @@ function readStyle(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set Link object.
*/
function readTileMatrixSetLink(node, objectStack) {
@@ -276,7 +276,7 @@ function readTileMatrixSetLink(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Dimension object.
*/
function readDimensions(node, objectStack) {
@@ -286,7 +286,7 @@ function readDimensions(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Resource URL object.
*/
function readResourceUrl(node, objectStack) {
@@ -309,7 +309,7 @@ function readResourceUrl(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} WGS84 BBox object.
*/
function readWgs84BoundingBox(node, objectStack) {
@@ -323,7 +323,7 @@ function readWgs84BoundingBox(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Legend object.
*/
function readLegendUrl(node, objectStack) {
@@ -336,11 +336,11 @@ function readLegendUrl(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} Coordinates object.
*/
function readCoordinates(node, objectStack) {
const coordinates = readString(node).split(' ');
const coordinates = readString(node).split(/\s+/);
if (!coordinates || coordinates.length != 2) {
return undefined;
}
@@ -355,7 +355,7 @@ function readCoordinates(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrix object.
*/
function readTileMatrix(node, objectStack) {
@@ -365,7 +365,7 @@ function readTileMatrix(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixSetLimits Object.
*/
function readTileMatrixLimitsList(node, objectStack) {
@@ -375,7 +375,7 @@ function readTileMatrixLimitsList(node, objectStack) {
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixLimits Array.
*/
function readTileMatrixLimits(node, objectStack) {

View File

@@ -82,7 +82,7 @@ class XMLFeature extends FeatureFormat {
* @function
* @param {Document|Node|Object|string} source Source.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Options.
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
* @api
*/
readFeatures(source, opt_options) {
@@ -103,10 +103,10 @@ class XMLFeature extends FeatureFormat {
* @param {Document} doc Document.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Options.
* @protected
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
*/
readFeaturesFromDocument(doc, opt_options) {
/** @type {Array.<module:ol/Feature>} */
/** @type {Array<module:ol/Feature>} */
const features = [];
for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
@@ -121,7 +121,7 @@ class XMLFeature extends FeatureFormat {
* @param {Node} node Node.
* @param {module:ol/format/Feature~ReadOptions=} opt_options Options.
* @protected
* @return {Array.<module:ol/Feature>} Features.
* @return {Array<module:ol/Feature>} Features.
*/
readFeaturesFromNode(node, opt_options) {}
@@ -221,7 +221,7 @@ class XMLFeature extends FeatureFormat {
/**
* Encode an array of features as string.
*
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Write options.
* @return {string} Result.
* @api
@@ -232,7 +232,7 @@ class XMLFeature extends FeatureFormat {
}
/**
* @param {Array.<module:ol/Feature>} features Features.
* @param {Array<module:ol/Feature>} features Features.
* @param {module:ol/format/Feature~WriteOptions=} opt_options Options.
* @return {Node} Node.
*/

View File

@@ -7,6 +7,7 @@ import Spatial from '../filter/Spatial.js';
* @classdesc
* Represents a `<Contains>` operator to test whether a geometry-valued property
* contains a given geometry.
* @api
*/
class Contains extends Spatial {
@@ -15,7 +16,6 @@ class Contains extends Spatial {
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @api
*/
constructor(geometryName, geometry, opt_srsName) {

View File

@@ -6,6 +6,7 @@ import Comparison from '../filter/Comparison.js';
/**
* @classdesc
* Represents a `<During>` comparison operator.
* @api
*/
class During extends Comparison {
@@ -13,7 +14,6 @@ class During extends Comparison {
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} begin The begin date in ISO-8601 format.
* @param {!string} end The end date in ISO-8601 format.
* @api
*/
constructor(propertyName, begin, end) {
super('During', propertyName);

View File

@@ -6,6 +6,7 @@ import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsEqualTo>` comparison operator.
* @api
*/
class EqualTo extends ComparisonBinary {
@@ -13,7 +14,6 @@ class EqualTo extends ComparisonBinary {
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @api
*/
constructor(propertyName, expression, opt_matchCase) {
super('PropertyIsEqualTo', propertyName, expression, opt_matchCase);

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