Compare commits

...

382 Commits

Author SHA1 Message Date
ahocevar
fad927c7d3 Use beta tag 2019-05-15 09:33:25 +02:00
ahocevar
53b9718381 Bump version (beta) 2019-05-15 09:32:20 +02:00
Frédéric Junod
2de282ae49 Merge pull request #9533 from fredj/canvas_optim
Canvas optimizations
2019-05-15 08:24:57 +02:00
Tim Schaub
72551ab506 Merge pull request #9538 from tschaub/module-name
Correct the module annotation for the vector image layer renderer
2019-05-14 18:10:13 -06:00
Tim Schaub
b1ea0fec50 Name the module like the module 2019-05-14 13:58:04 -06:00
Frederic Junod
98ee52c61c Move the transform matrix computation out of the for loop 2019-05-14 15:39:06 +02:00
Frederic Junod
f76b9bdd07 Only apply canvas transform if the tiles are scales 2019-05-14 15:33:44 +02:00
Frédéric Junod
3a1d927c41 Merge pull request #9532 from fredj/rm_prop_mapbox_example
Remove unused 'container' property in mapbox-layer example
2019-05-14 14:23:58 +02:00
Frederic Junod
9224bfab7d Remove unused 'container' property in mapbox-layer example 2019-05-14 13:48:26 +02:00
Frédéric Junod
b5535f3ba5 Merge pull request #9530 from fredj/spelling
Fix spelling
2019-05-14 09:26:53 +02:00
Frederic Junod
bfe6d29601 Fix spelling 2019-05-14 09:17:34 +02:00
Tim Schaub
807525b1db Merge pull request #9528 from openlayers/greenkeeper/puppeteer-1.16.0
Update puppeteer to the latest version 🚀
2019-05-13 21:01:49 -06:00
Tim Schaub
8504a49e17 Merge pull request #9489 from crubier/master
Fix Zoomify to display retina tiles
2019-05-13 19:05:31 -06:00
greenkeeper[bot]
83d317d16d chore(package): update puppeteer to version 1.16.0 2019-05-14 00:10:27 +00:00
Frédéric Junod
55b27c70b5 Merge pull request #9525 from jahow/custom-render-fn
Support a custom render function for the Layer class
2019-05-13 16:45:34 +02:00
Olivier Guyot
1c13893dd1 Mapbox Example / remove es6 shorthand
thanks @fredj

Co-Authored-By: Frédéric Junod <frederic.junod@camptocamp.com>
2019-05-13 16:38:10 +02:00
Olivier Guyot
4a1cda715d Layer / update doc to reflect custom render function support 2019-05-13 16:22:27 +02:00
Olivier Guyot
c9d1725f5c Composite renderer / trigger a render even when the source is undefined 2019-05-13 16:16:53 +02:00
Olivier Guyot
4bf314f9e6 Mapbox Example / simplify to use a custom render function 2019-05-13 16:16:53 +02:00
Olivier Guyot
14f580fe30 Layer / accepts a custom render function 2019-05-13 16:16:53 +02:00
Frédéric Junod
a2e6d4b324 Merge pull request #9522 from fredj/https
Use https urls for mapbox.com
2019-05-13 14:50:37 +02:00
Tim Schaub
dadc240038 Merge pull request #9520 from lutzhelm/iiif-doc
[WIP] Improve IIIF tile source and parser documentation
2019-05-13 06:47:09 -06:00
Andreas Hocevar
dd265623e4 Merge pull request #9523 from jahow/mapbox-simpler-example
Make the code simpler in the Mapbox example
2019-05-13 14:37:14 +02:00
Frederic Junod
23137cdab3 Use https urls for mapbox.com 2019-05-13 14:16:18 +02:00
Lutz Helm
1d08eb5752 Give a hint on how to parse IIIF info.json 2019-05-13 12:27:14 +02:00
Olivier Guyot
78cee60d91 Mapbox example / remove more unused code 2019-05-13 12:15:46 +02:00
Olivier Guyot
1deabaa1c0 Mapbox example / add mapbox css to avoid warning in console
Also remove manipulation of the mapbox canvas (not necessary anymore).
2019-05-13 11:42:28 +02:00
Olivier Guyot
88b6b18cc0 Mapbox example / remove overload of undocumented method
This was out of sync with mabox v54 and is not required anymore.
2019-05-13 11:38:45 +02:00
Andreas Hocevar
355fb41748 Merge pull request #9519 from jahow/mapbox-sync-render
Use synchronous render in Mapbox example
2019-05-13 11:37:26 +02:00
Olivier Guyot
7d2249f652 Mapbox example / trigger a synchronous redraw
This uses an undocumented method to trigger a synchronous redraw
instead of using the standard schedule from Mapbox. The CSS previously used
to make the OL and MB views match is not necessary anymore.

Reference: https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184
2019-05-13 11:16:36 +02:00
Lutz Helm
5e288ebedf Improve IIIF tile source doc 2019-05-13 11:15:20 +02:00
Lutz Helm
80eb8b62ce Display union types in IIIFInfo constructor doc 2019-05-13 11:14:43 +02:00
Lutz Helm
cdb36a3bf2 Expose IIIFInfo methods for doc 2019-05-13 11:04:28 +02:00
Lutz Helm
04a28854c9 Make IIIFInfo#Versions appear in doc
For whatever reasons, the possible values of `Versions` did not appear
in the built docs.
2019-05-13 10:49:38 +02:00
Andreas Hocevar
51cf9ee3a1 Merge pull request #9518 from ahocevar/hitdetect-no-declutter
Fix hit detection for multiple layers when decluttering is off
2019-05-13 09:23:43 +02:00
Andreas Hocevar
fbc8580539 Merge pull request #9517 from openlayers/greenkeeper/jsdoc-3.6.2
Update jsdoc to the latest version 🚀
2019-05-13 07:47:07 +02:00
ahocevar
eeec56fa94 Fix hit detection for multiple layers when decluttering is off 2019-05-12 23:32:44 +02:00
Andreas Hocevar
17d83b9c20 Merge pull request #9516 from ahocevar/ol-mapbox-style-5
Upgrade ol-mapbox-style to v5
2019-05-12 21:33:21 +02:00
greenkeeper[bot]
2c9f6b496f chore(package): update jsdoc to version 3.6.2 2019-05-12 16:51:14 +00:00
ahocevar
5006bbe13f Upgrade ol-mapbox-style to v5 2019-05-12 17:34:39 +02:00
ahocevar
a1026a50bd Bump beta version 2019-05-12 16:13:50 +02:00
Andreas Hocevar
c117ec79f7 Merge pull request #9515 from openlayers/greenkeeper/fs-extra-8.0.0
Update fs-extra to the latest version 🚀
2019-05-12 15:48:25 +02:00
greenkeeper[bot]
b37eb29444 chore(package): update fs-extra to version 8.0.0 2019-05-11 14:48:40 +00:00
Andreas Hocevar
4df545dfb0 Merge pull request #9505 from ahocevar/vectortile-pixelratio
Avoid blurry vector tiles
2019-05-10 14:56:10 +02:00
Tim Schaub
70f5822217 Merge pull request #9430 from lutzhelm/iiif
Adds IIIF Image API tile source
2019-05-10 06:32:28 -06:00
Frédéric Junod
d49a41def0 Merge pull request #9512 from fredj/mapbox-layer-example
Mapbox layer example improvement
2019-05-10 14:18:00 +02:00
Frédéric Junod
e4941f60db Merge pull request #9511 from fredj/update_dev_deps
Update devDependencies
2019-05-10 14:17:29 +02:00
Frederic Junod
d1fe22a872 Simplify mapboxgl control container removal 2019-05-10 12:39:39 +02:00
Frederic Junod
5756003c88 Don't create temporary arrays in mapbox-layer example 2019-05-10 10:59:15 +02:00
Frederic Junod
e5e2129a88 Use toLonLat function in mapbox-layer example 2019-05-10 10:48:45 +02:00
Frederic Junod
c5e6728d6d Update mapbox-gl to version 0.54.0 2019-05-10 10:48:21 +02:00
Frederic Junod
d9b3986c95 Update typescript to version 3.4.5 2019-05-10 10:15:30 +02:00
greenkeeper[bot]
a67f8e3f38 chore(package): update serve-static to version 1.14.0 2019-05-10 10:14:40 +02:00
greenkeeper[bot]
7989991da9 chore(package): update glob to version 7.1.4 2019-05-10 10:14:30 +02:00
greenkeeper[bot]
afa70e5a1e chore(package): update webpack-cli to version 3.3.2 2019-05-10 10:14:09 +02:00
greenkeeper[bot]
ce9ea5cc93 chore(package): update loglevelnext to version 3.0.1 2019-05-10 10:13:22 +02:00
greenkeeper[bot]
5f5cdc9645 chore(package): update copy-webpack-plugin to version 5.0.3 2019-05-10 10:13:10 +02:00
greenkeeper[bot]
6370426d52 chore(package): update webpack-cli to version 3.3.1 2019-05-10 10:12:52 +02:00
greenkeeper[bot]
fb7bd2158d chore(package): update sinon to version 7.3.2 2019-05-10 10:11:57 +02:00
greenkeeper[bot]
387b4188f2 chore(package): update front-matter to version 3.0.2 2019-05-10 10:11:44 +02:00
greenkeeper[bot]
c922d4eb8f chore(package): update karma to version 4.1.0 2019-05-10 10:11:27 +02:00
Frédéric Junod
9d4eda2318 Merge pull request #9508 from openlayers/greenkeeper/webpack-4.31.0
Update webpack to the latest version 🚀
2019-05-10 10:09:04 +02:00
Lutz Helm
bd235b7b49 Fix JSDoc error in IIIFInfo 2019-05-09 18:00:18 +02:00
Lutz Helm
7daba05548 Use quoted strings for accessing IIIF_PROFILE_VALUES 2019-05-09 18:00:18 +02:00
Lutz Helm
64e67ae351 Correct IIIF tile source doc 2019-05-09 18:00:18 +02:00
Lutz Helm
40ea2a8b7e Remove extent definition from IIIF example
See
https://github.com/openlayers/openlayers/pull/9430#pullrequestreview-232616993
2019-05-09 18:00:18 +02:00
Lutz Helm
4629fe5028 Add @api annotation for TileGrid#getExtent 2019-05-09 18:00:18 +02:00
Lutz Helm
ba2c558b72 Add typedefs for IIIF info.json responses 2019-05-09 18:00:18 +02:00
Lutz Helm
84f1e0c66e Avoid minification/compilation errors in IIIFInfo
Unquoted properties might be renamed, resulting in errors while
accessing these properties via intented string values.
See also:
https://github.com/openlayers/openlayers/pull/9430#pullrequestreview-232622522
https://github.com/openlayers/openlayers/pull/9430#pullrequestreview-232622575
2019-05-09 18:00:18 +02:00
Lutz Helm
72e41d3703 Remove attribution generation from IIIFInfo
Generating attributions by injecting 3rd party HTML content introduces
XSS vulnerabilities, so with regard to upcoming Image API changes this
functionality is removed.
See also
https://github.com/openlayers/openlayers/pull/9430#issuecomment-482610729
2019-05-09 18:00:18 +02:00
Lutz Helm
6775723840 Fix error in IIIFInfo IIIF Image API v3 handling 2019-05-09 18:00:18 +02:00
Lutz Helm
d332b6a0f4 Prepare IIIFInfo for JSON-LD context extensions
IIIF Image API 3 allows context extensions that should be added to the
info.json's @context property. Therefore, '@context' might be an array
instead of a string.
2019-05-09 18:00:18 +02:00
Lutz Helm
f68b8d8df9 Make IIIF_PROFILE_VALUES consistent with it's doc 2019-05-09 18:00:18 +02:00
Lutz Helm
c2cbae95c6 Fix codestyle in IIIFInfo tests 2019-05-09 18:00:18 +02:00
Lutz Helm
b36ad87cb5 Extend IIIFInfo tests 2019-05-09 18:00:18 +02:00
Lutz Helm
b7c004f95c Remove version specific IIIFInfo methods from class 2019-05-09 18:00:18 +02:00
Lutz Helm
7bfaa3b6ad Refactor IIIFInfo and add tests 2019-05-09 18:00:18 +02:00
Lutz Helm
0cffee6f83 Rename IIIFInfo format methods for more clarity 2019-05-09 18:00:18 +02:00
Lutz Helm
3895a59c5e Fix typo 2019-05-09 18:00:18 +02:00
Lutz Helm
a2b39c9c53 Clean up and document IIIFInfo parser
Optional preferred options are now reduced to the two options that
depend on the image service's supported features: format and quality.
2019-05-09 18:00:18 +02:00
Lutz Helm
12154d98b4 Improve IIIF tile source documentation 2019-05-09 18:00:18 +02:00
Lutz Helm
c25dba415f Add more IIIF tile source tests 2019-05-09 18:00:18 +02:00
Lutz Helm
27d943dcc3 Add tests for IIIF tile source and fix source
The tests are still incomplete.
This commit also corrects the IIIF source where tests have failed.
2019-05-09 18:00:18 +02:00
Lutz Helm
66b5b5d7e1 Cleanup IIIF example code 2019-05-09 18:00:18 +02:00
Lutz Helm
3cf9b5aa28 Add zDirection option to IIIF tile source 2019-05-09 18:00:18 +02:00
Lutz Helm
b77177ed74 Fix errors in IIIF code
- missing import in IIIFInfo
- syntax errors in IIIF
2019-05-09 18:00:18 +02:00
Lutz Helm
f61562a51a Remove unsupported options, document options 2019-05-09 18:00:18 +02:00
Lutz Helm
e4a531de8c Declare IIIF versions as enum 2019-05-09 18:00:18 +02:00
Lutz Helm
063bc51c59 Rename IIIF features to supports
Avoid terminology confusion between OpenLayers map features and IIIF
region/size calculation capability features.
2019-05-09 18:00:18 +02:00
Lutz Helm
3f3fbe7e4b Remove IIIF source rounding workarounds
Always try to use canonical URI form. If the server serves wrong tile
heights for given w, shaped size request URI parameters, so be it.
2019-05-09 18:00:18 +02:00
Lutz Helm
01a6381756 Change the IIIF image example image 2019-05-09 18:00:18 +02:00
Lutz Helm
0ab7ad741f Add error codes for IIIF errors
60: "Missing or invalid `size`."
Without at least a size, no IIIF can be displayed.

61: "Cannot determine IIIF Image API version from provided image
information JSON."
Without finding out the version information, one could only guess how to
use the image info JSON.
2019-05-09 18:00:18 +02:00
Lutz Helm
58efe1f850 Limit IIIF tile source percentages to 10 decimals max
IIIF Image API versions 1 and 2 recommend limiting the number of
decimals digits to 10 at most.
2019-05-09 18:00:18 +02:00
Lutz Helm
66b41a53b8 Fix error in IIIF v3 level0 size paramter
Size request parameter in w,h form for level 0 services that only support
listed sizes had been using erroneous w,w instead of w,h.
2019-05-09 18:00:18 +02:00
Lutz Helm
c00400c500 Add IIIF Image API tilesource with example
src/ol/source/IIIF.js contains a tile source for IIIF Image API services.
It supports Image API version 1 and 2 on compliance levels 0, 1 and 2.

To get working constructor options for IIIF from an IIIF image info.json,
use src/ol/format/IIIFInfo.js.

