Compare commits

...

227 Commits

Author SHA1 Message Date
Tim Schaub
df6cd8e54d 3.16.0-alpha.4 2016-05-18 21:52:40 -06:00
Tim Schaub
c4eb0ffcb5 Less weird name 2016-05-18 21:35:55 -06:00
Tim Schaub
a948d4b3ea Demonstrate how source.setUrl() works 2016-05-18 21:35:47 -06:00
Tim Schaub
2c1353f6e9 Allow XYZ source construction without options 2016-05-18 21:13:55 -06:00
Tim Schaub
783721951a Less special handling for WMTS tiles 2016-05-18 18:52:42 -06:00
Tim Schaub
c5dcde4455 Less special handling for WMS tiles 2016-05-18 18:47:38 -06:00
Tim Schaub
47cc4aac62 Rename source.getKeyParams() to source.getKey() 2016-05-18 18:34:50 -06:00
Tim Schaub
f86e7e5a71 Add a settable key for all tile sources
The source's key is used as the key for all tiles in the source.  For URL tile sources, the URL is the key.
2016-05-18 18:27:19 -06:00
Andreas Hocevar
9f501aeb0e Merge pull request #5352 from marlowp/Issue#5030
Add getResolutions() to ol.View
2016-05-18 18:03:09 +02:00
Andreas Hocevar
8afae37c4c Merge pull request #5359 from probins/notes
Move upgrade notes to correct place
2016-05-18 17:56:30 +02:00
Andreas Hocevar
2bff721227 Merge pull request #5343 from probins/nonapitypedefs
Rename non-api sub-namespace typedefs
2016-05-18 17:34:08 +02:00
Frédéric Junod
7a1756d8a9 Merge pull request #5361 from fredj/maki_url
Fix url to maki icons
2016-05-18 17:05:04 +02:00
Frederic Junod
412dc0457e Fix url to maki icons 2016-05-18 16:48:03 +02:00
Tobias Sauerwein
693e91970e Merge pull request #5358 from tsauerwein/ms-wfs-multiple-types
Handle multiple featureMember elements for different types (WFS format)
2016-05-18 15:12:57 +02:00
Peter Robins
557a3aee04 Move upgrade notes to correct place 2016-05-18 09:35:27 +00:00
tsauerwein
7080c508a4 Handle multiple featureMember elements for different types 2016-05-18 11:26:13 +02:00
Frédéric Junod
bc95ec053c Merge pull request #5355 from fredj/navigation-controls_descr
Fix navigation-controls example description
2016-05-18 08:25:54 +02:00
Andreas Hocevar
443d252ec1 Merge pull request #5353 from probins/api
Add API definition to docs landing page
2016-05-17 22:05:12 +02:00
Frédéric Junod
9a83339724 Merge pull request #5356 from openlayers/greenkeeper-rbush-1.4.3
Update rbush to version 1.4.3 🚀
2016-05-17 16:33:16 +02:00
Peter Robins
1a1d55d54e Add API policy to docs landing page 2016-05-17 14:27:12 +00:00
greenkeeperio-bot
57e9e96e5f chore(package): update rbush to version 1.4.3
https://greenkeeper.io/
2016-05-17 08:19:17 -06:00
Frederic Junod
5949170df0 Fix navigation-controls example description 2016-05-17 10:24:21 +02:00
Frédéric Junod
70dd26a412 Merge pull request #5354 from openlayers/greenkeeper-eslint-2.10.2
Update eslint to version 2.10.2 🚀
2016-05-17 08:26:49 +02:00
greenkeeperio-bot
21e8f69d97 chore(package): update eslint to version 2.10.2
https://greenkeeper.io/
2016-05-16 14:40:01 -06:00
Peter Marlow
9b9d006d75 Tests for #getResolutions on ol.View
Created tests for new getResolutions() function on ol.View.
2016-05-15 16:48:09 +01:00
Peter Marlow
350c4d525b Added getResolutions() function to ol.View
New getResolutions() function created for ol.View. This function returns
the array of resolutions passed to the ol.View constructor, or undefined
if none were given.
2016-05-15 16:47:27 +01:00
Andreas Hocevar
1c03814860 Merge pull request #5347 from openlayers/greenkeeper-eslint-2.10.1
Update eslint to version 2.10.1 🚀
2016-05-15 11:46:00 +02:00
greenkeeperio-bot
532275e779 chore(package): update eslint to version 2.10.1
https://greenkeeper.io/
2016-05-14 09:57:15 -06:00
Andreas Hocevar
ef52a757b1 Merge pull request #5344 from probins/rasterenum
Remove raster enum from test
2016-05-14 01:53:58 +02:00
Tim Schaub
048865d975 Merge pull request #5329 from tschaub/utfgrid
UTFGrid updates.
2016-05-13 12:59:56 -06:00
Tim Schaub
fb402d120e Removing access_token in notes for v3 use 2016-05-13 12:08:59 -06:00
Tim Schaub
5a5ad7ce31 Correct types 2016-05-13 12:08:59 -06:00
Tim Schaub
476191b0d0 Notes on using the v4 Mapbox API 2016-05-13 12:08:59 -06:00
Tim Schaub
94b8c853a7 Use legacy UTFGrid source (which doesn't require a token) 2016-05-13 12:08:59 -06:00
Tim Schaub
a810feb257 Test XHR loading 2016-05-13 12:08:58 -06:00
Tim Schaub
5c07628044 Return id if no data is present 2016-05-13 12:08:58 -06:00
Attila Berényi
4c82b3403c Use XHR by default 2016-05-13 12:08:58 -06:00
Peter Robins
cce7b148bb Remove raster enum from test 2016-05-13 16:26:26 +00:00
Peter Robins
176ddd3403 Rename non-api sub-namespace typedefs 2016-05-13 10:24:57 +00:00
Andreas Hocevar
4626554a18 Merge pull request #5335 from probins/typedefs
Move typedefs to separate file
2016-05-13 10:23:14 +02:00
Andreas Hocevar
9523fb6edd Merge pull request #5332 from ahocevar/examples-outdated-warning
Warn when viewing an outdated example, and offer a redirect to latest
2016-05-12 19:23:09 +02:00
Andreas Hocevar
31d0278dfb Merge pull request #5342 from ahocevar/fix-source-links
Fix incorrect source links
2016-05-12 18:55:35 +02:00
Andreas Hocevar
e74434299e Fix incorrect source links 2016-05-12 18:51:54 +02:00
Andreas Hocevar
3fc70bac00 Merge pull request #5339 from ahocevar/div-instead-of-alert
Use a div instead of alert for version warning
2016-05-12 18:20:56 +02:00
Andreas Hocevar
0d2b833e06 Use a div instead of alert for version warning
With this change, it is also no longer necessary to display the version in the
navigation bar. The accidently removed doctype is also brought back.
2016-05-12 17:13:44 +02:00
Andreas Hocevar
19692ed60a Warn when viewing an outdated example, and offer a redirect to latest 2016-05-12 13:40:48 +02:00
Peter Robins
0daa2cf574 Document typedef move 2016-05-12 07:45:48 +00:00
Peter Robins
dd358af0f2 Fix WFS errors by moving typedefs to own file
The WFS typedefs are the only sub-sub-namespace ones which are marked 'api', so cannot be renamed. Moving them to their own file resolves the errors.
2016-05-12 07:31:50 +00:00
Peter Robins
ab9ff536f5 Add goog.provides to typedefs.js to prevent compiler warnings
Without this there are 'defined before its owner' warnings, and issues of missing namespaces when compiling code with the library.
2016-05-11 19:51:14 +00:00
Peter Robins
c7aeebed8c Rename sub-sub-namespace typedefs to sub-namespace
These sub-sub-namespace typedefs are only used internally; some of them cause problems by creating a form of circular dependency. For example, ol.style.Atlas is created in style/atlasmanager.js; if ol.style.Atlas.Block is in a separate file, ol.style.Atlas is dependent on it, so the new file must precede ol.style.Atlas. However if it precedes it then it has to create the ol.style.Atlas namespace which should be created by atlasmanager.js. To get round this, these typedefs are renamed to remove the sub-sub-namespace.

Fortunately they are all non-api, so the rename should not affect anything.
2016-05-11 19:46:56 +00:00
Peter Robins
a1c86ed560 Fix eventTargetLike
This needs a goog.provide and a goog.require in events.js to compile.
2016-05-11 19:46:38 +00:00
Peter Robins
4f0b4dacbd Move sub-namespace typedefs to typedefs.js
Here too there is one problem case.
2016-05-11 19:45:59 +00:00
Peter Robins
ed34caa25a Fix ogc/filter
This only compiles if there is goog.provide('ol.Extent') in the typedefs file, and goog.require('ol.Extent') in this file. An alternative is to add an assert statement, but this means an extra dependency.

With this change there is no longer a need for the change to tasks/build.js
2016-05-11 17:18:05 +00:00
Peter Robins
535e8f5e35 Move top-level typedefs to typedefs.js
With one exception, those directly in the `ol` namespace can be moved without problem.
Some left-over goog.requires are also removed.
2016-05-11 17:18:05 +00:00
Frédéric Junod
d0e5b1e395 Merge pull request #5320 from fredj/modify_condition
Add a 'condition' option to ol.interaction.Modify
2016-05-11 17:15:41 +02:00
Andreas Hocevar
49e2fd0df3 Merge pull request #5333 from openlayers/improve-comments
Improve code readability with better comments
2016-05-11 16:13:15 +02:00
Andreas Hocevar
d59ace1a61 Improve code readability with better comments 2016-05-11 15:46:39 +02:00
Andreas Hocevar
d6395a3c82 Merge pull request #5330 from ahocevar/doc-fixes-improvements
Fix source links, display version and warn about outdated docs
2016-05-11 13:00:41 +02:00
Andreas Hocevar
d27ea0974e Fix source links, display version and warn about outdated docs 2016-05-11 12:45:58 +02:00
Frederic Junod
b49546d2af Add a 'condition' option to ol.interaction.Modify 2016-05-10 17:17:17 +02:00
Andreas Hocevar
8c8c4c3df4 Merge pull request #5324 from probins/rmrequires
Remove unneeded goog.provides/requires for typedefs
2016-05-10 16:31:42 +02:00
Tim Schaub
fa067b7e8a Merge pull request #5328 from tschaub/node-6
Use Node 6 on Travis.
2016-05-10 06:58:37 -06:00
Andreas Hocevar
c4387c14ff Merge pull request #5313 from ahocevar/rastersource-framestate-extent
Rastersource framestate extent
2016-05-10 14:35:25 +02:00
Tim Schaub
afcaa2ea51 Use Node 6 on Travis 2016-05-10 05:52:41 -06:00
Tobias Sauerwein
e55dc30257 Merge pull request #5326 from tsauerwein/example-clean-up
Fix wording in tile-load-event example
2016-05-10 11:39:25 +02:00
Andreas Hocevar
cb50e4a102 Merge pull request #5327 from openlayers/greenkeeper-closure-util-1.13.1
Update closure-util to version 1.13.1 🚀
2016-05-10 11:15:41 +02:00
greenkeeperio-bot
7d805393fc chore(package): update closure-util to version 1.13.1
https://greenkeeper.io/
2016-05-10 02:39:51 -06:00
tsauerwein
684d49cb78 Fix wording 2016-05-10 10:21:44 +02:00
Peter Robins
2a44669e18 Add some goog.requires to keep compiler happy 2016-05-09 16:00:07 +00:00
Andreas Hocevar
39087b2fa4 Reuse the frameState extent 2016-05-09 15:23:00 +02:00
Andreas Hocevar
5c76cb01af Use a snapshot of the frameState extent 2016-05-09 15:23:00 +02:00
Peter Robins
f57065c412 Remove unneeded goog.provides/requires for typedefs
In general, typedefs do not need and should not have goog.require/provide
2016-05-09 13:21:25 +00:00
Tim Schaub
e94939d01b Merge pull request #5289 from openlayers/greenkeeper-fs-extra-0.30.0
Update fs-extra to version 0.30.0 🚀
2016-05-09 06:42:20 -06:00
Tim Schaub
56a365acf4 Merge pull request #5319 from probins/patch-1
Remove outdated fixme from framestate.js.
2016-05-09 06:41:01 -06:00
Andreas Hocevar
fbb9194923 Merge pull request #5274 from samuellapointe/logofix
Allow using elements in logo attribution options
2016-05-09 13:46:11 +02:00
Peter Robins
ffe8daec66 Remove outdated fixme from framestate.js 2016-05-09 09:18:56 +01:00
Bart van den Eijnden
7984cc2b57 Merge pull request #5162 from probins/strategy
Improve docs/examples for loadingstrategy
2016-05-09 09:43:25 +02:00
greenkeeperio-bot
7944144c65 chore(package): update fs-extra to version 0.30.0
https://greenkeeper.io/
2016-05-09 01:08:25 -06:00
Frédéric Junod
ae46b40def Merge pull request #5314 from openlayers/greenkeeper-browserify-13.0.1
Update browserify to version 13.0.1 🚀
2016-05-09 09:08:11 +02:00
Andreas Hocevar
ed421ce4b2 Merge pull request #5315 from probins/tilecoordtransformtype
Remove unused ol.TileCoordTransformType
2016-05-07 12:06:57 +01:00
Peter Robins
51397ee294 Remove unused ol.TileCoordTransformType 2016-05-07 10:35:11 +00:00
greenkeeperio-bot
d316651c35 chore(package): update browserify to version 13.0.1
https://greenkeeper.io/
2016-05-06 09:48:53 -04:00
Tim Schaub
ff37fe128f Merge pull request #5310 from tschaub/fix-raster
Get raster sources working again.
2016-05-04 14:25:02 -04:00
Andreas Hocevar
72468f3470 Merge pull request #5291 from ahocevar/dispatch-while-dispatching-once-listener
Allow once listeners to dispatch events of same type
2016-05-04 12:10:21 -04:00
Andreas Hocevar
b2c6bb11cf Allow once listeners to dispatch events of same type 2016-05-04 11:55:30 -04:00
Frédéric Junod
088c439c34 Merge pull request #5309 from openlayers/greenkeeper-metalsmith-layouts-1.6.5
Update metalsmith-layouts to version 1.6.5 🚀
2016-05-04 08:32:16 +02:00
Tim Schaub
0b4ef31750 Get raster sources working again
This reverts 8e1ffbf91e
2016-05-03 17:47:05 -04:00
greenkeeperio-bot
f3cc873d65 chore(package): update metalsmith-layouts to version 1.6.5
https://greenkeeper.io/
2016-05-03 11:34:34 -04:00
Frédéric Junod
b1648c949e Merge pull request #5052 from openlayers/greenkeeper-fs-extra-0.26.7
Update fs-extra to version 0.26.7 🚀
2016-05-03 15:04:48 +02:00
Tobias Sauerwein
18520cd89d Merge pull request #5306 from gberaudo/unrequire_padding
Make olx.view.FitOptions.padding optional
2016-05-03 13:58:28 +02:00
Guillaume Beraudo
e2b2004aa4 Make olx.view.FitOptions.padding optional
Makes it consistent with other attributes.
2016-05-03 13:44:58 +02:00
Frédéric Junod
a6a0c88641 Merge pull request #5302 from fredj/rm_goog.partial
Remove use of goog.partial
2016-05-03 08:30:00 +02:00
greenkeeperio-bot
54e1e3408b chore(package): update fs-extra to version 0.26.7
https://greenkeeper.io/
2016-05-03 00:29:33 -06:00
Frédéric Junod
9ea297c54f Merge pull request #5304 from openlayers/greenkeeper-sinon-1.17.4
Update sinon to version 1.17.4 🚀
2016-05-03 08:29:18 +02:00
greenkeeperio-bot
5044c49ac3 chore(package): update sinon to version 1.17.4
https://greenkeeper.io/
2016-05-02 11:20:11 -06:00
Samuel Lapointe
f835d86333 Reduce closure dependency, fix GET issue 2016-05-02 09:34:58 -04:00
Frederic Junod
7c15280e81 Remove use of goog.partial
Use Function.prototype.bind instead, see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Partially_applied_functions_(currying)
2016-05-02 14:52:09 +02:00
Frédéric Junod
9f3c951c71 Merge pull request #4644 from fredj/rm_check-requires
Remove check-requires script
2016-05-02 09:52:39 +02:00
Frederic Junod
6abecb0192 Remove check-requires script
The missingProvide and missingRequire compiler checks are already checking
if the goog.require and goog.provide are correct.
2016-05-02 09:29:42 +02:00
Marc Jansen
4e17f58b26 Merge pull request #5298 from openlayers/greenkeeper-eslint-2.9.0
Update eslint to version 2.9.0 🚀
2016-04-29 22:33:29 +02:00
greenkeeperio-bot
15b6921bc9 chore(package): update eslint to version 2.9.0
https://greenkeeper.io/
2016-04-29 11:24:56 -06:00
Andreas Hocevar
c7898bcb0e Merge pull request #5296 from probins/patch-1
Document handling of KML MultiGeometries
2016-04-29 12:04:18 +02:00
Peter Robins
c28fd2ae1c Document handling of KML MultiGeometries 2016-04-29 10:56:43 +01:00
Andreas Hocevar
690ef18ee2 Merge pull request #5293 from giohappy/master
Block removePoint while dragging
2016-04-29 10:46:40 +02:00
giohappy
cd2ea6c7d6 Block removePoint during while dragging 2016-04-29 09:00:14 +02:00
Marc Jansen
36b8f31f40 Merge pull request #5285 from marcjansen/scaleline-tests
Add more tests for the scaleline control
2016-04-28 13:23:50 +02:00
Andreas Hocevar
0151d802d3 Merge pull request #5287 from ahocevar/vectortile-tests
Add and fix vectortile tests
2016-04-28 13:07:29 +02:00
Andreas Hocevar
a54c686691 Merge pull request #5288 from giohappy/master
Expose removeVertex_ as removePoint
2016-04-28 13:01:11 +02:00
Andreas Hocevar
ebc28aefd4 Add and fix vectortile tests 2016-04-28 12:57:27 +02:00
giohappy
d49bcdeedc Expose removeVertex_ as removePoint 2016-04-28 12:47:46 +02:00
Andreas Hocevar
2939ebc9b9 Merge pull request #5286 from ahocevar/only-render-whats-necessary
Skip unnecessary render functions
2016-04-28 11:18:35 +02:00
Andreas Hocevar
c17e23f2ae Skip unnecessary render functions 2016-04-28 10:22:20 +02:00
Marc Jansen
73a04c14f5 Add more tests for the scaleline control 2016-04-28 10:04:52 +02:00
Andreas Hocevar
88d20a69ad Merge pull request #5177 from ahocevar/vector-tile-hybrid-rendering
Add render options for vector tile layers
2016-04-28 09:04:45 +02:00
Frédéric Junod
138fe6ede1 Merge pull request #5278 from fredj/cleanup
Fix invalid generics type instantiation
2016-04-28 08:27:15 +02:00
Andreas Hocevar
12849a678e Add note about opaque option removal 2016-04-27 17:50:38 +02:00
Andreas Hocevar
c72a39ff53 Coding style fixes 2016-04-27 17:33:55 +02:00
Andreas Hocevar
ec832243a2 Add comment making clear that 'vector' mode does not generate images 2016-04-27 17:31:20 +02:00
Andreas Hocevar
c5f81a5706 Unconditionally call drawImage - image is always available 2016-04-27 17:31:20 +02:00
Frederic Junod
664507b79b Fix invalid generics type instantiation 2016-04-27 14:51:31 +02:00
Andreas Hocevar
c3217e8d30 Merge pull request #5044 from fblackburn/snapinteraction
Snap interaction now handle feature without geometry properly
2016-04-27 14:25:17 +02:00
Frédéric Junod
e3e0d23a83 Merge pull request #5277 from fredj/cleanup
Type cleanup
2016-04-27 13:24:05 +02:00
Frederic Junod
6002d4c3e8 Remove duplicate type in type annotation 2016-04-27 12:24:01 +02:00
Frederic Junod
63ebed437b Don't use the string constructor 2016-04-27 12:22:43 +02:00
Andreas Hocevar
762aa3029c Merge pull request #5275 from ahocevar/fix-select-getlayer
Fix feature-layer association on replaced selections
2016-04-27 10:40:43 +02:00
Tobias Sauerwein
1ca28506ac Merge pull request #5252 from tsauerwein/wfs-getfeature-filter
Add filter option to ol.format.WFS#writeGetFeature
2016-04-27 09:11:55 +02:00
Andreas Hocevar
c11e95099c Fix feature-layer association on replaced selections 2016-04-27 08:13:45 +02:00
Samuel Lapointe
3a1ff59cfb Allow using elements in logo attribution options
This commit lets the user use an element object instead of a {src: href} object for an attribution logo when creating a map. This opens a lot of possibilities for that logo, for example setting the target to force the logo to open in a new tab when clicked.
2016-04-26 15:30:09 -04:00
Francois Blackburn
9186d1fbda Snap interaction now handle feature without geometry properly 2016-04-26 14:14:47 -04:00
tsauerwein
2f72804fc3 Add example for writeGetFeature 2016-04-26 16:36:57 +02:00
tsauerwein
af294bd44e Add filter option to ol.format.WFS#writeGetFeature 2016-04-26 16:36:50 +02:00
Andreas Hocevar
ed6ac93222 Merge pull request #5264 from matjos/master
Fix for close draw polygon error
2016-04-26 10:52:28 +02:00
Mattias Josefsson
8f96251618 Added wanted change for issue #5145 2016-04-26 10:34:55 +02:00
Andreas Hocevar
343f41e99e Merge pull request #5267 from ahocevar/no-goog-functions
Use ol.functions instead of goog.functions
2016-04-25 16:03:31 +02:00
Andreas Hocevar
255e449dd3 Merge pull request #5266 from ahocevar/colorlike-doc
Document ol.colorlike
2016-04-25 15:53:57 +02:00
Andreas Hocevar
b37cd3fae6 Use ol.functions instead of goog.functions 2016-04-25 15:46:00 +02:00
Andreas Hocevar
d425f75bea Merge pull request #5261 from giohappy/master
add finishCondition to ol.interaction.Draw
2016-04-25 15:42:39 +02:00
Andreas Hocevar
989c04cf12 Document ol.colorlike 2016-04-25 15:33:46 +02:00
Mattias Josefsson
e85d8fa749 Fix for close draw polygon error 2016-04-25 11:48:55 +02:00
giohappy
394ef94fd3 Fix finishCondition test 2016-04-22 23:17:21 +02:00
giohappy
5934f9d416 add olx.interaction.DrawOptions.prototype.finishCondition to typedef 2016-04-22 15:21:11 +02:00
giohappy
ead6063170 make lint happy with drawinteraction.test.js 2016-04-22 15:16:11 +02:00
giohappy
c7af6bd494 Add ol.interaction.Draw.finishCondition to olx.js 2016-04-22 15:11:54 +02:00
giohappy
2076ef02ca Add test for finishCondition 2016-04-22 15:07:59 +02:00
giohappy
130b4d9459 add finishCondition to ol.interaction.Draw 2016-04-22 11:07:42 +02:00
Andreas Hocevar
60926626df Merge pull request #5259 from ahocevar/squash-changelog
Include squash commit merges in changelog
2016-04-22 09:36:46 +02:00
Andreas Hocevar
405ed2af56 Include squash commit merges in changelog 2016-04-21 16:20:03 +02:00
Andreas Hocevar
44f09497f0 Merge pull request #5257 from bjornharrtell/mvt-api
Add readFeatures and readProjection as MVT experimental API
2016-04-21 15:38:45 +02:00
Björn Harrtell
c40993d0d3 Add readFeatures and readProjection as MVT experimental API 2016-04-21 14:16:06 +02:00
Anna Lambrechtsen
18a29ea6d3 Add ol.source.ImageArcGISRest (#3880)
* Add ol.source.ImageArcGISRest

ol.source.ImageArcGISRest is added so a single image can be retrieved
which is required when labelling is applied to the underlying map
service.
it's based on the approach used in ol.source.ImageWMS

* updating to remove as many good references as possible
changing so js passes lint checks

* fixing up so build and tests run

* putting back what was lost in the merge

* adding in an example
tidying up
2016-04-20 11:19:53 +02:00
Andreas Hocevar
f7147960a9 Add render options for vector tile layers 2016-04-19 13:04:38 +02:00
Tim Schaub
0e4692e69e Merge pull request #5239 from openlayers/greenkeeper-eslint-2.8.0
Update eslint to version 2.8.0 🚀
2016-04-16 08:48:53 -06:00
greenkeeperio-bot
3de5a021a9 chore(package): update eslint to version 2.8.0
http://greenkeeper.io/
2016-04-15 12:02:15 -06:00
Frédéric Junod
b7278f184c Merge pull request #5230 from fredj/reuse_frameState
Reuse frame state arrays
2016-04-14 14:57:30 +02:00
Frédéric Junod
e46c8370d5 Merge pull request #5213 from fredj/rm_ol.source.Source.prototype.setProjection
Remove unused ol.source.Source#setProjection function
2016-04-14 12:43:14 +02:00
Frédéric Junod
dca7d6fc8f Merge pull request #5223 from fredj/memory
Create tmpSize_ before calling calculateTileRanges_
2016-04-14 12:43:01 +02:00
Frédéric Junod
db9dbc96b2 Merge pull request #5225 from fredj/rm_ol.extent.transform2D
Remove unused ol.extent.transform2D function
2016-04-14 12:42:48 +02:00
Tim Schaub
2496662070 Merge pull request #5212 from probins/kmlwrite
KML: fix GeometryCollection write
2016-04-14 04:27:18 -06:00
Frédéric Junod
8e3e47bed4 Merge pull request #5228 from adube/translate-layers-filter
Add 'layers' option to Translate interaction
2016-04-14 10:44:34 +02:00
Frederic Junod
92c96b95f9 Reuse the frame state viewHints array if defined 2016-04-14 10:36:12 +02:00
Frederic Junod
8e1ffbf91e Reuse the frame state extent array if defined 2016-04-14 10:32:10 +02:00
Frédéric Junod
8562c9a4fc Merge pull request #5221 from fredj/examples_deps_update
Update jquery, bootstrap and proj4js in examples
2016-04-14 08:35:35 +02:00
Frédéric Junod
400204357f Merge pull request #5227 from fredj/less_garbage
Add a temporary ol.TileCoord in ol.renderer.canvas.TileLayer
2016-04-14 08:33:40 +02:00
Alexandre Dubé
e6e9b12bac Add 'layers' option to Translate interaction 2016-04-13 13:35:36 -04:00
Frederic Junod
a2c3dfd5de Add a temporary ol.TileCoord in ol.renderer.canvas.TileLayer
Avoid garbage creation
2016-04-13 17:21:10 +02:00
Frederic Junod
72e354dce3 Remove unused ol.extent.transform2D function 2016-04-13 17:18:57 +02:00
Frédéric Junod
f92a38b28c Merge pull request #5222 from fredj/unused_vars
Remove unused private variables in ol.renderer.canvas.Map
2016-04-13 17:15:52 +02:00
Frédéric Junod
c15f8c8f07 Merge pull request #5220 from fredj/externs_cleanup
Externs cleanup
2016-04-13 17:15:32 +02:00
Frédéric Junod
de4e51efe8 Merge pull request #5224 from fredj/fix_indent
Fix jsdoc tags indentation
2016-04-13 17:15:00 +02:00
Tim Schaub
d4ac5800d5 Merge pull request #5218 from aisaacs/export-cartodb-setconfig
Add @api annotation to setConfig.
2016-04-13 09:11:12 -06:00
Frederic Junod
9507020218 Fix jsdoc tags indentation 2016-04-13 15:13:50 +02:00
Frederic Junod
ccfc3f7798 Create tmpSize_ before calling calculateTileRanges_ 2016-04-13 12:19:00 +02:00
Frederic Junod
593132c902 Remove unused private variables in ol.renderer.canvas.Map 2016-04-13 10:54:11 +02:00
Frederic Junod
6a6a906e83 Update proj4js to version 2.2.14 2016-04-13 09:28:26 +02:00
Frederic Junod
ed4ac8d83b Update jquery to version 2.2.3 2016-04-13 09:25:37 +02:00
Frederic Junod
35f0928802 Update bootstrap to version 3.3.6 2016-04-13 09:21:20 +02:00
Frederic Junod
044f6638ea Remove externs/jspdf.js and add NOCOMPILE to examples/export-pdf.js 2016-04-13 09:00:02 +02:00
Frederic Junod
936d38ca6f Remove unused externs/webgl-debug.js 2016-04-13 08:56:29 +02:00
Alessandro Isaacs
737daaeea9 Add @api annotation to setConfig 2016-04-12 08:26:30 -07:00
Frédéric Junod
01a6612ab3 Merge pull request #5215 from fredj/getClosestFeatureToCoordinate_filter
Add an optional feature filter to getClosestFeatureToCoordinate
2016-04-12 12:44:11 +02:00
Frederic Junod
05ceaab620 Add an optional feature filter to getClosestFeatureToCoordinate 2016-04-12 12:17:07 +02:00
Frederic Junod
f9fd73c44e Remove unused ol.source.Source#setProjection function 2016-04-11 15:43:25 +02:00
Peter Robins
27f20e2f54 KML: fix GeometryCollection write 2016-04-11 12:36:07 +00:00
Frédéric Junod
50b956b108 Merge pull request #5132 from nicholas-l/removeGoogString
Remove goog.string
2016-04-11 10:28:32 +02:00
Frédéric Junod
33db3d4941 Merge pull request #5206 from probins/patch-1
Minor correction of StyleFunction docs
2016-04-11 09:42:57 +02:00
Frédéric Junod
06ac1b603c Merge pull request #4932 from fredj/undef_WMSGetFeatureInfo
Remove undefined parameters to ol.format.WMSGetFeatureInfo#readFeatures_
2016-04-11 08:41:43 +02:00
Frédéric Junod
fb96ed94ec Merge pull request #5207 from openlayers/greenkeeper-clean-css-3.4.12
Update clean-css to version 3.4.12 🚀
2016-04-11 08:41:06 +02:00
greenkeeperio-bot
664efa18fc chore(package): update clean-css to version 3.4.12
http://greenkeeper.io/
2016-04-09 09:30:50 -06:00
Peter Robins
2a64d9ef55 Minor correction of StyleFunction docs 2016-04-08 18:35:16 +01:00
Andreas Hocevar
1ecd47aeb9 Merge pull request #5201 from probins/patch-2
Small clarification for vector source loader docs
2016-04-08 12:17:03 +02:00
Bart van den Eijnden
bb5b461192 Merge pull request #5200 from bartvde/issue-5199
Fix typo in rotate control for css classList
2016-04-08 11:01:09 +02:00
Peter Robins
9fb4a88841 Small clarification for vector source loader docs 2016-04-08 09:52:54 +01:00
Bart van den Eijnden
231234f9d0 Fix typo in rotate control for css classList 2016-04-08 10:51:26 +02:00
nicholas
c92223d792 Remove Goog.string 2016-04-08 18:09:57 +12:00
Nicholas Latham
cd6494149b Remove goog.global (#5178)
* Remove goog.global

* Correct externs location

* Use Function('return this')

* Remove global externs
2016-04-07 23:36:48 +02:00
Andreas Hocevar
6efd3dab0b Add rendering tests to ensure correct circle and polygon rendering (#5189) 2016-04-07 18:03:57 +02:00
Frédéric Junod
935eb9994c Merge pull request #5192 from openlayers/release-v3.15.1
Release 3.15.1
2016-04-07 16:55:15 +02:00
Frédéric Junod
6fc4427f4f Merge pull request #5191 from openlayers/release-v3.15.1
Release v3.15.1
2016-04-07 16:50:11 +02:00
Andreas Hocevar
fe33910ec2 Revert "Batch polygon fill and stroke instructions" 2016-04-07 16:30:04 +02:00
Frédéric Junod
c9ffcef766 Merge pull request #5183 from openlayers/greenkeeper-istanbul-0.4.3
Update istanbul to version 0.4.3 🚀
2016-04-07 13:44:03 +02:00
greenkeeperio-bot
8c9ac5932f chore(package): update istanbul to version 0.4.3
http://greenkeeper.io/
2016-04-07 12:15:38 +02:00
Frédéric Junod
6be704af69 Merge pull request #5187 from fredj/rm_goog.functions
Remove goog.functions.and from ol.interaction.Modify
2016-04-07 12:14:58 +02:00
Frederic Junod
c549fadc01 Remove goog.functions.and from ol.interaction.Modify 2016-04-07 11:46:52 +02:00
Frederic Junod
e099dcd9a9 Simplify ol.interaction.KeyboardPan#defaultCondition_
No need to invoke the function with 'call'
2016-04-07 11:44:23 +02:00
Renaud Michaëlis
53a9341ef0 Allow to delete the starting or ending vertex
* Allow to delete the starting or ending vertex

* Test if starting and ending vertex are removed
2016-04-06 13:47:37 +02:00
Nicholas Latham
18e9ff98ee Remove goog.labs.userAgent
* Remove goog.labs.*

* Change to function

* Change window to this

* Use goog.global
2016-04-06 11:05:49 +02:00
Frédéric Junod
f011b5266e Merge pull request #5176 from openlayers/greenkeeper-jquery-2.2.3
Update jquery to version 2.2.3 🚀
2016-04-06 08:36:12 +02:00
greenkeeperio-bot
d275b1cf74 chore(package): update jquery to version 2.2.3
http://greenkeeper.io/
2016-04-05 13:33:14 -06:00
Frédéric Junod
b691c47e78 Merge pull request #5173 from fredj/use_ol.dom.createCanvasContext2D
Use ol.dom.createCanvasContext2D
2016-04-05 14:42:49 +02:00
Frederic Junod
f2c30cffe2 Use ol.dom.createCanvasContext2D in ol.style.AtlasManager 2016-04-05 14:29:00 +02:00
Frederic Junod
f645d81fee Use ol.dom.createCanvasContext2D in ol.source.ImageStatic 2016-04-05 14:29:00 +02:00
Frederic Junod
38718ee5e6 Use ol.dom.createCanvasContext2D in ol.style.Circle 2016-04-05 14:29:00 +02:00
Frederic Junod
fc6b078642 Use ol.dom.createCanvasContext2D in ol.style.RegularShape 2016-04-05 14:29:00 +02:00
Frédéric Junod
587e8a6ecd Merge pull request #5171 from fredj/attribution_like_typedef
Move olx.source.AttributionOption out of externs/olx.js
2016-04-05 14:25:51 +02:00
Frederic Junod
db9c6a99c8 Move olx.source.AttributionOption out of externs/olx.js 2016-04-05 09:15:15 +02:00
Frédéric Junod
5302882fba Merge pull request #5170 from openlayers/greenkeeper-eslint-2.7.0
Update eslint to version 2.7.0 🚀
2016-04-05 08:29:56 +02:00
greenkeeperio-bot
60fb3b55ff chore(package): update eslint to version 2.7.0
http://greenkeeper.io/
2016-04-04 17:48:52 -06:00
Frédéric Junod
f20e446689 Merge pull request #5167 from fredj/rm_FastClick
Remove FastClick from mobile-full-screen example
2016-04-04 17:01:52 +02:00
Frédéric Junod
e36ffca838 Merge pull request #5166 from fredj/simplify_measure_example
Remove jquery dependency from measure example
2016-04-04 16:31:45 +02:00
Frederic Junod
4b832708e5 Remove FastClick from mobile-full-screen example 2016-04-04 16:31:28 +02:00
Frederic Junod
a7f61e6dda Remove jquery dependency from measure example 2016-04-04 16:14:11 +02:00
Frédéric Junod
825d525d3f Merge pull request #5164 from fredj/cartodb_cleanup
Cartodb cleanup
2016-04-04 14:55:27 +02:00
Frederic Junod
a42d76d69d Use ol.object.assign to update config properties in ol.source.CartoDB 2016-04-04 12:45:26 +02:00
Frederic Junod
02d262e387 Fix ol.source.CartoDB 'loading' state 2016-04-04 12:41:42 +02:00
Frédéric Junod
fe372847f8 Merge pull request #5163 from openlayers/release-v3.15.0
Release v3.15.0
2016-04-04 11:02:00 +02:00
Peter Robins
1cd7b76efe Improve docs/examples for loadingstrategy 2016-04-02 13:09:44 +00:00
Frederic Junod
4eb6997be9 Remove undefined parameters to ol.format.WMSGetFeatureInfo#readFeatures_
`this.featureType` and `this.featureNS` are not defined in `ol.format.WMSGetFeatureInfo`
2016-03-03 09:38:18 +01:00
231 changed files with 5455 additions and 2598 deletions

View File

@@ -3,7 +3,7 @@ sudo: false
language: node_js
node_js:
- "4"
- "6"
cache:
directories:

View File

@@ -119,8 +119,7 @@ examples: $(BUILD_EXAMPLES)
install: build/timestamps/node-modules-timestamp
.PHONY: lint
lint: build/timestamps/eslint-timestamp \
build/timestamps/check-requires-timestamp
lint: build/timestamps/eslint-timestamp
.PHONY: npm-install
npm-install: build/timestamps/node-modules-timestamp
@@ -184,13 +183,6 @@ build/timestamps/check-%-timestamp: $(BUILD_HOSTED)/examples/%.html \
./node_modules/.bin/phantomjs --local-to-remote-url-access=true --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $<
@touch $@
build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
$(SRC_SHADER_JS) $(SPEC_JS) \
$(SPEC_RENDERING_JS)
@mkdir -p $(@D)
@python bin/check-requires.py $(CLOSURE_LIB) $^
@touch $@
build/compiled-examples/all.js: $(EXAMPLES_JS)
@mkdir -p $(@D)
@python bin/combine-examples.py $^ > $@
@@ -219,7 +211,7 @@ build/timestamps/jsdoc-$(BRANCH)-timestamp: config/jsdoc/api/index.md \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
@rm -rf $(BUILD_HOSTED)/apidoc
./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d $(BUILD_HOSTED)/apidoc
./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json --package package.json -d $(BUILD_HOSTED)/apidoc
@touch $@
$(BUILD_HOSTED_EXAMPLES_JS): $(BUILD_HOSTED)/examples/%.js: build/examples/%.js

View File

@@ -1,193 +0,0 @@
import os
import logging
import re
import sys
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger('check-requires')
class Node(object):
def __init__(self):
self.present = False
self.children = {}
def _build_re(self, key):
if key == '*':
assert len(self.children) == 0
# We want to match `.doIt` but not `.SomeClass` or `.more.stuff`
return '(?=\\.[a-z]\\w*\\b(?!\\.))'
elif len(self.children) == 1:
child_key, child = next(self.children.iteritems())
child_re = child._build_re(child_key)
if child_key != '*':
child_re = '\\.' + child_re
if self.present:
return key + '(' + child_re + ')?'
else:
return key + child_re
elif self.children:
children_re = '(?:' + '|'.join(
('\\.' if k != '*' else '') + self.children[k]._build_re(k)
for k in sorted(self.children.keys())) + ')'
if self.present:
return key + children_re + '?'
else:
return key + children_re
else:
assert self.present
return key
def build_re(self, key):
return re.compile('\\b' + self._build_re(key) + '\\b')
def ifind(*paths):
"""ifind is an iterative version of os.walk, yielding all walked paths and
normalizing paths to use forward slashes."""
for path in paths:
for dirpath, dirnames, names in os.walk(path):
for name in names:
if os.sep == '/':
yield os.path.join(dirpath, name)
else:
yield '/'.join(dirpath.split(os.sep) + [name])
def _strip_comments(lines):
# FIXME this is a horribe hack, we should use a proper JavaScript parser
# here
in_multiline_comment = False
lineno = 0
for line in lines:
lineno += 1
if in_multiline_comment:
index = line.find('*/')
if index != -1:
in_multiline_comment = False
line = line[index + 2:]
if not in_multiline_comment:
line = re.sub(r'//[^\n]*', '', line)
line = re.sub(r'/\*.*?\*/', '', line)
index = line.find('/*')
if index != -1:
yield lineno, line[:index]
in_multiline_comment = True
else:
yield lineno, line
def check_requires(closure_lib, *filenames):
unused_count = 0
all_provides = set()
for filename in ifind(closure_lib):
if filename.endswith('.js'):
if not re.match(r'.*/closure/goog/', filename):
continue
# Skip goog.i18n because it contains so many modules that it causes
# the generated regular expression to exceed Python's limits
if re.match(r'.*/closure/goog/i18n/', filename):
continue
for line in open(filename, 'rU'):
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
if m:
all_provides.add(m.group(1))
for filename in sorted(filenames):
require_linenos = {}
uses = set()
lines = open(filename, 'rU').readlines()
for lineno, line in _strip_comments(lines):
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
if m:
all_provides.add(m.group(1))
continue
m = re.match(r'goog.require\(\'(.*)\'\);', line)
if m:
require_linenos[m.group(1)] = lineno
continue
ignore_linenos = require_linenos.values()
for lineno, line in enumerate(lines):
if lineno in ignore_linenos:
continue
for require in require_linenos.iterkeys():
if require in line:
uses.add(require)
for require in sorted(set(require_linenos.keys()) - uses):
logger.info('%s:%d: unused goog.require: %r' % (
filename, require_linenos[require], require))
unused_count += 1
all_provides.discard('ol')
all_provides.discard('ol.MapProperty')
root = Node()
for provide in all_provides:
node = root
for component in provide.split('.'):
if component not in node.children:
node.children[component] = Node()
node = node.children[component]
if component[0].islower():
# We've arrived at a namespace provide like `ol.foo`.
# In this case, we want to match uses like `ol.foo.doIt()` but
# not match things like `new ol.foo.SomeClass()`.
# For this purpose, we use the special wildcard key for the child.
node.children['*'] = Node()
else:
node.present = True
provide_res = [child.build_re(key)
for key, child in root.children.iteritems()]
missing_count = 0
for filename in sorted(filenames):
provides = set()
requires = set()
uses = set()
uses_linenos = {}
for lineno, line in _strip_comments(open(filename, 'rU')):
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
if m:
provides.add(m.group(1))
continue
m = re.match(r'goog.require\(\'(.*)\'\);', line)
if m:
requires.add(m.group(1))
continue
while True:
for provide_re in provide_res:
m = provide_re.search(line)
if m:
uses.add(m.group())
uses_linenos[m.group()] = lineno
line = line[:m.start()] + line[m.end():]
break
else:
break
if filename == 'src/ol/renderer/layerrenderer.js':
uses.discard('ol.renderer.Map')
m = re.match(
r'src/ol/renderer/(\w+)/\1(\w*)layerrenderer\.js\Z', filename)
if m:
uses.discard('ol.renderer.Map')
uses.discard('ol.renderer.%s.Map' % (m.group(1),))
missing_requires = uses - requires - provides
if missing_requires:
for missing_require in sorted(missing_requires):
logger.info("%s:%d missing goog.require('%s')" %
(filename, uses_linenos[missing_require],
missing_require))
missing_count += 1
return (unused_count, missing_count)
if __name__ == "__main__":
unused_count, missing_count = check_requires(*sys.argv[1:])
if unused_count > 0 or missing_count > 0:
logger.error('%d unused goog.requires, %d missing goog.requires' %
(unused_count, missing_count))
sys.exit(1)

View File

@@ -1,5 +1,30 @@
## Upgrade notes
#### Move of typedefs out of code and into separate file
This change should not affect the great majority of application developers, but it's possible there are edge cases when compiling application code together with the library which cause compiler errors or warnings. In this case, please raise a GitHub issue. `goog.require`s for typedefs should not be necessary.
#### Removal of `opaque` option for `ol.source.VectorTile`
This option is no longer needed, so it was removed from the API.
#### XHR loading for `ol.source.TileUTFGrid`
The `ol.source.TileUTFGrid` now uses XMLHttpRequest to load UTFGrid tiles by default. This works out of the box with the v4 Mapbox API. To work with the v3 API, you must use the new `jsonp` option on the source. See the examples below for detail.
```js
// To work with the v4 API
var v4source = new ol.source.TileUTFGrid({
url: 'https://api.tiles.mapbox.com/v4/example.json?access_token=' + YOUR_KEY_HERE
});
// To work with the v3 API
var v3source = new ol.source.TileUTFGrid({
jsonp: true, // <--- this is required for v3
url: 'http://api.tiles.mapbox.com/v3/example.json'
});
```
### v3.15.0
#### Internet Explorer 9 support

View File

@@ -17,7 +17,6 @@
"externs/closure-compiler.js",
"externs/esrijson.js",
"externs/example.js",
"externs/fastclick.js",
"externs/geojson.js",
"externs/jquery-1.9.js",
"externs/proj4js.js",

View File

@@ -17,9 +17,7 @@
"externs/closure-compiler.js",
"externs/esrijson.js",
"externs/example.js",
"externs/fastclick.js",
"externs/geojson.js",
"externs/jspdf.js",
"externs/jquery-1.9.js",
"externs/proj4js.js",
"externs/tilejson.js",

View File

@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
@@ -36,6 +36,11 @@
<div class="container-fluid">
<div id="latest-check" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
<button id="latest-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
This example uses OpenLayers v<span>{{ olVersion }}</span>. The <a id="latest-link" href="#" class="alert-link">latest</a> is v<span id="latest-version"></span>.
</div>
<div class="row-fluid">
<div class="span12">
<h4 id="title">{{ title }}</h4>
@@ -85,4 +90,30 @@
<script src="./resources/prism/prism.min.js"></script>
{{{ js.tag }}}
</body>
<script>
var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
fetch(packageUrl).then(function(response) {
return response.json();
}).then(function(json) {
var latestVersion = json.version;
document.getElementById('latest-version').innerHTML = latestVersion;
var url = window.location.href;
var branchSearch = url.match(/\/([^\/]*)\/examples\//);
var cookieText = 'dismissed=-' + latestVersion + '-';
var dismissed = document.cookie.indexOf(cookieText) != -1;
if (!dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '{{ olVersion }}' != latestVersion) {
var link = url.replace(branchSearch[0], '/latest/examples/');
fetch(link, {method: 'head'}).then(function(response) {
var a = document.getElementById('latest-link');
a.href = response.status == 200 ? link : '../../latest/examples/';
});
var latestCheck = document.getElementById('latest-check');
latestCheck.style.display = '';
document.getElementById('latest-dismiss').onclick = function() {
latestCheck.style.display = 'none';
document.cookie = cookieText;
}
}
});
</script>
</html>

View File

@@ -39,3 +39,26 @@ Interactions for [vector features](ol.Feature.html)
[ol.Geolocation](ol.Geolocation.html)<br>
[ol.Overlay](ol.Overlay.html)<br></td>
</tr></table>
&nbsp;
#### API change policy
The OpenLayers 3.x API consists of
* names of classes, class methods and properties
* names of static functions and constants
* order and types of function arguments
* types of function return values
API elements marked as `experimental` provide stable and functioning code, but may change.
Any changes will be documented in upgrade notes so application code can be changed appropriately
before using the new version of the library. All other API elements will remain compatible throughout the 3.x releases so that no changes to existing application code are necessary when upgrading to a later version.
*Note*: The API change policy does not cover CSS class names that are used to theme the
OpenLayers UI.
*Note for Closure Compiler users compiling their application code together with OpenLayers*:
The names of types other than those in the list above (e.g. `ol.Pixel`) are subject to change. It
is therefore recommended to either use the resolved type as listed in the API docs (e.g.
`Array.<number>` instead of `ol.Pixel`), or pay attention to the upgrade notes, which will list
the changes for those types.

View File

@@ -113,7 +113,8 @@ function generate(title, docs, filename, resolveLinks) {
var docData = {
filename: filename,
title: title,
docs: docs
docs: docs,
packageInfo: ( find({kind: 'package'}) || [] ) [0]
};
var outpath = path.join(outdir, filename),
@@ -327,11 +328,6 @@ exports.publish = function(taffyData, opts, tutorials) {
}
});
// update outdir if necessary, then create outdir
var packageInfo = ( find({kind: 'package'}) || [] ) [0];
if (packageInfo && packageInfo.name) {
outdir = path.join(outdir, packageInfo.name, packageInfo.version);
}
fs.mkPath(outdir);
// copy the template's static files to outdir
@@ -439,13 +435,10 @@ exports.publish = function(taffyData, opts, tutorials) {
if (members.globals.length) { generate('Global', [{kind: 'globalobj'}], globalUrl); }
// index page displays information from package.json and lists files
var files = find({kind: 'file'}),
packages = find({kind: 'package'});
var files = find({kind: 'file'});
generate('Index',
packages.concat(
[{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}]
).concat(files),
[{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}].concat(files),
indexUrl);
// set up the lists that we'll use to generate pages

View File

@@ -53,20 +53,44 @@ $(function () {
$(window).on('resize', _onResize);
_onResize();
var currentVersion = document.getElementById('package-version').innerHTML;
// warn about outdated version
var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
fetch(packageUrl).then(function(response) {
return response.json();
}).then(function(json) {
var latestVersion = json.version;
document.getElementById('latest-version').innerHTML = latestVersion;
var url = window.location.href;
var branchSearch = url.match(/\/([^\/]*)\/apidoc\//);
var cookieText = 'dismissed=-' + latestVersion + '-';
var dismissed = document.cookie.indexOf(cookieText) != -1;
if (!dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && currentVersion != latestVersion) {
var link = url.replace(branchSearch[0], '/latest/apidoc/');
fetch(link, {method: 'head'}).then(function(response) {
var a = document.getElementById('latest-link');
a.href = response.status == 200 ? link : '../../latest/apidoc/';
});
var latestCheck = document.getElementById('latest-check');
latestCheck.style.display = '';
document.getElementById('latest-dismiss').onclick = function() {
latestCheck.style.display = 'none';
document.cookie = cookieText;
}
}
});
// create source code links to github
var srcLinks = $('div.tag-source');
var masterSearch = window.location.href.match(/\/([^\/]*\/)apidoc\//);
if (masterSearch && masterSearch.length) {
var branch = masterSearch[1];
srcLinks.each(function(i, el) {
var textParts = el.innerHTML.trim().split(', ');
var link = 'https://github.com/openlayers/ol3/blob/' + branch +
var link = 'https://github.com/openlayers/ol3/blob/v' + currentVersion + '/' +
textParts[0];
el.innerHTML = '<a href="' + link + '">' + textParts[0] + '</a>, ' +
'<a href="' + link + textParts[1].replace('line ', '#l') + '">' +
textParts[1] + '</a>';
});
}
// show/hide unstable items
var links = $('a[href^="ol."]');

View File

@@ -416,3 +416,7 @@ footer {
left: 250px;
font-weight: normal;
}
#latest-check {
margin-top: -10px;
margin-bottom: 10px;
}

View File

@@ -1,8 +1,12 @@
<?js
var version = obj.packageInfo.version;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>OpenLayers 3 API Reference - <?js= title ?></title>
<title>OpenLayers v<?js= version ?> API - <?js= title ?></title>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<script src="scripts/jquery.min.js"> </script>
@@ -36,6 +40,10 @@
<?js= this.partial('navigation.tmpl', this) ?>
<div class="main">
<h1 class="page-title" data-filename="<?js= filename ?>"><?js= title ?></h1>
<div id="latest-check" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
<button id="latest-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
This documentation is for OpenLayers v<span id="package-version"><?js= version ?></span>. The <a id="latest-link" href="#" class="alert-link">latest</a> is v<span id="latest-version"></span>.
</div>
<?js= content ?>
</div>
</div>

View File

@@ -45,7 +45,7 @@ The easiest way to use a custom projection is to add the [Proj4js](http://proj4j
Following example shows definition of a [British National Grid](http://epsg.io/27700):
``` html
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js"></script>
```
``` javascript

View File

@@ -1,6 +1,5 @@
{
"globals": {
"FastClick": false,
"$": false,
"arc": false,
"common": false,

View File

@@ -0,0 +1,11 @@
---
layout: example.html
title: Image ArcGIS MapServer
shortdesc: Example of an image ArcGIS layer.
docs: >
This example shows how to use a dynamic ArcGIS REST MapService.
This source type supports Map and Image Services. For dyamic ArcGIS
services.
tags: arcgis, image, dynamiclayer"
---
<div id="map" class="map"></div>

29
examples/arcgis-image.js Normal file
View File

@@ -0,0 +1,29 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Image');
goog.require('ol.source.MapQuest');
goog.require('ol.source.ImageArcGISRest');
var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
'Specialty/ESRI_StateCityHighway_USA/MapServer';
var layers = [
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
}),
new ol.layer.Image({
source: new ol.source.ImageArcGISRest({
params: {},
url: url
})
})
];
var map = new ol.Map({
layers: layers,
target: 'map',
view: new ol.View({
center: [-10997148, 4569099],
zoom: 4
})
});

View File

@@ -6,8 +6,8 @@ docs: >
This example shows how to customize the buttons tooltips with <a href="http://getbootstrap.com/javascript/#tooltips">Bootstrap</a>.
tags: "custom, tooltip"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
---
<div id="map" class="map"></div>

View File

@@ -0,0 +1,9 @@
---
layout: example.html
title: Custom Icon
shortdesc: Example using a custom attribution icon object
docs: >
This example creates a custom element for the attribution icon
tags: "icon, element"
---
<div id="map" class="map"><div id="popup"></div></div>

27
examples/custom-icon.js Normal file
View File

@@ -0,0 +1,27 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var logoElement = document.createElement('a');
logoElement.href = 'http://www.osgeo.org/';
logoElement.target = '_blank';
var logoImage = document.createElement('img');
logoImage.src = 'http://www.osgeo.org/sites/all/themes/osgeo/logo.png';
logoElement.appendChild(logoImage);
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
}),
logo: logoElement
});

View File

@@ -1,3 +1,4 @@
// NOCOMPILE
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control');

View File

@@ -10,7 +10,7 @@ tags: "fullscreen, geolocation, orientation, mobile"
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
<title>Mobile Geolocation Tracking with Orientation</title>
@@ -44,7 +44,7 @@ tags: "fullscreen, geolocation, orientation, mobile"
<button id="geolocate">Geolocate Me!</button>
<button id="simulate">Simulate</button>
</div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="http://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=geolocation-orientation" type="text/javascript"></script>
</body>

View File

@@ -6,8 +6,8 @@ docs: >
Example using an icon to symbolize a point.
tags: "vector, style, icon, marker, popup"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
---
<div id="map" class="map"><div id="popup"></div></div>

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
<style>

View File

@@ -6,8 +6,8 @@ docs: >
This example parses a KML file and renders the features as a vector layer. The layer is given a <code>style</code> that renders earthquake locations with a size relative to their magnitude.
tags: "KML, vector, style, tooltip"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
---
<div id="map" class="map"><div id="info"></div></div>

View File

@@ -7,8 +7,8 @@ docs: >
yellow with an opacity calculated based on the current offset to local noon.
tags: "KML, vector, style"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
---
<div id="map" class="map"><div id="info"></div></div>

View File

@@ -6,7 +6,7 @@ docs: >
Example of a map with layer group.
tags: "tilejson, input, bind, group, layergroup"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
---
<div id="map" class="map"></div>
<div id="layertree">

View File

@@ -43,6 +43,7 @@ function tileUrlFunction(tileCoord) {
var map = new ol.Map({
layers: [
new ol.layer.VectorTile({
renderMode: 'vector',
preload: Infinity,
source: new ol.source.VectorTile({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +

View File

@@ -5,8 +5,6 @@ shortdesc: Example of using the ol.interaction.Draw interaction to create a simp
docs: >
<p><i>NOTE: By default, length and area are calculated using the projected coordinates. This is not accurate for projections like Mercator where the projected meters do not correspond to meters on the ground. To get a standarized measurement across all projections, use the geodesic measures.</i></p>
tags: "draw, edit, measure, vector"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -117,7 +117,7 @@ var pointerMoveHandler = function(evt) {
helpTooltipElement.innerHTML = helpMsg;
helpTooltip.setPosition(evt.coordinate);
$(helpTooltipElement).removeClass('hidden');
helpTooltipElement.classList.remove('hidden');
};
@@ -132,8 +132,8 @@ var map = new ol.Map({
map.on('pointermove', pointerMoveHandler);
$(map.getViewport()).on('mouseout', function() {
$(helpTooltipElement).addClass('hidden');
map.getViewport().addEventListener('mouseout', function() {
helpTooltipElement.classList.add('hidden');
});
var typeSelect = document.getElementById('type');

View File

@@ -24,9 +24,8 @@ cloak:
</head>
<body>
<div id="map" class="map"></div>
<script src="https://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<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="http://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js" type="text/javascript"></script>
<script src="loader.js?id=mobile-full-screen" type="text/javascript"></script>
</body>
</html>

View File

@@ -32,11 +32,3 @@ geolocation.once('change:position', function() {
view.setCenter(geolocation.getPosition());
view.setResolution(2.388657133911758);
});
// Use FastClick to eliminate the 300ms delay between a physical tap
// and the firing of a click event on mobile browsers.
// See http://updates.html5rocks.com/2013/12/300ms-tap-delay-gone-away
// for more information.
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body);
});

View File

@@ -3,8 +3,7 @@ layout: example.html
title: Navigation Controls
shortdesc: Shows how to add navigation controls.
docs: >
<p>This example shows how to use the beforeRender function on the Map to run one
or more animations.</p>
<p>This example shows how to use the <code>ol.control.ZoomToExtent</code> control.</p>
<p>The following navigation controls are added to the map:</p>
<ul>
<li><code>ol.control.Zoom</code> (added by default)</li>

View File

@@ -6,9 +6,9 @@ docs: >
<p>The popups are created using <a href="http://getbootstrap.com/javascript/#popovers">Popovers</a> from Bootstrap.</p>
tags: "overlay, popup, bootstrap, popover, mapquest, openaerial"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
---
<div id="map" class="map"></div>
<div style="display: none;">

View File

@@ -8,7 +8,7 @@ docs: >
in <a href="http://epsg.io/">EPSG.io</a> database.
tags: "reprojection, projection, proj4js, mapquest, epsg.io"
resources:
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of single image source.
tags: "reprojection, projection, proj4js, mapquest, image, imagestatic"
resources:
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -6,7 +6,7 @@ docs: >
This example shows client-side raster reprojection between various projections.
tags: "reprojection, projection, proj4js, mapquest, wms, wmts, hidpi"
resources:
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -122,3 +122,7 @@ pre {
#api-links ul {
display: inline;
}
#latest-check {
margin-top: -10px;
margin-bottom: 10px;
}

View File

@@ -15,8 +15,8 @@ function createMapboxStreetsV6Style() {
var icon = iconCache[iconName];
if (!icon) {
icon = new ol.style.Style({image: new ol.style.Icon({
src: '//raw.githubusercontent.com/mapbox/maki/mb-pages/renders/' +
iconName + '-12.png'
src: 'https://cdn.rawgit.com/mapbox/maki/master/icons/' + iconName + '-15.svg',
imgSize: [15, 15]
})});
iconCache[iconName] = icon;
}

View File

@@ -0,0 +1,12 @@
---
layout: example.html
title: Reusable Source
shortdesc: Updating a tile source by changing the URL.
docs: >
You can call <code>source.setUrl()</code> to update the URL for a tile source. Note that when you change the URL for a tile source, existing tiles will not be replaced until new tiles are loaded. If you are interested instead in clearing currently rendered tiles, you can call the <code>source.refresh()</code> method. Alternatively, you can use two separate sources if you want to remove rendered tiles and start over loading new tiles.
---
<div id="map" class="map"></div>
<button class="switcher" value="0">January</button>
<button class="switcher" value="1">January (with bathymetry)</button>
<button class="switcher" value="2">July</button>
<button class="switcher" value="3">July (with bathymetry)</button>

View File

@@ -0,0 +1,39 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.XYZ');
var urls = [
'https://{a-c}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-jan/{z}/{x}/{y}.png',
'https://{a-c}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-bathy-jan/{z}/{x}/{y}.png',
'https://{a-c}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-jul/{z}/{x}/{y}.png',
'https://{a-c}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-bathy-jul/{z}/{x}/{y}.png'
];
var source = new ol.source.XYZ();
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: source
})
],
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
function updateUrl(index) {
source.setUrl(urls[index]);
}
var buttons = document.getElementsByClassName('switcher');
for (var i = 0, ii = buttons.length; i < ii; ++i) {
var button = buttons[i];
button.addEventListener('click', updateUrl.bind(null, Number(button.value)));
}
updateUrl(0);

View File

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

View File

@@ -6,6 +6,6 @@ docs: >
Example of a Sphere Mollweide map with a Graticule component.
tags: "graticule, Mollweide, projection, proj4js"
resources:
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -8,7 +8,6 @@ docs: >
and <code>tileloaderror</code> type events to monitor tile loading
progress. This example registers listeners for these events and
renders a tile loading progress bar at the bottom of the map.</p>
This example creates a "rotate to north" button.
tags: "tile, events, loading"
---
<div class="wrapper">

View File

@@ -6,6 +6,8 @@ docs: >
<p>Point to a country to see its name and flag.</p>
Tiles made with [TileMill](http://tilemill.com). Hosting on MapBox.com or with open-source [TileServer](https://github.com/klokantech/tileserver-php/).
tags: "utfgrid, tileutfgrid, tilejson"
cloak:
pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg: Your Mapbox access token from http://mapbox.com/ here
---
<div id="map" class="map"></div>
<div style="display: none;">

View File

@@ -5,14 +5,17 @@ goog.require('ol.layer.Tile');
goog.require('ol.source.TileJSON');
goog.require('ol.source.TileUTFGrid');
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
var mapLayer = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
url: 'http://api.tiles.mapbox.com/v4/mapbox.geography-class.json?access_token=' + key
})
});
var gridSource = new ol.source.TileUTFGrid({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
url: 'http://api.tiles.mapbox.com/v4/mapbox.geography-class.json?access_token=' + key
});
var gridLayer = new ol.layer.Tile({source: gridSource});

View File

@@ -4,9 +4,9 @@ title: Editable ArcGIS REST Feature Service
shortdesc: Example of using an ArcGIS REST Feature Service in an editing application.
docs: >
This example loads features from ArcGIS REST Feature Service and allows to add new features or update existing features.
tags: "vector, esri, ArcGIS, REST, Feature, Service, bbox, loading, server, edit, updateFeature, addFeature"
tags: "vector, esri, ArcGIS, REST, Feature, Service, loading, server, edit, updateFeature, addFeature"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -1,12 +1,12 @@
---
layout: example.html
title: ArcGIS REST Feature Service
shortdesc: Example of using an ArcGIS REST Feature Service with a BBOX strategy.
shortdesc: Example of using an ArcGIS REST Feature Service with a Tile strategy.
docs: >
This example loads new features from ArcGIS REST Feature Service when the view extent changes.
tags: "vector, esri, ArcGIS, REST, Feature, Service, bbox, loading, server"
tags: "vector, esri, ArcGIS, REST, Feature, Service, loading, server"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://code.jquery.com/jquery-2.2.3.min.js
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -0,0 +1,13 @@
---
layout: example.html
title: WFS - GetFeature
shortdesc: Example of making a WFS GetFeature request with a filter.
docs: >
This example generates a `GetFeature` request which uses a `PropertyIsEqualTo`
and a `PropertyIsLike` filter, and then posts the request to load the features
that match the query.
tags: "vector, WFS, GetFeature, filter"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -0,0 +1,66 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.ogc.filter');
goog.require('ol.format.WFS');
goog.require('ol.format.GeoJSON');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.BingMaps');
goog.require('ol.source.Vector');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var vectorSource = new ol.source.Vector();
var vector = new ol.layer.Vector({
source: vectorSource,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(0, 0, 255, 1.0)',
width: 2
})
})
});
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
})
});
var map = new ol.Map({
layers: [raster, vector],
target: document.getElementById('map'),
view: new ol.View({
center: [-8908887.277395891, 5381918.072437216],
maxZoom: 19,
zoom: 12
})
});
// generate a GetFeature request
var f = ol.format.ogc.filter;
var featureRequest = new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:3857',
featureNS: 'http://openstreemap.org',
featurePrefix: 'osm',
featureTypes: ['water_areas'],
outputFormat: 'application/json',
filter: f.and(
f.like('name', 'Mississippi*'),
f.equalTo('waterway', 'riverbank')
)
});
// then post the request and add the received features to a layer
fetch('http://demo.boundlessgeo.com/geoserver/wfs', {
method: 'POST',
body: new XMLSerializer().serializeToString(featureRequest)
}).then(function(response) {
return response.json();
}).then(function(json) {
var features = new ol.format.GeoJSON().readFeatures(json);
vectorSource.addFeatures(features);
map.getView().fit(vectorSource.getExtent(), /** @type {ol.Size} */ (map.getSize()));
});

View File

@@ -18,9 +18,7 @@ var vectorSource = new ol.source.Vector({
'outputFormat=application/json&srsname=EPSG:3857&' +
'bbox=' + extent.join(',') + ',EPSG:3857';
},
strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({
maxZoom: 19
}))
strategy: ol.loadingstrategy.bbox
});

View File

@@ -6,7 +6,7 @@ docs: >
With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections.
tags: "wms, single image, proj4js, projection"
resources:
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js
- http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
- http://epsg.io/21781-1753.js
---
<div id="map" class="map"></div>

View File

@@ -1,26 +0,0 @@
/**
* @fileoverview Externs for FastClick 1.0.6
* @see https://github.com/ftlabs/fastclick
* @externs
*/
/**
* @type {Object}
* @const
*/
var FastClick = {};
/**
* @typedef {{
* touchBoundary: (number|undefined),
* tapDelay: (number|undefined),
* tapTimeout: (number|undefined)
* }}
*/
FastClick.AttachOptions;
/**
* @param {Element} layer
* @param {FastClick.AttachOptions=} opt_options
*/
FastClick.attach = function(layer, opt_options) {};

View File

@@ -1,46 +0,0 @@
/**
* @fileoverview jsPDF PDF generator.
* @see https://github.com/MrRio/jsPDF
*/
/**
* @constructor
* @param {string=} orientation One of `portrait` or `landscape`
* (or shortcuts `p` (default), `l`).
* @param {string=} unit Measurement unit to be used when coordinates are specified.
* One of `pt`, `mm` (default), `cm`, `in`.
* @param {string=} format Default: `a4`.
* @param {boolean=} compressPdf
*/
var jsPDF = function(orientation, unit, format, compressPdf) {};
/**
* @param {string} imageData
* @param {string} format
* @param {number} x
* @param {number} y
* @param {number} w
* @param {number} h
* @param {string=} alias
* @param {number=} compression
* @return {jsPDF}
*/
jsPDF.prototype.addImage = function(imageData, format, x, y, w, h, alias, compression) {};
/**
* @return {jsPDF}
*/
jsPDF.prototype.autoPrint = function() {};
/**
* @param {string} type
* @param {Object=} options
* @return {jsPDF}
*/
jsPDF.prototype.output = function(type, options) {};
/**
* @param {string} filename
* @return {jsPDF}
*/
jsPDF.prototype.save = function(filename) {};

View File

@@ -175,7 +175,7 @@ olx.interaction.InteractionOptions.prototype.handleEvent;
* layers: (Array.<ol.layer.Base>|ol.Collection.<ol.layer.Base>|undefined),
* loadTilesWhileAnimating: (boolean|undefined),
* loadTilesWhileInteracting: (boolean|undefined),
* logo: (boolean|string|olx.LogoOptions|undefined),
* logo: (boolean|string|olx.LogoOptions|Element|undefined),
* overlays: (ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined),
* renderer: (ol.RendererType|Array.<ol.RendererType|string>|string|undefined),
* target: (Element|string|undefined),
@@ -261,9 +261,10 @@ olx.MapOptions.prototype.loadTilesWhileInteracting;
* The map logo. A logo to be displayed on the map at all times. If a string is
* provided, it will be set as the image source of the logo. If an object is
* provided, the `src` property should be the URL for an image and the `href`
* property should be a URL for creating a link. To disable the map logo, set
* the option to `false`. By default, the OpenLayers 3 logo is shown.
* @type {boolean|string|olx.LogoOptions|undefined}
* property should be a URL for creating a link. If an element is provided,
* the element will be used. To disable the map logo, set the option to
* `false`. By default, the OpenLayers 3 logo is shown.
* @type {boolean|string|olx.LogoOptions|Element|undefined}
* @api stable
*/
olx.MapOptions.prototype.logo;
@@ -2049,7 +2050,8 @@ olx.format.WFSOptions.prototype.schemaLocation;
* propertyNames: (Array.<string>|undefined),
* startIndex: (number|undefined),
* count: (number|undefined),
* bbox: (ol.Extent|undefined)}}
* bbox: (ol.Extent|undefined),
* filter: (ol.format.ogc.filter.Filter|undefined)}}
* @api
*/
olx.format.WFSWriteGetFeatureOptions;
@@ -2155,6 +2157,14 @@ olx.format.WFSWriteGetFeatureOptions.prototype.count;
olx.format.WFSWriteGetFeatureOptions.prototype.bbox;
/**
* OGC filter condition. See {@link ol.format.ogc.filter} for more information.
* @type {ol.format.ogc.filter.Filter|undefined}
* @api
*/
olx.format.WFSWriteGetFeatureOptions.prototype.filter;
/**
* @typedef {{featureNS: string,
* featurePrefix: string,
@@ -2585,6 +2595,7 @@ olx.interaction.DragZoomOptions.prototype.out;
* type: ol.geom.GeometryType,
* maxPoints: (number|undefined),
* minPoints: (number|undefined),
* finishCondition: (ol.events.ConditionType|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
* geometryFunction: (ol.interaction.DrawGeometryFunctionType|undefined),
* geometryName: (string|undefined),
@@ -2659,6 +2670,15 @@ olx.interaction.DrawOptions.prototype.maxPoints;
olx.interaction.DrawOptions.prototype.minPoints;
/**
* A function that takes an {@link ol.MapBrowserEvent} and returns a boolean
* to indicate whether the drawing can be finished.
* @type {ol.events.ConditionType|undefined}
* @api
*/
olx.interaction.DrawOptions.prototype.finishCondition;
/**
* Style for sketch features.
* @type {ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined}
@@ -2715,7 +2735,10 @@ olx.interaction.DrawOptions.prototype.wrapX;
/**
* @typedef {{features: (ol.Collection.<ol.Feature>|undefined)}}
* @typedef {{
* features: (ol.Collection.<ol.Feature>|undefined),
* layers: (undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean)
* }}
* @api
*/
olx.interaction.TranslateOptions;
@@ -2730,6 +2753,18 @@ olx.interaction.TranslateOptions;
olx.interaction.TranslateOptions.prototype.features;
/**
* A list of layers from which features should be
* translated. Alternatively, a filter function can be provided. The
* function will be called for each layer in the map and should return
* `true` for layers that you want to be translatable. If the option is
* absent, all visible layers will be considered translatable.
* @type {undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean}
* @api
*/
olx.interaction.TranslateOptions.prototype.layers;
/**
* @typedef {{condition: (ol.events.ConditionType|undefined),
* duration: (number|undefined),
@@ -2802,7 +2837,8 @@ olx.interaction.KeyboardZoomOptions.prototype.delta;
/**
* @typedef {{deleteCondition: (ol.events.ConditionType|undefined),
* @typedef {{condition: (ol.events.ConditionType|undefined),
* deleteCondition: (ol.events.ConditionType|undefined),
* pixelTolerance: (number|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
* features: ol.Collection.<ol.Feature>,
@@ -2812,6 +2848,17 @@ olx.interaction.KeyboardZoomOptions.prototype.delta;
olx.interaction.ModifyOptions;
/**
* A function that takes an {@link ol.MapBrowserEvent} and returns a boolean
* to indicate whether that event will be considered to add or move a vertex
* to the sketch.
* Default is {@link ol.events.condition.primaryAction}.
* @type {ol.events.ConditionType|undefined}
* @api
*/
olx.interaction.ModifyOptions.prototype.condition;
/**
* A function that takes an {@link ol.MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
@@ -3079,7 +3126,6 @@ olx.interaction.SelectOptions.prototype.toggleCondition;
*/
olx.interaction.SelectOptions.prototype.multi;
/**
* Collection where the interaction will place selected features. Optional. If
* not set the interaction will create a collection. In any case the collection
@@ -3090,7 +3136,6 @@ olx.interaction.SelectOptions.prototype.multi;
*/
olx.interaction.SelectOptions.prototype.features;
/**
* A function that takes an {@link ol.Feature} and an {@link ol.layer.Layer} and
* returns `true` if the feature may be selected or `false` otherwise.
@@ -3783,6 +3828,7 @@ olx.layer.VectorOptions.prototype.visible;
* maxResolution: (number|undefined),
* opacity: (number|undefined),
* renderBuffer: (number|undefined),
* renderMode: (ol.layer.VectorTileRenderType|string|undefined),
* renderOrder: (function(ol.Feature, ol.Feature):number|undefined),
* source: (ol.source.VectorTile|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
@@ -3807,6 +3853,22 @@ olx.layer.VectorTileOptions;
olx.layer.VectorTileOptions.prototype.renderBuffer;
/**
* Render mode for vector tiles:
* * `'image'`: Vector tiles are rendered as images. Great performance, but
* point symbols and texts are always rotated with the view and pixels are
* scaled during zoom animations.
* * `'hybrid'`: Polygon and line elements are rendered as images, so pixels
* are scaled during zoom animations. Point symbols and texts are accurately
* rendered as vectors and can stay upright on rotated views.
* * `'vector'`: Vector tiles are rendered as vectors. Most accurate rendering
* even during animations, but slower performance than the other options.
* The default is `'hybrid'`.
* @type {ol.layer.VectorTileRenderType|string|undefined}
* @api
*/
olx.layer.VectorTileOptions.prototype.renderMode;
/**
* Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created.
@@ -3946,13 +4008,6 @@ olx.render.ToContextOptions.prototype.pixelRatio;
olx.source;
/**
* @typedef {string|Array.<string>|ol.Attribution|Array.<ol.Attribution>}
* @api
*/
olx.source.AttributionOption;
/**
* @typedef {{cacheSize: (number|undefined),
* culture: (string|undefined),
@@ -4039,7 +4094,7 @@ olx.source.BingMapsOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* distance: (number|undefined),
* extent: (ol.Extent|undefined),
* format: (ol.format.Feature|undefined),
@@ -4055,7 +4110,7 @@ olx.source.ClusterOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.ClusterOptions.prototype.attributions;
@@ -4138,6 +4193,7 @@ olx.source.ClusterOptions.prototype.wrapX;
/**
* @typedef {{preemptive: (boolean|undefined),
* jsonp: (boolean|undefined),
* tileJSON: (TileJSON|undefined),
* url: (string|undefined)}}
* @api
@@ -4145,6 +4201,15 @@ olx.source.ClusterOptions.prototype.wrapX;
olx.source.TileUTFGridOptions;
/**
* Use JSONP with callback to load the TileJSON. Useful when the server
* does not support CORS. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.source.TileUTFGridOptions.prototype.jsonp;
/**
* If `true` the TileUTFGrid source loads the tiles based on their "visibility".
* This improves the speed of response, but increases traffic.
@@ -4177,7 +4242,7 @@ olx.source.TileUTFGridOptions.prototype.url;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
@@ -4202,7 +4267,7 @@ olx.source.TileImageOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.TileImageOptions.prototype.attributions;
@@ -4349,11 +4414,10 @@ olx.source.TileImageOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* format: (ol.format.Feature|undefined),
* logo: (string|olx.LogoOptions|undefined),
* opaque: (boolean|undefined),
* projection: ol.proj.ProjectionLike,
* state: (ol.source.State|undefined),
* tileClass: (function(new: ol.VectorTile, ol.TileCoord,
@@ -4373,7 +4437,7 @@ olx.source.VectorTileOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.VectorTileOptions.prototype.attributions;
@@ -4404,14 +4468,6 @@ olx.source.VectorTileOptions.prototype.format;
olx.source.VectorTileOptions.prototype.logo;
/**
* Whether the layer is opaque.
* @type {boolean|undefined}
* @api
*/
olx.source.VectorTileOptions.prototype.opaque;
/**
* Projection.
* @type {ol.proj.ProjectionLike}
@@ -4701,7 +4757,7 @@ olx.source.TileDebugOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* maxZoom: (number|undefined),
@@ -4717,7 +4773,7 @@ olx.source.OSMOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.OSMOptions.prototype.attributions;
@@ -4801,7 +4857,106 @@ olx.source.OSMOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* params: Object.<string,*>,
* projection: ol.proj.ProjectionLike,
* ratio: (number|undefined),
* resolutions: (Array.<number>|undefined),
* url: (string|undefined)}}
* @api
*/
olx.source.ImageArcGISRestOptions;
/**
* Attributions.
* @type {Array.<ol.Attribution>|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.attributions;
/**
* The `crossOrigin` attribute for loaded images. Note that you must provide a
* `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image}
* for more detail.
* @type {null|string|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.crossOrigin;
/**
* Logo.
* @type {string|olx.LogoOptions|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.logo;
/**
* Optional function to load an image given a URL.
* @type {ol.ImageLoadFunctionType|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.imageLoadFunction;
/**
* ArcGIS Rest parameters. This field is optional. Service defaults will be
* used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is `IMAGE` by
* default. `TRANSPARENT` is `true` by default. `BBOX, `SIZE`, `BBOXSR`,
* and `IMAGESR` will be set dynamically. Set `LAYERS` to
* override the default service layer visibility. See
* {@link http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/}
* for further reference.
* @type {Object.<string,*>|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.params;
/**
* Projection.
* @type {ol.proj.ProjectionLike}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.projection;
/**
* Ratio. `1` means image requests are the size of the map viewport, `2` means
* twice the size of the map viewport, and so on. Default is `1.5`.
* @type {number|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.ratio;
/**
* Resolutions. If specified, requests will be made for these resolutions only.
* @type {Array.<number>|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.resolutions;
/**
* ArcGIS Rest service URL for a Map Service or Image Service. The
* url should include /MapServer or /ImageServer.
* @type {string|undefined}
* @api
*/
olx.source.ImageArcGISRestOptions.prototype.url;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* canvasFunction: ol.CanvasFunctionType,
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.proj.ProjectionLike,
@@ -4815,7 +4970,7 @@ olx.source.ImageCanvasOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.ImageCanvasOptions.prototype.attributions;
@@ -4880,7 +5035,7 @@ olx.source.ImageCanvasOptions.prototype.state;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* logo: (string|olx.LogoOptions|undefined),
* projection: ol.proj.ProjectionLike,
* ratio: (number|undefined),
@@ -4894,7 +5049,7 @@ olx.source.ImageVectorOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.ImageVectorOptions.prototype.attributions;
@@ -5012,7 +5167,7 @@ olx.source.RasterOptions.prototype.operationType;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* crossOrigin: (null|string|undefined),
* hidpi: (boolean|undefined),
* serverType: (ol.source.wms.ServerType|string|undefined),
@@ -5030,7 +5185,7 @@ olx.source.ImageWMSOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.ImageWMSOptions.prototype.attributions;
@@ -5210,7 +5365,7 @@ olx.source.StamenOptions.prototype.url;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* crossOrigin: (null|string|undefined),
* imageExtent: (ol.Extent),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
@@ -5225,7 +5380,7 @@ olx.source.ImageStaticOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.ImageStaticOptions.prototype.attributions;
@@ -5294,7 +5449,7 @@ olx.source.ImageStaticOptions.prototype.url;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* params: (Object.<string, *>|undefined),
@@ -5313,7 +5468,7 @@ olx.source.TileArcGISRestOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.TileArcGISRestOptions.prototype.attributions;
@@ -5430,7 +5585,7 @@ olx.source.TileArcGISRestOptions.prototype.urls;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* jsonp: (boolean|undefined),
@@ -5447,7 +5602,7 @@ olx.source.TileJSONOptions;
* Optional attributions for the source. If provided, these will be used
* instead of any attribution data advertised by the server. If not provided,
* any attributions advertised by the server will be used.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.TileJSONOptions.prototype.attributions;
@@ -5521,7 +5676,7 @@ olx.source.TileJSONOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* params: Object.<string,*>,
* crossOrigin: (null|string|undefined),
@@ -5544,7 +5699,7 @@ olx.source.TileWMSOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.TileWMSOptions.prototype.attributions;
@@ -5700,7 +5855,7 @@ olx.source.TileWMSOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* features: (Array.<ol.Feature>|ol.Collection.<ol.Feature>|undefined),
* format: (ol.format.Feature|undefined),
* loader: (ol.FeatureLoader|undefined),
@@ -5716,7 +5871,7 @@ olx.source.VectorOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.VectorOptions.prototype.attributions;
@@ -5742,8 +5897,8 @@ olx.source.VectorOptions.prototype.format;
/**
* The loader function used to load features, from a remote source for example.
* Note that the source will create and use an XHR feature loader when `url` is
* set.
* If this is not set and `url` is set, the source will create and use an XHR
* feature loader.
* @type {ol.FeatureLoader|undefined}
* @api
*/
@@ -5820,7 +5975,7 @@ olx.source.VectorOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (string|null|undefined),
* logo: (string|olx.LogoOptions|undefined),
@@ -5850,7 +6005,7 @@ olx.source.WMTSOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api
*/
olx.source.WMTSOptions.prototype.attributions;
@@ -6036,7 +6191,7 @@ olx.source.WMTSOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
@@ -6060,7 +6215,7 @@ olx.source.XYZOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.XYZOptions.prototype.attributions;
@@ -6210,7 +6365,7 @@ olx.source.XYZOptions.prototype.urls;
olx.source.XYZOptions.prototype.wrapX;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
@@ -6228,7 +6383,7 @@ olx.source.CartoDBOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.CartoDBOptions.prototype.attributions;
@@ -6326,7 +6481,7 @@ olx.source.CartoDBOptions.prototype.account;
/**
* @typedef {{attributions: (olx.source.AttributionOption|undefined),
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* crossOrigin: (null|string|undefined),
* logo: (string|olx.LogoOptions|undefined),
@@ -6341,7 +6496,7 @@ olx.source.ZoomifyOptions;
/**
* Attributions.
* @type {olx.source.AttributionOption|undefined}
* @type {ol.AttributionLike|undefined}
* @api stable
*/
olx.source.ZoomifyOptions.prototype.attributions;
@@ -7272,7 +7427,8 @@ olx.view;
/**
* @typedef {{padding: !Array.<number>,
* @typedef {{
* padding: (!Array.<number>|undefined),
* constrainResolution: (boolean|undefined),
* nearest: (boolean|undefined),
* maxZoom: (number|undefined),
@@ -7285,7 +7441,7 @@ olx.view.FitOptions;
/**
* Padding (in pixels) to be cleared inside the view. Values in the array are
* top, right, bottom and left padding. Default is `[0, 0, 0, 0]`.
* @type {!Array.<number>}
* @type {!Array.<number>|undefined}
* @api
*/
olx.view.FitOptions.prototype.padding;
@@ -7334,9 +7490,9 @@ olx.view.FitOptions.prototype.maxZoom;
* extent: (null|ol.Extent),
* focus: ol.Coordinate,
* index: number,
* layerStates: Object.<number, ol.layer.LayerState>,
* layerStatesArray: Array.<ol.layer.LayerState>,
* logos: Object.<string, string>,
* layerStates: Object.<number, ol.LayerState>,
* layerStatesArray: Array.<ol.LayerState>,
* logos: Object.<string, (string|Element)>,
* pixelRatio: number,
* pixelToCoordinateMatrix: ol.vec.Mat4.Number,
* postRenderFunctions: Array.<ol.PostRenderFunction>,

View File

@@ -1,98 +0,0 @@
/**
* @externs
* @see http://www.khronos.org/webgl/wiki/Debugging
* @see http://www.khronos.org/webgl/wiki/HandlingContextLost
*/
/**
* @constructor
* @extends {WebGLRenderingContext}
*/
var WebGLDebugRenderingContext = function() {};
/**
* @constructor
* @extends {HTMLCanvasElement}
*/
var WebGLDebugLostContextSimulatingCanvas = function() {};
/**
* @nosideeffects
* @return {number}
*/
WebGLDebugLostContextSimulatingCanvas.prototype.getNumCalls = function() {};
/**
*/
WebGLDebugLostContextSimulatingCanvas.prototype.loseContext = function() {};
/**
* @param {number} numCalls
*/
WebGLDebugLostContextSimulatingCanvas.prototype.loseContextInNCalls =
function(numCalls) {};
/**
*/
WebGLDebugLostContextSimulatingCanvas.prototype.restoreContext = function() {};
/**
* @param {number} timeout
*/
WebGLDebugLostContextSimulatingCanvas.prototype.setRestoreTimeout =
function(timeout) {};
/**
* @type {Object}
*/
var WebGLDebugUtils = {};
/**
* @nosideeffects
* @param {number} value
* @return {string}
*/
WebGLDebugUtils.glEnumToString = function(value) {};
/**
* @nosideeffects
* @param {string} functionName
* @param {Array} args Args.
* @return {string} String.
*/
WebGLDebugUtils.glFunctionArgsToString = function(functionName, args) {};
/**
* @param {WebGLRenderingContext} ctx
*/
WebGLDebugUtils.init = function(ctx) {};
/**
* @param {HTMLCanvasElement} canvas
* @return {WebGLDebugLostContextSimulatingCanvas}
*/
WebGLDebugUtils.makeLostContextSimulatingCanvas = function(canvas) {};
/**
* @param {WebGLRenderingContext} context
* @param {Function=} opt_onErrorFunc
* @param {Function=} opt_onFunc
* @return {WebGLDebugRenderingContext}
*/
WebGLDebugUtils.makeDebugContext =
function(context, opt_onErrorFunc, opt_onFunc) {};

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "3.15.1",
"version": "3.16.0-alpha.4",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
@@ -31,41 +31,41 @@
],
"dependencies": {
"async": "1.5.2",
"browserify": "13.0.0",
"closure-util": "1.13.0",
"browserify": "13.0.1",
"closure-util": "1.13.1",
"derequire": "2.0.3",
"fs-extra": "0.26.6",
"fs-extra": "0.30.0",
"glob": "6.0.4",
"handlebars": "4.0.5",
"jsdoc": "3.4.0",
"marked": "0.3.5",
"metalsmith": "2.1.0",
"metalsmith-layouts": "1.6.4",
"metalsmith-layouts": "1.6.5",
"nomnom": "1.8.1",
"pbf": "1.3.5",
"pixelworks": "1.1.0",
"rbush": "1.4.2",
"rbush": "1.4.3",
"temp": "0.8.3",
"vector-tile": "1.2.0",
"walk": "2.3.9"
},
"devDependencies": {
"clean-css": "3.4.11",
"clean-css": "3.4.12",
"coveralls": "2.11.9",
"debounce": "^1.0.0",
"eslint": "2.6.0",
"eslint": "2.10.2",
"eslint-config-openlayers": "4.1.0",
"expect.js": "0.3.1",
"gaze": "^1.0.0",
"istanbul": "0.4.2",
"jquery": "2.2.2",
"istanbul": "0.4.3",
"jquery": "2.2.3",
"mocha": "2.4.5",
"mocha-phantomjs-core": "^1.3.0",
"mustache": "2.2.1",
"phantomjs-prebuilt": "2.1.7",
"proj4": "2.3.14",
"resemblejs": "2.2.0",
"sinon": "1.17.3",
"sinon": "1.17.4",
"slimerjs": "0.906.1"
},
"eslintConfig": {

View File

@@ -1,7 +1,6 @@
goog.provide('ol.animation');
goog.require('ol');
goog.require('ol.PreRenderFunction');
goog.require('ol.ViewHint');
goog.require('ol.coordinate');
goog.require('ol.easing');

View File

@@ -1,17 +0,0 @@
goog.provide('ol.CanvasFunctionType');
/**
* A function returning the canvas element (`{HTMLCanvasElement}`)
* used by the source as an image. The arguments passed to the function are:
* {@link ol.Extent} the image extent, `{number}` the image resolution,
* `{number}` the device pixel ratio, {@link ol.Size} the image size, and
* {@link ol.proj.Projection} the image projection. The canvas returned by
* this function is cached by the source. The this keyword inside the function
* references the {@link ol.source.ImageCanvas}.
*
* @typedef {function(this:ol.source.ImageCanvas, ol.Extent, number,
* number, ol.Size, ol.proj.Projection): HTMLCanvasElement}
* @api
*/
ol.CanvasFunctionType;

View File

@@ -1,15 +1,8 @@
goog.provide('ol.CenterConstraint');
goog.provide('ol.CenterConstraintType');
goog.require('ol.math');
/**
* @typedef {function((ol.Coordinate|undefined)): (ol.Coordinate|undefined)}
*/
ol.CenterConstraintType;
/**
* @param {ol.Extent} extent Extent.
* @return {ol.CenterConstraintType} The constraint.

View File

@@ -3,7 +3,6 @@
// causes occasional loss of precision and rounding errors, especially in the
// alpha channel.
goog.provide('ol.Color');
goog.provide('ol.color');
goog.require('goog.asserts');
@@ -13,17 +12,6 @@ goog.require('ol');
goog.require('ol.math');
/**
* A color represented as a short array [red, green, blue, alpha].
* 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>}
* @api
*/
ol.Color;
/**
* This RegExp matches # followed by 3 or 6 hex digits.
* @const

View File

@@ -1,19 +1,8 @@
goog.provide('ol.ColorLike');
goog.provide('ol.colorlike');
goog.require('ol.color');
/**
* A type accepted by CanvasRenderingContext2D.fillStyle.
* Represents a color, pattern, or gradient.
*
* @typedef {string|CanvasPattern|CanvasGradient}
* @api
*/
ol.ColorLike;
/**
* @param {ol.Color|ol.ColorLike} color Color.
* @return {ol.ColorLike} The color as an ol.ColorLike

5
src/ol/colorlike.jsdoc Normal file
View File

@@ -0,0 +1,5 @@
/**
* An {@link ol.ColorLike} can be a color, gradient or pattern accepted by
* [CanvasRenderingContext2D.fillStyle](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle).
* @namespace ol.colorlike
*/

View File

@@ -1,9 +1,5 @@
goog.provide('ol.Constraints');
goog.require('ol.CenterConstraintType');
goog.require('ol.ResolutionConstraintType');
goog.require('ol.RotationConstraintType');
/**
* @constructor

View File

@@ -303,10 +303,14 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
var image, logoElement, logoKey;
for (logoKey in logos) {
var logoValue = logos[logoKey];
if (logoValue instanceof HTMLElement) {
this.logoLi_.appendChild(logoValue);
logoElements[logoKey] = logoValue;
}
if (!(logoKey in logoElements)) {
image = new Image();
image.src = logoKey;
var logoValue = logos[logoKey];
if (logoValue === '') {
logoElement = image;
} else {

View File

@@ -156,7 +156,7 @@ ol.control.FullScreen.prototype.setMap = function(map) {
goog.base(this, 'setMap', map);
if (map) {
this.listenerKeys.push(
ol.events.listen(goog.global.document, goog.dom.fullscreen.EventType.CHANGE,
ol.events.listen(ol.global.document, goog.dom.fullscreen.EventType.CHANGE,
this.handleFullScreenChange_, this)
);
}

View File

@@ -4,10 +4,7 @@ goog.provide('ol.control.MousePosition');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.CoordinateFormatType');
goog.require('ol.Object');
goog.require('ol.Pixel');
goog.require('ol.TransformFunction');
goog.require('ol.control.Control');
goog.require('ol.proj');
goog.require('ol.proj.Projection');

View File

@@ -40,7 +40,7 @@ ol.control.Rotate = function(opt_options) {
'ol-compass', label);
} else {
this.label_ = label;
this.label_.classList.add(this.label_, 'ol-compass');
this.label_.classList.add('ol-compass');
}
var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';

View File

@@ -42,9 +42,8 @@ ol.control.Zoom = function(opt_options) {
'title': zoomInTipLabel
}, zoomInLabel);
ol.events.listen(inElement,
ol.events.EventType.CLICK, goog.partial(
ol.control.Zoom.prototype.handleClick_, delta), this);
ol.events.listen(inElement, ol.events.EventType.CLICK,
ol.control.Zoom.prototype.handleClick_.bind(this, delta));
var outElement = goog.dom.createDom('BUTTON', {
'class': className + '-out',
@@ -52,9 +51,8 @@ ol.control.Zoom = function(opt_options) {
'title': zoomOutTipLabel
}, zoomOutLabel);
ol.events.listen(outElement,
ol.events.EventType.CLICK, goog.partial(
ol.control.Zoom.prototype.handleClick_, -delta), this);
ol.events.listen(outElement, ol.events.EventType.CLICK,
ol.control.Zoom.prototype.handleClick_.bind(this, -delta));
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
ol.css.CLASS_CONTROL;

View File

@@ -9,7 +9,6 @@ goog.require('ol.events');
goog.require('ol.events.Event');
goog.require('ol.events.EventType');
goog.require('ol.pointer.PointerEventHandler');
goog.require('ol.Size');
goog.require('ol.ViewHint');
goog.require('ol.animation');
goog.require('ol.control.Control');

View File

@@ -1,27 +1,7 @@
goog.provide('ol.Coordinate');
goog.provide('ol.CoordinateFormatType');
goog.provide('ol.coordinate');
goog.require('goog.string');
goog.require('ol.math');
/**
* A function that takes a {@link ol.Coordinate} and transforms it into a
* `{string}`.
*
* @typedef {function((ol.Coordinate|undefined)): string}
* @api stable
*/
ol.CoordinateFormatType;
/**
* An array of numbers representing an xy coordinate. Example: `[16, 48]`.
* @typedef {Array.<number>} ol.Coordinate
* @api stable
*/
ol.Coordinate;
goog.require('ol.string');
/**
@@ -133,8 +113,8 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fraction
var x = Math.abs(3600 * normalizedDegrees);
var dflPrecision = opt_fractionDigits || 0;
return Math.floor(x / 3600) + '\u00b0 ' +
goog.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
goog.string.padNumber((x % 60), 2, dflPrecision) + '\u2033 ' +
ol.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
ol.string.padNumber((x % 60), 2, dflPrecision) + '\u2033 ' +
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
};

View File

@@ -207,7 +207,7 @@ ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
if (ol.has.DEVICE_ORIENTATION) {
var tracking = this.getTracking();
if (tracking && !this.listenerKey_) {
this.listenerKey_ = ol.events.listen(goog.global, 'deviceorientation',
this.listenerKey_ = ol.events.listen(ol.global, 'deviceorientation',
this.orientationChange_, this);
} else if (!tracking && this.listenerKey_ !== null) {
ol.events.unlistenByKey(this.listenerKey_);

View File

@@ -36,7 +36,7 @@ ol.dom.canUseCssTransform = (function() {
if (canUseCssTransform === undefined) {
goog.asserts.assert(document.body,
'document.body should not be null');
goog.asserts.assert(goog.global.getComputedStyle,
goog.asserts.assert(ol.global.getComputedStyle,
'getComputedStyle is required (unsupported browser?)');
var el = document.createElement('P'),
@@ -52,7 +52,7 @@ ol.dom.canUseCssTransform = (function() {
for (var t in transforms) {
if (t in el.style) {
el.style[t] = 'translate(1px,1px)';
has2d = goog.global.getComputedStyle(el).getPropertyValue(
has2d = ol.global.getComputedStyle(el).getPropertyValue(
transforms[t]);
}
}
@@ -77,7 +77,7 @@ ol.dom.canUseCssTransform3D = (function() {
if (canUseCssTransform3D === undefined) {
goog.asserts.assert(document.body,
'document.body should not be null');
goog.asserts.assert(goog.global.getComputedStyle,
goog.asserts.assert(ol.global.getComputedStyle,
'getComputedStyle is required (unsupported browser?)');
var el = document.createElement('P'),
@@ -93,7 +93,7 @@ ol.dom.canUseCssTransform3D = (function() {
for (var t in transforms) {
if (t in el.style) {
el.style[t] = 'translate3d(1px,1px,1px)';
has3d = goog.global.getComputedStyle(el).getPropertyValue(
has3d = ol.global.getComputedStyle(el).getPropertyValue(
transforms[t]);
}
}
@@ -192,7 +192,7 @@ ol.dom.transformElement2D = function(element, transform, opt_precision) {
*/
ol.dom.outerWidth = function(element) {
var width = element.offsetWidth;
var style = element.currentStyle || goog.global.getComputedStyle(element);
var style = element.currentStyle || ol.global.getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
return width;
@@ -208,7 +208,7 @@ ol.dom.outerWidth = function(element) {
*/
ol.dom.outerHeight = function(element) {
var height = element.offsetHeight;
var style = element.currentStyle || goog.global.getComputedStyle(element);
var style = element.currentStyle || ol.global.getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
return height;

View File

@@ -3,6 +3,7 @@ goog.provide('ol.events.EventType');
goog.provide('ol.events.KeyCode');
goog.require('ol.object');
goog.require('ol.events.EventTargetLike');
/**
@@ -61,40 +62,6 @@ ol.events.KeyCode = {
ol.events.LISTENER_MAP_PROP_ = 'olm_' + ((Math.random() * 1e4) | 0);
/**
* @typedef {EventTarget|ol.events.EventTarget|
* {addEventListener: function(string, Function, boolean=),
* removeEventListener: function(string, Function, boolean=),
* dispatchEvent: function(string)}}
*/
ol.events.EventTargetLike;
/**
* Key to use with {@link ol.Observable#unByKey}.
*
* @typedef {{bindTo: (Object|undefined),
* boundListener: (ol.events.ListenerFunctionType|undefined),
* callOnce: boolean,
* deleteIndex: (number|undefined),
* listener: ol.events.ListenerFunctionType,
* target: (EventTarget|ol.events.EventTarget),
* type: string}}
* @api
*/
ol.events.Key;
/**
* Listener function. This function is called with an event object as argument.
* When the function returns `false`, event propagation will stop.
*
* @typedef {function(ol.events.Event)|function(ol.events.Event): boolean}
* @api
*/
ol.events.ListenerFunctionType;
/**
* @param {ol.events.Key} listenerObj Listener object.
* @return {ol.events.ListenerFunctionType} Bound listener.

View File

@@ -1,4 +1,3 @@
goog.provide('ol.events.ConditionType');
goog.provide('ol.events.condition');
goog.require('goog.asserts');
@@ -7,16 +6,6 @@ goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserPointerEvent');
/**
* A function that takes an {@link ol.MapBrowserEvent} and returns a
* `{boolean}`. If the condition is met, true should be returned.
*
* @typedef {function(ol.MapBrowserEvent): boolean}
* @api stable
*/
ol.events.ConditionType;
/**
* Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when
* additionally the shift-key is pressed).
@@ -221,3 +210,18 @@ ol.events.condition.mouseOnly = function(mapBrowserEvent) {
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
return mapBrowserEvent.pointerEvent.pointerType == 'mouse';
};
/**
* Return `true` if the event originates from a primary pointer in
* contact with the surface or if the left mouse button is pressed.
* @see http://www.w3.org/TR/pointerevents/#button-states
*
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if the event originates from a primary pointer.
* @api
*/
ol.events.condition.primaryAction = function(mapBrowserEvent) {
var pointerEvent = mapBrowserEvent.pointerEvent;
return pointerEvent.isPrimary && pointerEvent.button === 0;
};

View File

@@ -33,6 +33,12 @@ ol.events.EventTarget = function() {
*/
this.pendingRemovals_ = {};
/**
* @private
* @type {!Object.<string, number>}
*/
this.dispatching_ = {};
/**
* @private
* @type {!Object.<string, Array.<ol.events.ListenerFunctionType>>}
@@ -72,20 +78,26 @@ ol.events.EventTarget.prototype.dispatchEvent = function(event) {
var listeners = this.listeners_[type];
var propagate;
if (listeners) {
if (!(type in this.pendingRemovals_)) {
if (!(type in this.dispatching_)) {
this.dispatching_[type] = 0;
this.pendingRemovals_[type] = 0;
}
++this.dispatching_[type];
for (var i = 0, ii = listeners.length; i < ii; ++i) {
if (listeners[i].call(this, evt) === false || evt.propagationStopped) {
propagate = false;
break;
}
}
--this.dispatching_[type];
if (this.dispatching_[type] === 0) {
var pendingRemovals = this.pendingRemovals_[type];
delete this.pendingRemovals_[type];
while (pendingRemovals--) {
this.removeEventListener(type, ol.nullFunction);
}
delete this.dispatching_[type];
}
return propagate;
}
};

View File

@@ -1,21 +1,8 @@
goog.provide('ol.Extent');
goog.provide('ol.extent');
goog.provide('ol.extent.Corner');
goog.provide('ol.extent.Relationship');
goog.require('goog.asserts');
goog.require('goog.vec.Mat4');
goog.require('ol.Coordinate');
goog.require('ol.Size');
goog.require('ol.TransformFunction');
/**
* An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
* @typedef {Array.<number>}
* @api stable
*/
ol.Extent;
/**
@@ -878,37 +865,3 @@ ol.extent.applyTransform = function(extent, transformFn, opt_extent) {
var ys = [coordinates[1], coordinates[3], coordinates[5], coordinates[7]];
return ol.extent.boundingExtentXYs_(xs, ys, opt_extent);
};
/**
* Apply a 2d transform to an extent.
* @param {ol.Extent} extent Input extent.
* @param {goog.vec.Mat4.Number} transform The transform matrix.
* @param {ol.Extent=} opt_extent Optional extent for return values.
* @return {ol.Extent} The transformed extent.
*/
ol.extent.transform2D = function(extent, transform, opt_extent) {
var dest = opt_extent ? opt_extent : [];
var m00 = goog.vec.Mat4.getElement(transform, 0, 0);
var m10 = goog.vec.Mat4.getElement(transform, 1, 0);
var m01 = goog.vec.Mat4.getElement(transform, 0, 1);
var m11 = goog.vec.Mat4.getElement(transform, 1, 1);
var m03 = goog.vec.Mat4.getElement(transform, 0, 3);
var m13 = goog.vec.Mat4.getElement(transform, 1, 3);
var xi = [0, 2, 0, 2];
var yi = [1, 1, 3, 3];
var xs = [];
var ys = [];
var i, x, y;
for (i = 0; i < 4; ++i) {
x = extent[xi[i]];
y = extent[yi[i]];
xs[i] = m00 * x + m01 * y + m03;
ys[i] = m10 * x + m11 * y + m13;
}
dest[0] = Math.min.apply(null, xs);
dest[1] = Math.min.apply(null, ys);
dest[2] = Math.max.apply(null, xs);
dest[3] = Math.max.apply(null, ys);
return dest;
};

View File

@@ -1,5 +1,4 @@
goog.provide('ol.Feature');
goog.provide('ol.FeatureStyleFunction');
goog.require('goog.asserts');
goog.require('ol.events');
@@ -284,18 +283,6 @@ ol.Feature.prototype.setGeometryName = function(name) {
};
/**
* A function that returns an array of {@link ol.style.Style styles} given a
* resolution. The `this` keyword inside the function references the
* {@link ol.Feature} to be styled.
*
* @typedef {function(this: ol.Feature, number):
* (ol.style.Style|Array.<ol.style.Style>)}
* @api stable
*/
ol.FeatureStyleFunction;
/**
* Convert the provided object into a feature style function. Functions passed
* through unchanged. Arrays of ol.style.Style or single style objects wrapped

View File

@@ -1,5 +1,3 @@
goog.provide('ol.FeatureLoader');
goog.provide('ol.FeatureUrlFunction');
goog.provide('ol.featureloader');
goog.require('goog.asserts');
@@ -11,38 +9,6 @@ goog.require('ol.proj.Projection');
goog.require('ol.xml');
/**
* {@link ol.source.Vector} sources use a function of this type to load
* features.
*
* This function takes an {@link ol.Extent} representing the area to be loaded,
* a `{number}` representing the resolution (map units per pixel) and an
* {@link ol.proj.Projection} for the projection as arguments. `this` within
* the function is bound to the {@link ol.source.Vector} it's called from.
*
* The function is responsible for loading the features and adding them to the
* source.
* @api
* @typedef {function(this:ol.source.Vector, ol.Extent, number,
* ol.proj.Projection)}
*/
ol.FeatureLoader;
/**
* {@link ol.source.Vector} sources use a function of this type to get the url
* to load features from.
*
* This function takes an {@link ol.Extent} representing the area to be loaded,
* a `{number}` representing the resolution (map units per pixel) and an
* {@link ol.proj.Projection} for the projection as arguments and returns a
* `{string}` representing the URL.
* @api
* @typedef {function(ol.Extent, number, ol.proj.Projection) : string}
*/
ol.FeatureUrlFunction;
/**
* @param {string|ol.FeatureUrlFunction} url Feature URL service.
* @param {ol.format.Feature} format Feature format.

View File

@@ -166,7 +166,7 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
@@ -179,7 +179,7 @@ ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
@@ -192,7 +192,7 @@ ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML2.prototype.BOX_PARSERS_ = {
@@ -205,7 +205,7 @@ ol.format.GML2.prototype.BOX_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {

View File

@@ -450,7 +450,7 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
@@ -463,7 +463,7 @@ ol.format.GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
@@ -476,7 +476,7 @@ ol.format.GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.GEOMETRY_PARSERS_ = {
@@ -506,7 +506,7 @@ ol.format.GML3.prototype.GEOMETRY_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.MULTICURVE_PARSERS_ = {
@@ -521,7 +521,7 @@ ol.format.GML3.prototype.MULTICURVE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.MULTISURFACE_PARSERS_ = {
@@ -536,7 +536,7 @@ ol.format.GML3.prototype.MULTISURFACE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.CURVEMEMBER_PARSERS_ = {
@@ -550,7 +550,7 @@ ol.format.GML3.prototype.CURVEMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.SURFACEMEMBER_PARSERS_ = {
@@ -563,7 +563,7 @@ ol.format.GML3.prototype.SURFACEMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.SURFACE_PARSERS_ = {
@@ -575,7 +575,7 @@ ol.format.GML3.prototype.SURFACE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.CURVE_PARSERS_ = {
@@ -587,7 +587,7 @@ ol.format.GML3.prototype.CURVE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.ENVELOPE_PARSERS_ = {
@@ -602,7 +602,7 @@ ol.format.GML3.prototype.ENVELOPE_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.PATCHES_PARSERS_ = {
@@ -615,7 +615,7 @@ ol.format.GML3.prototype.PATCHES_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GML3.prototype.SEGMENTS_PARSERS_ = {
@@ -712,7 +712,7 @@ ol.format.GML3.prototype.writePoint_ = function(node, geometry, objectStack) {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GML3.ENVELOPE_SERIALIZERS_ = {
@@ -738,7 +738,7 @@ ol.format.GML3.prototype.writeEnvelope = function(node, extent, objectStack) {
}
var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */
({node: node}), ol.format.GML3.ENVELOPE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
values,
@@ -1019,7 +1019,7 @@ ol.format.GML3.prototype.writeGeometryElement = function(node, geometry, objectS
value =
ol.format.Feature.transformWithOptions(geometry, true, context);
}
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */
(item), ol.format.GML3.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this);
@@ -1066,7 +1066,7 @@ ol.format.GML3.prototype.writeFeatureElement = function(node, feature, objectSta
}
var item = ol.object.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */
(item), context.serializers,
ol.xml.makeSimpleNodeFactory(undefined, featureNS),
values,
@@ -1091,7 +1091,7 @@ ol.format.GML3.prototype.writeFeatureMembers_ = function(node, features, objectS
this.writeFeatureElement, this);
var item = ol.object.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */
(item),
serializers,
ol.xml.makeSimpleNodeFactory(featureType, featureNS), features,
@@ -1100,7 +1100,7 @@ ol.format.GML3.prototype.writeFeatureMembers_ = function(node, features, objectS
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
@@ -1114,7 +1114,7 @@ ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GML3.POINTMEMBER_SERIALIZERS_ = {
@@ -1126,7 +1126,7 @@ ol.format.GML3.POINTMEMBER_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
@@ -1140,7 +1140,7 @@ ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GML3.RING_SERIALIZERS_ = {
@@ -1152,7 +1152,7 @@ ol.format.GML3.RING_SERIALIZERS_ = {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GML3.GEOMETRY_SERIALIZERS_ = {

View File

@@ -106,13 +106,13 @@ ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Array.<ol.Feature>} Features.
* @return {Array.<ol.Feature> | undefined} Features.
*/
ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
'node.nodeType should be ELEMENT');
var localName = node.localName;
var features;
var features = null;
if (localName == 'FeatureCollection') {
if (node.namespaceURI === 'http://www.opengis.net/wfs') {
features = ol.xml.pushParseAndPop([],
@@ -154,9 +154,12 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
}
}
}
if (localName != 'featureMember') {
// recheck featureType for each featureMember
context['featureType'] = featureType;
context['featureNS'] = featureNS;
}
}
if (typeof featureNS === 'string') {
var ns = featureNS;
featureNS = {};
@@ -178,9 +181,13 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
}
parsersNS[featureNS[p]] = parsers;
}
if (localName == 'featureMember') {
features = ol.xml.pushParseAndPop(undefined, parsersNS, node, objectStack);
} else {
features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack);
}
if (!features) {
}
if (features === null) {
features = [];
}
return features;
@@ -500,7 +507,7 @@ ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, object
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
@@ -515,7 +522,7 @@ ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
@@ -530,7 +537,7 @@ ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
@@ -545,7 +552,7 @@ ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
@@ -558,7 +565,7 @@ ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
@@ -571,7 +578,7 @@ ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
@@ -584,7 +591,7 @@ ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @protected
*/
ol.format.GMLBase.prototype.RING_PARSERS = {
@@ -628,7 +635,8 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
if (opt_options) {
ol.object.assign(options, this.getReadOptions(node, opt_options));
}
return this.readFeaturesInternal(node, [options]);
var features = this.readFeaturesInternal(node, [options]);
return features || [];
};

View File

@@ -279,7 +279,7 @@ ol.format.GPX.FEATURE_READER_ = {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS(
@@ -292,7 +292,7 @@ ol.format.GPX.GPX_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS(
@@ -306,7 +306,7 @@ ol.format.GPX.LINK_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS(
@@ -326,7 +326,7 @@ ol.format.GPX.RTE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS(
@@ -338,7 +338,7 @@ ol.format.GPX.RTEPT_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS(
@@ -358,7 +358,7 @@ ol.format.GPX.TRK_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS(
@@ -369,7 +369,7 @@ ol.format.GPX.TRKSEG_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS(
@@ -381,7 +381,7 @@ ol.format.GPX.TRKPT_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
@@ -526,7 +526,7 @@ ol.format.GPX.writeLink_ = function(node, value, objectStack) {
properties['linkText'],
properties['linkType']
];
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ ({node: node}),
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */ ({node: node}),
ol.format.GPX.LINK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
link, objectStack, ol.format.GPX.LINK_SEQUENCE_);
};
@@ -571,7 +571,7 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
}
var orderedKeys = ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */
({node: node, 'properties': properties}),
ol.format.GPX.WPT_TYPE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
values, objectStack, orderedKeys);
@@ -615,7 +615,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties();
/** @type {ol.xml.NodeStackItem} */
/** @type {ol.xmlNodeStackItem} */
var context = {node: node, 'properties': properties};
var geometry = feature.getGeometry();
if (geometry) {
@@ -641,7 +641,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
* @private
*/
ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
/** @type {ol.xml.NodeStackItem} */
/** @type {ol.xmlNodeStackItem} */
var context = {node: node, 'geometryLayout': lineString.getLayout(),
'properties': {}};
ol.xml.pushSerializeAndPop(context,
@@ -682,7 +682,7 @@ ol.format.GPX.LINK_SEQUENCE_ = ['text', 'type'];
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GPX.LINK_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -705,7 +705,7 @@ ol.format.GPX.RTE_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GPX.RTE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -736,7 +736,7 @@ ol.format.GPX.TRK_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GPX.TRK_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -764,7 +764,7 @@ ol.format.GPX.TRKSEG_NODE_FACTORY_ = ol.xml.makeSimpleNodeFactory('trkpt');
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GPX.TRKSEG_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -787,7 +787,7 @@ ol.format.GPX.WPT_TYPE_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GPX.WPT_TYPE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -855,7 +855,7 @@ ol.format.GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -895,7 +895,7 @@ ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) {
//FIXME Serialize metadata
var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
ol.xml.pushSerializeAndPop(/** @type {ol.xmlNodeStackItem} */
({node: gpx}), ol.format.GPX.GPX_SERIALIZERS_,
ol.format.GPX.GPX_NODE_FACTORY_, features, [opt_options]);
return gpx;

View File

@@ -11,7 +11,6 @@ goog.require('goog.dom.NodeType');
goog.require('goog.object');
goog.require('ol');
goog.require('ol.Feature');
goog.require('ol.FeatureStyleFunction');
goog.require('ol.array');
goog.require('ol.color');
goog.require('ol.format.Feature');
@@ -42,20 +41,6 @@ goog.require('ol.style.Text');
goog.require('ol.xml');
/**
* @typedef {{x: number, xunits: (ol.style.IconAnchorUnits|undefined),
* y: number, yunits: (ol.style.IconAnchorUnits|undefined)}}
*/
ol.format.KMLVec2_;
/**
* @typedef {{flatCoordinates: Array.<number>,
* whens: Array.<number>}}
*/
ol.format.KMLGxTrackObject_;
/**
* @classdesc
* Feature format for reading and writing data in the KML format.
@@ -529,7 +514,7 @@ ol.format.KML.readURI_ = function(node) {
/**
* @param {Node} node Node.
* @private
* @return {ol.format.KMLVec2_} Vec2.
* @return {ol.KMLVec2_} Vec2.
*/
ol.format.KML.readVec2_ = function(node) {
var xunits = node.getAttribute('xunits');
@@ -604,7 +589,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_;
}
var anchor, anchorXUnits, anchorYUnits;
var hotSpot = /** @type {ol.format.KMLVec2_|undefined} */
var hotSpot = /** @type {ol.KMLVec2_|undefined} */
(object['hotSpot']);
if (hotSpot) {
anchor = [hotSpot.x, hotSpot.y];
@@ -798,7 +783,7 @@ ol.format.KML.gxCoordParser_ = function(node, objectStack) {
ol.format.KML.GX_NAMESPACE_URIS_, node.namespaceURI),
'namespaceURI of the node should be known to the KML parser');
goog.asserts.assert(node.localName == 'coord', 'localName should be coord');
var gxTrackObject = /** @type {ol.format.KMLGxTrackObject_} */
var gxTrackObject = /** @type {ol.KMLGxTrackObject_} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isObject(gxTrackObject),
'gxTrackObject should be an Object');
@@ -857,7 +842,7 @@ ol.format.KML.readGxTrack_ = function(node, objectStack) {
'namespaceURI of the node should be known to the KML parser');
goog.asserts.assert(node.localName == 'Track', 'localName should be Track');
var gxTrackObject = ol.xml.pushParseAndPop(
/** @type {ol.format.KMLGxTrackObject_} */ ({
/** @type {ol.KMLGxTrackObject_} */ ({
flatCoordinates: [],
whens: []
}), ol.format.KML.GX_TRACK_PARSERS_, node, objectStack);
@@ -1383,7 +1368,7 @@ ol.format.KML.whenParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
'node.nodeType should be ELEMENT');
goog.asserts.assert(node.localName == 'when', 'localName should be when');
var gxTrackObject = /** @type {ol.format.KMLGxTrackObject_} */
var gxTrackObject = /** @type {ol.KMLGxTrackObject_} */
(objectStack[objectStack.length - 1]);
goog.asserts.assert(goog.isObject(gxTrackObject),
'gxTrackObject should be an Object');
@@ -1416,7 +1401,7 @@ ol.format.KML.whenParser_ = function(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.DATA_PARSERS_ = ol.xml.makeStructureNS(
@@ -1427,7 +1412,7 @@ ol.format.KML.DATA_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.EXTENDED_DATA_PARSERS_ = ol.xml.makeStructureNS(
@@ -1439,7 +1424,7 @@ ol.format.KML.EXTENDED_DATA_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = ol.xml.makeStructureNS(
@@ -1451,7 +1436,7 @@ ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.FLAT_LINEAR_RING_PARSERS_ = ol.xml.makeStructureNS(
@@ -1462,7 +1447,7 @@ ol.format.KML.FLAT_LINEAR_RING_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_ = ol.xml.makeStructureNS(
@@ -1474,7 +1459,7 @@ ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.GX_TRACK_PARSERS_ = ol.xml.makeStructureNS(
@@ -1488,7 +1473,7 @@ ol.format.KML.GX_TRACK_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_ = ol.xml.makeStructureNS(
@@ -1499,7 +1484,7 @@ ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.ICON_PARSERS_ = ol.xml.makeStructureNS(
@@ -1516,7 +1501,7 @@ ol.format.KML.ICON_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.ICON_STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -1530,7 +1515,7 @@ ol.format.KML.ICON_STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.INNER_BOUNDARY_IS_PARSERS_ = ol.xml.makeStructureNS(
@@ -1541,7 +1526,7 @@ ol.format.KML.INNER_BOUNDARY_IS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.LABEL_STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -1553,7 +1538,7 @@ ol.format.KML.LABEL_STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.LINE_STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -1565,7 +1550,7 @@ ol.format.KML.LINE_STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.MULTI_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS(
@@ -1580,7 +1565,7 @@ ol.format.KML.MULTI_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS(
@@ -1591,7 +1576,7 @@ ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.NETWORK_LINK_PARSERS_ = ol.xml.makeStructureNS(
@@ -1609,7 +1594,7 @@ ol.format.KML.NETWORK_LINK_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.LINK_PARSERS_ = ol.xml.makeStructureNS(
@@ -1620,7 +1605,7 @@ ol.format.KML.LINK_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_ = ol.xml.makeStructureNS(
@@ -1631,7 +1616,7 @@ ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.PAIR_PARSERS_ = ol.xml.makeStructureNS(
@@ -1644,7 +1629,7 @@ ol.format.KML.PAIR_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.PLACEMARK_PARSERS_ = ol.xml.makeStructureNS(
@@ -1681,7 +1666,7 @@ ol.format.KML.PLACEMARK_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.POLY_STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -1694,7 +1679,7 @@ ol.format.KML.POLY_STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.SCHEMA_DATA_PARSERS_ = ol.xml.makeStructureNS(
@@ -1705,7 +1690,7 @@ ol.format.KML.SCHEMA_DATA_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -1719,7 +1704,7 @@ ol.format.KML.STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.KML.STYLE_MAP_PARSERS_ = ol.xml.makeStructureNS(
@@ -1869,7 +1854,9 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
/**
* Read the first feature from a KML source.
* Read the first feature from a KML source. MultiGeometries are converted into
* GeometryCollections if they are a mix of geometry types, and into MultiPoint/
* MultiLineString/MultiPolygon if they are all of the same type.
*
* @function
* @param {Document|Node|Object|string} source Source.
@@ -1902,7 +1889,9 @@ ol.format.KML.prototype.readFeatureFromNode = function(node, opt_options) {
/**
* Read all features from a KML source.
* Read all features from a KML source. MultiGeometries are converted into
* GeometryCollections if they are a mix of geometry types, and into MultiPoint/
* MultiLineString/MultiPolygon if they are all of the same type.
*
* @function
* @param {Document|Node|Object|string} source Source.
@@ -2172,7 +2161,7 @@ ol.format.KML.writeCoordinatesTextNode_ = function(node, coordinates, objectStac
* @private
*/
ol.format.KML.writeDocument_ = function(node, features, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
ol.xml.pushSerializeAndPop(context, ol.format.KML.DOCUMENT_SERIALIZERS_,
ol.format.KML.DOCUMENT_NODE_FACTORY_, features, objectStack, undefined,
this);
@@ -2186,7 +2175,7 @@ ol.format.KML.writeDocument_ = function(node, features, objectStack) {
* @private
*/
ol.format.KML.writeIcon_ = function(node, icon, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
var parentNode = objectStack[objectStack.length - 1].node;
var orderedKeys = ol.format.KML.ICON_SEQUENCE_[parentNode.namespaceURI];
var values = ol.xml.makeSequence(icon, orderedKeys);
@@ -2208,7 +2197,7 @@ ol.format.KML.writeIcon_ = function(node, icon, objectStack) {
* @private
*/
ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
var properties = {};
var src = style.getSrc();
var size = style.getSize();
@@ -2229,7 +2218,7 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
}
if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) {
var /** @type {ol.format.KMLVec2_} */ hotSpot = {
var /** @type {ol.KMLVec2_} */ hotSpot = {
x: anchor[0],
xunits: ol.style.IconAnchorUnits.PIXELS,
y: size[1] - anchor[1],
@@ -2266,7 +2255,7 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
* @private
*/
ol.format.KML.writeLabelStyle_ = function(node, style, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
var properties = {};
var fill = style.getFill();
if (fill) {
@@ -2292,7 +2281,7 @@ ol.format.KML.writeLabelStyle_ = function(node, style, objectStack) {
* @private
*/
ol.format.KML.writeLineStyle_ = function(node, style, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
var properties = {
'color': style.getColor(),
'width': style.getWidth()
@@ -2313,19 +2302,23 @@ ol.format.KML.writeLineStyle_ = function(node, style, objectStack) {
*/
ol.format.KML.writeMultiGeometry_ = function(node, geometry, objectStack) {
goog.asserts.assert(
(geometry instanceof ol.geom.GeometryCollection) ||
(geometry instanceof ol.geom.MultiPoint) ||
(geometry instanceof ol.geom.MultiLineString) ||
(geometry instanceof ol.geom.MultiPolygon),
'geometry should be one of: ol.geom.MultiPoint, ' +
'ol.geom.MultiLineString or ol.geom.MultiPolygon');
/** @type {ol.xml.NodeStackItem} */
'geometry should be one of: ol.geom.GeometryCollection, ' +
'ol.geom.MultiPoint, ol.geom.MultiLineString or ol.geom.MultiPolygon');
/** @type {ol.xmlNodeStackItem} */
var context = {node: node};
var type = geometry.getType();
/** @type {Array.<ol.geom.Geometry>} */
var geometries;
/** @type {function(*, Array.<*>, string=): (Node|undefined)} */
var factory;
if (type == ol.geom.GeometryType.MULTI_POINT) {
if (type == ol.geom.GeometryType.GEOMETRY_COLLECTION) {
geometries = geometry.getGeometries();
factory = ol.format.KML.GEOMETRY_NODE_FACTORY_;
} else if (type == ol.geom.GeometryType.MULTI_POINT) {
geometries =
(/** @type {ol.geom.MultiPoint} */ (geometry)).getPoints();
factory = ol.format.KML.POINT_NODE_FACTORY_;
@@ -2353,7 +2346,7 @@ ol.format.KML.writeMultiGeometry_ = function(node, geometry, objectStack) {
* @private
*/
ol.format.KML.writeBoundaryIs_ = function(node, linearRing, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
ol.xml.pushSerializeAndPop(context,
ol.format.KML.BOUNDARY_IS_SERIALIZERS_,
ol.format.KML.LINEAR_RING_NODE_FACTORY_, [linearRing], objectStack);
@@ -2370,7 +2363,7 @@ ol.format.KML.writeBoundaryIs_ = function(node, linearRing, objectStack) {
* @private
*/
ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
// set id
if (feature.getId()) {
@@ -2428,7 +2421,7 @@ ol.format.KML.writePrimitiveGeometry_ = function(node, geometry, objectStack) {
'geometry should be one of ol.geom.Point, ol.geom.LineString ' +
'or ol.geom.LinearRing');
var flatCoordinates = geometry.getFlatCoordinates();
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
context['layout'] = geometry.getLayout();
context['stride'] = geometry.getStride();
ol.xml.pushSerializeAndPop(context,
@@ -2451,7 +2444,7 @@ ol.format.KML.writePolygon_ = function(node, polygon, objectStack) {
goog.asserts.assert(linearRings.length > 0,
'linearRings should not be empty');
var outerRing = linearRings.shift();
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
// inner rings
ol.xml.pushSerializeAndPop(context,
ol.format.KML.POLYGON_SERIALIZERS_,
@@ -2472,7 +2465,7 @@ ol.format.KML.writePolygon_ = function(node, polygon, objectStack) {
* @private
*/
ol.format.KML.writePolyStyle_ = function(node, style, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
ol.xml.pushSerializeAndPop(context, ol.format.KML.POLY_STYLE_SERIALIZERS_,
ol.format.KML.COLOR_NODE_FACTORY_, [style.getColor()], objectStack);
};
@@ -2497,7 +2490,7 @@ ol.format.KML.writeScaleTextNode_ = function(node, scale) {
* @private
*/
ol.format.KML.writeStyle_ = function(node, style, objectStack) {
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
var /** @type {ol.xmlNodeStackItem} */ context = {node: node};
var properties = {};
var fillStyle = style.getFill();
var strokeStyle = style.getStroke();
@@ -2525,7 +2518,7 @@ ol.format.KML.writeStyle_ = function(node, style, objectStack) {
/**
* @param {Node} node Node to append a TextNode with the Vec2 to.
* @param {ol.format.KMLVec2_} vec2 Vec2.
* @param {ol.KMLVec2_} vec2 Vec2.
* @private
*/
ol.format.KML.writeVec2_ = function(node, vec2) {
@@ -2549,7 +2542,7 @@ ol.format.KML.KML_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.KML_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2561,7 +2554,7 @@ ol.format.KML.KML_SERIALIZERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.DOCUMENT_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2582,7 +2575,8 @@ ol.format.KML.GEOMETRY_TYPE_TO_NODENAME_ = {
'Polygon': 'Polygon',
'MultiPoint': 'MultiGeometry',
'MultiLineString': 'MultiGeometry',
'MultiPolygon': 'MultiGeometry'
'MultiPolygon': 'MultiGeometry',
'GeometryCollection': 'MultiGeometry'
};
@@ -2602,7 +2596,7 @@ ol.format.KML.ICON_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.ICON_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2630,7 +2624,7 @@ ol.format.KML.ICON_STYLE_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.ICON_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2655,7 +2649,7 @@ ol.format.KML.LABEL_STYLE_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.LABEL_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2678,7 +2672,7 @@ ol.format.KML.LINE_STYLE_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.LINE_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2690,7 +2684,7 @@ ol.format.KML.LINE_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.BOUNDARY_IS_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2702,7 +2696,7 @@ ol.format.KML.BOUNDARY_IS_SERIALIZERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.MULTI_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2711,7 +2705,9 @@ ol.format.KML.MULTI_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.KML.writePrimitiveGeometry_),
'Point': ol.xml.makeChildAppender(
ol.format.KML.writePrimitiveGeometry_),
'Polygon': ol.xml.makeChildAppender(ol.format.KML.writePolygon_)
'Polygon': ol.xml.makeChildAppender(ol.format.KML.writePolygon_),
'GeometryCollection': ol.xml.makeChildAppender(
ol.format.KML.writeMultiGeometry_)
});
@@ -2729,7 +2725,7 @@ ol.format.KML.PLACEMARK_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.PLACEMARK_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2759,7 +2755,7 @@ ol.format.KML.PLACEMARK_SERIALIZERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.PRIMITIVE_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2771,7 +2767,7 @@ ol.format.KML.PRIMITIVE_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.POLYGON_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2785,7 +2781,7 @@ ol.format.KML.POLYGON_SERIALIZERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.POLY_STYLE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2807,7 +2803,7 @@ ol.format.KML.STYLE_SEQUENCE_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.KML.STYLE_SERIALIZERS_ = ol.xml.makeStructureNS(
@@ -2954,7 +2950,8 @@ ol.format.KML.OUTER_BOUNDARY_NODE_FACTORY_ =
/**
* Encode an array of features in the KML format.
* Encode an array of features in the KML format. GeometryCollections, MultiPoints,
* MultiLineStrings, and MultiPolygons are output as MultiGeometries.
*
* @function
* @param {Array.<ol.Feature>} features Features.
@@ -2966,7 +2963,8 @@ ol.format.KML.prototype.writeFeatures;
/**
* Encode an array of features in the KML format as an XML node.
* Encode an array of features in the KML format as an XML node. GeometryCollections,
* MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries.
*
* @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options.
@@ -2984,7 +2982,7 @@ ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) {
ol.xml.setAttributeNS(kml, xmlSchemaInstanceUri, 'xsi:schemaLocation',
ol.format.KML.SCHEMA_LOCATION_);
var /** @type {ol.xml.NodeStackItem} */ context = {node: kml};
var /** @type {ol.xmlNodeStackItem} */ context = {node: kml};
var properties = {};
if (features.length > 1) {
properties['Document'] = features;

View File

@@ -147,6 +147,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
/**
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
goog.asserts.assertInstanceof(source, ArrayBuffer);
@@ -180,6 +181,7 @@ ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
/**
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.readProjection = function(source) {
return this.defaultDataProjection;

638
src/ol/format/ogc/filter.js Normal file
View File

@@ -0,0 +1,638 @@
goog.provide('ol.format.ogc.filter');
goog.provide('ol.format.ogc.filter.Filter');
goog.provide('ol.format.ogc.filter.Logical');
goog.provide('ol.format.ogc.filter.LogicalBinary');
goog.provide('ol.format.ogc.filter.And');
goog.provide('ol.format.ogc.filter.Or');
goog.provide('ol.format.ogc.filter.Not');
goog.provide('ol.format.ogc.filter.Bbox');
goog.provide('ol.format.ogc.filter.Comparison');
goog.provide('ol.format.ogc.filter.ComparisonBinary');
goog.provide('ol.format.ogc.filter.EqualTo');
goog.provide('ol.format.ogc.filter.NotEqualTo');
goog.provide('ol.format.ogc.filter.LessThan');
goog.provide('ol.format.ogc.filter.LessThanOrEqualTo');
goog.provide('ol.format.ogc.filter.GreaterThan');
goog.provide('ol.format.ogc.filter.GreaterThanOrEqualTo');
goog.provide('ol.format.ogc.filter.IsNull');
goog.provide('ol.format.ogc.filter.IsBetween');
goog.provide('ol.format.ogc.filter.IsLike');
goog.require('ol.Extent');
goog.require('ol.Object');
/**
* Create a logical `<And>` operator between two filter conditions.
*
* @param {!ol.format.ogc.filter.Filter} conditionA First filter condition.
* @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition.
* @returns {!ol.format.ogc.filter.And} `<And>` operator.
* @api
*/
ol.format.ogc.filter.and = function(conditionA, conditionB) {
return new ol.format.ogc.filter.And(conditionA, conditionB);
};
/**
* Create a logical `<Or>` operator between two filter conditions.
*
* @param {!ol.format.ogc.filter.Filter} conditionA First filter condition.
* @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition.
* @returns {!ol.format.ogc.filter.Or} `<Or>` operator.
* @api
*/
ol.format.ogc.filter.or = function(conditionA, conditionB) {
return new ol.format.ogc.filter.Or(conditionA, conditionB);
};
/**
* Represents a logical `<Not>` operator for a filter condition.
*
* @param {!ol.format.ogc.filter.Filter} condition Filter condition.
* @returns {!ol.format.ogc.filter.Not} `<Not>` operator.
* @api
*/
ol.format.ogc.filter.not = function(condition) {
return new ol.format.ogc.filter.Not(condition);
};
/**
* Create a `<BBOX>` operator to test whether a geometry-valued property
* intersects a fixed bounding box
*
* @param {!string} geometryName Geometry name to use.
* @param {!ol.Extent} extent Extent.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @returns {!ol.format.ogc.filter.Bbox} `<BBOX>` operator.
* @api
*/
ol.format.ogc.filter.bbox = function(geometryName, extent, opt_srsName) {
return new ol.format.ogc.filter.Bbox(geometryName, extent, opt_srsName);
};
/**
* Creates a `<PropertyIsEqualTo>` comparison operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @returns {!ol.format.ogc.filter.EqualTo} `<PropertyIsEqualTo>` operator.
* @api
*/
ol.format.ogc.filter.equalTo = function(propertyName, expression, opt_matchCase) {
return new ol.format.ogc.filter.EqualTo(propertyName, expression, opt_matchCase);
};
/**
* Creates a `<PropertyIsNotEqualTo>` comparison operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @returns {!ol.format.ogc.filter.NotEqualTo} `<PropertyIsNotEqualTo>` operator.
* @api
*/
ol.format.ogc.filter.notEqualTo = function(propertyName, expression, opt_matchCase) {
return new ol.format.ogc.filter.NotEqualTo(propertyName, expression, opt_matchCase);
};
/**
* Creates a `<PropertyIsLessThan>` comparison operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @returns {!ol.format.ogc.filter.LessThan} `<PropertyIsLessThan>` operator.
* @api
*/
ol.format.ogc.filter.lessThan = function(propertyName, expression) {
return new ol.format.ogc.filter.LessThan(propertyName, expression);
};
/**
* Creates a `<PropertyIsLessThanOrEqualTo>` comparison operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @returns {!ol.format.ogc.filter.LessThanOrEqualTo} `<PropertyIsLessThanOrEqualTo>` operator.
* @api
*/
ol.format.ogc.filter.lessThanOrEqualTo = function(propertyName, expression) {
return new ol.format.ogc.filter.LessThanOrEqualTo(propertyName, expression);
};
/**
* Creates a `<PropertyIsGreaterThan>` comparison operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @returns {!ol.format.ogc.filter.GreaterThan} `<PropertyIsGreaterThan>` operator.
* @api
*/
ol.format.ogc.filter.greaterThan = function(propertyName, expression) {
return new ol.format.ogc.filter.GreaterThan(propertyName, expression);
};
/**
* Creates a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @returns {!ol.format.ogc.filter.GreaterThanOrEqualTo} `<PropertyIsGreaterThanOrEqualTo>` operator.
* @api
*/
ol.format.ogc.filter.greaterThanOrEqualTo = function(propertyName, expression) {
return new ol.format.ogc.filter.GreaterThanOrEqualTo(propertyName, expression);
};
/**
* Creates a `<PropertyIsNull>` comparison operator to test whether a property value
* is null.
*
* @param {!string} propertyName Name of the context property to compare.
* @returns {!ol.format.ogc.filter.IsNull} `<PropertyIsNull>` operator.
* @api
*/
ol.format.ogc.filter.isNull = function(propertyName) {
return new ol.format.ogc.filter.IsNull(propertyName);
};
/**
* Creates a `<PropertyIsBetween>` comparison operator to test whether an expression
* value lies within a range given by a lower and upper bound (inclusive).
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} lowerBoundary The lower bound of the range.
* @param {!number} upperBoundary The upper bound of the range.
* @returns {!ol.format.ogc.filter.IsBetween} `<PropertyIsBetween>` operator.
* @api
*/
ol.format.ogc.filter.between = function(propertyName, lowerBoundary, upperBoundary) {
return new ol.format.ogc.filter.IsBetween(propertyName, lowerBoundary, upperBoundary);
};
/**
* Represents a `<PropertyIsLike>` comparison operator that matches a string property
* value against a text pattern.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} pattern Text pattern.
* @param {string=} opt_wildCard Pattern character which matches any sequence of
* zero or more string characters. Default is '*'.
* @param {string=} opt_singleChar pattern character which matches any single
* string character. Default is '.'.
* @param {string=} opt_escapeChar Escape character which can be used to escape
* the pattern characters. Default is '!'.
* @param {boolean=} opt_matchCase Case-sensitive?
* @returns {!ol.format.ogc.filter.IsLike} `<PropertyIsLike>` operator.
* @api
*/
ol.format.ogc.filter.like = function(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
return new ol.format.ogc.filter.IsLike(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
};
/**
* @classdesc
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature filters.
*
* @constructor
* @param {!string} tagName The XML tag name for this filter.
* @extends {ol.Object}
* @api
*/
ol.format.ogc.filter.Filter = function(tagName) {
goog.base(this);
/**
* @private
* @type {!string}
*/
this.tagName_ = tagName;
};
goog.inherits(ol.format.ogc.filter.Filter, ol.Object);
/**
* The XML tag name for a filter.
* @returns {!string} Name.
*/
ol.format.ogc.filter.Filter.prototype.getTagName = function() {
return this.tagName_;
};
// Logical filters
/**
* @classdesc
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature logical filters.
*
* @constructor
* @param {!string} tagName The XML tag name for this filter.
* @extends {ol.format.ogc.filter.Filter}
*/
ol.format.ogc.filter.Logical = function(tagName) {
goog.base(this, tagName);
};
goog.inherits(ol.format.ogc.filter.Logical, ol.format.ogc.filter.Filter);
/**
* @classdesc
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature binary logical filters.
*
* @constructor
* @param {!string} tagName The XML tag name for this filter.
* @param {!ol.format.ogc.filter.Filter} conditionA First filter condition.
* @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition.
* @extends {ol.format.ogc.filter.Logical}
*/
ol.format.ogc.filter.LogicalBinary = function(tagName, conditionA, conditionB) {
goog.base(this, tagName);
/**
* @public
* @type {!ol.format.ogc.filter.Filter}
*/
this.conditionA = conditionA;
/**
* @public
* @type {!ol.format.ogc.filter.Filter}
*/
this.conditionB = conditionB;
};
goog.inherits(ol.format.ogc.filter.LogicalBinary, ol.format.ogc.filter.Logical);
/**
* @classdesc
* Represents a logical `<And>` operator between two filter conditions.
*
* @constructor
* @param {!ol.format.ogc.filter.Filter} conditionA First filter condition.
* @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition.
* @extends {ol.format.ogc.filter.LogicalBinary}
* @api
*/
ol.format.ogc.filter.And = function(conditionA, conditionB) {
goog.base(this, 'And', conditionA, conditionB);
};
goog.inherits(ol.format.ogc.filter.And, ol.format.ogc.filter.LogicalBinary);
/**
* @classdesc
* Represents a logical `<Or>` operator between two filter conditions.
*
* @constructor
* @param {!ol.format.ogc.filter.Filter} conditionA First filter condition.
* @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition.
* @extends {ol.format.ogc.filter.LogicalBinary}
* @api
*/
ol.format.ogc.filter.Or = function(conditionA, conditionB) {
goog.base(this, 'Or', conditionA, conditionB);
};
goog.inherits(ol.format.ogc.filter.Or, ol.format.ogc.filter.LogicalBinary);
/**
* @classdesc
* Represents a logical `<Not>` operator for a filter condition.
*
* @constructor
* @param {!ol.format.ogc.filter.Filter} condition Filter condition.
* @extends {ol.format.ogc.filter.Logical}
* @api
*/
ol.format.ogc.filter.Not = function(condition) {
goog.base(this, 'Not');
/**
* @public
* @type {!ol.format.ogc.filter.Filter}
*/
this.condition = condition;
};
goog.inherits(ol.format.ogc.filter.Not, ol.format.ogc.filter.Logical);
// Spatial filters
/**
* @classdesc
* Represents a `<BBOX>` operator to test whether a geometry-valued property
* intersects a fixed bounding box
*
* @constructor
* @param {!string} geometryName Geometry name to use.
* @param {!ol.Extent} extent Extent.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @extends {ol.format.ogc.filter.Filter}
* @api
*/
ol.format.ogc.filter.Bbox = function(geometryName, extent, opt_srsName) {
goog.base(this, 'BBOX');
/**
* @public
* @type {!string}
*/
this.geometryName = geometryName;
/**
* @public
* @type {!ol.Extent}
*/
this.extent = extent;
/**
* @public
* @type {string|undefined}
*/
this.srsName = opt_srsName;
};
goog.inherits(ol.format.ogc.filter.Bbox, ol.format.ogc.filter.Filter);
// Property comparison filters
/**
* @classdesc
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature property comparison filters.
*
* @constructor
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
* @extends {ol.format.ogc.filter.Filter}
* @api
*/
ol.format.ogc.filter.Comparison = function(tagName, propertyName) {
goog.base(this, tagName);
/**
* @public
* @type {!string}
*/
this.propertyName = propertyName;
};
goog.inherits(ol.format.ogc.filter.Comparison, ol.format.ogc.filter.Filter);
/**
* @classdesc
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature property binary comparison filters.
*
* @constructor
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {ol.format.ogc.filter.Comparison}
* @api
*/
ol.format.ogc.filter.ComparisonBinary = function(
tagName, propertyName, expression, opt_matchCase) {
goog.base(this, tagName, propertyName);
/**
* @public
* @type {!(string|number)}
*/
this.expression = expression;
/**
* @public
* @type {boolean|undefined}
*/
this.matchCase = opt_matchCase;
};
goog.inherits(ol.format.ogc.filter.ComparisonBinary, ol.format.ogc.filter.Comparison);
/**
* @classdesc
* Represents a `<PropertyIsEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {ol.format.ogc.filter.ComparisonBinary}
* @api
*/
ol.format.ogc.filter.EqualTo = function(propertyName, expression, opt_matchCase) {
goog.base(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase);
};
goog.inherits(ol.format.ogc.filter.EqualTo, ol.format.ogc.filter.ComparisonBinary);
/**
* @classdesc
* Represents a `<PropertyIsNotEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {ol.format.ogc.filter.ComparisonBinary}
* @api
*/
ol.format.ogc.filter.NotEqualTo = function(propertyName, expression, opt_matchCase) {
goog.base(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase);
};
goog.inherits(ol.format.ogc.filter.NotEqualTo, ol.format.ogc.filter.ComparisonBinary);
/**
* @classdesc
* Represents a `<PropertyIsLessThan>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {ol.format.ogc.filter.ComparisonBinary}
* @api
*/
ol.format.ogc.filter.LessThan = function(propertyName, expression) {
goog.base(this, 'PropertyIsLessThan', propertyName, expression);
};
goog.inherits(ol.format.ogc.filter.LessThan, ol.format.ogc.filter.ComparisonBinary);
/**
* @classdesc
* Represents a `<PropertyIsLessThanOrEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {ol.format.ogc.filter.ComparisonBinary}
* @api
*/
ol.format.ogc.filter.LessThanOrEqualTo = function(propertyName, expression) {
goog.base(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression);
};
goog.inherits(ol.format.ogc.filter.LessThanOrEqualTo, ol.format.ogc.filter.ComparisonBinary);
/**
* @classdesc
* Represents a `<PropertyIsGreaterThan>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {ol.format.ogc.filter.ComparisonBinary}
* @api
*/
ol.format.ogc.filter.GreaterThan = function(propertyName, expression) {
goog.base(this, 'PropertyIsGreaterThan', propertyName, expression);
};
goog.inherits(ol.format.ogc.filter.GreaterThan, ol.format.ogc.filter.ComparisonBinary);
/**
* @classdesc
* Represents a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {ol.format.ogc.filter.ComparisonBinary}
* @api
*/
ol.format.ogc.filter.GreaterThanOrEqualTo = function(propertyName, expression) {
goog.base(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression);
};
goog.inherits(ol.format.ogc.filter.GreaterThanOrEqualTo, ol.format.ogc.filter.ComparisonBinary);
/**
* @classdesc
* Represents a `<PropertyIsNull>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @extends {ol.format.ogc.filter.Comparison}
* @api
*/
ol.format.ogc.filter.IsNull = function(propertyName) {
goog.base(this, 'PropertyIsNull', propertyName);
};
goog.inherits(ol.format.ogc.filter.IsNull, ol.format.ogc.filter.Comparison);
/**
* @classdesc
* Represents a `<PropertyIsBetween>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} lowerBoundary The lower bound of the range.
* @param {!number} upperBoundary The upper bound of the range.
* @extends {ol.format.ogc.filter.Comparison}
* @api
*/
ol.format.ogc.filter.IsBetween = function(propertyName, lowerBoundary, upperBoundary) {
goog.base(this, 'PropertyIsBetween', propertyName);
/**
* @public
* @type {!number}
*/
this.lowerBoundary = lowerBoundary;
/**
* @public
* @type {!number}
*/
this.upperBoundary = upperBoundary;
};
goog.inherits(ol.format.ogc.filter.IsBetween, ol.format.ogc.filter.Comparison);
/**
* @classdesc
* Represents a `<PropertyIsLike>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} pattern Text pattern.
* @param {string=} opt_wildCard Pattern character which matches any sequence of
* zero or more string characters. Default is '*'.
* @param {string=} opt_singleChar pattern character which matches any single
* string character. Default is '.'.
* @param {string=} opt_escapeChar Escape character which can be used to escape
* the pattern characters. Default is '!'.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {ol.format.ogc.filter.Comparison}
* @api
*/
ol.format.ogc.filter.IsLike = function(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
goog.base(this, 'PropertyIsLike', propertyName);
/**
* @public
* @type {!string}
*/
this.pattern = pattern;
/**
* @public
* @type {!string}
*/
this.wildCard = (opt_wildCard !== undefined) ? opt_wildCard : '*';
/**
* @public
* @type {!string}
*/
this.singleChar = (opt_singleChar !== undefined) ? opt_singleChar : '.';
/**
* @public
* @type {!string}
*/
this.escapeChar = (opt_escapeChar !== undefined) ? opt_escapeChar : '!';
/**
* @public
* @type {boolean|undefined}
*/
this.matchCase = opt_matchCase;
};
goog.inherits(ol.format.ogc.filter.IsLike, ol.format.ogc.filter.Comparison);

View File

@@ -0,0 +1,29 @@
/**
* This namespace contains convenience functions to create filters for
* {@link ol.format.WFS#writeGetFeature}.
*
* For example to generate a `GetFeature` request with a `PropertyIsEqualTo` filter:
*
* var request = new ol.format.WFS().writeGetFeature({
* srsName: 'urn:ogc:def:crs:EPSG::4326',
* featureNS: 'http://www.openplans.org/topp',
* featurePrefix: 'topp',
* featureTypes: ['states'],
* filter: ol.format.wfs.filter.equalTo('name', 'New York')
* });
*
* Or to combine a `BBOX` filter with a `PropertyIsLike` filter:
*
* var f = ol.format.wfs.filter;
* var request = new ol.format.WFS().writeGetFeature({
* srsName: 'urn:ogc:def:crs:EPSG::4326',
* featureNS: 'http://www.openplans.org/topp',
* featurePrefix: 'topp',
* featureTypes: ['states'],
* filter: f.and(
* f.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
* f.like('name', 'New*')
* )
* });
* @namespace ol.format.ogc.filter
*/

View File

@@ -165,7 +165,7 @@ ol.format.OSMXML.NAMESPACE_URIS_ = [
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS(
@@ -177,7 +177,7 @@ ol.format.OSMXML.WAY_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS(
@@ -189,7 +189,7 @@ ol.format.OSMXML.PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS(

View File

@@ -302,7 +302,7 @@ ol.format.OWS.NAMESPACE_URIS_ = [
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS(
@@ -318,7 +318,7 @@ ol.format.OWS.PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
@@ -337,7 +337,7 @@ ol.format.OWS.ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS(
@@ -348,7 +348,7 @@ ol.format.OWS.ALLOWED_VALUES_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS(
@@ -360,7 +360,7 @@ ol.format.OWS.CONSTRAINT_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS(
@@ -372,7 +372,7 @@ ol.format.OWS.CONTACT_INFO_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS(
@@ -383,7 +383,7 @@ ol.format.OWS.DCP_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS(
@@ -395,7 +395,7 @@ ol.format.OWS.HTTP_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS(
@@ -406,7 +406,7 @@ ol.format.OWS.OPERATION_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS(
@@ -417,7 +417,7 @@ ol.format.OWS.OPERATIONS_METADATA_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS(
@@ -429,7 +429,7 @@ ol.format.OWS.PHONE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
@@ -441,7 +441,7 @@ ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
@@ -457,7 +457,7 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
@@ -472,7 +472,7 @@ ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =

View File

@@ -5,7 +5,7 @@
* `readFeature` returning an `ol.Feature`
* `readGeometry` returning an `ol.geom.Geometry`
Having different functions for multiple return types allows both the user to specify what type of data he wants and for the Compiler to properly type check the code. Depending on the format, it is entirely reasonable to leave one or more of these methods unimplemented, or provide sensible default implementations.
Having different functions for multiple return types allows both the user to specify what type of data they want and for the compiler to properly type check the code. Depending on the format, it is entirely reasonable to leave one or more of these methods unimplemented, or provide sensible default implementations.
For example, `ol.format.GPX` only supports reading multiple features. Therefore `readFeature` and `readGeometry` are unimplemented and will raise an exception if called.
@@ -19,7 +19,7 @@ If a file cannot be parsed, then the return value should be `null` for all three
# Implementing XML formats
This is an introduction for people looking to contribute an XML format reader to OpenLayers 3. After having read this document, you should read the code of and make sure that you understand the simpler XML format readers like `ol.format.GPX` before embarking on writing your own format reader.
The document ends with guildelines for implementing a new format.
The document ends with guidelines for implementing a new format.
The `ol.xml` namespace contains a number of useful functions for parsing XML documents. All code in OpenLayers 3 that reads data from XML documents should use it. It has several features:

View File

@@ -5,6 +5,14 @@ goog.require('goog.dom.NodeType');
goog.require('ol');
goog.require('ol.format.GML3');
goog.require('ol.format.GMLBase');
goog.require('ol.format.ogc.filter');
goog.require('ol.format.ogc.filter.Bbox');
goog.require('ol.format.ogc.filter.ComparisonBinary');
goog.require('ol.format.ogc.filter.LogicalBinary');
goog.require('ol.format.ogc.filter.Not');
goog.require('ol.format.ogc.filter.IsBetween');
goog.require('ol.format.ogc.filter.IsNull');
goog.require('ol.format.ogc.filter.IsLike');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
@@ -74,26 +82,6 @@ ol.format.WFS.FEATURE_PREFIX = 'feature';
ol.format.WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
/**
* Number of features; bounds/extent.
* @typedef {{numberOfFeatures: number,
* bounds: ol.Extent}}
* @api stable
*/
ol.format.WFS.FeatureCollectionMetadata;
/**
* Total deleted; total inserted; total updated; array of insert ids.
* @typedef {{totalDeleted: number,
* totalInserted: number,
* totalUpdated: number,
* insertIds: Array.<string>}}
* @api stable
*/
ol.format.WFS.TransactionResponse;
/**
* @const
* @type {string}
@@ -205,7 +193,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WFS.FEATURE_COLLECTION_PARSERS_ = {
@@ -238,7 +226,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WFS.TRANSACTION_SUMMARY_PARSERS_ = {
@@ -267,7 +255,7 @@ ol.format.WFS.readTransactionSummary_ = function(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WFS.OGC_FID_PARSERS_ = {
@@ -291,7 +279,7 @@ ol.format.WFS.fidParser_ = function(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WFS.INSERT_RESULTS_PARSERS_ = {
@@ -315,7 +303,7 @@ ol.format.WFS.readInsertResults_ = function(node, objectStack) {
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_ = {
@@ -360,7 +348,7 @@ ol.format.WFS.prototype.readTransactionResponseFromNode = function(node) {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.WFS.QUERY_SERIALIZERS_ = {
@@ -509,7 +497,7 @@ ol.format.WFS.writeNative_ = function(node, nativeElement, objectStack) {
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.WFS.TRANSACTION_SERIALIZERS_ = {
@@ -551,24 +539,163 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
ol.format.WFS.QUERY_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('PropertyName'), propertyNames,
objectStack);
var bbox = context['bbox'];
if (bbox) {
var filter = context['filter'];
if (filter) {
var child = ol.xml.createElementNS('http://www.opengis.net/ogc', 'Filter');
ol.format.WFS.writeOgcBBOX_(child, bbox, objectStack);
node.appendChild(child);
ol.format.WFS.writeFilterCondition_(child, filter, objectStack);
}
};
/**
* @param {Node} node Node.
* @param {string} value PropertyName value.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeOgcPropertyName_ = function(node, value, objectStack) {
var property = ol.xml.createElementNS('http://www.opengis.net/ogc',
'PropertyName');
ol.format.WFS.writeFilterCondition_ = function(node, filter, objectStack) {
var item = {node: node};
ol.xml.pushSerializeAndPop(item,
ol.format.WFS.GETFEATURE_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory(filter.getTagName()),
[filter], objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeBboxFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.Bbox,
'must be bbox filter');
var context = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
context.srsName = filter.srsName;
ol.format.WFS.writeOgcPropertyName_(node, filter.geometryName);
ol.format.GML3.prototype.writeGeometryElement(node, filter.extent, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeLogicalFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.LogicalBinary,
'must be logical filter');
var item = {node: node};
var conditionA = filter.conditionA;
ol.xml.pushSerializeAndPop(item,
ol.format.WFS.GETFEATURE_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory(conditionA.getTagName()),
[conditionA], objectStack);
var conditionB = filter.conditionB;
ol.xml.pushSerializeAndPop(item,
ol.format.WFS.GETFEATURE_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory(conditionB.getTagName()),
[conditionB], objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeNotFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.Not,
'must be Not filter');
var item = {node: node};
var condition = filter.condition;
ol.xml.pushSerializeAndPop(item,
ol.format.WFS.GETFEATURE_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory(condition.getTagName()),
[condition], objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeComparisonFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.ComparisonBinary,
'must be binary comparison filter');
if (filter.matchCase !== undefined) {
node.setAttribute('matchCase', filter.matchCase.toString());
}
ol.format.WFS.writeOgcPropertyName_(node, filter.propertyName);
ol.format.WFS.writeOgcLiteral_(node, '' + filter.expression);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeIsNullFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.IsNull,
'must be IsNull comparison filter');
ol.format.WFS.writeOgcPropertyName_(node, filter.propertyName);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.IsBetween,
'must be IsBetween comparison filter');
ol.format.WFS.writeOgcPropertyName_(node, filter.propertyName);
ol.format.WFS.writeOgcExpression_('LowerBoundary', node, '' + filter.lowerBoundary);
ol.format.WFS.writeOgcExpression_('UpperBoundary', node, '' + filter.upperBoundary);
};
/**
* @param {Node} node Node.
* @param {ol.format.ogc.filter.Filter} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeIsLikeFilter_ = function(node, filter, objectStack) {
goog.asserts.assertInstanceof(filter, ol.format.ogc.filter.IsLike,
'must be IsLike comparison filter');
node.setAttribute('wildCard', filter.wildCard);
node.setAttribute('singleChar', filter.singleChar);
node.setAttribute('escapeChar', filter.escapeChar);
if (filter.matchCase !== undefined) {
node.setAttribute('matchCase', filter.matchCase.toString());
}
ol.format.WFS.writeOgcPropertyName_(node, filter.propertyName);
ol.format.WFS.writeOgcLiteral_(node, '' + filter.pattern);
};
/**
* @param {string} tagName Tag name.
* @param {Node} node Node.
* @param {string} value Value.
* @private
*/
ol.format.WFS.writeOgcExpression_ = function(tagName, node, value) {
var property = ol.xml.createElementNS('http://www.opengis.net/ogc', tagName);
ol.format.XSD.writeStringTextNode(property, value);
node.appendChild(property);
};
@@ -576,29 +703,46 @@ ol.format.WFS.writeOgcPropertyName_ = function(node, value, objectStack) {
/**
* @param {Node} node Node.
* @param {ol.Extent} bbox Bounding box.
* @param {Array.<*>} objectStack Node stack.
* @param {string} value PropertyName value.
* @private
*/
ol.format.WFS.writeOgcBBOX_ = function(node, bbox, objectStack) {
var context = objectStack[objectStack.length - 1];
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
var geometryName = context['geometryName'];
var bboxNode = ol.xml.createElementNS('http://www.opengis.net/ogc', 'BBOX');
node.appendChild(bboxNode);
ol.format.WFS.writeOgcPropertyName_(bboxNode, geometryName, objectStack);
ol.format.GML3.prototype.writeGeometryElement(bboxNode, bbox, objectStack);
ol.format.WFS.writeOgcPropertyName_ = function(node, value) {
ol.format.WFS.writeOgcExpression_('PropertyName', node, value);
};
/**
* @type {Object.<string, Object.<string, ol.xml.Serializer>>}
* @param {Node} node Node.
* @param {string} value PropertyName value.
* @private
*/
ol.format.WFS.writeOgcLiteral_ = function(node, value) {
ol.format.WFS.writeOgcExpression_('Literal', node, value);
};
/**
* @type {Object.<string, Object.<string, ol.xmlSerializer>>}
* @private
*/
ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
'http://www.opengis.net/wfs': {
'Query': ol.xml.makeChildAppender(
ol.format.WFS.writeQuery_)
'Query': ol.xml.makeChildAppender(ol.format.WFS.writeQuery_)
},
'http://www.opengis.net/ogc': {
'And': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
'Or': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
'Not': ol.xml.makeChildAppender(ol.format.WFS.writeNotFilter_),
'BBOX': ol.xml.makeChildAppender(ol.format.WFS.writeBboxFilter_),
'PropertyIsEqualTo': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),
'PropertyIsNotEqualTo': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),
'PropertyIsLessThan': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),
'PropertyIsLessThanOrEqualTo': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),
'PropertyIsGreaterThan': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),
'PropertyIsGreaterThanOrEqualTo': ol.xml.makeChildAppender(ol.format.WFS.writeComparisonFilter_),
'PropertyIsNull': ol.xml.makeChildAppender(ol.format.WFS.writeIsNullFilter_),
'PropertyIsBetween': ol.xml.makeChildAppender(ol.format.WFS.writeIsBetweenFilter_),
'PropertyIsLike': ol.xml.makeChildAppender(ol.format.WFS.writeIsLikeFilter_)
}
};
@@ -633,6 +777,7 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
'GetFeature');
node.setAttribute('service', 'WFS');
node.setAttribute('version', '1.1.0');
var filter;
if (options) {
if (options.handle) {
node.setAttribute('handle', options.handle);
@@ -652,6 +797,19 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
if (options.count !== undefined) {
node.setAttribute('count', options.count);
}
filter = options.filter;
if (options.bbox) {
goog.asserts.assert(options.geometryName,
'geometryName must be set when using bbox filter');
var bbox = ol.format.ogc.filter.bbox(
options.geometryName, options.bbox, options.srsName);
if (filter) {
// if bbox and filter are both set, combine the two into a single filter
filter = ol.format.ogc.filter.and(filter, bbox);
} else {
filter = bbox;
}
}
}
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation', this.schemaLocation_);
@@ -661,7 +819,7 @@ ol.format.WFS.prototype.writeGetFeature = function(options) {
featureNS: options.featureNS ? options.featureNS : this.featureNS_,
featurePrefix: options.featurePrefix,
geometryName: options.geometryName,
bbox: options.bbox,
filter: filter,
propertyNames: options.propertyNames ? options.propertyNames : []
};
goog.asserts.assert(Array.isArray(options.featureTypes),

View File

@@ -366,12 +366,6 @@ ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
};
/**
* @typedef {{type: number, value: (number|string|undefined), position: number}}
*/
ol.format.WKT.Token;
/**
* @const
* @enum {number}
@@ -451,7 +445,7 @@ ol.format.WKT.Lexer.prototype.nextChar_ = function() {
/**
* Fetch and return the next token.
* @return {!ol.format.WKT.Token} Next string token.
* @return {!ol.WKTToken} Next string token.
*/
ol.format.WKT.Lexer.prototype.nextToken = function() {
var c = this.nextChar_();
@@ -537,7 +531,7 @@ ol.format.WKT.Parser = function(lexer) {
this.lexer_ = lexer;
/**
* @type {ol.format.WKT.Token}
* @type {ol.WKTToken}
* @private
*/
this.token_;
@@ -561,7 +555,7 @@ ol.format.WKT.Parser.prototype.consume_ = function() {
/**
* If the given type matches the current token, consume it.
* @param {ol.format.WKT.TokenType.<number>} type Token type.
* @param {ol.format.WKT.TokenType} type Token type.
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.match = function(type) {
@@ -838,7 +832,7 @@ ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
/**
* @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout.<string>=)}
* @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout)}
* @private
*/
ol.format.WKT.Parser.GeometryConstructor_ = {

View File

@@ -568,7 +568,7 @@ ol.format.WMSCapabilities.NAMESPACE_URIS_ = [
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
@@ -582,7 +582,7 @@ ol.format.WMSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS(
@@ -598,7 +598,7 @@ ol.format.WMSCapabilities.CAPABILITY_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS(
@@ -626,7 +626,7 @@ ol.format.WMSCapabilities.SERVICE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS(
@@ -648,7 +648,7 @@ ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS(
@@ -662,7 +662,7 @@ ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
@@ -679,7 +679,7 @@ ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS(
@@ -690,7 +690,7 @@ ol.format.WMSCapabilities.EXCEPTION_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
@@ -731,7 +731,7 @@ ol.format.WMSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS(
@@ -746,7 +746,7 @@ ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
@@ -764,7 +764,7 @@ ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS(
@@ -780,7 +780,7 @@ ol.format.WMSCapabilities.REQUEST_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS(
@@ -793,7 +793,7 @@ ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS(
@@ -805,7 +805,7 @@ ol.format.WMSCapabilities.DCPTYPE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS(
@@ -819,7 +819,7 @@ ol.format.WMSCapabilities.HTTP_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -838,7 +838,7 @@ ol.format.WMSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
@@ -851,7 +851,7 @@ ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_ = ol.xml.makeStructureNS(

View File

@@ -149,10 +149,7 @@ ol.format.WMSGetFeatureInfo.prototype.readFeatures;
* @inheritDoc
*/
ol.format.WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = {
'featureType': this.featureType,
'featureNS': this.featureNS
};
var options = {};
if (opt_options) {
ol.object.assign(options, this.getReadOptions(node, opt_options));
}

View File

@@ -277,7 +277,7 @@ ol.format.WMTSCapabilities.OWS_NAMESPACE_URIS_ = [
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
@@ -289,7 +289,7 @@ ol.format.WMTSCapabilities.PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.CONTENTS_PARSERS_ = ol.xml.makeStructureNS(
@@ -303,7 +303,7 @@ ol.format.WMTSCapabilities.CONTENTS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
@@ -332,7 +332,7 @@ ol.format.WMTSCapabilities.LAYER_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
@@ -349,7 +349,7 @@ ol.format.WMTSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_ = ol.xml.makeStructureNS(
@@ -361,7 +361,7 @@ ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.DIMENSION_PARSERS_ = ol.xml.makeStructureNS(
@@ -378,7 +378,7 @@ ol.format.WMTSCapabilities.DIMENSION_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.WGS84_BBOX_READERS_ = ol.xml.makeStructureNS(
@@ -392,7 +392,7 @@ ol.format.WMTSCapabilities.WGS84_BBOX_READERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_PARSERS_ = ol.xml.makeStructureNS(
@@ -411,7 +411,7 @@ ol.format.WMTSCapabilities.TMS_PARSERS_ = ol.xml.makeStructureNS(
/**
* @const
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @type {Object.<string, Object.<string, ol.xmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TM_PARSERS_ = ol.xml.makeStructureNS(

View File

@@ -1,9 +1,9 @@
goog.provide('ol.format.XSD');
goog.require('goog.asserts');
goog.require('goog.string');
goog.require('ol');
goog.require('ol.xml');
goog.require('ol.string');
/**
@@ -142,11 +142,11 @@ ol.format.XSD.writeBooleanTextNode = function(node, bool) {
ol.format.XSD.writeDateTimeTextNode = function(node, dateTime) {
var date = new Date(dateTime * 1000);
var string = date.getUTCFullYear() + '-' +
goog.string.padNumber(date.getUTCMonth() + 1, 2) + '-' +
goog.string.padNumber(date.getUTCDate(), 2) + 'T' +
goog.string.padNumber(date.getUTCHours(), 2) + ':' +
goog.string.padNumber(date.getUTCMinutes(), 2) + ':' +
goog.string.padNumber(date.getUTCSeconds(), 2) + 'Z';
ol.string.padNumber(date.getUTCMonth() + 1, 2) + '-' +
ol.string.padNumber(date.getUTCDate(), 2) + 'T' +
ol.string.padNumber(date.getUTCHours(), 2) + ':' +
ol.string.padNumber(date.getUTCMinutes(), 2) + ':' +
ol.string.padNumber(date.getUTCSeconds(), 2) + 'Z';
node.appendChild(ol.xml.DOCUMENT.createTextNode(string));
};

View File

@@ -1,21 +0,0 @@
// FIXME factor out common code between usedTiles and wantedTiles
goog.provide('ol.PostRenderFunction');
goog.provide('ol.PreRenderFunction');
/**
* @typedef {function(ol.Map, ?olx.FrameState): boolean}
*/
ol.PostRenderFunction;
/**
* Function to perform manipulations before rendering. This function is called
* with the {@link ol.Map} as first and an optional {@link olx.FrameState} as
* second argument. Return `true` to keep this function for the next frame,
* `false` to remove it.
* @typedef {function(ol.Map, ?olx.FrameState): boolean}
* @api
*/
ol.PreRenderFunction;

View File

@@ -5,7 +5,6 @@ goog.provide('ol.GeolocationProperty');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.Coordinate');
goog.require('ol.Object');
goog.require('ol.geom.Geometry');
goog.require('ol.geom.Polygon');
@@ -135,12 +134,12 @@ ol.Geolocation.prototype.handleTrackingChanged_ = function() {
if (ol.has.GEOLOCATION) {
var tracking = this.getTracking();
if (tracking && this.watchId_ === undefined) {
this.watchId_ = goog.global.navigator.geolocation.watchPosition(
this.watchId_ = ol.global.navigator.geolocation.watchPosition(
this.positionChange_.bind(this),
this.positionError_.bind(this),
this.getTrackingOptions());
} else if (!tracking && this.watchId_ !== undefined) {
goog.global.navigator.geolocation.clearWatch(this.watchId_);
ol.global.navigator.geolocation.clearWatch(this.watchId_);
this.watchId_ = undefined;
}
}

View File

@@ -1,7 +1,6 @@
goog.provide('ol.geom.flat.geodesic');
goog.require('goog.asserts');
goog.require('ol.TransformFunction');
goog.require('ol.math');
goog.require('ol.proj');

View File

@@ -34,7 +34,7 @@ ol.has.MAC = ua.indexOf('macintosh') !== -1;
* @type {number}
* @api stable
*/
ol.has.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1;
ol.has.DEVICE_PIXEL_RATIO = ol.global.devicePixelRatio || 1;
/**
@@ -56,7 +56,7 @@ ol.has.CANVAS = ol.ENABLE_CANVAS && (
* @return {boolean} Canvas supported.
*/
function() {
if (!('HTMLCanvasElement' in goog.global)) {
if (!('HTMLCanvasElement' in ol.global)) {
return false;
}
try {
@@ -81,7 +81,7 @@ ol.has.CANVAS = ol.ENABLE_CANVAS && (
* @type {boolean}
* @api stable
*/
ol.has.DEVICE_ORIENTATION = 'DeviceOrientationEvent' in goog.global;
ol.has.DEVICE_ORIENTATION = 'DeviceOrientationEvent' in ol.global;
/**
@@ -98,7 +98,7 @@ ol.has.DOM = ol.ENABLE_DOM;
* @type {boolean}
* @api stable
*/
ol.has.GEOLOCATION = 'geolocation' in goog.global.navigator;
ol.has.GEOLOCATION = 'geolocation' in ol.global.navigator;
/**
@@ -107,7 +107,7 @@ ol.has.GEOLOCATION = 'geolocation' in goog.global.navigator;
* @type {boolean}
* @api stable
*/
ol.has.TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global;
ol.has.TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in ol.global;
/**
@@ -115,7 +115,7 @@ ol.has.TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global;
* @const
* @type {boolean}
*/
ol.has.POINTER = 'PointerEvent' in goog.global;
ol.has.POINTER = 'PointerEvent' in ol.global;
/**
@@ -123,7 +123,7 @@ ol.has.POINTER = 'PointerEvent' in goog.global;
* @const
* @type {boolean}
*/
ol.has.MSPOINTER = !!(goog.global.navigator.msPointerEnabled);
ol.has.MSPOINTER = !!(ol.global.navigator.msPointerEnabled);
/**
@@ -142,7 +142,7 @@ ol.has.WEBGL;
var textureSize;
var /** @type {Array.<string>} */ extensions = [];
if ('WebGLRenderingContext' in goog.global) {
if ('WebGLRenderingContext' in ol.global) {
try {
var canvas = /** @type {HTMLCanvasElement} */
(document.createElement('CANVAS'));

View File

@@ -5,7 +5,6 @@ goog.require('goog.asserts');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
goog.require('ol.Attribution');
goog.require('ol.Extent');
/**

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