An example is available in examples/iiif.html respectivly examples/iiif.js.
2019-05-09 18:00:18 +02:00
greenkeeper[bot]
944af1fe80 chore(package): update webpack to version 4.31.0 2019-05-09 08:26:44 +00:00
Vincent Lecrubier
ea55f39298 Support tilePixelRatio in Zoomify to support retina 2019-05-08 22:52:14 +02:00
ahocevar
84db84bc23 Avoid blurry vector tiles 2019-05-08 10:31:29 +02:00
Frédéric Junod
f366eaea52 Merge pull request #9504 from fredj/examples_tsc
Minor examples fixes
2019-05-07 16:38:20 +02:00
Frederic Junod
f5ae41f03e Compare Date with Date instead of number 2019-05-07 14:54:46 +02:00
Frederic Junod
6b1bce2b9d Add missing className property to BaseTile layer options 2019-05-07 14:54:46 +02:00
Frederic Junod
bd57128ca4 Remove unsupported condition property
There's no `condition` property for the Extent interaction
2019-05-07 14:54:46 +02:00
Frederic Junod
5012e4987c Don't use View#constrainCenter function 2019-05-07 14:54:46 +02:00
Andreas Hocevar
6e3d3d4877 Merge pull request #9466 from ahocevar/declutter-global
Declutter in correct order and for all layers
2019-05-07 14:33:24 +02:00
Frederic Junod
d30f6175ce Add function JSDoc tag 2019-05-07 13:52:48 +02:00
Frederic Junod
0e08d9e0fd Add empty declutterItems in RasterSource frameState
To please the type checker.
2019-05-07 13:52:25 +02:00
Andreas Hocevar
4973281f3c Merge pull request #9497 from simonseyock/patch-2
Fix earth radius in documentation
2019-05-06 17:20:22 +02:00
Simon Seyock
8f3820be22 Fix earth radius in documentation 2019-05-06 16:26:49 +02:00
Andreas Hocevar
033a18bc1c Merge pull request #9493 from ahocevar/jsdoc-3-6
Upgrade jsdoc to v3.6.1
2019-05-06 09:51:39 +02:00
ahocevar
99fb0bf57e Revert "Try downgrading Node for JSDoc"
This reverts commit 284c1dff83.
2019-05-06 09:42:00 +02:00
ahocevar
49a9f21388 Upgrade jsdoc to v3.6.1 2019-05-05 21:29:19 +02:00
Andreas Hocevar
e4d25400ee Merge pull request #9490 from jahow/improve-webgl-doc
Misc. API doc improvements
2019-05-05 19:30:12 +02:00
Andreas Hocevar
1e350677fb Merge pull request #9492 from ahocevar/unmanaged-zindex
Fix zIndex handling for unmanaged layers
2019-05-05 19:14:21 +02:00
ahocevar
86f304ae02 Fix typos 2019-05-05 15:11:22 +02:00
ahocevar
00c09eb281 Make rendering tests more cross-platform proof 2019-05-05 15:05:02 +02:00
ahocevar
6c8c8a6477 Fix decluttering on VectorImage layers 2019-05-05 14:54:23 +02:00
ahocevar
1142caf5e8 Modify render tests to catch regressions 2019-05-05 14:54:23 +02:00
ahocevar
ba6ac43a28 Fix zIndex handling for unmanaged layers 2019-05-05 13:24:46 +02:00
ahocevar
12289b8ef9 Declutter in correct order and for all layers 2019-05-05 12:20:38 +02:00
Olivier Guyot
f69c37566e Improve documentation on webgl and View 2019-05-04 17:26:05 +02:00
Tim Schaub
6cfd0b70ed Merge pull request #9388 from jahow/restore-coverage
Restore code coverage report
2019-05-03 08:33:45 -06:00
Tim Schaub
d95bcc8594 Merge pull request #9487 from tschaub/examples-layout
Avoid header expanding over examples
2019-05-03 08:28:27 -06:00
Olivier Guyot
d3e6f4c3b2 Restore code coverage in Karma config
The transpiling step is done by babel instead of bublé now.
Bublé caused the istanbul instrumenter step to crash because of an
unexpected SourceMap object format.
2019-05-03 15:15:14 +02:00
Frédéric Junod
eb21369d86 Merge pull request #9488 from openlayers/codesandbox_lang_attr
Set the 'lang' attribute to the html tag in examples
2019-05-03 14:31:31 +02:00
Frederic Junod
68a29f1ac6 Set the 'lang' attribute to the html tag in examples 2019-05-03 11:32:33 +02:00
Tim Schaub
6413badada Avoid header expanding over examples 2019-05-02 18:31:56 -06:00
Frédéric Junod
d6485b1e94 Merge pull request #9486 from openlayers/greenkeeper/jquery-3.4.1
Update jquery to the latest version 🚀
2019-05-02 08:45:13 +02:00
greenkeeper[bot]
98a5f552b2 chore(package): update jquery to version 3.4.1 2019-05-01 21:22:51 +00:00
Tim Schaub
067260170b Merge pull request #9484 from tschaub/ci-docs
Build API docs in CI job
2019-05-01 12:44:33 -06:00
Tim Schaub
9850c0134e Merge pull request #9476 from tschaub/event-longnames
Document events fired by interactions
2019-05-01 10:04:58 -06:00
Tim Schaub
284c1dff83 Try downgrading Node for JSDoc 2019-05-01 10:03:17 -06:00
Tim Schaub
d166c79242 Build API docs in CI job 2019-05-01 09:06:40 -06:00
Tim Schaub
e4f377fb46 Merge pull request #9475 from tschaub/single-color-callback
Call the color callback once per feature
2019-04-29 09:14:40 -06:00
Tim Schaub
e22af6dbd6 Merge pull request #9477 from tschaub/unused
Tidy up the JSDoc events plugin
2019-04-29 06:18:22 -06:00
Tim Schaub
0f998b4522 Link to the extent event instead of the extent event type 2019-04-28 16:36:33 -06:00
Tim Schaub
2cdfcf8b21 Latest jsdoc plugin for event longnames 2019-04-28 16:26:14 -06:00
Tim Schaub
b3e770226f Smaller scope 2019-04-28 16:03:54 -06:00
Tim Schaub
981328576f Remove unused classes lookup 2019-04-28 16:00:43 -06:00
Tim Schaub
3b1a415d6b Call the color callback once per feature 2019-04-28 14:09:31 -06:00
Andreas Hocevar
fde36b237e Merge pull request #9469 from ahocevar/vectortile-zdirection
Use nearest lower resolution of vector tiles
2019-04-26 15:12:41 +02:00
ahocevar
dde9c59021 Use nearest lower resolution of vector tiles 2019-04-26 14:29:09 +02:00
Frédéric Junod
a12b323907 Merge pull request #9468 from openlayers/greenkeeper/puppeteer-1.15.0
Update puppeteer to the latest version 🚀
2019-04-26 08:42:08 +02:00
greenkeeper[bot]
1687f9bb84 chore(package): update puppeteer to version 1.15.0 2019-04-26 02:33:10 +00:00
Tim Schaub
9a12a668a2 Merge pull request #9452 from tschaub/color-callback
Fewer calls to the WebGL color callback
2019-04-24 09:46:41 -06:00
Tim Schaub
b98268ffee Merge pull request #9453 from tschaub/for-key-in-uniforms
Remove unnecessary closure and fix uniform type
2019-04-23 17:20:26 -06:00
Frédéric Junod
4d1ae3d483 Merge pull request #9459 from fredj/html-to-image
Use html-to-image instead of dom-to-image-more
2019-04-23 11:53:57 +02:00
Frederic Junod
2f6f110fa3 Remove constrainResolution property in fit options 2019-04-23 10:19:21 +02:00
Frederic Junod
93c25d4f82 Export the map viewport instead of the layers
And filter out the controls elements
2019-04-23 10:17:16 +02:00
Frederic Junod
2ac1095c52 Use html-to-image instead of dom-to-image-more
dom-to-image-more do not support safari
2019-04-23 09:58:31 +02:00
Tim Schaub
d5b868f4a6 Version without v 2019-04-22 09:22:20 -06:00
Tim Schaub
17081fac46 Bump to v6.0.0-beta.6
The version must point to an existing tag for published examples to work.
2019-04-22 09:15:27 -06:00
Andreas Hocevar
4a18b57021 Merge pull request #9450 from ahocevar/later-interacting-flag
Set the interacting flag on pointerdrag instead of pointerdown
2019-04-19 17:51:33 -07:00
Tim Schaub
58c4c9ebb8 Remove unnecessary closure and fix uniform type 2019-04-19 14:33:43 -07:00
Tim Schaub
a16234faaa Allow color callback without third arg 2019-04-19 13:57:40 -07:00
Tim Schaub
154265a2d9 Fewer calls to the color callback 2019-04-19 13:49:53 -07:00
Andreas Hocevar
440ae897a5 Merge pull request #9444 from openlayers/greenkeeper/mocha-6.1.4
Update mocha to the latest version 🚀
2019-04-19 10:11:46 -07:00
ahocevar
86fac0937b Set the interacting flag on pointerdrag instead of pointerdown 2019-04-19 09:42:12 -07:00
greenkeeper[bot]
682102d4d6 chore(package): update mocha to version 6.1.4 2019-04-18 18:59:28 +00:00
Tim Schaub
22774b4821 Bump to 6.0.0-beta 2019-04-18 10:09:58 -07:00
Andreas Hocevar
046e73e785 Merge pull request #9439 from ahocevar/vectortile-attributions
Add attributionsCollapsible option to source/VectorTile
2019-04-18 07:36:50 -07:00
Tim Schaub
a71a823676 Merge pull request #9440 from tschaub/csv-parsing
Skip the header and bad data in CSV parsing
2019-04-17 23:25:02 -07:00
Andreas Hocevar
3ba7ecc602 Merge pull request #9442 from ahocevar/raster-no-transition
Disable opacity transition for raster source sources
2019-04-17 18:21:38 -07:00
ahocevar
887d8e8a90 Disable opacity transition for raster source sources 2019-04-17 17:38:50 -07:00
Andreas Hocevar
251fc79484 Merge pull request #9441 from ahocevar/view-center-no-round
Do not round view center to pixels
2019-04-17 16:30:00 -07:00
Tim Schaub
fc0ed7b96f Skip the header and bad data 2019-04-17 16:26:40 -07:00
ahocevar
752b69680e Do not round view center to pixels 2019-04-17 15:52:58 -07:00
ahocevar
756f63e212 Add attributionsCollapsible option to source/VectorTile 2019-04-17 09:06:37 -07:00
Frédéric Junod
84a82ea5b2 Merge pull request #9435 from fredj/api_default
Set the default values after the property name
2019-04-17 08:29:28 +02:00
Frederic Junod
08dd5f58a2 Set the default values after the property name 2019-04-15 16:44:06 +02:00
Frédéric Junod
04963c83d6 Merge pull request #9433 from fredj/cleanup
Remove unused private variables, remove trailing whitespace
2019-04-15 13:36:54 +02:00
Frederic Junod
711dacf4b7 Remove unused private variables, remove trailing whitespaces 2019-04-15 11:31:18 +02:00
Frédéric Junod
6fbd196132 Merge pull request #9416 from fredj/circle_rotate
Implement rotate and translate functions for circle geometry
2019-04-15 08:22:29 +02:00
Andreas Hocevar
5969ac31ea Merge pull request #9432 from openlayers/greenkeeper/handlebars-4.1.2
Update handlebars to the latest version 🚀
2019-04-13 22:23:22 +02:00
greenkeeper[bot]
21c51ff784 chore(package): update handlebars to version 4.1.2 2019-04-13 14:21:50 +00:00
Tim Schaub
3d10e92218 Merge pull request #9431 from openlayers/greenkeeper/webpack-4.30.0
Update webpack to the latest version 🚀
2019-04-13 06:32:19 -06:00
greenkeeper[bot]
84371fe4be chore(package): update webpack to version 4.30.0 2019-04-12 20:36:52 +00:00
Frédéric Junod
1995164219 Merge pull request #9429 from fredj/update_dev_deps
Update all devDependencies
2019-04-12 12:42:10 +02:00
greenkeeper[bot]
4f128a1ec0 chore(package): update ol-mapbox-style to version 4.3.1 2019-04-12 10:59:30 +02:00
greenkeeper[bot]
f11744da56 chore(package): update webpack-dev-server to version 3.3.1 2019-04-12 10:25:32 +02:00
greenkeeper[bot]
08434ed3d5 chore(package): update webpack-dev-middleware to version 3.6.2 2019-04-12 10:24:32 +02:00
greenkeeper[bot]
2c76d7531b chore(package): update globby to version 9.2.0 2019-04-12 10:24:17 +02:00
greenkeeper[bot]
bbec7d76d4 chore(package): update eslint to version 5.16.0 2019-04-12 10:24:03 +02:00
greenkeeper[bot]
255c4b34ba chore(package): update sinon to version 7.3.1 2019-04-12 10:23:46 +02:00
greenkeeper[bot]
fd220f9cce chore(package): update copy-webpack-plugin to version 5.0.2 2019-04-12 10:23:19 +02:00
greenkeeper[bot]
34d68aadbd chore(package): update @types/geojson to version 7946.0.7 2019-04-12 10:22:37 +02:00
greenkeeper[bot]
3bc822e8ef chore(package): update @openlayers/eslint-plugin to version 4.0.0-beta.2 2019-04-12 10:22:11 +02:00
Frédéric Junod
7340e865a3 Merge pull request #9427 from openlayers/greenkeeper/mocha-6.1.3
Update mocha to the latest version 🚀
2019-04-12 08:41:43 +02:00
Frédéric Junod
5b231fe990 Merge pull request #9425 from fredj/rm_unused_webgl
Remove unused ol/render/webgl module
2019-04-12 08:41:24 +02:00
greenkeeper[bot]
9c55256de2 chore(package): update mocha to version 6.1.3 2019-04-12 00:32:49 +00:00
Frederic Junod
491020f027 Remove unused ol/render/webgl module 2019-04-11 16:37:50 +02:00
Frederic Junod
2989c84248 Implement translate function for circle geometry 2019-04-11 16:12:41 +02:00
Andreas Hocevar
db1515a9f3 Merge pull request #9420 from openlayers/greenkeeper/jquery-3.4.0
Update jquery to the latest version 🚀
2019-04-11 09:06:34 +02:00
greenkeeper[bot]
a774b1a278 chore(package): update jquery to version 3.4.0 2019-04-10 19:55:54 +00:00
Andreas Hocevar
81865f70e4 Merge pull request #9418 from ahocevar/reexport-geometrycollection
Re-export GeometryCollection in ol/geom
2019-04-10 10:30:33 +02:00
Frédéric Junod
c6db2d07bb Use .js extension for import
Co-Authored-By: ahocevar <andreas.hocevar@gmail.com>
2019-04-10 09:09:50 +02:00
ahocevar
91215b303e Re-export GeometryCollection in ol/geom 2019-04-09 20:08:11 +02:00
Frederic Junod
319a905ec0 Implement rotate function for circle geometry 2019-04-09 16:58:44 +02:00
Frédéric Junod
9883b7d3d9 Merge pull request #9411 from fredj/raster_state_test
Fix tile state condition in raster layer test
2019-04-09 08:27:43 +02:00
Frédéric Junod
07e31840eb Merge pull request #9410 from fredj/MouseWheelZoom_max_zoom
Add new maxDelta property to MouseWheelZoom constructor
2019-04-09 08:27:27 +02:00
Andreas Hocevar
03483b5439 Merge pull request #9412 from openlayers/greenkeeper/mocha-6.1.2
Update mocha to the latest version 🚀
2019-04-08 21:36:22 +02:00
greenkeeper[bot]
9a42ab73d8 chore(package): update mocha to version 6.1.2 2019-04-08 19:02:57 +00:00
Frederic Junod
746f92d597 Fix tile state condition in raster layer test
The state was duplicated from the beginning, see 3ddb8712a3
2019-04-08 17:04:37 +02:00
Frederic Junod
238fbca650 Add new maxDelta property to MouseWheelZoom constructor 2019-04-08 15:02:21 +02:00
Frédéric Junod
3875147812 Merge pull request #9409 from fredj/rm_opt_this
Remove more opt_this parameters
2019-04-08 14:37:59 +02:00
Frederic Junod
be065cdacc Update upgrade-notes 2019-04-08 13:46:54 +02:00
Frederic Junod
187f58c1c3 Remove opt_this param in ol/extent 2019-04-08 13:46:54 +02:00
Frederic Junod
c20bdedcac Remove opt_this param in ol/structs/LRUCache 2019-04-08 13:46:54 +02:00
Frederic Junod
617dd9f031 Remove opt_this param in ol/structs/RBush 2019-04-08 13:46:54 +02:00
Frédéric Junod
077afac90a Merge pull request #9408 from openlayers/greenkeeper/mocha-6.1.1
chore(package): update mocha to version 6.1.1
2019-04-08 10:26:54 +02:00
Frédéric Junod
f091d96b6c Merge pull request #9406 from openlayers/greenkeeper/clean-css-cli-4.3.0
Update clean-css-cli to the latest version 🚀
2019-04-08 08:48:03 +02:00
greenkeeper[bot]
a30aa78726 chore(package): update mocha to version 6.1.1
Closes #9407
2019-04-07 23:07:05 +00:00
greenkeeper[bot]
66f49559ee chore(package): update clean-css-cli to version 4.3.0 2019-04-06 09:49:54 +00:00
Andreas Hocevar
8899c3e3c5 Merge pull request #9405 from openlayers/greenkeeper/marked-0.6.2
Update marked to the latest version 🚀
2019-04-05 17:39:42 +02:00
Andreas Hocevar
10a2b718f5 Merge pull request #9286 from ahocevar/interim-transition
Disable transition when an interim tile is available
2019-04-05 17:33:58 +02:00
Andreas Hocevar
c72f699c90 Merge pull request #9404 from jahow/fix-view-jump-glitch
View / apply constraints when an interaction starts
2019-04-05 17:30:33 +02:00
ahocevar
16e132caea Mark new animate_ method private 2019-04-05 17:21:23 +02:00
ahocevar
070c1ec029 Resolve constraints for View#animate() API calls 2019-04-05 17:13:55 +02:00
greenkeeper[bot]
21c26cabed chore(package): update marked to version 0.6.2 2019-04-05 14:34:13 +00:00
Olivier Guyot
0f73f16cfa View / apply constraints when an interaction starts
Previously, an interaction could begin while target values
(center/resolution) were out of the allowed range, causing a
glitch where the view zoom/position would jump suddenly.
2019-04-05 11:55:35 +02:00
Andreas Hocevar
dfa8506549 Merge pull request #9390 from jahow/add-webgl-filtering
Add a new WebGL example for filtering features
2019-04-04 12:34:20 +02:00
Olivier Guyot
8fb6ed5c6f Add a new webgl example with real time feature filtering 2019-04-02 23:46:13 +02:00
Olivier Guyot
c6a859d1ed Webgl / clarify premultiplied alpha handling
By default, alpha premultiplying should be done by the initial rendering
(eg quads) and not the final post processing pass.

The default post processing pass expects premultiplied color values and
will not do this operation itself.
2019-04-02 22:12:47 +02:00
Olivier Guyot
b955579a9c Webgl / clarified the buffer binding/flushing logic
The Webgl points layer renderer has also been optimized accordingly,
giving out much better performance.
2019-04-02 21:05:31 +02:00
Marc Jansen
7c1df60d06 Merge pull request #9387 from openlayers/greenkeeper/puppeteer-1.14.0
Update puppeteer to the latest version 🚀
2019-03-30 10:59:37 +01:00
greenkeeper[bot]
0583bc0cc8 chore(package): update puppeteer to version 1.14.0 2019-03-30 00:13:09 +00:00
Andreas Hocevar
c9de49e56e Merge pull request #9385 from Kai-W/master
PointsLayer added clear of the render Buffers on Source Change
2019-03-29 12:50:16 +01:00
Kai-W
275a22b685 Added clear of the render Buffers on Source Change 2019-03-28 17:21:43 +01:00
Andreas Hocevar
7091ed3de6 Merge pull request #9379 from openlayers/vectortile-typo
Fix typo in vector tile source docs
2019-03-27 12:50:35 +01:00
Andreas Hocevar
7ebae2ba80 Fix typo in vector tile source docs 2019-03-26 14:54:44 +01:00
Andreas Hocevar
9eb9fffc94 Merge pull request #9368 from ahocevar/multiworld
Show only one world
2019-03-26 14:17:21 +01:00
Marc Jansen
061965ecb7 Merge pull request #9362 from KaiVolland/text-rendering
Use local font "Ubuntu Regular" for rendering tests
2019-03-25 22:08:05 +01:00
Andreas Hocevar
3a7f9d93f4 Merge pull request #9357 from ahocevar/vectortile-view-resolution-2
Render vector tiles at the view resolution
2019-03-25 17:44:31 +01:00
ahocevar
3940b5ec88 Show only one world 2019-03-25 14:49:13 +01:00
Andreas Hocevar
a95481a8fe Merge pull request #9374 from jahow/fix-initialzoom
Fix view initialization with min/max resolution constraint
2019-03-25 14:33:25 +01:00
Olivier Guyot
77a1628610 Tests / remove view extent constraint on zoomify tests 2019-03-25 14:03:40 +01:00
Olivier Guyot
c08da3c694 Map / resolve view constraints when resized/view changed
This makes the `resolveConstraints` view method public but not part of the
api.
2019-03-25 13:38:51 +01:00
Olivier Guyot
98994cad61 View / tests now pass without smoothResolutionConstraint: false 2019-03-25 13:21:10 +01:00
Olivier Guyot
91dda5e5ca View / refactor initialization with resolution constraint
This also makes it possible to call `solveConstraints_` with a duration of 0,
which means the target values are modified straight away without triggering
an animation or leaving the current flow.
2019-03-25 13:21:10 +01:00
Olivier Guyot
b63c4188e4 View / add tests for parameter initialization with constraints 2019-03-25 13:18:49 +01:00
Olivier Guyot
10423ddbe4 Fix View method name in upgrade notes
See #9349
2019-03-25 13:18:49 +01:00
Andreas Hocevar
f32e097051 Merge pull request #9364 from KaiVolland/clip-rendering
Replace clip.test.js with new tests
2019-03-25 12:18:37 +01:00
Andreas Hocevar
1be6050da8 Merge pull request #9360 from KaiVolland/9281-rastersouce-attributions
Enables attributions for the RasterSource
2019-03-25 12:10:57 +01:00
Kai Volland
62ebe29ead Enables attributions for the RasterSource
Attributions included in the passed sources are concatenated.
2019-03-25 11:47:45 +01:00
Kai Volland
ef061dd4c3 Updates font settings for rendering tests
This updates font name and size for renderinge tests that
include TextStyles.
2019-03-25 11:39:10 +01:00
Kai Volland
bff3e88343 Replaces clip.test.js with new tests
Transforms the old rendering test for
layer clipping to the new rendering test approach.
2019-03-25 11:13:04 +01:00
ahocevar
3d2711d35e Add missing arg type 2019-03-24 21:24:30 +01:00
Andreas Hocevar
927a98ac5b Merge pull request #9365 from jahow/patch-1
Fix View method name in upgrade notes
2019-03-22 15:30:56 +01:00
Olivier Guyot
8983ebdc69 Fix View method name in upgrade notes
See #9349
2019-03-22 13:30:58 +01:00
Kai Volland
681a8f1d9c Replaces remaining vectorimage.tests.js
Transforms the old rendering tests for the VectorImageLayer
decluttering to the new rendering test approach.
2019-03-22 10:14:41 +01:00
Andreas Hocevar
447117be4f Merge pull request #9361 from lutzhelm/9343-zdirection
Add a zDirection option for Zoomify - implements #9343
2019-03-21 19:12:41 +01:00
ahocevar
681c3169c1 Add zDirection memeber to the baes class, for type checking 2019-03-21 18:50:03 +01:00
Kai Volland
5665da6518 Use local font "Ubuntu Regular" for rendering tests
Set local font for all rendering tests including
TextStyles to enhance comparability on different
systems.
2019-03-21 15:06:07 +01:00
Lutz Helm
085c60af49 Remove tile source zDirection getter
The renderer now accesses the zDirection member directly if it exists.
This also has the advantage of not advertising any object methods that
hav no use for most tile sources.
2019-03-21 14:47:09 +01:00
Lutz Helm
2bf217207e Test renderer behavior for Zoomify zDirection
The zDirection addition to the Zoomify tile source only takes effect through
the renderer, so these two renderer cases are added to test the behavior.

zoomify-no-zdirection expects the default behavior.
zoomify-zdirection expects the tiles for the next better resolution.
2019-03-21 11:51:42 +01:00
Lutz Helm
f5abb45de0 Add a zDirection option for Zoomify
Via zDirection, the renderer's selection of a tile source's resolution can be
controlled if the view's resolution does not match any tile source resolution.

Currently the zDirection option is only available for Zoomify. The comment
https://github.com/openlayers/openlayers/issues/9343#issuecomment-474341033
describes why caution is advised when using zDirection for other sources.

ol/source/Tile~TileSource#getZDirection has been added to avoid having the
getZDirection method solely in the Zoomify source - just to document the
possibility.
2019-03-21 10:06:22 +01:00
ahocevar
fefcc9f0ca Return directly when all we do is render queued images 2019-03-20 23:04:48 +01:00
ahocevar
d2f60a70d1 Recreate instructions for the view resolution 2019-03-20 22:45:17 +01:00
ahocevar
a25ca03040 Do not use tile.load() for getting source tiles 2019-03-20 22:45:17 +01:00
ahocevar
461256767e Make pattern fills work on a scaled canvas 2019-03-20 22:25:25 +01:00
Tim Schaub
c4279ff665 Merge pull request #9333 from KaiVolland/unify-rendering-tests
Unify rendering tests
2019-03-20 08:34:54 -07:00
Frédéric Junod
ad5c9ac589 Merge pull request #9350 from fredj/cleanup_examples
Remove unnecessary css in examples
2019-03-19 16:21:51 +01:00
Andreas Hocevar
458f1d0f64 Merge pull request #9351 from ahocevar/default-styles
More efficient default styles
2019-03-19 15:56:49 +01:00
ahocevar
b06c84cef9 More efficient default stroke style 2019-03-19 13:58:20 +01:00
ahocevar
b33ceaa400 More efficient default fill color 2019-03-19 13:57:10 +01:00
Kai Volland
7510a19c73 Replaces vectorimage.tests.js (partially)
Transforms the old rendering tests for the VectorImageLayer
to the new rendering test approach.
The declutter tests are kept in the old format for know.
2019-03-19 11:30:45 +01:00
Kai Volland
ac3a2d960a Replaces tile.tests.js (partially) with new tests
Transforms the old rendering tests for the TileLayer
to the new rendering test approach.
The render-listener test is kept in the old format for know.
2019-03-18 16:39:37 +01:00
Frederic Junod
d5f92843a9 Remove unnecessary css in examples 2019-03-18 16:19:01 +01:00
Kai Volland
fc878fd539 Replaces vectortile.tests.js with new tests
Transforms the old rendering tests for the VectorTileLayer
to the new rendering test approach.
2019-03-18 16:15:58 +01:00
Frédéric Junod
84bf801b52 Merge pull request #9346 from fredj/cleanup
Remove tilePixelRatio options from ol.source.VectorTile
2019-03-18 16:12:28 +01:00
Kai Volland
f555048319 Replaces vector.tests.js with new tests
Transforms the old rendering tests for the LayerVector
to the new rendering test approach.
2019-03-18 15:39:48 +01:00
Frederic Junod
72788187c8 Remove tilePixelRatio options from ol.source.VectorTile
Was removed in #7070
2019-03-18 14:35:58 +01:00
Kai Volland
6759641715 Replaces image.tests.js with new tests
Transforms the old rendering tests for the ImageLayer
to the new rendering test approach.
2019-03-18 13:56:45 +01:00
Frédéric Junod
e12a0ea0ff Merge pull request #9345 from fredj/devDependencies
Update all dev dependencies
2019-03-18 11:53:01 +01:00
greenkeeper[bot]
508d980514 chore(package): update webpack-cli to version 3.3.0 2019-03-18 11:13:50 +01:00
greenkeeper[bot]
c52566a244 chore(package): update eslint to version 5.15.2 2019-03-18 11:13:02 +01:00
greenkeeper[bot]
5803727409 chore(package): update ol-mapbox-style to version 4.2.1 2019-03-18 11:12:50 +01:00
greenkeeper[bot]
1d88528686 chore(package): update buble to version 0.19.7 2019-03-18 11:12:39 +01:00
greenkeeper[bot]
3a4be21a25 chore(package): update copy-webpack-plugin to version 5.0.1 2019-03-18 11:12:11 +01:00
greenkeeper[bot]
16419b3281 chore(package): update pngjs to version 3.4.0 2019-03-18 11:11:58 +01:00
greenkeeper[bot]
6d50f43448 chore(package): update webpack-dev-middleware to version 3.6.1 2019-03-18 11:11:40 +01:00
greenkeeper[bot]
f1bfccbfe6 chore(package): update yargs to version 13.2.2 2019-03-18 11:10:50 +01:00
greenkeeper[bot]
a56e8719d3 chore(package): update url-polyfill to version 1.1.5 2019-03-18 11:10:15 +01:00
greenkeeper[bot]
85e2ffa63f chore(package): update sinon to version 7.2.7 2019-03-18 11:09:57 +01:00
greenkeeper[bot]
1b91400ebc chore(package): update karma to version 4.0.1 2019-03-18 11:08:53 +01:00
greenkeeper[bot]
48156af617 chore(package): update terser-webpack-plugin to version 1.2.3 2019-03-18 11:08:34 +01:00
greenkeeper[bot]
c510fe268b chore(package): update webpack-dev-server to version 3.2.1 2019-03-18 11:08:19 +01:00
Kai Volland
912fb03564 Fixes RasterSource tests
Puppeteer/TestSuite seems to have
problems with webworker so threads is set
to 0
2019-03-18 10:33:05 +01:00
Andreas Hocevar
3f7c52c29f Merge pull request #9342 from openlayers/greenkeeper/handlebars-4.1.1
Update handlebars to the latest version 🚀
2019-03-17 11:53:10 +01:00
Andreas Hocevar
9284ba47a4 Merge pull request #9341 from ahocevar/remove-unused
Remove unused ExecutorGroup methods
2019-03-17 11:46:08 +01:00
greenkeeper[bot]
4a405cc975 chore(package): update handlebars to version 4.1.1 2019-03-16 21:30:46 +00:00
ahocevar
5857117625 Remove unused ExecutorGroup methods 2019-03-16 21:29:49 +01:00
Frédéric Junod
75d9ade613 Merge pull request #9337 from fredj/codesandbox_div_size
Set map div size in example send to codesandbox
2019-03-15 15:15:59 +01:00
Kai Volland
58cebcc97f Replaces tilewms.tests.js with new tests
Transforms the old rendering tests for the TileWMSSource
to the new rendering test approach.
2019-03-15 14:30:23 +01:00
Kai Volland
3f8da79893 Replaces raster.tests.js with new tests
Transforms the old rendering tests for the RasterSource
to the new rendering test approach.
2019-03-15 14:04:23 +01:00
Frederic Junod
5f8450d67d Set map div size in example send to codesandbox 2019-03-15 13:53:58 +01:00
Kai Volland
d89b909187 Replaces text.tests.js with new tests
Transforms the old rendering tests for the TextStyle
to the new rendering test approach.
2019-03-15 12:11:13 +01:00
Kai Volland
f79b358c92 Replaces regularshape.tests.js with new tests
Transforms the old rendering tests for the regularshape
to the new rendering test approach.
2019-03-15 10:42:47 +01:00
Kai Volland
e4ef5c789c Removes map.tests.js renders 2019-03-15 10:42:47 +01:00
Kai Volland
d871196e16 Removes linestring.test.js
Removes linestring.test.js and related pngs as linestring
style is already tested with the new approach.
2019-03-15 10:42:47 +01:00
Kai Volland
595b74d04e Replaces map.tests.js with new tests
Transforms the old rendering test for the Map
to the new rendering test approach.
2019-03-15 10:42:47 +01:00
Kai Volland
de0f5d44a3 Replaces circle.tests.js with new tests
Transforms the old rendering test for the CircleStyle
to the new rendering test approach.
2019-03-15 10:42:47 +01:00
Frédéric Junod
1637cffbe9 Merge pull request #9335 from openlayers/codesandbox_template
Create codesandbox using the 'parcel' template
2019-03-14 16:24:24 +01:00
Frederic Junod
2f28f89c59 Create codesandbox using the 'parcel' template
The default template is `create-react-app` and this one ignores the `head` tag defined in out `index.html`
2019-03-14 15:08:01 +01:00
Frédéric Junod
de7afee96d Merge pull request #9329 from fredj/cluster_refresh
Don't refresh the layer after addFeatures call
2019-03-14 11:04:28 +01:00
Frederic Junod
92cb9f1c51 Don't refresh the layer after addFeatures call 2019-03-14 10:25:19 +01:00
Frédéric Junod
7896fa894d Merge pull request #9328 from fredj/cleanup
Mark layerFilter in AtPixelOptions as optional
2019-03-14 09:17:28 +01:00
Andreas Hocevar
d6f7533c76 Merge pull request #9325 from ahocevar/no-round
Create a more accurate origin for tile positioning
2019-03-14 09:12:19 +01:00
ahocevar
4a9d2e689e Create a more accurate origin for tile positioning 2019-03-13 18:34:23 +01:00
Andreas Hocevar
df3d771c53 Merge pull request #9320 from RobertOrthofer/master
enhance tile-debug readability
2019-03-13 12:16:23 +01:00
Robert Orthofer
0aa14db88b move stroke behind text to achieve halo 2019-03-13 09:31:01 +01:00
Andreas Hocevar
d75caaa3df Merge pull request #9318 from ahocevar/smart-cache-size
Smart cache size
2019-03-13 08:17:24 +01:00
Andreas Hocevar
cfc79254d0 Merge pull request #9322 from ahocevar/render-to-source-resolution
Use closest lower source resolution for render tiles
2019-03-13 08:15:25 +01:00
ahocevar
ac0d67b273 Use closest lower source resolution for render tiles 2019-03-12 16:51:20 +01:00
Andreas Hocevar
17b37a90da Merge pull request #9321 from KaiVolland/inheritdoc
Fixes #9294 (missing documention for methods with `@inheritDoc`)
2019-03-12 15:26:26 +01:00
Kai Volland
72d38fa929 Fixes missing methods with @inheritdoc
- This sets ignore to false if a method tagged with
inheritdoc has a matching ancestor. It also stops iterating
when a match is found.
- Outdated TODO is removed, too.
2019-03-12 15:07:03 +01:00
Robert Orthofer
a051892b92 enhance tile-debug readability
this commit enhances the readability of
tile debug coordinates by adding a stroke
for better readability on aerial imagery
and a maxWidth for high zoom levels
2019-03-12 12:48:26 +01:00
Tim Schaub
c573d53297 Merge pull request #9319 from tschaub/licensed
Add title to license to clarify that it is BSD 2-Clause
2019-03-12 04:21:54 -06:00
ahocevar
b4fc249991 Faster calculation of target size
Since usedTiles and wantedTiles will never have an overlap, we can use their
key count directly.
2019-03-12 08:53:52 +01:00
Frédéric Junod
c321c90497 Merge pull request #9300 from fredj/f9299
Fix documentation about zoomDelta for ol.interaction.default function
2019-03-12 08:31:30 +01:00
ahocevar
cb2b57232c Add tests 2019-03-12 08:11:17 +01:00
Tim Schaub
90c3c1db81 Add title to license to clarify that it is BSD 2-Clause
The BSD 2-Clause License is a simplified version of the BSD 3-Clause License.  This license was popularized by the FreeBSD project and is sometimes referred to as the "FreeBSD License" (see https://opensource.org/licenses/BSD-2-Clause and https://en.wikipedia.org/wiki/BSD_licenses#2-clause).  To clarify that the OpenLayers License uses the BSD 2-Clause License template, this change adds "The 2-Clause BSD License" to the top of our license file.  In addition, this change makes our license a verbatim copy of the template at https://opensource.org/licenses/BSD-2-Clause with only the copyright holders added.  This change is not intended to change the project's license, only to clarify the template used for that license.  See https://lists.osgeo.org/pipermail/openlayers-dev/2011-May/007555.html for the original motion to switch to the BSD 2-Clause License (also known as the FreeBSD License).
2019-03-11 22:27:35 -06:00
ahocevar
11f5a4c5b8 Move tile specific methods to the tile layer renderer 2019-03-12 00:19:51 +01:00
ahocevar
0f217392d7 Adjust tile cache size when too small 2019-03-12 00:19:13 +01:00
Andreas Hocevar
b54b7c5989 Merge pull request #9305 from KaiVolland/fix-scaleline-test
Fixes failing tests for Chrome v74
2019-03-11 15:30:01 +01:00
Kai Volland
1348d76a33 Updates test renders
Rendering has changed due to change of browser test version.
2019-03-11 15:13:13 +01:00
Frederic Junod
4a13bf2fa9 Mark layerFilter in AtPixelOptions as optional 2019-03-11 15:11:16 +01:00
Frederic Junod
d71fa78ee2 Remove unused template tag 2019-03-11 15:10:32 +01:00
Frédéric Junod
c0d4cdbabf Merge pull request #9315 from fredj/f9290
Change CSS class for tooltips in measure example
2019-03-11 14:37:43 +01:00
Frederic Junod
76aa26e3e9 Change CSS class for tooltips in measure example 2019-03-11 14:24:57 +01:00
Kai Volland
fcf6e81430 Fixes issue with ScaleLine
Math.pow with negative exponents is inaccurate in chrome v74. `toFixed`
is called on the result to fix this.
2019-03-11 13:31:49 +01:00
Andreas Hocevar
dfabcc0c66 Merge pull request #9137 from jahow/add-view-constrain-extent-2
Refactor the way view constraints are handled & add a view extent constraint
2019-03-11 10:38:31 +01:00
Andreas Hocevar
3282c74de6 Merge pull request #9311 from openlayers/greenkeeper/pbf-3.2.0
Update pbf to the latest version 🚀
2019-03-11 10:29:17 +01:00
Andreas Hocevar
dee36639bd Merge pull request #9313 from ahocevar/interpolate-tests
Re-enable and fix disabled tests
2019-03-11 10:18:00 +01:00
Andreas Hocevar
5a578c00a7 Merge pull request #9314 from ahocevar/fix-transpile
Fix transpilation
2019-03-11 10:17:32 +01:00
ahocevar
e8243b73b5 Fix transpilation 2019-03-11 10:11:05 +01:00
ahocevar
404b04ae59 Re-enable and fix disabled tests 2019-03-11 09:30:04 +01:00
Andreas Hocevar
8a02a6f9f1 Merge pull request #9308 from ahocevar/vectortile-loader-projection
Simplify vector tile projection handling
2019-03-11 09:28:48 +01:00
Bart van den Eijnden
4a67bd86a8 Merge pull request #9312 from bartvde/stamen-minzoom
Update zoom levels for Stamen source
2019-03-11 09:17:50 +01:00
Frédéric Junod
feb1a9f31b Merge pull request #9310 from fredj/stamen_transition
Add transition options to Stamen source
2019-03-11 09:11:38 +01:00
greenkeeper[bot]
8a5720e8cb fix(package): update pbf to version 3.2.0 2019-03-11 07:51:32 +00:00
bartvde
9ad2924f00 Update zoom levels for Stamen source 2019-03-11 08:50:28 +01:00
Frederic Junod
0401aed6e3 Add transition options to Stamen source 2019-03-11 08:34:42 +01:00
ahocevar
b2722542fe Simplify vector tile projection handling 2019-03-10 09:37:58 +01:00
Andreas Hocevar
7002053678 Merge pull request #9307 from ahocevar/line-height
Take line-height into account when measuring text height
2019-03-09 10:07:16 +01:00
Frederic Junod
425cd19922 Add a new font line height option in vector-label example 2019-03-09 09:59:57 +01:00
ahocevar
4a7b3cde56 Take line-height into account when measuring text height 2019-03-09 08:25:09 +01:00
Frédéric Junod
9c1c71b8e5 Merge pull request #9306 from fredj/dispose_layer_renderer
Set the canvas size to 0 on dispose
2019-03-09 08:00:35 +01:00
Frederic Junod
6de566d95b Set the canvas size to 0 on dispose 2019-03-08 13:25:49 +01:00
Kai Volland
b31715e86e Updates puppeteer to 1.13.0
Will use Chromium 74.0.3723.0 (r637110) to run the tests
2019-03-08 11:23:41 +01:00
Frederic Junod
9e89047e6a Fix documentation about zoomDelta for ol.interaction.default function 2019-03-07 14:22:33 +01:00
Andreas Hocevar
a372ca0569 Merge pull request #9295 from ahocevar/update-ol-mapbox-style
Update ol-mapbox-style to fix broken mapbox-style example
2019-03-07 10:10:08 +01:00
Marc Jansen
1e06dd979e Merge pull request #9292 from KaiVolland/downgrade-puppeteer
Downgrades puppeteer to `~1.11.0`
2019-03-06 19:15:35 +01:00
ahocevar
c44e6ebe1d Update ol-mapbox-style to fix broken mapbox-style example 2019-03-06 19:13:33 +01:00
Kai Volland
c8fab42d75 Downgrades puppeteer to ~1.11.0
This downgrades puppeteer to version `~1.11.0`.
This will download the stable version of chromium
(72.0.3582.0). The current puppeteer version
(`^1.12.2`) downloads the beta version of
chromium (73.0.3679.0).
2019-03-06 16:53:45 +01:00
Andreas Hocevar
0995f95ef1 Fix typo in extent-constrained example
Co-Authored-By: jahow <olivier.guyot@camptocamp.com>
2019-03-04 18:11:15 +01:00
Olivier Guyot
447266cbe8 Better smoothing of resolution and center constraints
Previously the formula for the resolution constraint allowed going way past
the minimum zoom.
Also adjusted the center constraint to avoid a zigzag effect when going out
of resolution bounds.
2019-03-04 10:14:06 +01:00
Andreas Hocevar
d25a534dea Merge pull request #9285 from openlayers/greenkeeper/globby-9.1.0
Update globby to the latest version 🚀
2019-03-04 09:53:25 +01:00
ahocevar
56f37ab347 Disable transition when an interim tile is available 2019-03-03 23:07:46 +01:00
greenkeeper[bot]
90749cd80f chore(package): update globby to version 9.1.0 2019-03-03 13:21:03 +00:00
Olivier Guyot
f67baa0dc0 Interactions / fix zoom level when a zoom interaction ends 2019-02-22 15:04:54 +01:00
Olivier Guyot
75c379beeb View / allow specifying an anchor on interaction end
This also fixes a bug where the animation anchor would be lost when outside
the allowed resolution.
2019-02-22 15:04:54 +01:00
Olivier Guyot
405e206717 View / better names for getValid* and applyParameters_ methods 2019-02-22 15:04:54 +01:00
Olivier Guyot
c2af03f152 Update the View documentation & document breaking changes 2019-02-22 15:04:54 +01:00
Olivier Guyot
7835869582 Add an extent restriction on the mapbox layer example
This fixes a bug where the OL map would allow much larger resolution than
mapbox.
2019-02-22 15:01:30 +01:00
Olivier Guyot
78e8f23df5 View / add getValidCenter method to improve interactions
The DragPan, KeyboardPan and DragZoom interactions now make sure to
animate to a valid center/resolution target to avoid
a chained "resolve" animation which looks weird.

The `View.fit` method was also fixed to use this.
2019-02-22 15:01:30 +01:00
Olivier Guyot
433bccd207 Linting and fixes for unit tests 2019-02-22 15:01:30 +01:00
Olivier Guyot
ef6d17d817 View / add a 'smoothResolutionConstraint' options
When enabled (true by default), the resolution min/max values will be applied with
a smoothing effect for a better user experience.
2019-02-22 15:01:30 +01:00
Olivier Guyot
e023c144bb View / add adjust* methods to manipulate the view more easily
API changes:
* (breaking) the `rotate` method is gone
* the `adjustRotation`, `adjustResolution` and `adjustZoom` methods are now
  available and allow using an anchor.

This means interactions do not have to do the anchor computation themselves
and this also fix anchor computation when constraints must be applied.
2019-02-22 15:01:30 +01:00
Olivier Guyot
b5273babb5 View / handle resolutions array with length=1 2019-02-22 15:01:30 +01:00
Olivier Guyot
49662b019c View / add a constrainResolution option
This introduces a breaking change.

This options replaces the various `constrainResolution` options on interactions
and the `fit` method.

Since constraints are now the responsibility of the View, the fact that intermediary
zoom levels are allowed or not is now set in the view options.

By default, the view resolution is unconstrained.
2019-02-22 15:01:30 +01:00
jahow
48ad1ffcbf View / implement a smooth rebound effect when a max extent is given
This is done by applying the center constraint differently when we're in the
middle of an interaction/animation or not.

When the view is moving, the center constraint will restrain the given value
in an "elastic" way, using a logarithmic function.

This can be disabled using the `smoothCenterConstrain` view parameter.
2019-02-22 15:01:30 +01:00
jahow
cd186ada7f Add new tests for View & Interaction w/ fixes 2019-02-22 15:01:30 +01:00
Olivier Guyot
a6f65df8c4 View / add a resolveConstraints method to end interactions
This will help making sure that the view will come back to a "rested" state
once the interactions are over.

Interactions no longer need to handle the animation back to a rested state,
they simply call `endInteraction` with the desired duration and direction.
2019-02-22 15:01:30 +01:00
Olivier Guyot
1c5fd62e43 View / refactor how zoom and resolution are computed
This commit aims to simplify the computation of zoom and resolution in the
View class.

Previously zoom levels and resolution computations were mixed in different places,
ie resolution constraints, initial values, etc.

Now the View class only has the `getZoomForResolution` and `getResolutionForZoom`
methods to convert from one system to another.

Other than that, most computations use the resolution system internally.

The `constrainResolution` method also does not exist anymore, and is replaced
by `getValidResolution` and `getValidZoomLevel` public methods.
2019-02-22 15:01:30 +01:00
Olivier Guyot
1f379a06a4 View / add support for viewport extent constraint
This introduces a breaking change:

The `extent` view option now constrains the whole viewport and not just the
view center.
The option `constrainOnlyCenter` was added to keep the previous behaviour.

Constraining the whole viewport and not only the view center means
that the center and resolution constraints must be applied with a knowledge of
the viewport size.
2019-02-22 15:01:30 +01:00
jahow
e52fab636c View / apply constraints automatically based on hints
All constraints can now function differently if they are applied during
interaction or animation.
2019-02-22 15:01:30 +01:00
jahow
d991dfa54a View / remove constrainCenter method 2019-02-22 15:01:30 +01:00
jahow
c2c1aa01d3 View / removed the constrainRotation method 2019-02-22 15:01:30 +01:00
Olivier Guyot
e6c4b2ffd1 View / make the constrainResolution function private
Other classes should not need to worry about constraining the resolution
or not, as the View will eventually do this on its own.
2019-02-22 15:01:30 +01:00
Olivier Guyot
3c1e3779e2 View / add a method to compute a valid zoom level
The `getValidZoomLevel` apply the current resolution constraint to return
a value that is guaranteed valid.

This is used for interactions & controls which need a target value to work:
the +/- buttons, the zoom clider, the dragbox zoom and the mouse wheel zoom.
2019-02-22 15:01:30 +01:00
Olivier Guyot
4e1ece16ed View / implemented begin- and endInteraction methods 2019-02-22 15:01:30 +01:00
Olivier Guyot
1cb934dbe3 View / implement intermediate values for center/rot/res
The view now has targetCenter, targetRotation and targetResolution members.

These hold the new values given by set* methods. The actual view parameters are then changed by
calling `applyParameters_`.
2019-02-22 15:01:30 +01:00
327 changed files with 57187 additions and 4843 deletions

View File

@@ -27,6 +27,10 @@ jobs:
name: Run Tests
command: npm test
- store_artifacts:
path: coverage/
destination: coverage
- store_artifacts:
path: rendering/cases/
destination: rendering
@@ -38,3 +42,11 @@ jobs:
- store_artifacts:
path: build/examples
destination: examples
- run:
name: Build API Docs
command: npm run apidoc
- store_artifacts:
path: build/apidoc
destination: apidoc

View File

@@ -1,26 +1,25 @@
Copyright 2005-present OpenLayers Contributors. All rights reserved.
BSD 2-Clause License
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Copyright 2005-present, OpenLayers Contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY OPENLAYERS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of OpenLayers Contributors.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,6 +1,6 @@
# OpenLayers
[OpenLayers](https://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web. It can display map tiles, vector data and markers loaded from any source on any web page. OpenLayers has been developed to further the use of geographic information of all kinds. It is completely free, Open Source JavaScript, released under the 2-clause BSD License (also known as the FreeBSD).
[OpenLayers](https://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web. It can display map tiles, vector data and markers loaded from any source on any web page. OpenLayers has been developed to further the use of geographic information of all kinds. It is completely free, Open Source JavaScript, released under the [BSD 2-Clause License](https://opensource.org/licenses/BSD-2-Clause).
## Getting Started

View File

@@ -4,6 +4,38 @@
#### Backwards incompatible changes
#### Removal of optional this arguments
The optional this (i.e. opt_this) arguments were removed from the following methods.
Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
* `forEachCorner` in `ol/extent`
* `LRUCache#forEach`
* `RBush#forEach` and `RBush#forEachInExtent`
##### The `setCenter`, `setZoom`, `setResolution` and `setRotation` methods on `ol/View` do not bypass constraints anymore
Previously, these methods allowed setting values that were inconsistent with the given view constraints.
This is no longer the case and all changes to the view state now follow the same logic:
target values are provided and constraints are applied on these to determine the actual values to be used.
##### Removal of the `constrainResolution` option on `View.fit`, `PinchZoom`, `MouseWheelZoom` and `ol/interaction.js`
The `constrainResolution` option is now only supported by the `View` class. A `View.setConstrainResolution` method was added as well.
Generally, the responsibility of applying center/rotation/resolutions constraints was moved from interactions and controls to the `View` class.
##### The view `extent` option now applies to the whole viewport
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainCenterOnly` in the view options.
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
##### Zoom is constrained so only one world is visible
Previously, maps showed multiple worlds at low zoom levels. Now, the view is restricted to show only one world. To get the previous behavior, configure the `ol/View` with `multiWorld: true`.
##### Removal of deprecated methods
The `inherits` function that was used to inherit the prototype methods from one constructor into another has been removed.
@@ -66,6 +98,14 @@ If you were previously using `VectorTile` layers with `renderMode: 'vector'`, yo
If you were previously using `Vector` layers with `renderMode: 'image'`, you have to remove this configuration option. Instead, use the new `ol/layer/VectorImage` layer with your `ol/source/Vector`.
##### New declutter behavior
If a map has more than one layer with `declutter` set to true, decluttering now considers all `Vector` and `VectorTile` layers, instead of decluttering each layer separately. Only `VectorImage` layers continue to be decluttered separately. The higher the z-index of a layer, the higher the priority of its decluttered items.
Within a layer, the declutter order has changed. Previously, styles with a lower `zIndex` were prioritized over those with a higher `zIndex`. Now the opposite order is used.
On vector layers, even if decluttered images or texts have a lower z-Index than polygons or lines, they will now be rendered on top of the polygons or lines. For vector tile layers, this was the case already in previous releases.
##### New `prerender` and `postrender` layer events replace old `precompose`, `render` and `postcompose` events
If you were previously registering for `precompose` and `postcompose` events, you should now register for `prerender` and `postrender` events on layers. Instead of the previous `render` event, you should now listen for `postrender`. Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.
@@ -99,6 +139,58 @@ Due to the constraint above (layers can only be added to a single map), the over
Previously, a graticule was not a layer. Now it is. See the graticule example for details on how to add a graticule layer to your map.
##### `ol/format/Feature` API change
The `getLastExtent()` method, which was required for custom `tileLoadFunction`s in `ol/source/Vector`, has been removed because it is no longer needed (see below).
##### `ol/VectorTile` API changes
* Removal of the `getProjection()` and `setProjection()` methods. These were used in custom `tileLoadFunction`s on `ol/source/VectorTile`, which work differently now (see below).
* Removal of the `getExtent()` and `setExtent()` methods. These were used in custom `tileLoadFunction`s on `ol/source/VectorTile`, which work differently now (see below).
##### Custom tileLoadFunction on a VectorTile source needs changes
Previously, applications needed to call `setProjection()` and `setExtent()` on the tile in a custom `tileLoadFunction` on `ol/source/VectorTile`. The format's `getLastExtent()` method was used to get the extent. All this is no longer needed. Instead, the `extent` (first argument to the loader function) and `projection` (third argument to the loader function) are simply passed as `extent` and `featureProjection` options to the format's `readFeatures()` method.
Example for an old `tileLoadFunction`:
```js
function(tile, url) {
tile.setLoader(function() {
fetch(url).then(function(response) {
response.arrayBuffer().then(function(data) {
var format = tile.getFormat();
tile.setProjection(format.readProjection(data));
tile.setFeatures(format.readFeatures(data, {
// featureProjection is not required for ol/format/MVT
featureProjection: map.getView().getProjection()
}));
tile.setExtent(format.getLastExtent());
})
})
}
});
```
This function needs to be changed to:
```js
function(tile, url) {
tile.setLoader(function(extent, resolution, projection) {
fetch(url).then(function(response) {
response.arrayBuffer().then(function(data) {
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data, {
// extent is only required for ol/format/MVT
extent: extent,
featureProjection: projection
}));
})
})
}
});
```
##### Drop of support for the experimental WebGL renderer
The WebGL map and layers renderers are gone, replaced by a `WebGLHelper` function that provides a lightweight,

View File

@@ -1,43 +1,43 @@
<table><tr>
<th width="33.3%">Map</th><th width="33.3%">View</th><th width="33.3%">Layers</th>
</tr><tr>
<td><p>A [map](module-ol_Map-Map.html) is made of [layers](module-ol_layer_Base-BaseLayer.html), a [view](module-ol_View-View.html) to visualize them, [interactions](module-ol_interaction_Interaction-Interaction.html) to modify map content and [controls](module-ol_control_Control-Control.html) with UI components.</p>
[Overview](module-ol_Map-Map.html)<br>
[Creation](module-ol_Map-Map.html#Map)<br>
[Events](module-ol_MapBrowserEvent-MapBrowserEvent.html)</td>
<td><p>A <a href="module-ol_Map-Map.html">map</a> is made of <a href="module-ol_layer_Base-BaseLayer.html">layers</a>, a <a href="module-ol_View-View.html">view</a> to visualize them, <a href="module-ol_interaction_Interaction-Interaction.html">interactions</a> to modify map content and <a href="module-ol_control_Control-Control.html">controls</a> with UI components.</p>
<a href="module-ol_Map-Map.html">Overview</a><br>
<a href="module-ol_Map-Map.html#Map">Creation</a><br>
<a href="module-ol_MapBrowserEvent-MapBrowserEvent.html">Events</a></td>
<td><p>The view manages the visual parameters of the map view, like resolution or rotation.</p>
[View](module-ol_View-View.html) with center, projection, resolution and rotation</td>
<td><p>Layers are lightweight containers that get their data from [sources](module-ol_source_Source-Source.html).</p>
[ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)<br>
[ol/layer/Image](module-ol_layer_Image-ImageLayer.html)<br>
[ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)<br>
[ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)</td>
<a href="module-ol_View-View.html">View</a> with center, projection, resolution and rotation</td>
<td><p>Layers are lightweight containers that get their data from <a href="module-ol_source_Source-Source.html">sources</a>.</p>
<a href="module-ol_layer_Tile-TileLayer.html">ol/layer/Tile</a><br>
<a href="module-ol_layer_Image-ImageLayer.html">ol/layer/Image</a><br>
<a href="module-ol_layer_Vector-VectorLayer.html">ol/layer/Vector</a><br>
<a href="module-ol_layer_VectorTile-VectorTileLayer.html">ol/layer/VectorTile</a></td>
</tr><tr>
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
</tr><tr>
<td>[Map default controls](module-ol_control_util.html#.defaults)<br>
[All controls](module-ol_control_Control-Control.html)
<td><a href="module-ol_control_util.html#.defaults">Map default controls</a><br>
<a href="module-ol_control_Control-Control.html">All controls</a>
</td>
<td>
[Map default interactions](module-ol_interaction.html#~defaults)<br>
Interactions for [vector features](module-ol_Feature-Feature.html)
<ul><li>[ol/interaction/Select](module-ol_interaction_Select-Select.html)</li>
<li>[ol/interaction/Draw](module-ol_interaction_Draw-Draw.html)</li>
<li>[ol/interaction/Modify](module-ol_interaction_Modify-Modify.html)</li></ul>
[All interactions](module-ol_interaction_Interaction-Interaction.html)</td>
<td>[Tile sources](module-ol_source_Tile-TileSource.html) for [ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)
<br>[Image sources](module-ol_source_Image-ImageSource.html) for [ol/layer/Image](module-ol_layer_Image-ImageLayer.html)
<br>[Vector sources](module-ol_source_Vector-VectorSource.html) for [ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)
<br>[Vector tile sources](module-ol_source_VectorTile-VectorTile.html) for [ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)
<br>[Formats](module-ol_format_Feature-FeatureFormat.html) for reading/writing vector data
<br>[ol/format/WMSCapabilities](module-ol_format_WMSCapabilities-WMSCapabilities.html)</td></tr>
<a href="module-ol_interaction.html#~defaults">Map default interactions</a><br>
Interactions for <a href="module-ol_Feature-Feature.html">vector features</a>
<ul><li><a href="module-ol_interaction_Select-Select.html">ol/interaction/Select</a></li>
<li><a href="module-ol_interaction_Draw-Draw.html">ol/interaction/Draw</a></li>
<li><a href="module-ol_interaction_Modify-Modify.html">ol/interaction/Modify</a></li></ul>
<a href="module-ol_interaction_Interaction-Interaction.html">All interactions</a></td>
<td><a href="module-ol_source_Tile-TileSource.html">Tile sources</a> for <a href="module-ol_layer_Tile-TileLayer.html">ol/layer/Tile</a>
<br><a href="module-ol_source_Image-ImageSource.html">Image sources</a> for <a href="module-ol_layer_Image-ImageLayer.html">ol/layer/Image</a>
<br><a href="module-ol_source_Vector-VectorSource.html">Vector sources</a> for <a href="module-ol_layer_Vector-VectorLayer.html">ol/layer/Vector</a>
<br><a href="module-ol_source_VectorTile-VectorTile.html">Vector tile sources</a> for <a href="module-ol_layer_VectorTile-VectorTileLayer.html">ol/layer/VectorTile</a>
<br><a href="module-ol_format_Feature-FeatureFormat.html">Formats</a> for reading/writing vector data
<br><a href="module-ol_format_WMSCapabilities-WMSCapabilities.html">ol/format/WMSCapabilities</a></td></tr>
<tr><th>Projections</th><th>Observable objects</th><th>Other components</th></tr>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol/proj#transform()](module-ol_proj.html#.transform) and [ol/proj#transformExtent()](module-ol_proj.html#.transformExtent).</p>
[ol/proj](module-ol_proj.html)</td>
<td><p>Changes to all [ol/Object](module-ol_Object-BaseObject.html)s can be observed by calling the [object.on('propertychange')](module-ol_Object-BaseObject.html#on) method. Listeners receive an [ol/Object.ObjectEvent](module-ol_Object-ObjectEvent.html) with information on the changed property and old value.</p>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use <a href="module-ol_proj.html#.transform">ol/proj#transform()</a> and <a href="module-ol_proj.html#.transformExtent">ol/proj#transformExtent()</a>.</p>
<a href="module-ol_proj.html">ol/proj</a></td>
<td><p>Changes to all <a href="module-ol_Object-BaseObject.html">ol/Object</a>s can be observed by calling the <a href="module-ol_Object-BaseObject.html#on">object.on('propertychange')</a> method. Listeners receive an <a href="module-ol_Object-ObjectEvent.html">ol/Object.ObjectEvent</a> with information on the changed property and old value.</p>
<td>
[ol/Geolocation](module-ol_Geolocation.html)<br>
[ol/Overlay](module-ol_Overlay-Overlay.html)<br></td>
<a href="module-ol_Geolocation.html">ol/Geolocation</a><br>
<a href="module-ol_Overlay-Overlay.html">ol/Overlay</a><br></td>
</tr></table>
&nbsp;

View File

@@ -1,32 +1,29 @@
const events = {};
const classes = {};
exports.handlers = {
newDoclet: function(e) {
const doclet = e.doclet;
let cls;
if (doclet.kind == 'event') {
cls = doclet.longname.split('#')[0];
if (!(cls in events)) {
events[cls] = [];
}
events[cls].push(doclet.longname);
} else if (doclet.kind == 'class' && !(doclet.longname in classes)) {
classes[doclet.longname] = doclet;
if (doclet.kind !== 'event') {
return;
}
const cls = doclet.longname.split('#')[0];
if (!(cls in events)) {
events[cls] = [];
}
events[cls].push(doclet.longname);
},
parseComplete: function(e) {
const doclets = e.doclets;
let doclet, i, ii, j, jj, event, fires;
for (i = 0, ii = doclets.length - 1; i < ii; ++i) {
doclet = doclets[i];
for (let i = 0, ii = doclets.length - 1; i < ii; ++i) {
const doclet = doclets[i];
if (doclet.fires) {
if (doclet.kind == 'class') {
fires = [];
for (j = 0, jj = doclet.fires.length; j < jj; ++j) {
event = doclet.fires[j].replace('event:', '');
const fires = [];
for (let j = 0, jj = doclet.fires.length; j < jj; ++j) {
const event = doclet.fires[j].replace('event:', '');
if (events[event]) {
fires.push.apply(fires, events[event]);
} else if (doclet.fires[j] !== 'event:ObjectEvent') {

View File

@@ -1,12 +1,8 @@
/*
* This is a hack to prevent inheritDoc tags from entirely removing
* documentation of the method that inherits the documentation.
*
* TODO: Remove this hack when https://github.com/jsdoc3/jsdoc/issues/53
* is addressed.
*/
exports.defineTags = function(dictionary) {
dictionary.defineTag('inheritDoc', {
mustHaveValue: false,
@@ -92,10 +88,15 @@ exports.handlers = {
incompleteDoclet.stability = stability;
for (key in candidate) {
if (candidate.hasOwnProperty(key) &&
keepKeys.indexOf(key) == -1) {
keepKeys.indexOf(key) == -1) {
incompleteDoclet[key] = candidate[key];
}
}
// We have found a matching parent doc and applied it so we
// don't want to ignore this doclet anymore.
incompleteDoclet.ignore = false;
// We found a match so we can stop break
break;
}
}
}

View File

@@ -37,7 +37,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */

View File

@@ -220,3 +220,11 @@ Duplicate item added to a unique collection. For example, it may be that you tr
### 59
Invalid command found in the PBF. This indicates that the loaded vector tile may be corrupt.
### 60
Missing or invalid `size`.
### 61
Cannot determine IIIF Image API version from provided image information JSON.

View File

@@ -5,7 +5,6 @@
"common": false,
"createMapboxStreetsV6Style": false,
"d3": false,
"domtoimage": false,
"geojsonvt": false,
"GyroNorm": false,
"jsPDF": false,

View File

@@ -21,8 +21,6 @@ tags: "center, rotation, openstreetmap"
<div class="padding-bottom"></div>
<div class="center"></div>
</div>
<button id="zoomtoswitzerlandbest">Zoom to Switzerland</button> (best fit),<br/>
<button id="zoomtoswitzerlandconstrained">Zoom to Switzerland</button> (respect resolution constraint).<br/>
<button id="zoomtoswitzerlandnearest">Zoom to Switzerland</button> (nearest),<br/>
<button id="zoomtoswitzerland">Zoom to Switzerland</button> (best fit).<br/>
<button id="zoomtolausanne">Zoom to Lausanne</button> (with min resolution),<br/>
<button id="centerlausanne">Center on Lausanne</button>

View File

@@ -47,29 +47,14 @@ const map = new Map({
view: view
});
const zoomtoswitzerlandbest = document.getElementById('zoomtoswitzerlandbest');
zoomtoswitzerlandbest.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150], constrainResolution: false});
}, false);
const zoomtoswitzerlandconstrained =
document.getElementById('zoomtoswitzerlandconstrained');
zoomtoswitzerlandconstrained.addEventListener('click', function() {
const zoomtoswitzerland =
document.getElementById('zoomtoswitzerland');
zoomtoswitzerland.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150]});
}, false);
const zoomtoswitzerlandnearest =
document.getElementById('zoomtoswitzerlandnearest');
zoomtoswitzerlandnearest.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150], nearest: true});
}, false);
const zoomtolausanne = document.getElementById('zoomtolausanne');
zoomtolausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1];

View File

@@ -100,8 +100,7 @@ function xyz2rgb(x) {
const raster = new RasterSource({
sources: [new Stamen({
layer: 'watercolor',
transition: 0
layer: 'watercolor'
})],
operation: function(pixels, data) {
const hcl = rgb2hcl(pixels[0]);

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,6 @@ gn.init().then(function() {
center[0] -= resolution * gamma * 25;
center[1] += resolution * beta * 25;
view.setCenter(view.constrainCenter(center));
view.setCenter(center);
});
});

View File

@@ -1,18 +0,0 @@
#map {
position: relative;
}
#info {
position: absolute;
height: 1px;
width: 1px;
z-index: 100;
}
.tooltip.in {
opacity: 1;
}
.tooltip.top .tooltip-arrow {
border-top-color: white;
}
.tooltip-inner {
border: 2px solid white;
}

View File

@@ -3,11 +3,9 @@ layout: example.html
title: Map Export
shortdesc: Example of exporting a map as a PNG image.
docs: >
Example of exporting a map as a PNG image. This example use the <a href="https://www.npmjs.com/package/dom-to-image-more">dom-to-image-more</a>
Example of exporting a map as a PNG image. This example use the <a href="https://www.npmjs.com/package/html-to-image">html-to-image</a>
library.
tags: "export, png, openstreetmap"
resources:
- https://unpkg.com/dom-to-image-more@2.7.1/dist/dom-to-image-more.min.js
---
<div id="map" class="map"></div>
<a id="export-png" class="btn btn-default"><i class="fa fa-download"></i> Download PNG</a>

View File

@@ -4,6 +4,8 @@ import GeoJSON from '../src/ol/format/GeoJSON.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
import {toPng} from 'html-to-image';
const map = new Map({
layers: [
new TileLayer({
@@ -23,9 +25,17 @@ const map = new Map({
})
});
// export options for html-to-image.
// See: https://github.com/bubkoo/html-to-image#options
const exportOptions = {
filter: function(element) {
return element.className.indexOf('ol-control') === -1;
}
};
document.getElementById('export-png').addEventListener('click', function() {
map.once('rendercomplete', function() {
domtoimage.toPng(map.getViewport().querySelector('.ol-layers'))
toPng(map.getTargetElement(), exportOptions)
.then(function(dataURL) {
const link = document.getElementById('image-download');
link.href = dataURL;

View File

@@ -7,7 +7,6 @@ docs: >
tags: "export, pdf, openstreetmap"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js
- https://unpkg.com/dom-to-image-more@2.7.1/dist/dom-to-image-more.min.js
---
<div class="row-fluid">
<div class="span12">

View File

@@ -4,6 +4,8 @@ import WKT from '../src/ol/format/WKT.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
import {toJpeg} from 'html-to-image';
const raster = new TileLayer({
source: new OSM()
});
@@ -41,6 +43,15 @@ const dims = {
a5: [210, 148]
};
// export options for html-to-image.
// See: https://github.com/bubkoo/html-to-image#options
const exportOptions = {
filter: function(element) {
return element.className.indexOf('ol-control') === -1;
}
};
const exportButton = document.getElementById('export-pdf');
exportButton.addEventListener('click', function() {
@@ -57,15 +68,14 @@ exportButton.addEventListener('click', function() {
const extent = map.getView().calculateExtent(size);
map.once('rendercomplete', function() {
domtoimage.toJpeg(map.getViewport().querySelector('.ol-layers')).then(function(dataUrl) {
toJpeg(map.getTargetElement(), exportOptions).then(function(dataUrl) {
const pdf = new jsPDF('landscape', undefined, format);
pdf.addImage(dataUrl, 'JPEG', 0, 0, dim[0], dim[1]);
pdf.save('map.pdf');
// Reset original map size
map.setSize(size);
map.getView().fit(extent, {
size: size,
constrainResolution: false
size: size
});
exportButton.disabled = false;
document.body.style.cursor = 'auto';

View File

@@ -0,0 +1,9 @@
---
layout: example.html
title: Constrained Extent
shortdesc: Example of a view with a constrained extent.
docs: >
This map has a view that is constrained in an extent. This is done using the `extent` view option. Please note that specifying `constrainOnlyCenter: true` would only apply the extent restriction to the view center.
tags: "view, extent, constrain, restrict"
---
<div id="map" class="map"></div>

View File

@@ -0,0 +1,25 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
import {defaults as defaultControls} from '../src/ol/control/util';
import ZoomSlider from '../src/ol/control/ZoomSlider';
const view = new View({
center: [328627.563458, 5921296.662223],
zoom: 8,
extent: [-572513.341856, 5211017.966314,
916327.095083, 6636950.728974]
});
new Map({
layers: [
new TileLayer({
source: new OSM()
})
],
keyboardEventTarget: document,
target: 'map',
view: view,
controls: defaultControls().extend([new ZoomSlider()])
});

View File

@@ -1,6 +1,5 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import {platformModifierKeyOnly} from '../src/ol/events/condition.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import ExtentInteraction from '../src/ol/interaction/Extent.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
@@ -27,9 +26,7 @@ const map = new Map({
})
});
const extent = new ExtentInteraction({
condition: platformModifierKeyOnly
});
const extent = new ExtentInteraction();
map.addInteraction(extent);
extent.setActive(false);

View File

@@ -0,0 +1,25 @@
---
layout: example.html
title: Filtering features with WebGL
shortdesc: Using WebGL to filter large quantities of features
docs: >
This example shows how to use `ol/renderer/webgl/PointsLayer` to dynamically filter a large amount
of point geometries. The above map is based on a dataset from the NASA containing 45k recorded meteorite
landing sites. Each meteorite is marked by a circle on the map (the bigger the circle, the heavier
the object). A pulse effect has been added, which is slightly offset by the year of the impact.
Adjusting the sliders causes the objects outside of the date range to be filtered out of the map. This is done using
a custom fragment shader on the layer renderer, and by using the `v_opacity` attribute of the rendered objects
to store the year of impact.
tags: "webgl, icon, sprite, filter, feature"
---
<div id="map" class="map"></div>
<form>
<div id="status">Show impacts between <span class="min-year"></span> and <span class="max-year"></span></div>
<label>Minimum year:</label>
<input id="min-year" type="range" min="1850" max="2015" step="1" value="1850"/>
<label>Maximum year:</label>
<input id="max-year" type="range" min="1850" max="2015" step="1" value="2015"/>
</form>

View File

@@ -0,0 +1,164 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import Feature from '../src/ol/Feature';
import Point from '../src/ol/geom/Point';
import VectorLayer from '../src/ol/layer/Vector';
import {Vector} from '../src/ol/source';
import {fromLonLat} from '../src/ol/proj';
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer';
import {clamp, lerp} from '../src/ol/math';
import Stamen from '../src/ol/source/Stamen';
const vectorSource = new Vector({
features: [],
attributions: 'NASA'
});
const oldColor = [180, 140, 140];
const newColor = [255, 80, 80];
const startTime = Date.now() * 0.001;
// hanle input values & events
const minYearInput = document.getElementById('min-year');
const maxYearInput = document.getElementById('max-year');
function updateStatusText() {
const div = document.getElementById('status');
div.querySelector('span.min-year').textContent = minYearInput.value;
div.querySelector('span.max-year').textContent = maxYearInput.value;
}
minYearInput.addEventListener('input', updateStatusText);
minYearInput.addEventListener('change', updateStatusText);
maxYearInput.addEventListener('input', updateStatusText);
maxYearInput.addEventListener('change', updateStatusText);
updateStatusText();
class WebglPointsLayer extends VectorLayer {
createRenderer() {
return new WebGLPointsLayerRenderer(this, {
colorCallback: function(feature, color) {
// color is interpolated based on year
const ratio = clamp((feature.get('year') - 1800) / (2013 - 1800), 0, 1);
color[0] = lerp(oldColor[0], newColor[0], ratio) / 255;
color[1] = lerp(oldColor[1], newColor[1], ratio) / 255;
color[2] = lerp(oldColor[2], newColor[2], ratio) / 255;
color[3] = 1;
return color;
},
sizeCallback: function(feature) {
return 18 * clamp(feature.get('mass') / 200000, 0, 1) + 8;
},
fragmentShader: [
'precision mediump float;',
'uniform float u_time;',
'uniform float u_minYear;',
'uniform float u_maxYear;',
'varying vec2 v_texCoord;',
'varying float v_opacity;',
'varying vec4 v_color;',
'void main(void) {',
' float impactYear = v_opacity;',
// filter out pixels if the year is outside of the given range
' if (impactYear < u_minYear || v_opacity > u_maxYear) {',
' discard;',
' }',
' vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);',
' float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;',
' float value = 2.0 * (1.0 - sqRadius);',
' float alpha = smoothstep(0.0, 1.0, value);',
' vec3 color = v_color.rgb;',
' float period = 8.0;',
' color.g *= 2.0 * (1.0 - sqrt(mod(u_time + impactYear * 0.025, period) / period));',
' gl_FragColor = vec4(color, v_color.a);',
' gl_FragColor.a *= alpha;',
' gl_FragColor.rgb *= gl_FragColor.a;',
'}'
].join(' '),
opacityCallback: function(feature) {
// here the opacity channel of the vertices is used to store the year of impact
return feature.get('year');
},
uniforms: {
u_time: function() {
return Date.now() * 0.001 - startTime;
},
u_minYear: function() {
return parseInt(minYearInput.value);
},
u_maxYear: function() {
return parseInt(maxYearInput.value);
}
}
});
}
}
function loadData() {
const client = new XMLHttpRequest();
client.open('GET', 'data/csv/meteorite_landings.csv');
client.onload = function() {
const csv = client.responseText;
const features = [];
let prevIndex = csv.indexOf('\n') + 1; // scan past the header line
let curIndex;
while ((curIndex = csv.indexOf('\n', prevIndex)) != -1) {
const line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
prevIndex = curIndex + 1;
const coords = fromLonLat([parseFloat(line[4]), parseFloat(line[3])]);
if (isNaN(coords[0]) || isNaN(coords[1])) {
// guard against bad data
continue;
}
features.push(new Feature({
mass: parseFloat(line[1]) || 0,
year: parseInt(line[2]) || 0,
geometry: new Point(coords)
}));
}
vectorSource.addFeatures(features);
};
client.send();
}
loadData();
const map = new Map({
layers: [
new TileLayer({
source: new Stamen({
layer: 'toner'
})
}),
new WebglPointsLayer({
source: vectorSource
})
],
target: document.getElementById('map'),
view: new View({
center: [0, 0],
zoom: 2
})
});
// animate the map
function animate() {
map.render();
window.requestAnimationFrame(animate);
}
animate();

View File

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

View File

@@ -10,7 +10,6 @@ import {fromLonLat} from '../src/ol/proj';
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer';
import {lerp} from '../src/ol/math';
const features = [];
const vectorSource = new Vector({
features: [],
attributions: 'National UFO Reporting Center'
@@ -39,16 +38,17 @@ class WebglPointsLayer extends VectorLayer {
createRenderer() {
return new WebGLPointsLayerRenderer(this, {
texture: texture,
colorCallback: function(feature, vertex, component) {
// component at index 3 is alpha
if (component === 3) {
return 1;
}
colorCallback: function(feature, color) {
// color is interpolated based on year (min is 1910, max is 2013)
// please note: most values are between 2000-2013
const ratio = (feature.get('year') - 1950) / (2013 - 1950);
return lerp(oldColor[component], newColor[component], ratio * ratio) / 255;
color[0] = lerp(oldColor[0], newColor[0], ratio * ratio) / 255;
color[1] = lerp(oldColor[1], newColor[1], ratio * ratio) / 255;
color[2] = lerp(oldColor[2], newColor[2], ratio * ratio) / 255;
color[3] = 1;
return color;
},
texCoordCallback: function(feature, component) {
let coords = shapeTextureCoords[feature.get('shape')];
@@ -70,17 +70,14 @@ function loadData() {
client.open('GET', 'data/csv/ufo_sighting_data.csv');
client.onload = function() {
const csv = client.responseText;
let curIndex;
let prevIndex = 0;
let line;
while ((curIndex = csv.indexOf('\n', prevIndex)) > 0) {
line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
prevIndex = curIndex + 1;
const features = [];
// skip header
if (prevIndex === 0) {
continue;
}
let prevIndex = csv.indexOf('\n') + 1; // scan past the header line
let curIndex;
while ((curIndex = csv.indexOf('\n', prevIndex)) != -1) {
const line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
prevIndex = curIndex + 1;
const coords = fromLonLat([parseFloat(line[5]), parseFloat(line[4])]);

View File

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

16
examples/iiif.html Normal file
View File

@@ -0,0 +1,16 @@
---
layout: example.html
title: IIIF Image API
shortdesc: Example of a IIIF Image API source.
docs: >
Example of a tile source for an International Image Interoperability Framework (IIIF) Image Service.
Try any Image API version 1 or 2 service.
tags: "IIIF, IIIF Image API, tile source"
---
<div id="map" class="map"></div>
<div class="controls">
<div id="iiif-notification">&nbsp;</div>
Enter <code>info.json</code> URL:
<input type="text" id="imageInfoUrl" value="https://iiif.ub.uni-leipzig.de/iiif/j2k/0000/0107/0000010732/00000072.jpx/info.json">
<button id="display">Display image</button>
</div>

46
examples/iiif.js Normal file
View File

@@ -0,0 +1,46 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import IIIF from '../src/ol/source/IIIF.js';
import IIIFInfo from '../src/ol/format/IIIFInfo.js';
const layer = new TileLayer(),
map = new Map({
layers: [layer],
target: 'map'
}),
notifyDiv = document.getElementById('iiif-notification'),
urlInput = document.getElementById('imageInfoUrl'),
displayButton = document.getElementById('display');
function refreshMap(imageInfoUrl) {
fetch(imageInfoUrl).then(function(response) {
response.json().then(function(imageInfo) {
const options = new IIIFInfo(imageInfo).getTileSourceOptions();
if (options === undefined || options.version === undefined) {
notifyDiv.textContent = 'Data seems to be no valid IIIF image information.';
return;
}
options.zDirection = -1;
const iiifTileSource = new IIIF(options);
layer.setSource(iiifTileSource);
map.setView(new View({
resolutions: iiifTileSource.getTileGrid().getResolutions(),
extent: iiifTileSource.getTileGrid().getExtent(),
constrainOnlyCenter: true
}));
map.getView().fit(iiifTileSource.getTileGrid().getExtent());
notifyDiv.textContent = '';
}).catch(function(body) {
notifyDiv.textContent = 'Could not read image info json. ' + body;
});
}).catch(function() {
notifyDiv.textContent = 'Could not read data from URL.';
});
}
displayButton.addEventListener('click', function() {
refreshMap(urlInput.value);
});
refreshMap(urlInput.value);

View File

@@ -11,9 +11,25 @@
body {
padding-top: 70px;
}
img.header-logo {
padding-left: 18px;
}
input.search-query {
color: #333;
}
@media (max-width: 480px) {
input.search-query {
width: 110px;
}
#count {
display: none;
}
}
@media (max-width: 374px) {
input.search-query {
display: none;
}
}
.example {
display: block;
padding: 10px;
@@ -182,9 +198,9 @@
<body>
<header class="navbar navbar-fixed-top" role="navigation">
<div class="container">
<div class="container-fluid">
<div class="display-table pull-left">
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png">&nbsp;OpenLayers Examples</a>
<a class="navbar-brand" href="./"><img class="header-logo" src="./resources/logo-70x70.png">&nbsp;OpenLayers</a>
<form class="navbar-form" role="search">
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
<span id="count"></span>

View File

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

View File

@@ -7,7 +7,7 @@ import OSM from '../src/ol/source/OSM.js';
const map = new Map({
interactions: defaultInteractions({
constrainResolution: true, onFocusOnly: true
onFocusOnly: true
}),
layers: [
new TileLayer({

View File

@@ -6,9 +6,10 @@ docs: >
Show how to add a mapbox-gl-js layer in an openlayers map. **Note**: Make sure to get your own Mapbox API key when using this example. No map will be visible when the API key has expired.
tags: "simple, mapbox, vector, tiles"
resources:
- https://unpkg.com/mapbox-gl@0.51.0/dist/mapbox-gl.js
- https://unpkg.com/mapbox-gl@0.54.0/dist/mapbox-gl.js
- https://unpkg.com/mapbox-gl@0.54.0/dist/mapbox-gl.css
cloak:
- key: ER67WIiPdCQvhgsUjoWK
value: Your Mapbox access token from http://mapbox.com/ here
value: Your Mapbox access token from https://mapbox.com/ here
---
<div id="map" class="map"></div>

View File

@@ -1,189 +1,12 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import Layer from '../src/ol/layer/Layer';
import {assign} from '../src/ol/obj';
import {getTransform} from '../src/ol/proj';
import SourceState from '../src/ol/source/State';
import {toLonLat} from '../src/ol/proj';
import {Stroke, Style} from '../src/ol/style.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
class Mapbox extends Layer {
/**
* @param {import('./Base.js').Options} options Layer options.
*/
constructor(options) {
const baseOptions = assign({}, options);
super(baseOptions);
this.baseOptions = baseOptions;
/**
* @private
* @type boolean
*/
this.loaded = false;
this.initMap();
}
initMap() {
const map = this.map_;
const view = map.getView();
const transformToLatLng = getTransform(view.getProjection(), 'EPSG:4326');
const center = transformToLatLng(view.getCenter());
this.centerLastRender = view.getCenter();
this.zoomLastRender = view.getZoom();
this.centerLastRender = view.getCenter();
this.zoomLastRender = view.getZoom();
const options = assign(this.baseOptions, {
attributionControl: false,
boxZoom: false,
center,
container: map.getTargetElement(),
doubleClickZoom: false,
dragPan: false,
dragRotate: false,
interactive: false,
keyboard: false,
pitchWithRotate: false,
scrollZoom: false,
touchZoomRotate: false,
zoom: view.getZoom() - 1
});
this.mbmap = new mapboxgl.Map(options);
this.mbmap.on('load', function() {
this.mbmap.getCanvas().remove();
this.loaded = true;
this.map_.render();
[
'mapboxgl-control-container'
].forEach(className => document.getElementsByClassName(className)[0].remove());
}.bind(this));
this.mbmap.on('render', function() {
// Reset offset
if (this.centerNextRender) {
this.centerLastRender = this.centerNextRender;
}
if (this.zoomNextRender) {
this.zoomLastRender = this.zoomNextRender;
}
this.updateRenderedPosition([0, 0], 1);
}.bind(this));
}
/**
*
* @inheritDoc
*/
render(frameState) {
const map = this.map_;
const view = map.getView();
const transformToLatLng = getTransform(view.getProjection(), 'EPSG:4326');
this.centerNextRender = view.getCenter();
const lastRender = map.getPixelFromCoordinate(this.centerLastRender);
const nextRender = map.getPixelFromCoordinate(this.centerNextRender);
const centerOffset = [lastRender[0] - nextRender[0], lastRender[1] - nextRender[1]];
this.zoomNextRender = view.getZoom();
const zoomOffset = Math.pow(2, this.zoomNextRender - this.zoomLastRender);
this.updateRenderedPosition(centerOffset, zoomOffset);
const rotation = frameState.viewState.rotation;
if (rotation) {
this.mbmap.rotateTo(-rotation * 180 / Math.PI, {
animate: false
});
}
// Re-render mbmap
const center = transformToLatLng(this.centerNextRender);
const zoom = view.getZoom() - 1;
this.mbmap.jumpTo({
center: center,
zoom: zoom
});
return this.mbmap.getCanvas();
}
updateRenderedPosition(centerOffset, zoomOffset) {
const style = this.mbmap.getCanvas().style;
style.left = Math.round(centerOffset[0]) + 'px';
style.top = Math.round(centerOffset[1]) + 'px';
style.transform = 'scale(' + zoomOffset + ')';
}
setVisible(visible) {
super.setVisible(visible);
const canvas = this.mbmap.getCanvas();
canvas.style.display = visible ? 'block' : 'none';
}
setOpacity(opacity) {
super.setOpacity(opacity);
const canvas = this.mbmap.getCanvas();
canvas.style.opacity = opacity;
}
setZIndex(zindex) {
super.setZIndex(zindex);
const canvas = this.mbmap.getCanvas();
canvas.style.zIndex = zindex;
}
/**
* @inheritDoc
*/
getSourceState() {
return this.loaded ? SourceState.READY : SourceState.UNDEFINED;
}
setMap(map) {
this.map_ = map;
}
}
mapboxgl.Map.prototype._setupContainer = function _setupContainer() {
const container = this._container;
container.classList.add('mapboxgl-map');
const canvasContainer = this._canvasContainer = container.firstChild;
this._canvas = document.createElement('canvas');
canvasContainer.insertBefore(this._canvas, canvasContainer.firstChild);
this._canvas.style.position = 'absolute';
this._canvas.addEventListener('webglcontextlost', this._contextLost, false);
this._canvas.addEventListener('webglcontextrestored', this._contextRestored, false);
this._canvas.setAttribute('tabindex', '0');
this._canvas.setAttribute('aria-label', 'Map');
this._canvas.className = 'mapboxgl-canvas';
const dimensions = this._containerDimensions();
this._resizeCanvas(dimensions[0], dimensions[1]);
this._controlContainer = canvasContainer;
const controlContainer = this._controlContainer = document.createElement('div');
controlContainer.className = 'mapboxgl-control-container';
container.appendChild(controlContainer);
const positions = this._controlPositions = {};
['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach(function(positionName) {
const elem = document.createElement('div');
elem.className = 'mapboxgl-ctrl-' + positionName;
controlContainer.appendChild(elem);
positions[positionName] = elem;
});
};
const style = new Style({
stroke: new Stroke({
color: '#319FD3',
@@ -203,15 +26,78 @@ const map = new Map({
target: 'map',
view: new View({
center: [-10997148, 4569099],
zoom: 4
zoom: 4,
minZoom: 1,
extent: [-Infinity, -20048966.10, Infinity, 20048966.10],
smoothExtentConstraint: false,
smoothResolutionConstraint: false
})
});
// init Mapbox object
const view = map.getView();
const center = toLonLat(view.getCenter(), view.getProjection());
const key = 'ER67WIiPdCQvhgsUjoWK';
const mbLayer = new Mapbox({
map: map,
container: map.getTarget(),
style: 'https://maps.tilehosting.com/styles/bright/style.json?key=' + key
const mbMap = new mapboxgl.Map({
style: 'https://maps.tilehosting.com/styles/bright/style.json?key=' + key,
attributionControl: false,
boxZoom: false,
center: center,
container: map.getTargetElement(),
doubleClickZoom: false,
dragPan: false,
dragRotate: false,
interactive: false,
keyboard: false,
pitchWithRotate: false,
scrollZoom: false,
touchZoomRotate: false,
zoom: view.getZoom() - 1
});
// init OL layers
const mbLayer = new Layer({
render: function(frameState) {
const canvas = mbMap.getCanvas();
const view = map.getView();
const visible = mbLayer.getVisible();
canvas.style.display = visible ? 'block' : 'none';
const opacity = mbLayer.getOpacity();
canvas.style.opacity = opacity;
// adjust view parameters in mapbox
const rotation = frameState.viewState.rotation;
if (rotation) {
mbMap.rotateTo(-rotation * 180 / Math.PI, {
animate: false
});
}
const center = toLonLat(view.getCenter(), view.getProjection());
const zoom = view.getZoom() - 1;
mbMap.jumpTo({
center: center,
zoom: zoom,
animate: false
});
// cancel the scheduled update & trigger synchronous redraw
// see https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184
// NOTE: THIS MIGHT BREAK WHEN UPDATING MAPBOX
if (mbMap._frame) {
mbMap._frame.cancel();
mbMap._frame = null;
}
mbMap._render();
return canvas;
}
});
map.addLayer(mbLayer);

View File

@@ -9,6 +9,6 @@ resources:
- resources/mapbox-streets-v6-style.js
cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
value: Your Mapbox access token from http://mapbox.com/ here
value: Your Mapbox access token from https://mapbox.com/ here
---
<div id="map" class="map"></div>

View File

@@ -9,6 +9,6 @@ resources:
- resources/mapbox-streets-v6-style.js
cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
value: Your Mapbox access token from http://mapbox.com/ here
value: Your Mapbox access token from https://mapbox.com/ here
---
<div id="map" class="map"></div>

View File

@@ -1,4 +1,4 @@
.tooltip {
.ol-tooltip {
position: relative;
background: rgba(0, 0, 0, 0.5);
border-radius: 4px;
@@ -6,18 +6,19 @@
padding: 4px 8px;
opacity: 0.7;
white-space: nowrap;
font-size: 12px;
}
.tooltip-measure {
.ol-tooltip-measure {
opacity: 1;
font-weight: bold;
}
.tooltip-static {
.ol-tooltip-static {
background-color: #ffcc33;
color: black;
border: 1px solid white;
}
.tooltip-measure:before,
.tooltip-static:before {
.ol-tooltip-measure:before,
.ol-tooltip-static:before {
border-top: 6px solid rgba(0, 0, 0, 0.5);
border-right: 6px solid transparent;
border-left: 6px solid transparent;
@@ -27,6 +28,6 @@
margin-left: -7px;
left: 50%;
}
.tooltip-static:before {
.ol-tooltip-static:before {
border-top-color: #ffcc33;
}
}

View File

@@ -225,7 +225,7 @@ function addInteraction() {
draw.on('drawend',
function() {
measureTooltipElement.className = 'tooltip tooltip-static';
measureTooltipElement.className = 'ol-tooltip ol-tooltip-static';
measureTooltip.setOffset([0, -7]);
// unset sketch
sketch = null;
@@ -245,7 +245,7 @@ function createHelpTooltip() {
helpTooltipElement.parentNode.removeChild(helpTooltipElement);
}
helpTooltipElement = document.createElement('div');
helpTooltipElement.className = 'tooltip hidden';
helpTooltipElement.className = 'ol-tooltip hidden';
helpTooltip = new Overlay({
element: helpTooltipElement,
offset: [15, 0],
@@ -263,7 +263,7 @@ function createMeasureTooltip() {
measureTooltipElement.parentNode.removeChild(measureTooltipElement);
}
measureTooltipElement = document.createElement('div');
measureTooltipElement.className = 'tooltip tooltip-measure';
measureTooltipElement.className = 'ol-tooltip ol-tooltip-measure';
measureTooltip = new Overlay({
element: measureTooltipElement,
offset: [0, -15],

View File

@@ -5,7 +5,7 @@ shortdesc: Restrict pinch zooming to integer zoom levels.
docs: >
By default, the `ol/interaction/PinchZoom` can leave the map at fractional zoom levels.
If instead you want to constrain pinch zooming to integer zoom levels, set
<code>constrainResolution: true</code> when constructing the interaction.
<code>constrainResolution: true</code> when constructing the view.
tags: "pinch, zoom, interaction"
---
<div id="map" class="map"></div>

View File

@@ -6,10 +6,8 @@ import OSM from '../src/ol/source/OSM.js';
const map = new Map({
interactions: defaultInteractions({pinchZoom: false}).extend([
new PinchZoom({
constrainResolution: true // force zooming to a integer zoom
})
interactions: defaultInteractions().extend([
new PinchZoom()
]),
layers: [
new TileLayer({
@@ -19,6 +17,7 @@ const map = new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
zoom: 2,
constrainResolution: true
})
});

View File

@@ -38,6 +38,9 @@
},
"package.json": {
content: pkgJson
},
'sandbox.config.json': {
content: '{"template": "parcel"}'
}
}
});

View File

@@ -11,7 +11,7 @@ docs: >
tags: "raster, pixel operation, flood"
cloak:
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
value: Your Mapbox access token from http://mapbox.com/ here
value: Your Mapbox access token from https://mapbox.com/ here
---
<div id="map" class="map"></div>
<label>

View File

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

View File

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

View File

@@ -78,7 +78,7 @@
<header class="navbar" role="navigation">
<div class="container">
<div class="display-table pull-left" id="navbar-logo-container">
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png">&nbsp;OpenLayers Examples</a>
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png">&nbsp;OpenLayers</a>
</div>
<!-- menu items that get hidden below 768px width -->
<nav class='collapse navbar-collapse navbar-responsive-collapse'>
@@ -122,14 +122,18 @@
<a class="copy-button" id="copy-html-button" data-clipboard-target="#example-html-source"><i class="fa fa-clipboard"></i> Copy</a>
</div>
<pre><legend>index.html</legend><code id="example-html-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;{{ title }}&lt;/title&gt;
&lt;!-- The line below is only needed for old environments like Internet Explorer and Android 4.x --&gt;
&lt;script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"&gt;&lt;/script&gt;{{#if extraHead.remote}}
{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
{{ indent extraHead.remote spaces=4 }}{{/if}}
&lt;style&gt;
{{ indent css.source spaces=6 }} &lt;/style&gt;{{/if}}
.map {
width: 100%;
height:400px;
}
{{#if css.source}}{{ indent css.source spaces=6 }}{{/if}} &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
{{ indent contents spaces=4 }} &lt;script src="index.js"&gt;&lt;/script&gt;

View File

@@ -8,7 +8,7 @@ docs: >
tags: "utfgrid, tilejson"
cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
value: Your Mapbox access token from http://mapbox.com/ here
value: Your Mapbox access token from https://mapbox.com/ here
---
<div id="map" class="map"></div>
<div style="display: none;">

View File

@@ -103,6 +103,9 @@ tags: "geojson, vector, openstreetmap, label"
<label>Size: </label>
<input type="text" value="12px" id="points-size" />
<br />
<label>Line height: </label>
<input type="text" value="1" id="points-height" />
<br />
<label>Offset X:</label>
<input type="text" value="0" id="points-offset-x" />
<br />
@@ -212,6 +215,9 @@ tags: "geojson, vector, openstreetmap, label"
<label>Size: </label>
<input type="text" value="12px" id="lines-size" />
<br />
<label>Line height: </label>
<input type="text" value="1.2" id="lines-height" />
<br />
<label>Offset X:</label>
<input type="text" value="0" id="lines-offset-x" />
<br />
@@ -321,6 +327,9 @@ tags: "geojson, vector, openstreetmap, label"
<label>Size: </label>
<input type="text" value="10px" id="polygons-size" />
<br />
<label>Line height: </label>
<input type="text" value="1" id="polygons-height" />
<br />
<label>Offset X:</label>
<input type="text" value="0" id="polygons-offset-x" />
<br />

View File

@@ -16,6 +16,7 @@ const myDom = {
font: document.getElementById('points-font'),
weight: document.getElementById('points-weight'),
size: document.getElementById('points-size'),
height: document.getElementById('points-height'),
offsetX: document.getElementById('points-offset-x'),
offsetY: document.getElementById('points-offset-y'),
color: document.getElementById('points-color'),
@@ -34,6 +35,7 @@ const myDom = {
maxangle: document.getElementById('lines-maxangle'),
overflow: document.getElementById('lines-overflow'),
size: document.getElementById('lines-size'),
height: document.getElementById('lines-height'),
offsetX: document.getElementById('lines-offset-x'),
offsetY: document.getElementById('lines-offset-y'),
color: document.getElementById('lines-color'),
@@ -52,6 +54,7 @@ const myDom = {
maxangle: document.getElementById('polygons-maxangle'),
overflow: document.getElementById('polygons-overflow'),
size: document.getElementById('polygons-size'),
height: document.getElementById('polygons-height'),
offsetX: document.getElementById('polygons-offset-x'),
offsetY: document.getElementById('polygons-offset-y'),
color: document.getElementById('polygons-color'),
@@ -84,6 +87,7 @@ const createTextStyle = function(feature, resolution, dom) {
const align = dom.align.value;
const baseline = dom.baseline.value;
const size = dom.size.value;
const height = dom.height.value;
const offsetX = parseInt(dom.offsetX.value, 10);
const offsetY = parseInt(dom.offsetY.value, 10);
const weight = dom.weight.value;
@@ -98,7 +102,7 @@ const createTextStyle = function(feature, resolution, dom) {
document.getElementsByTagName('head')[0].appendChild(openSans);
openSansAdded = true;
}
const font = weight + ' ' + size + ' ' + dom.font.value;
const font = weight + ' ' + size + '/' + height + ' ' + dom.font.value;
const fillColor = dom.color.value;
const outlineColor = dom.outline.value;
const outlineWidth = parseInt(dom.outlineWidth.value, 10);

View File

@@ -46,7 +46,7 @@ function updateInfo() {
function setTime() {
startDate.setMinutes(startDate.getMinutes() + 15);
if (startDate > Date.now()) {
if (startDate > new Date()) {
startDate = threeHoursAgo();
}
layers[1].getSource().updateParams({'TIME': startDate.toISOString()});

View File

@@ -11,5 +11,6 @@ tags: "zoomify, deep zoom, IIP, pixel, projection"
<select id="zoomifyProtocol">
<option value="zoomify">Zoomify</option>
<option value="iip">IIP</option>
<option value="zoomifyretina">Zoomify Retina</option>
</select>
</div>

View File

@@ -12,6 +12,8 @@ const iipUrl = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?FIF=' + '/mnt/MD1/AD00/
const layer = new TileLayer({
source: new Zoomify({
tileSize: 256,
tilePixelRatio: 1,
url: zoomifyUrl,
size: [imgWidth, imgHeight],
crossOrigin: 'anonymous'
@@ -20,12 +22,15 @@ const layer = new TileLayer({
const extent = [0, -imgHeight, imgWidth, 0];
const resolutions = layer.getSource().getTileGrid().getResolutions();
const map = new Map({
layers: [layer],
target: 'map',
view: new View({
// adjust zoom levels to those provided by the source
resolutions: layer.getSource().getTileGrid().getResolutions(),
minResolution: resolutions[resolutions.length - 1],
maxResolution: resolutions[0],
// constrain the center: center cannot be set outside this extent
extent: extent
})
@@ -36,17 +41,73 @@ const control = document.getElementById('zoomifyProtocol');
control.addEventListener('change', function(event) {
const value = event.currentTarget.value;
if (value === 'iip') {
layer.setSource(new Zoomify({
url: iipUrl,
size: [imgWidth, imgHeight],
crossOrigin: 'anonymous'
}));
const extent = [0, -imgHeight, imgWidth, 0];
layer.setSource(
new Zoomify({
tileSize: 256,
tilePixelRatio: 1,
url: iipUrl,
size: [imgWidth, imgHeight],
crossOrigin: 'anonymous'
})
);
const resolutions = layer.getSource().getTileGrid().getResolutions();
map.setView(
new View({
// adjust zoom levels to those provided by the source
minResolution: resolutions[resolutions.length - 1],
maxResolution: resolutions[0],
// constrain the center: center cannot be set outside this extent
extent: extent
})
);
map.getView().fit(extent);
} else if (value === 'zoomify') {
layer.setSource(new Zoomify({
url: zoomifyUrl,
size: [imgWidth, imgHeight],
crossOrigin: 'anonymous'
}));
const extent = [0, -imgHeight, imgWidth, 0];
layer.setSource(
new Zoomify({
tileSize: 256,
tilePixelRatio: 1,
url: zoomifyUrl,
size: [imgWidth, imgHeight],
crossOrigin: 'anonymous'
})
);
const resolutions = layer.getSource().getTileGrid().getResolutions();
map.setView(
new View({
// adjust zoom levels to those provided by the source
minResolution: resolutions[resolutions.length - 1],
maxResolution: resolutions[0],
// constrain the center: center cannot be set outside this extent
extent: extent
})
);
map.getView().fit(extent);
} else if (value === 'zoomifyretina') {
const pixelRatio = 4;
// Be careful! Image extent will be modified by pixel ratio
const extent = [0, -imgHeight / pixelRatio, imgWidth / pixelRatio, 0];
layer.setSource(
new Zoomify({
tileSize: 256 / pixelRatio,
tilePixelRatio: pixelRatio,
url: zoomifyUrl,
size: [imgWidth / pixelRatio, imgHeight / pixelRatio],
crossOrigin: 'anonymous'
})
);
const resolutions = layer.getSource().getTileGrid().getResolutions();
map.setView(
new View({
// adjust zoom levels to those provided by the source
minResolution: resolutions[resolutions.length - 1] / pixelRatio,
maxResolution: resolutions[0],
// constrain the center: center cannot be set outside this extent
extent: extent
})
);
map.getView().fit(extent);
}
});

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "5.3.0",
"version": "6.0.0-beta.8",
"description": "OpenLayers mapping library",
"keywords": [
"map",
@@ -24,7 +24,7 @@
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && tsc --project config/tsconfig-build.json",
"typecheck": "tsc --pretty",
"apidoc": "jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
"apidoc": "jsdoc -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
},
"main": "index.js",
"repository": {
@@ -36,62 +36,68 @@
"url": "https://github.com/openlayers/openlayers/issues"
},
"dependencies": {
"pbf": "3.1.0",
"pbf": "3.2.0",
"pixelworks": "1.1.0",
"rbush": "2.0.2"
},
"devDependencies": {
"@openlayers/eslint-plugin": "^4.0.0-beta.1",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"@openlayers/eslint-plugin": "^4.0.0-beta.2",
"@types/arcgis-rest-api": "^10.4.4",
"@types/geojson": "^7946.0.6",
"@types/geojson": "^7946.0.7",
"@types/pbf": "^3.0.1",
"@types/rbush": "^2.0.2",
"@types/topojson-specification": "^1.0.1",
"buble": "^0.19.6",
"babel-loader": "^8.0.5",
"buble": "^0.19.7",
"buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.2.1",
"copy-webpack-plugin": "^5.0.0",
"clean-css-cli": "4.3.0",
"copy-webpack-plugin": "^5.0.3",
"coveralls": "3.0.3",
"eslint": "^5.13.0",
"eslint": "^5.16.0",
"eslint-config-openlayers": "^11.0.0",
"expect.js": "0.3.1",
"front-matter": "^3.0.1",
"fs-extra": "^7.0.1",
"glob": "^7.1.2",
"globby": "^8.0.1",
"handlebars": "4.1.0",
"front-matter": "^3.0.2",
"fs-extra": "^8.0.0",
"glob": "^7.1.4",
"globby": "^9.2.0",
"handlebars": "4.1.2",
"html-to-image": "^0.1.0",
"istanbul": "0.4.5",
"jquery": "3.3.1",
"jsdoc": "3.5.5",
"jsdoc-plugin-typescript": "^1.0.7",
"karma": "^4.0.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jquery": "3.4.1",
"jsdoc": "3.6.2",
"jsdoc-plugin-typescript": "^2.0.0",
"karma": "^4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.2",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-firefox-launcher": "^1.1.0",
"karma-mocha": "1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.0-rc.2",
"loglevelnext": "^3.0.0",
"marked": "0.6.1",
"mocha": "6.0.2",
"ol-mapbox-style": "^4.0.0",
"loglevelnext": "^3.0.1",
"marked": "0.6.2",
"mocha": "6.1.4",
"ol-mapbox-style": "^5.0.0-beta.1",
"pixelmatch": "^4.0.2",
"pngjs": "^3.3.3",
"pngjs": "^3.4.0",
"proj4": "2.5.0",
"puppeteer": "^1.12.2",
"serve-static": "^1.13.2",
"puppeteer": "~1.16.0",
"serve-static": "^1.14.0",
"shx": "^0.3.2",
"sinon": "^7.2.3",
"terser-webpack-plugin": "^1.2.2",
"typescript": "^3.2.2",
"url-polyfill": "^1.1.3",
"sinon": "^7.3.2",
"terser-webpack-plugin": "^1.2.3",
"typescript": "^3.4.5",
"url-polyfill": "^1.1.5",
"walk": "^2.3.9",
"webpack": "4.29.6",
"webpack-cli": "^3.2.3",
"webpack-dev-middleware": "^3.5.2",
"webpack-dev-server": "^3.1.14",
"yargs": "^13.2.0"
"webpack": "4.31.0",
"webpack-cli": "^3.3.2",
"webpack-dev-middleware": "^3.6.2",
"webpack-dev-server": "^3.3.1",
"yargs": "^13.2.2"
},
"eslintConfig": {
"extends": "openlayers",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1,61 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import XYZ from '../../../src/ol/source/XYZ.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import MultiPolygon from '../../../src/ol/geom/MultiPolygon.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import {getVectorContext} from '../../../src/ol/render.js';
const source = new XYZ({
url: '/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
const layer = new TileLayer({
source: source
});
const geometry = new MultiPolygon([
[[[-80, -40], [-40, 0], [-80, 40], [-120, 0], [-80, -40]]],
[[[80, -40], [120, 0], [80, 40], [40, 0], [80, -40]]]
]).transform('EPSG:4326', 'EPSG:3857');
const style = new Style({
stroke: new Stroke({
width: 2,
color: 'blue'
})
});
layer.on('prerender', function(event) {
const context = event.context;
context.save();
const vectorContext = getVectorContext(event);
vectorContext.setStyle(style);
vectorContext.drawGeometry(geometry);
context.clip();
});
layer.on('postrender', function(event) {
const context = event.context;
context.restore();
const vectorContext = getVectorContext(event);
vectorContext.setStyle(style);
vectorContext.drawGeometry(geometry);
});
new Map({
pixelRatio: 1,
target: 'map',
layers: [layer],
view: new View({
center: [0, 0],
zoom: 0
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,28 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import Static from '../../../src/ol/source/ImageStatic.js';
import {
get as getProjection,
transform,
transformExtent
} from '../../../src/ol/proj';
import ImageLayer from '../../../src/ol/layer/Image.js';
const center = transform([-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857');
new Map({
pixelRatio: 1,
target: 'map',
layers: [new ImageLayer({
source: new Static({
url: '/data/tiles/osm/5/5/12.png',
imageExtent: transformExtent([-123, 37, -122, 38], 'EPSG:4326', 'EPSG:3857'),
projection: getProjection('EPSG:3857')
})
})],
view: new View({
center,
zoom: 8
})
});
render();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -0,0 +1,30 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import XYZ from '../../../src/ol/source/XYZ';
import {createXYZ} from '../../../src/ol/tilegrid.js';
const center = [-10997148, 4569099];
const layer = new TileLayer({
source: new XYZ({
url: '/data/tiles/512x256/{z}/{x}/{y}.png',
tileGrid: createXYZ({
tileSize: [512, 256]
}),
transition: 0
})
});
const map = new Map({
target: 'map',
pixelRatio: 1,
view: new View({
center: center,
zoom: 5
})
});
map.addLayer(layer);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -0,0 +1,26 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj';
import XYZ from '../../../src/ol/source/XYZ';
const center = fromLonLat([8.6, 50.1]);
new Map({
layers: [
new TileLayer({
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg',
transition: 0
}),
opacity: 0.2
})
],
target: 'map',
view: new View({
center: center,
zoom: 3
})
});
render();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -0,0 +1,35 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj';
import XYZ from '../../../src/ol/source/XYZ';
const center = fromLonLat([8.6, 50.1]);
const layer1 = new TileLayer({
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg',
transition: 0
}),
opacity: 0.2
});
const layer2 = new TileLayer({
source: new XYZ({
url: '/data/tiles/stamen-labels/{z}/{x}/{y}.png',
transition: 0
})
});
const map = new Map({
pixelRatio: 1,
layers: [layer1, layer2],
target: 'map',
view: new View({
center: center,
zoom: 3
})
});
map.getView().setRotation(Math.PI / 2);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -0,0 +1,167 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Style from '../../../src/ol/style/Style.js';
import Text from '../../../src/ol/style/Text.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js';
let center = [1825927.7316762917, 6143091.089223046];
const map = new Map({
pixelRatio: 1,
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
const source1 = new VectorSource();
const layer1 = new VectorLayer({
declutter: true,
source: source1
});
const source2 = new VectorSource();
const layer2 = new VectorLayer({
declutter: true,
source: source2
});
const source3 = new VectorSource();
const layer3 = new VectorLayer({
declutter: true,
source: source3
});
const source4 = new VectorSource();
const layer4 = new VectorLayer({
declutter: true,
source: source4
});
const feature1 = new Feature({
geometry: new Point(center),
zIndex: 2
});
source1.addFeature(feature1);
source1.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
zIndex: 3
}));
source1.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
zIndex: 1
}));
layer1.setStyle(function(feature) {
return new Style({
zIndex: feature.get('zIndex'),
image: new CircleStyle({
radius: 15,
fill: new Fill({
color: 'blue'
})
})
});
});
map.addLayer(layer1);
center = [center[0] + 500, center[1] + 700];
const feature2 = new Feature({
geometry: new Point(center),
text: 'center',
zIndex: 2
});
source2.addFeature(feature2);
source2.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west',
zIndex: 3
}));
source2.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east',
zIndex: 1
}));
layer2.setStyle(function(feature) {
return new Style({
zIndex: feature.get('zIndex'),
text: new Text({
text: feature.get('text'),
font: 'italic bold 18px Ubuntu'
})
});
});
map.addLayer(layer2);
center = [center[0] + 500, center[1] + 300];
source3.addFeature(new Feature({
geometry: new Point(center),
text: 'center'
}));
source3.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west'
}));
source3.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east'
}));
layer3.setStyle(function(feature) {
return new Style({
image: new CircleStyle({
radius: 10,
stroke: new Stroke({
color: 'red',
width: 8
})
}),
text: new Text({
text: feature.get('text'),
font: 'italic bold 18px Ubuntu',
textBaseline: 'bottom',
offsetY: -12
})
});
});
map.addLayer(layer3);
center = [center[0] - 2000, center[1] - 2000];
const point = new Feature(new Point(center));
point.setStyle(new Style({
zIndex: 1,
image: new CircleStyle({
radius: 8,
stroke: new Stroke({
color: 'blue',
width: 4
})
})
}));
const line = new Feature(new LineString([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new Style({
zIndex: 2,
stroke: new Stroke({
color: '#CCC',
width: 12
}),
text: new Text({
placement: 'line',
text: 'east-west',
font: 'italic bold 18px Ubuntu',
overflow: true
})
}));
source4.addFeature(point);
source4.addFeature(line);
map.addLayer(layer4);
render({tolerance: 0.007});

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

View File

@@ -0,0 +1,54 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Feature from '../../../src/ol/Feature.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Fill from '../../../src/ol/style/Fill.js';
const src = new VectorSource({
features: [
new Feature(new Polygon([[
[-22, 18],
[-22, 78],
[-9, 78],
[-9, 18],
[-22, 18]
]])),
new Feature(new Polygon([[
[-9, 18],
[-9, 78],
[4, 78],
[4, 18],
[-9, 18]
]]))
]
});
const layer = new VectorLayer({
renderBuffer: 0,
source: src,
style: new Style({
stroke: new Stroke({
color: [0, 0, 0, 1],
width: 2
}),
fill: new Fill({
color: [255, 0, 0, 1]
})
})
});
const view = new View({
center: [-9.5, 78],
zoom: 2,
projection: 'EPSG:4326'
});
new Map({
pixelRatio: 1,
layers: [layer],
target: 'map',
view: view
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,43 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Feature from '../../../src/ol/Feature.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Style from '../../../src/ol/style/Style.js';
import Fill from '../../../src/ol/style/Fill.js';
const feature = new Feature({
geometry: new Polygon([
[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]],
[[0, 60], [-17.6336, 24.2705], [-57.0634, 18.5410], [-28.5317, -9.2705], [-35.2671, -48.5410], [0, -30], [35.2671, -48.5410], [28.5317, -9.2705], [57.0634, 18.5410], [17.6336, 24.2705], [0, 60]]
])
});
const src = new VectorSource({
features: [
feature
]
});
const layer = new VectorLayer({
renderBuffer: 0,
source: src,
style: new Style({
fill: new Fill({
color: 'blue'
})
})
});
const view = new View({
center: [0, 0],
zoom: 1,
projection: 'EPSG:4326'
});
new Map({
pixelRatio: 1,
layers: [layer],
target: 'map',
view: view
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,110 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Circle from '../../../src/ol/geom/Circle.js';
import LineString from '../../../src/ol/geom/LineString.js';
const center = [1825927.7316762917, 6143091.089223046];
const source1 = new VectorSource();
const source2 = new VectorSource();
const vectorLayer1 = new VectorLayer({
source: source1,
style: new Style({
stroke: new Stroke({
color: '#3399CC',
width: 1.25
})
})
});
const vectorLayer2 = new VectorLayer({
source: source2,
opacity: 0.6
});
function addCircle(r, source) {
source.addFeature(new Feature(new Circle(center, r)));
}
function addPolygon(r, source) {
source.addFeature(new Feature(new Polygon([
[
[center[0] - r, center[1] - r],
[center[0] + r, center[1] - r],
[center[0] + r, center[1] + r],
[center[0] - r, center[1] + r],
[center[0] - r, center[1] - r]
]
])));
}
const smallLine = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new Style({
zIndex: -99,
stroke: new Stroke({width: 75, color: 'red'})
}));
smallLine.getGeometry().translate(-1000, 1000);
source1.addFeature(smallLine);
addPolygon(100, source1);
addCircle(200, source1);
addPolygon(250, source1);
addCircle(500, source1);
addPolygon(600, source1);
addPolygon(720, source1);
const smallLine2 = new Feature(new LineString([
[center[0], center[1] - 1000],
[center[0], center[1] + 1000]
]));
smallLine2.setStyle([
new Style({
stroke: new Stroke({width: 35, color: 'blue'})
}),
new Style({
stroke: new Stroke({width: 15, color: 'green'})
})
]);
smallLine2.getGeometry().translate(1000, 1000);
source1.addFeature(smallLine2);
const smallLine3 = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine3.setStyle([
new Style({
stroke: new Stroke({width: 75, color: 'red'})
}),
new Style({
stroke: new Stroke({width: 45, color: 'white'})
})
]);
smallLine3.getGeometry().translate(-1000, -1000);
addPolygon(400, source2);
addCircle(400, source2);
source2.addFeature(smallLine3);
const map = new Map({
layers: [
vectorLayer1,
vectorLayer2
],
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
map.getView().setRotation(Math.PI + Math.PI / 4);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,167 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Style from '../../../src/ol/style/Style.js';
import Text from '../../../src/ol/style/Text.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js';
let center = [1825927.7316762917, 6143091.089223046];
const map = new Map({
pixelRatio: 1,
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
const source1 = new VectorSource();
const layer1 = new VectorImageLayer({
declutter: true,
source: source1
});
const source2 = new VectorSource();
const layer2 = new VectorImageLayer({
declutter: true,
source: source2
});
const source3 = new VectorSource();
const layer3 = new VectorImageLayer({
declutter: true,
source: source3
});
const source4 = new VectorSource();
const layer4 = new VectorImageLayer({
declutter: true,
source: source4
});
const feature1 = new Feature({
geometry: new Point(center),
zIndex: 2
});
source1.addFeature(feature1);
source1.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
zIndex: 3
}));
source1.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
zIndex: 1
}));
layer1.setStyle(function(feature) {
return new Style({
zIndex: feature.get('zIndex'),
image: new CircleStyle({
radius: 15,
fill: new Fill({
color: 'blue'
})
})
});
});
map.addLayer(layer1);
center = [center[0] + 500, center[1] + 700];
const feature2 = new Feature({
geometry: new Point(center),
text: 'center',
zIndex: 2
});
source2.addFeature(feature2);
source2.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west',
zIndex: 3
}));
source2.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east',
zIndex: 1
}));
layer2.setStyle(function(feature) {
return new Style({
zIndex: feature.get('zIndex'),
text: new Text({
text: feature.get('text'),
font: 'italic bold 18px Ubuntu'
})
});
});
map.addLayer(layer2);
center = [center[0] + 500, center[1] + 300];
source3.addFeature(new Feature({
geometry: new Point(center),
text: 'center'
}));
source3.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west'
}));
source3.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east'
}));
layer3.setStyle(function(feature) {
return new Style({
image: new CircleStyle({
radius: 10,
stroke: new Stroke({
color: 'red',
width: 8
})
}),
text: new Text({
text: feature.get('text'),
font: 'italic bold 18px Ubuntu',
textBaseline: 'bottom',
offsetY: -12
})
});
});
map.addLayer(layer3);
center = [center[0] - 2000, center[1] - 2000];
const point = new Feature(new Point(center));
point.setStyle(new Style({
zIndex: 1,
image: new CircleStyle({
radius: 8,
stroke: new Stroke({
color: 'blue',
width: 4
})
})
}));
const line = new Feature(new LineString([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new Style({
zIndex: 2,
stroke: new Stroke({
color: '#CCC',
width: 12
}),
text: new Text({
placement: 'line',
text: 'east-west',
font: 'italic bold 18px Ubuntu',
overflow: true
})
}));
source4.addFeature(point);
source4.addFeature(line);
map.addLayer(layer4);
render({tolerance: 0.007});

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,110 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Circle from '../../../src/ol/geom/Circle.js';
import LineString from '../../../src/ol/geom/LineString.js';
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
const center = [1825927.7316762917, 6143091.089223046];
const source1 = new VectorSource();
const source2 = new VectorSource();
const vectorLayer1 = new VectorImageLayer({
source: source1,
style: new Style({
stroke: new Stroke({
color: '#3399CC',
width: 1.25
})
})
});
const vectorLayer2 = new VectorImageLayer({
source: source2,
opacity: 0.6
});
function addCircle(r, source) {
source.addFeature(new Feature(new Circle(center, r)));
}
function addPolygon(r, source) {
source.addFeature(new Feature(new Polygon([
[
[center[0] - r, center[1] - r],
[center[0] + r, center[1] - r],
[center[0] + r, center[1] + r],
[center[0] - r, center[1] + r],
[center[0] - r, center[1] - r]
]
])));
}
const smallLine = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new Style({
zIndex: -99,
stroke: new Stroke({width: 75, color: 'red'})
}));
smallLine.getGeometry().translate(-1000, 1000);
source1.addFeature(smallLine);
addPolygon(100, source1);
addCircle(200, source1);
addPolygon(250, source1);
addCircle(500, source1);
addPolygon(600, source1);
addPolygon(720, source1);
const smallLine2 = new Feature(new LineString([
[center[0], center[1] - 1000],
[center[0], center[1] + 1000]
]));
smallLine2.setStyle([
new Style({
stroke: new Stroke({width: 35, color: 'blue'})
}),
new Style({
stroke: new Stroke({width: 15, color: 'green'})
})
]);
smallLine2.getGeometry().translate(1000, 1000);
source1.addFeature(smallLine2);
const smallLine3 = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine3.setStyle([
new Style({
stroke: new Stroke({width: 75, color: 'red'})
}),
new Style({
stroke: new Stroke({width: 45, color: 'white'})
})
]);
smallLine3.getGeometry().translate(-1000, -1000);
addPolygon(400, source2);
addCircle(1000, source2);
source2.addFeature(smallLine3);
const map = new Map({
layers: [
vectorLayer1,
vectorLayer2
],
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
map.getView().setRotation(Math.PI + Math.PI / 4);
render({tolerance: 0.005});

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@@ -0,0 +1,31 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorTileSource from '../../../src/ol/source/VectorTile';
import MVT from '../../../src/ol/format/MVT';
import {createXYZ} from '../../../src/ol/tilegrid';
import VectorTileLayer from '../../../src/ol/layer/VectorTile';
const map = new Map({
pixelRatio: 2,
layers: [
new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
tileGrid: createXYZ(),
url: '/data/tiles/mapbox-streets-v6/{z}/{x}/{y}.vector.pbf',
transition: 0
})
})
],
target: 'map',
view: new View({
center: [1825927.7316762917, 6143091.089223046],
zoom: 14
})
});
map.getView().setRotation(Math.PI / 4);
render({
message: 'Vector tile layer rotates (hidip)',
tolerance: 0.01
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,29 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
const map = new Map({
pixelRatio: 1,
target: 'map',
layers: [
new VectorLayer({
source: new VectorSource({
features: [new Feature({
geometry: new Point([0, 0])
})]
})
})
],
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1,
multiWorld: true
})
});
map.getView().setCenter([10, 10]);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,27 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
new Map({
pixelRatio: 1,
target: 'map',
layers: [
new VectorLayer({
source: new VectorSource({
features: [new Feature({
geometry: new Point([0, 0])
})]
})
})
],
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
})
});
render();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -4,8 +4,10 @@ import {Vector as VectorLayer, Tile as TileLayer} from '../../../src/ol/layer.js
import {Vector as VectorSource, XYZ} from '../../../src/ol/source.js';
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
import {Style, Stroke} from '../../../src/ol/style.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
new Map({
const map = new Map({
layers: [
new TileLayer({
source: new XYZ({
@@ -14,6 +16,7 @@ new Map({
})
}),
new VectorLayer({
zIndex: 1,
style: new Style({
stroke: new Stroke({
color: 'rgba(255,255,255,0.5)',
@@ -33,4 +36,11 @@ new Map({
})
});
const unmanaged = new VectorLayer({
source: new VectorSource({
features: [new Feature(new Point([0, 0]))]
})
});
unmanaged.setMap(map);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,169 @@
import Feature from '../../../src/ol/Feature.js';
import MultiPoint from '../../../src/ol/geom/MultiPoint.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
const vectorSource = new VectorSource();
let feature;
feature = new Feature({
geometry: new MultiPoint([[-20, 18]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-10, 18]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[4, 18]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-20, 3]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
}),
stroke: new Stroke({
color: '#000000',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-10, 3]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
}),
stroke: new Stroke({
color: '#000000',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[4, 3]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
}),
stroke: new Stroke({
color: '#000000',
width: 3
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-20, -15]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
stroke: new Stroke({
color: '#256308',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-10, -15]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: 'rgba(0, 0, 255, 0.3)'
}),
stroke: new Stroke({
color: '#256308',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[4, -15]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: 'rgba(235, 45, 70, 0.6)'
}),
stroke: new Stroke({
color: '#256308',
width: 3
})
})
}));
vectorSource.addFeature(feature);
const vectorLayer = new VectorLayer({
source: vectorSource
});
new Map({
layers: [
vectorLayer
],
target: 'map',
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
zoom: 1
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,169 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
const vectorSource = new VectorSource();
let feature;
feature = new Feature({
geometry: new Point([-20, 18])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10, 18])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([4, 18])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-20, 3])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
}),
stroke: new Stroke({
color: '#000000',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10, 3])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
}),
stroke: new Stroke({
color: '#000000',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([4, 3])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
}),
stroke: new Stroke({
color: '#000000',
width: 3
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-20, -15])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
stroke: new Stroke({
color: '#256308',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10, -15])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: 'rgba(0, 0, 255, 0.3)'
}),
stroke: new Stroke({
color: '#256308',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([4, -15])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: 'rgba(235, 45, 70, 0.6)'
}),
stroke: new Stroke({
color: '#256308',
width: 3
})
})
}));
vectorSource.addFeature(feature);
const vectorLayer = new VectorLayer({
source: vectorSource
});
new Map({
layers: [
vectorLayer
],
target: 'map',
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
zoom: 1
})
});
render();

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