Compare commits

...

457 Commits

Author SHA1 Message Date
ahocevar
5cc1ff0f45 Use beta tag 2019-06-24 09:54:41 +02:00
ahocevar
2df5f85018 Set version to 6.0.0-beta.10 2019-06-24 09:52:07 +02:00
Andreas Hocevar
4a0d6ce43c Merge pull request #9705 from ahocevar/vectortile-render-optimizations
Vector tile renderer optimizations and fixes
2019-06-24 09:50:56 +02:00
Andreas Hocevar
187969cbb3 Merge pull request #9706 from ahocevar/non-browser-screen-check
Do not use self to check browser features
2019-06-24 09:48:59 +02:00
ahocevar
8cdfc6e17c Do not use self to check browser features 2019-06-23 14:26:40 +02:00
ahocevar
9cd35d67a9 Fix clipping and clearing 2019-06-23 14:23:32 +02:00
ahocevar
4d2fa476a3 Simpler z sort 2019-06-23 14:22:56 +02:00
ahocevar
f864c05070 Less frame budget restrictions 2019-06-23 14:07:22 +02:00
ahocevar
3557271e5a Use Image.prototype.decode also in Safari 2019-06-23 14:06:14 +02:00
Andreas Hocevar
8a49e06ebd Merge pull request #9704 from ahocevar/vectortile-reuse-issue
Handle container reuse properly when layers are added/removed
2019-06-22 19:33:59 +02:00
ahocevar
6783f6adb9 Handle container reuse properly when layers are added/removed 2019-06-22 19:12:39 +02:00
Tim Schaub
5eb27f7704 Merge pull request #9703 from openlayers/greenkeeper/eslint-6.0.0
Update eslint to the latest version 🚀
2019-06-22 07:13:34 -06:00
greenkeeper[bot]
df240fe905 chore(package): update eslint to version 6.0.0 2019-06-22 04:08:47 +00:00
Frédéric Junod
300522e3cc Merge pull request #9701 from fredj/overlay_will-change
Remove will-change CSS rule for Overlay container
2019-06-21 16:36:27 +02:00
Tim Schaub
3ede6e32be Merge pull request #9702 from lutzhelm/typecheck-iiif
Fix several TypeScript type check problems
2019-06-21 07:53:59 -06:00
Tim Schaub
ce45a10063 Merge pull request #9700 from KaiVolland/9692-typescript
Solves typescript related issues
2019-06-21 07:48:15 -06:00
Tim Schaub
2438ef167b Merge pull request #9699 from petrsloup/maptiler-url-fix
Fix MapTiler API usage
2019-06-21 07:46:42 -06:00
Lutz Helm
d6dc7a926d Fix several TypeScript type check problems 2019-06-21 15:26:28 +02:00
Frederic Junod
6e6a2cae06 Use version 4 TileJSON from mapbox 2019-06-21 14:33:26 +02:00
Frederic Junod
a6ebad008f Remove will-change CSS rule for Overlay container
Fixes #9467
Fixes #9139

Chrome doesn't force a composition if the `will-change` CSS rule is different from `transform` or `opacity`.
See https://bugs.chromium.org/p/chromium/issues/detail?id=960953
2019-06-21 14:22:46 +02:00
Kai Volland
ed5d4aaf6d Fixes typing issue in mat4.js 2019-06-21 13:35:40 +02:00
Kai Volland
f507efe77d Fixes typing issue in Composite.js 2019-06-21 13:31:27 +02:00
Kai Volland
83173cd385 Fixes typing issue in VectorTile.js 2019-06-21 13:30:35 +02:00
Kai Volland
b6b91abc27 Fixes typing issue in DragPan.js 2019-06-21 13:28:56 +02:00
Petr Sloup
05c791efcd Fix MapTiler API usage 2019-06-21 11:22:24 +02:00
Tim Schaub
2342626a57 Merge pull request #9698 from openlayers/greenkeeper/puppeteer-1.18.0
Update puppeteer to the latest version 🚀
2019-06-20 23:33:59 -06:00
greenkeeper[bot]
7c0a0a4786 chore(package): update puppeteer to version 1.18.0 2019-06-20 22:24:07 +00:00
Frédéric Junod
a35ca03e07 Merge pull request #9636 from fredj/rm_from_webgl
Remove and move code from ol/webgl
2019-06-20 16:16:27 +02:00
Tim Schaub
c522454af1 Merge pull request #9695 from openlayers/greenkeeper/webpack-4.35.0
Update webpack to the latest version 🚀
2019-06-20 07:16:29 -06:00
Frederic Junod
ef10834eb3 Remove unused constants from ol/webgl
And change the `EXTENSIONS` constant to a function
2019-06-20 10:25:22 +02:00
greenkeeper[bot]
8efad7bcff chore(package): update webpack to version 4.35.0 2019-06-20 05:08:42 +00:00
Andreas Hocevar
51c8886d60 Merge pull request #9684 from ahocevar/doc-nav
List complete classes in doc navigation
2019-06-17 15:37:19 +02:00
Frédéric Junod
34a8702202 Merge pull request #9685 from fredj/rm_glContext
Remove glContext from RenderEvent
2019-06-17 14:10:51 +02:00
Frederic Junod
1f00da8d83 Remove glContext from RenderEvent 2019-06-17 13:52:56 +02:00
ahocevar
8d793ad6ec List complete classes in doc navigation 2019-06-17 13:10:02 +02:00
Andreas Hocevar
bd8a7bff16 Merge pull request #9681 from ahocevar/apidoc-fixed-and-improved
Remove duplicates from api docs and make navigation more usable
2019-06-17 08:27:48 +02:00
ahocevar
d059689856 Index classes under modulues 2019-06-17 08:15:49 +02:00
ahocevar
4ea28333f8 Avoid duplicates in api docs 2019-06-17 08:15:17 +02:00
Andreas Hocevar
edebf35135 Merge pull request #9677 from ahocevar/featureformat-tilepixels
Add support for tile pixel projection in feature formats
2019-06-15 08:22:28 +02:00
Frédéric Junod
90b645daa5 Merge pull request #9679 from fredj/cleanup
Set pixelTransform and inversePixelTransform as protected
2019-06-15 07:53:15 +02:00
Andreas Hocevar
9eac927b45 Merge pull request #9678 from ahocevar/geography-class
Update geography class urls
2019-06-14 23:20:47 +02:00
Frederic Junod
ec5e8bfa50 Set pixelTransform and inversePixelTransform as protected
The variables are used in child classes
2019-06-14 14:52:28 +02:00
ahocevar
124e984a6d Fix and simplify geojson-vt example 2019-06-14 14:28:37 +02:00
ahocevar
76f44efbb6 Add support for tile pixels to feature formats 2019-06-14 14:28:37 +02:00
ahocevar
ddaaf6a860 Update geography class urls 2019-06-14 12:53:52 +02:00
Tim Schaub
92c16ecdf5 Merge pull request #9673 from openlayers/greenkeeper/webpack-4.34.0
Update webpack to the latest version 🚀
2019-06-12 19:15:28 -06:00
greenkeeper[bot]
635d7a9189 chore(package): update webpack to version 4.34.0 2019-06-12 23:40:39 +00:00
Tim Schaub
fc6ca5eaf3 Merge pull request #9660 from openlayers/greenkeeper/pixelmatch-5.0.0
Update pixelmatch to the latest version 🚀
2019-06-07 04:08:01 -06:00
greenkeeper[bot]
803f960ded chore(package): update pixelmatch to version 5.0.0 2019-06-07 07:52:43 +00:00
Frédéric Junod
ef1b672323 Merge pull request #9658 from fredj/f9628
Don't use HTMLImageElement.decode method on Safari
2019-06-06 16:34:57 +02:00
Frederic Junod
002dc34455 Don't use HTMLImageElement.decode method on Safari
The decode function is supported by Safari but not when the image is a svg file.
2019-06-06 16:15:36 +02:00
Frédéric Junod
cc8389d588 Merge pull request #9657 from fredj/getFeaturesInExtent_doc
Better documentation for getFeaturesInExtent function
2019-06-06 14:23:11 +02:00
Frederic Junod
a8e0e4e960 Better documentation for getFeaturesInExtent function 2019-06-06 14:08:25 +02:00
Olivier Guyot
9ae7256048 Merge pull request #9562 from jahow/webgl-worker
Optimize the WebGL points renderer using a worker
2019-06-06 08:48:29 +02:00
Frederic Junod
e036767746 Use version 4 TileJSON from mapbox 2019-06-06 08:34:31 +02:00
Frédéric Junod
9a49c91fdd Merge pull request #9653 from openlayers/greenkeeper/coveralls-3.0.4
Update coveralls to the latest version 🚀
2019-06-06 08:19:45 +02:00
greenkeeper[bot]
37ff7f547b chore(package): update coveralls to version 3.0.4 2019-06-06 00:10:14 +00:00
Marc Jansen
c97a728531 Merge pull request #9394 from KaiVolland/docs-import-functions
Introduces import snippets for static functions
2019-06-05 22:20:15 +02:00
Olivier Guyot
811bff0430 Merge pull request #9638 from agpixdev/translate-interaction-filter
#9625: Add filter function to translate interaction
2019-06-05 15:32:29 +02:00
Olivier Guyot
2412fe0211 Webgl / remove handling of element_index_uint extension
From now on we will assume this extension is always enabled.

An error message have been added in the unlikely scenario of a lack
of support.
2019-06-05 14:46:15 +02:00
Tim Schaub
32084a7fce Merge pull request #9649 from openlayers/greenkeeper/webpack-4.33.0
Update webpack to the latest version 🚀
2019-06-04 20:11:55 -07:00
André Garneau
7817cf31c6 Changes following code review
Add a type for FilterFunction and add tests for filter option.
2019-06-04 17:45:28 -04:00
greenkeeper[bot]
2e5aac8dba chore(package): update webpack to version 4.33.0 2019-06-04 20:02:28 +00:00
Frédéric Junod
8b08996703 Merge pull request #9644 from fredj/webgl_layer_compose
Use compose function from ol/transform
2019-06-04 15:35:05 +02:00
Andreas Hocevar
1fbbc56f93 Merge pull request #9645 from ahocevar/no-used-tiles
Handle case of no used tiles
2019-06-04 15:26:27 +02:00
ahocevar
8f77a300de Handle case of no used tiles 2019-06-04 14:07:23 +02:00
Frederic Junod
91d49b26b5 Round the transform values in makeProjectionTransform test 2019-06-04 14:00:39 +02:00
Frederic Junod
02ce2f4bec Use compose function from ol/transform 2019-06-04 13:23:12 +02:00
Andreas Hocevar
d4f98c8e59 Merge pull request #9640 from ahocevar/base-docs
Import options directly instead of importing a typedef
2019-06-04 09:30:38 +02:00
Andreas Hocevar
ab0860a22a Merge pull request #9641 from ahocevar/less-proj-imports
Only import what's needed from projections
2019-06-04 09:27:05 +02:00
ahocevar
dd478167a0 Only import what's needed from projections 2019-06-04 09:14:08 +02:00
ahocevar
2df911e0a8 Import options directly instead of importing a typedef 2019-06-04 08:41:08 +02:00
Andreas Hocevar
e9939ecc38 Merge pull request #9637 from ahocevar/detach-labelcache-on-settarget
Detach label cache on Map#setTarget()
2019-06-03 16:03:30 +02:00
Frédéric Junod
d058439756 Merge pull request #9633 from fredj/rm_typecast
Mark the `layers` property as optional in OverviewMap constructor
2019-06-03 15:46:23 +02:00
ahocevar
8c21c9196d Move label cache listener management to the renderer 2019-06-03 15:13:30 +02:00
ahocevar
68b7831daf Listen to label cache again when we have a target 2019-06-03 14:28:20 +02:00
ahocevar
153e06e4d5 Detach label cache on Map#setTarget() 2019-06-03 14:14:13 +02:00
Andreas Hocevar
9bedfb7cb0 Merge pull request #9634 from ahocevar/remove-old-android-workaround
Remove old Android workaround
2019-06-03 10:17:44 +02:00
ahocevar
1bd23a0c32 Remove old Android workaround 2019-06-03 10:03:53 +02:00
Frederic Junod
50343afa61 Remove unnecessary typecasts in constructors options 2019-06-03 09:08:41 +02:00
Frederic Junod
a9e1ebccd3 Mark the layers property as optional in OverviewMap constructor 2019-06-03 09:07:20 +02:00
Andreas Hocevar
9672142c1e Merge pull request #9629 from ahocevar/reuse-vectortile-overlay
Clear overlay canvas when reusing containers
2019-06-02 18:20:24 +02:00
ahocevar
6123be726a Handle layer removal on shared containers 2019-06-02 13:59:06 +02:00
ahocevar
05d8517686 Clear overlay canvas when reusing containers 2019-06-02 11:07:30 +02:00
Frederic Junod
87d5f4c8bc Use 'helper' from WebGLHelper in tests 2019-06-01 15:35:31 +02:00
Frederic Junod
06be00bbd5 Webgl Helper / add an API for OESElementIndexUint extension 2019-06-01 15:35:27 +02:00
Frederic Junod
7fb113c3dc Mark 'helper' variable protected 2019-06-01 15:33:36 +02:00
Olivier Guyot
98b0c65450 Rendering tests / add custom web worker loader
Also includes a change in the rollup-babel plugin to avoid
adding helpers as dependencies (which would give out errors).
2019-06-01 15:33:36 +02:00
Olivier Guyot
698816030e Webgl points / fix unit tests 2019-06-01 15:33:36 +02:00
Olivier Guyot
03e70bd10e Webgl points / handle using short instead of int for indices
This is controlled by the availability of the OES_element_index_uint
webgl extension.
2019-06-01 15:33:36 +02:00
Olivier Guyot
e0983cb1c6 Webgl worker / add tests, some typing and documentation
The worker currently works by receiving GENERATE_BUFFERS messages and
will send back the same kind of message, with the generated buffers
attached. All properties of the original message are kept, so that
when a GENERATE_BUFFERS message comes back to the main thread it
is possible to know what and how the buffers where generated.

This is typically used for the `projectionTransform` matrix, and
will also be necessary when working with tiles.
2019-06-01 15:33:36 +02:00
Olivier Guyot
a366803cdd Webgl / use the new buffer API in helper & the points renderer 2019-06-01 15:33:36 +02:00
Olivier Guyot
33d007ce01 Webgl buffer / now stores data in typed arrays
The `WebGLBuffer` class API was changed in order to allow populating
the internal array in different ways.
2019-06-01 15:33:31 +02:00
Olivier Guyot
8566cfc227 Webgl points / get back the instructions array from the worker
This means we won't have to recreate a binary buffer (through a typed array)
on every `rebuildBuffer` call.
2019-06-01 15:25:24 +02:00
Olivier Guyot
65be907095 Webgl points / shifts the buffer write logic in a worker
The worker receives a transferable array of instructions
and sends back two transferable arrays (vertex and index buffer).
The projection transform is also sent so that when the main thread
receives the buffers from the worker it also knows which projection to
apply when rendering the geometries.
2019-06-01 15:25:11 +02:00
Olivier Guyot
532b8194b1 Webgl points / use the new typed-array based utils for buffers
`rebuildBuffer` is still a very CPU intensive task and is blocking the
main thread.
2019-06-01 15:20:04 +02:00
Olivier Guyot
eb912d95ca Webgl / refactor utilities to work only on typed arrays
The base webgl renderer module now has two types of utilities:
* `writeXFeatureInstructions` will write a series of values in a given
typed array, which represent how a given feature will be rendered; for points,
this means position, size, color, etc.
* `writeXFeatureToBuffers` will fill up the given index & vertex buffers
with values based on the provided render instructions

As such, the logic for rendering features is:
user-input style > instructions array >(*) index/vertex buffers > draw

(*) this transformation is intended to be done on a worker.
2019-06-01 15:19:37 +02:00
Frédéric Junod
245ded43d4 Merge pull request #9626 from fredj/rm_from_has
Remove TOUCH, POINTER and MSPOINTER from ol/has
2019-06-01 12:09:40 +01:00
Frederic Junod
7c215b2532 Remove TOUCH, POINTER and MSPOINTER from ol/has 2019-06-01 07:18:23 +02:00
Frédéric Junod
579d05a0cb Merge pull request #9624 from fredj/cleanup
Remove typecasts in ol/control/OverviewMap
2019-06-01 06:13:02 +01:00
André Garneau
b42ee8ca0f Add filter function to translate interaction
Add a filter function to the translate interaction. This filter is similar to the one present in the select interaction options and provides the ability to dynamically filter which features to include in the translate interaction. Adding the existing "features" options allows further filtering to take place. In this case the filter is first applied, and features that are passing the filtering need to be present in the "features" options to be further kept. The default filter function always return true (no filtering).
2019-05-31 14:51:13 -04:00
Frederic Junod
ede864c823 Remove typecasts in ol/control/OverviewMap
The `options` type was not correctly detected by the typescript compiler.
2019-05-31 16:18:15 +02:00
ahocevar
a50ef05565 Set version to 6.0.0-beta.9 2019-05-30 15:55:09 +02:00
Tim Schaub
93a607d846 Merge pull request #9615 from tschaub/import-specifiers
Include full filename in import specifier
2019-05-29 09:35:34 -06:00
Tim Schaub
deb00f20fe Include full filename in import specifier 2019-05-29 08:51:10 -06:00
Frédéric Junod
c4e465dcf9 Merge pull request #9592 from fredj/f9587_layerIndex
Remove `layerState` param from `prepareFrame` and `renderFrame` function
2019-05-29 09:27:38 +02:00
Frederic Junod
bfea858306 Add missing extension in import 2019-05-29 09:19:17 +02:00
Frédéric Junod
c92bf29677 Fix spelling
Co-Authored-By: Tim Schaub <tschaub@users.noreply.github.com>
2019-05-29 09:07:05 +02:00
Andreas Hocevar
6675f9be57 Merge pull request #9289 from sbrunner/vector-source-geom
Vector source geom
2019-05-28 11:23:31 +02:00
Frédéric Junod
1a6d67776b Merge pull request #9608 from fredj/md_link
Use markdown link syntax in jsdoc
2019-05-27 14:17:18 +02:00
Stéphane Brunner
889b6a9f43 Removes unnecessary type cast 2019-05-27 11:34:33 +02:00
Stéphane Brunner
970c1bcb66 Make the vector source geometry generic 2019-05-27 11:34:31 +02:00
Frederic Junod
2db953ceb1 Use markdown link syntax in jsdoc 2019-05-27 11:06:12 +02:00
Olivier Guyot
051cc68f24 Merge pull request #9596 from jahow/fix-source-missing-event
Vector source / prevent adding features with duplicate id in the collection
2019-05-26 10:53:58 +02:00
Frederic Junod
40c49a9ce5 Remove layerState param from prepareFrame and renderFrame function 2019-05-25 07:19:10 +02:00
Olivier Guyot
442fa907ce Vector source / prevent adding features with duplicate id...
...in the collection.

Previously two features with the same id could be pushed manually in the
features collection and stay there.

This would cause an error when clearing the source.

Fixes #6183.
2019-05-24 23:29:48 +02:00
Bart van den Eijnden
7044e30529 Merge pull request #9604 from bartvde/window-global
Use window instead of global in addEventListener
2019-05-24 15:17:07 +02:00
Frédéric Junod
7cfe047feb Merge pull request #9599 from openlayers/github_funding
Create FUNDING.yml
2019-05-24 15:14:26 +02:00
Tim Schaub
796f20385d Merge pull request #9598 from openlayers/greenkeeper/puppeteer-1.17.0
Update puppeteer to the latest version 🚀
2019-05-24 06:58:00 -06:00
bartvde
c76aa76743 Use window instead of global in addEventListener 2019-05-24 14:51:32 +02:00
Bart van den Eijnden
2969c9e8fb Merge pull request #9601 from bartvde/fix-addeventlistener2
Use global addEventListener in PluggableMap
2019-05-24 14:11:26 +02:00
bartvde
119c24faa2 Use global addEventListener in PluggableMap 2019-05-24 13:45:19 +02:00
Frédéric Junod
93711ea806 Create FUNDING.yml 2019-05-24 11:19:37 +02:00
Andreas Hocevar
96331c5d95 Merge pull request #9584 from ahocevar/reuse-render-target
Reuse render target
2019-05-24 10:33:36 +02:00
ahocevar
d8f41a9d73 Only reuse target when className is the same 2019-05-24 10:16:20 +02:00
greenkeeper[bot]
311900e441 chore(package): update puppeteer to version 1.17.0 2019-05-24 00:18:21 +00:00
ahocevar
bdb87f06f9 Rework tile image render queue 2019-05-23 15:55:29 +02:00
Frédéric Junod
ddb7da3733 Merge pull request #6217 from fredj/dragpan_primary
Add primaryAction condition to DragPan
2019-05-23 09:50:55 +02:00
Tim Schaub
a358521b2b Merge pull request #9594 from openlayers/greenkeeper/webpack-4.32.2
Update webpack to the latest version 🚀
2019-05-22 21:12:52 -06:00
greenkeeper[bot]
4f833501d7 chore(package): update webpack to version 4.32.2 2019-05-22 23:39:55 +00:00
ahocevar
ace5c65ee5 Smarter opacity handling 2019-05-22 16:47:23 +02:00
ahocevar
ae47d3df58 Use opacity from layer state 2019-05-22 16:47:22 +02:00
ahocevar
4c8effe6fa No tile transition when layer opacity is set 2019-05-22 16:47:22 +02:00
ahocevar
c56ad4363d Canvas opacity instead of css 2019-05-22 16:47:22 +02:00
ahocevar
7895b16043 Reuse container for raster and vector image layers 2019-05-22 16:47:20 +02:00
ahocevar
a45e704be2 Smarter reuse detection 2019-05-22 16:46:46 +02:00
ahocevar
d1f1b468b1 Reuse target for image layers 2019-05-22 16:46:46 +02:00
ahocevar
a55505b36a Reuse containers for tile, vector and vector tile layers 2019-05-22 16:46:40 +02:00
ahocevar
930318ab7a Clip high res tiles out of low res tiles only once 2019-05-22 15:57:15 +02:00
ahocevar
5fe9e06535 Use clipping to not render high res tiles on top of low res 2019-05-22 15:57:15 +02:00
ahocevar
606443bc6d Pass render target of previous layer to next layer 2019-05-22 15:56:51 +02:00
Frederic Junod
ec811bfa1f Add primaryAction condition to DragPan interaction 2019-05-22 15:21:17 +02:00
Tim Schaub
5e8d7f666e Merge pull request #9589 from openlayers/greenkeeper/webpack-4.32.1
Update webpack to the latest version 🚀
2019-05-22 06:35:21 -06:00
greenkeeper[bot]
4f9057f066 chore(package): update webpack to version 4.32.1 2019-05-22 06:59:26 +00:00
Tim Schaub
4ed6413635 Merge pull request #9586 from openlayers/greenkeeper/rollup-plugin-terser-5.0.0
Update rollup-plugin-terser to the latest version 🚀
2019-05-21 18:34:20 -06:00
greenkeeper[bot]
bb5ebaa1ab chore(package): update rollup-plugin-terser to version 5.0.0 2019-05-21 22:32:01 +00:00
Tim Schaub
c9491ed023 Merge pull request #9569 from engsterhold/patch-1
Fix for change in Zoomify.js/CustomTile signature
2019-05-21 06:52:51 -06:00
Tim Schaub
3db13fa3bb Merge pull request #9582 from tschaub/stale
Add app to mark inactive issues as stale
2019-05-21 06:49:56 -06:00
robert
7e4e113ac9 lint fix
Signed-off-by: robert <24939343+engsterhold@users.noreply.github.com>
2019-05-21 12:32:30 +02:00
Tim Schaub
dc4ce62fab Merge pull request #9581 from tschaub/update-webpack
Update webpack and use mode in the loader
2019-05-20 19:43:37 -06:00
Tim Schaub
6288744d70 Configure Stale app
See https://github.com/organizations/openlayers/settings/installations/1008384
2019-05-20 17:56:30 -06:00
Tim Schaub
c0339f167b Use mode from the loader context
See https://github.com/webpack/webpack/pull/9140.
2019-05-20 10:33:59 -06:00
greenkeeper[bot]
60007d8e3c chore(package): update webpack to version 4.32.0 2019-05-20 10:33:20 -06:00
Frédéric Junod
2322131b01 Merge pull request #9576 from fredj/has-geolocation
Remove geolocation detection from ol/has
2019-05-18 09:40:21 +02:00
Frederic Junod
39bb6a8ffe Remove geolocation detection from ol/has 2019-05-18 08:50:33 +02:00
Tim Schaub
0631a121c3 Merge pull request #9575 from tschaub/untwisted-exports
Rework exports for getUid and control defaults
2019-05-17 13:03:14 -06:00
Tim Schaub
c860f15f91 Break the circular dependency by extending a pluggable map 2019-05-17 12:38:32 -06:00
Tim Schaub
c10fd7aaab Avoid overwriting longname for getUid 2019-05-17 12:00:10 -06:00
Andreas Hocevar
7ced251d19 Merge pull request #9574 from jumpinjackie/update-mapguide-demo-server
Update OL MapGuide example to point to my demo MapGuide Server.
2019-05-17 19:49:39 +02:00
Frédéric Junod
637c823fa6 Merge pull request #9571 from fredj/misc_examples
Small examples improvements
2019-05-17 17:00:58 +02:00
Frederic Junod
2d655143c3 Add an Overlay in the export-map example 2019-05-17 16:45:29 +02:00
Jackie Ng
fba95ea3f0 Update OL MapGuide example to point to my demo MapGuide Server.
Fixes #9573
2019-05-18 00:21:53 +10:00
Frédéric Junod
40393cd9a4 Merge pull request #9572 from fredj/upgrade-notes_css
Add a note about CSS removal in upgrade-notes.md
2019-05-17 15:44:31 +02:00
Frederic Junod
10527bd221 Remove margin in full screen
In only affects Safari, in Chrome `margin: 0;` is in the default browser's style sheet.
2019-05-17 15:41:03 +02:00
Frederic Junod
4c2b11f6d7 Add a note about CSS removal in upgrade-notes.md 2019-05-17 15:21:51 +02:00
Frédéric Junod
512a39bafd Merge pull request #9570 from fredj/rm_media_print
Remove CSS print rules in ol.css
2019-05-17 14:58:55 +02:00
Frederic Junod
78c09a0ff6 Add svg icon example 2019-05-17 14:48:03 +02:00
Frederic Junod
6dc00b75e0 Update d3 version in d3 example 2019-05-17 14:27:20 +02:00
Frederic Junod
6b50f1555b Add webgl tag to heatmap layer example 2019-05-17 14:25:34 +02:00
Frederic Junod
a6f098f78b Remove CSS print rules in ol.css
Fixes #7909
2019-05-17 14:21:19 +02:00
engsterhold
f77b0941b8 fixed styling 2019-05-17 13:52:10 +02:00
Tim Schaub
6d06f81ca7 Merge pull request #9563 from tschaub/fragile-docs
Fix @abstract and @module annotations
2019-05-16 16:27:09 -06:00
Tim Schaub
908ecb39e3 Description below @abstract trips up JSDoc 2019-05-16 16:10:30 -06:00
Tim Schaub
6cad19e9d5 Description below @module trips up JSDoc 2019-05-16 16:09:30 -06:00
ahocevar
b0fae46aa6 Do not use css z-index 2019-05-16 22:29:32 +02:00
Andreas Hocevar
17d26acb2f Merge pull request #9560 from ahocevar/simplify-loading
Simplify loading detection loop
2019-05-16 22:27:59 +02:00
Andreas Hocevar
579fadd797 Merge pull request #9561 from ahocevar/map-memory-leak
Remove memory leak caused by label cache listeners
2019-05-16 22:26:56 +02:00
Tim Schaub
9693336d99 Merge pull request #9559 from tschaub/minify-worker
Minify worker
2019-05-16 14:20:11 -06:00
ahocevar
335648d613 Remove memory leak caused by label cache listeners 2019-05-16 21:04:55 +02:00
ahocevar
dc906f79e1 Simplify loading detection loop 2019-05-16 20:19:32 +02:00
Tim Schaub
34a8a484c4 Merge pull request #9558 from tschaub/unlisten
Stop listening for image decoding
2019-05-16 11:46:15 -06:00
Tim Schaub
0d489f2ea9 Minify worker in examples for a production build 2019-05-16 10:41:33 -06:00
Tim Schaub
d49e166506 Minify worker source 2019-05-16 10:35:18 -06:00
Frederic Junod
a0e6af425e Add tests for listenImage function, fix private variables initialization 2019-05-16 16:42:37 +02:00
engsterhold
e69b15d33e Bandaid fix for change in Zoomify.js/CustomTile signature
The recent addition of tilePixelRatio to the Zoomify.js/CustomTile constructor broke parameter binding in IIIF.js/IIIF.
The fix mirrors the change in the  Zoomify.js/Zoomify constructor
2019-05-16 16:10:58 +02:00
Tim Schaub
ee9a0bcd05 Stop listening for image decoding 2019-05-16 08:06:12 -06:00
Tim Schaub
442fbb13d2 Merge pull request #9550 from tschaub/worker
Setup for building workers
2019-05-16 07:02:34 -06:00
Frédéric Junod
fddc5bcc5b Merge pull request #9555 from fredj/rm_unused
Remove unused roundUpToPowerOfTwo function
2019-05-16 13:57:19 +02:00
Frederic Junod
c2058af13a Remove unused roundUpToPowerOfTwo function 2019-05-16 12:11:58 +02:00
Frederic Junod
bb022050ed Add 'webworker' lib into the TypeScript's compilerOptions 2019-05-16 09:49:29 +02:00
Frédéric Junod
a8e5cb1e12 Merge pull request #9553 from openlayers/greenkeeper/ol-mapbox-style-5.0.0-beta.2
chore(package): update ol-mapbox-style to version 5.0.0-beta.2
2019-05-16 09:43:56 +02:00
Frédéric Junod
1628ce8729 Merge pull request #9551 from fredj/img_decode
Use HTMLImageElement.decode if available
2019-05-16 09:30:55 +02:00
greenkeeper[bot]
37f96ddcfa chore(package): update ol-mapbox-style to version 5.0.0-beta.2 2019-05-16 07:21:23 +00:00
Andreas Hocevar
1fc75fdc68 Merge pull request #9500 from edellucien/kml_extended_data
KML string validation with extendedData
2019-05-16 09:20:03 +02:00
lucien
10c4ec0b37 Only use 'pushSerializeAndPop' later in code to write extendedData after 2019-05-16 09:10:40 +02:00
Frederic Junod
2e34dd0faf Use HTMLImageElement.decode if available 2019-05-16 08:53:29 +02:00
Tim Schaub
b7b37f9548 Add worker loader to the tests 2019-05-15 16:49:54 -06:00
Tim Schaub
05f13bb363 Add worker loader to the examples 2019-05-15 16:49:38 -06:00
Tim Schaub
e307410301 A task to inline workers 2019-05-15 16:38:06 -06:00
Tim Schaub
5a4541dadb Merge pull request #9534 from tschaub/simpler-mapbox-layer-example
Remove unnecessary parts from the Mapbox layer example
2019-05-15 14:00:46 -06:00
Andreas Hocevar
56ec6b093e Merge pull request #9548 from ahocevar/italic-labels
Avoid cut off labels for italic fonts
2019-05-15 16:58:17 +02:00
Frédéric Junod
61d753c803 Merge pull request #9549 from fredj/rm_unused
Remove unused getReplayTransform_ function in VectorTileLayer
2019-05-15 16:31:09 +02:00
Tim Schaub
f312706269 Remove unnecessary parts from the Mapbox layer example 2019-05-15 08:26:43 -06:00
Frederic Junod
f33ad5e025 Remove unused getReplayTransform_ function in VectorTileLayer 2019-05-15 15:10:54 +02:00
ahocevar
2e31f716ed Avoid cut off labels for italic text 2019-05-15 15:01:12 +02:00
Tim Schaub
eafb657264 Merge pull request #9545 from tschaub/default-view-extent
Avoid panning off the edge of the world
2019-05-15 04:58:29 -06:00
Tim Schaub
0cee259d0b Merge pull request #9539 from tschaub/event-error
Document existing error event type
2019-05-15 04:53:57 -06:00
Tim Schaub
be8797f355 Merge pull request #9541 from tschaub/rbush-three
Upgrade to rbush@3
2019-05-15 04:53:15 -06:00
Tim Schaub
d652bfc4a7 Merge pull request #9543 from tschaub/upgrade-jsdoc-plugin
Update jsdoc-plugin-typescript to version 2.0.1
2019-05-15 04:52:26 -06:00
Andreas Hocevar
11607caa81 Merge pull request #9536 from ahocevar/font-cache-hits
More font cache hits
2019-05-15 12:13:40 +02:00
ahocevar
41e958ea1f Split text into single chars or don't split at all 2019-05-15 11:55:29 +02:00
Olivier Guyot
39de2451bc Merge pull request #9537 from jahow/webgl-geojson-refactoring
WebGL / Points renderer refactoring
2019-05-15 11:44:40 +02:00
Olivier Guyot
e11e3c5f6e Webgl / minor function renaming 2019-05-15 11:30:24 +02:00
Olivier Guyot
c705775d75 Linting 2019-05-15 10:20:31 +02:00
Olivier Guyot
9ca75e9d43 Webgl points / rebuild buffers when source change 2019-05-15 10:18:53 +02:00
Olivier Guyot
5d2b7fe4bb Webgl points / use the helper ton compute the projection transform
The `WebGLHelper` class now provides a `makeProjectionTransform` method
that updates a transform to match the projection for a given frame state.

This also means that the WebGLHelper does not set the projection matrix
uniform anymore, this is the responsibility of the renderer as
the rendered coordinates will not be in world space from now on.
2019-05-15 10:18:47 +02:00
Olivier Guyot
fb455891ce Webgl points / make coordinates in view space to avoid precision glitches
Fixes #9479
2019-05-15 10:18:47 +02:00
Olivier Guyot
3e2e45ce6d Webgl helper / add the possibility to use transforms as custom uniforms
These will be translated into 4x4 matrices in GLSL.
2019-05-15 10:18:47 +02:00
Olivier Guyot
75eb62363a WebGL points / rebuild buffers only when extent changed 2019-05-15 10:18:47 +02:00
Olivier Guyot
523097903a WebGL points / rebuild buffers on every non animation frame 2019-05-15 10:18:22 +02:00
Olivier Guyot
c6d214b585 Webgl / implement support for custom attributes in webgl buffers
Only numerical attributes can be pushed in webgl buffers.
2019-05-15 10:15:55 +02:00
Frédéric Junod
c9604dbd69 Merge pull request #9546 from fredj/canvas_optim
Lazily create the hit detection context
2019-05-15 10:15:02 +02:00
Frédéric Junod
df37519858 Initialize hitDetectionContext to null
Co-Authored-By: Andreas Hocevar <andreas.hocevar@gmail.com>
2019-05-15 10:03:43 +02:00
Frederic Junod
10c6009ffa Lazily create the hit detection context 2019-05-15 09:52:57 +02:00
Olivier Guyot
27e520add4 WebGL points / use pushFeatureInBuffer util
Feature objects are converted to geoJSON with the properties
set for rendering.
2019-05-15 09:47:00 +02:00
Olivier Guyot
3a429d3f6c Webgl / add utils for pushing geojson geometries in webgl buffers
For now only point geometries are handled.
2019-05-15 09:44:41 +02:00
Olivier Guyot
5e36468245 Webgl / add a simple Layer renderer for common logic
This will eventually provides utilities for manipulating & rendering data
2019-05-15 09:43:29 +02:00
Olivier Guyot
a2d83f5358 WebGL points / add minimal tests 2019-05-15 09:42:15 +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
217c6ba764 Avoid panning off the edge of the world 2019-05-14 20:15:51 -06:00
greenkeeper[bot]
039f21274b chore(package): update jsdoc-plugin-typescript to version 2.0.1 2019-05-14 18:59:50 -06:00
Tim Schaub
09fdd30876 Upgrade to rbush@3 2019-05-14 18:43:08 -06: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
811e5f60eb Document existing error event type 2019-05-14 14:28:00 -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
lucien
81f99f1579 Write placemark's ExtendedData tag after Style tag 2019-05-07 09:02:28 +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
Kai Volland
9860699d5f Introduces import snippets for static functions
Adds snippets for import of modules and their
exported functions to the API documentation.
2019-04-04 10:07:55 +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
ahocevar
56f37ab347 Disable transition when an interim tile is available 2019-03-03 23:07:46 +01:00
256 changed files with 51333 additions and 2262 deletions

View File

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

8
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: openlayers
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL

17
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- blocker
- regression
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -4,6 +4,48 @@
#### Backwards incompatible changes #### Backwards incompatible changes
#### Removal of `TOUCH` constant from `ol/has`
If you were previously using this constant, you can check if `'ontouchstart'` is defined in `window` instead.
```js
if ('ontouchstart' in window) {
// ...
}
```
#### Removal of `GEOLOCATION` constant from `ol/has`
If you were previously using this constant, you can check if `'geolocation'` is defined in `navigator` instead.
```js
if ('geolocation' in navigator) {
// ...
}
```
#### Removal of CSS print rules
The CSS media print rules were removed from the `ol.css` file. To get the previous behavior, use the following CSS:
```css
@media print {
.ol-control {
display: none;
}
}
```
#### 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 ##### 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. Previously, these methods allowed setting values that were inconsistent with the given view constraints.
@@ -22,9 +64,9 @@ Previously, this options only constrained the view *center*. This behaviour can
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input. 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 ##### The view 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`. Previously, maps showed multiple worlds at low zoom levels. In addition, it used to be possible to pan off the north or south edge of the world. Now, the view is restricted to show only one world, and you cannot pan off the edge. To get the previous behavior, configure the `ol/View` with `multiWorld: true`.
##### Removal of deprecated methods ##### Removal of deprecated methods
@@ -88,6 +130,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`. 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 ##### 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. 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.

View File

@@ -1,43 +1,43 @@
<table><tr> <table><tr>
<th width="33.3%">Map</th><th width="33.3%">View</th><th width="33.3%">Layers</th> <th width="33.3%">Map</th><th width="33.3%">View</th><th width="33.3%">Layers</th>
</tr><tr> </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> <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>
[Overview](module-ol_Map-Map.html)<br> <a href="module-ol_Map-Map.html">Overview</a><br>
[Creation](module-ol_Map-Map.html#Map)<br> <a href="module-ol_Map-Map.html#Map">Creation</a><br>
[Events](module-ol_MapBrowserEvent-MapBrowserEvent.html)</td> <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> <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> <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 [sources](module-ol_source_Source-Source.html).</p> <td><p>Layers are lightweight containers that get their data from <a href="module-ol_source_Source-Source.html">sources</a>.</p>
[ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)<br> <a href="module-ol_layer_Tile-TileLayer.html">ol/layer/Tile</a><br>
[ol/layer/Image](module-ol_layer_Image-ImageLayer.html)<br> <a href="module-ol_layer_Image-ImageLayer.html">ol/layer/Image</a><br>
[ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)<br> <a href="module-ol_layer_Vector-VectorLayer.html">ol/layer/Vector</a><br>
[ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)</td> <a href="module-ol_layer_VectorTile-VectorTileLayer.html">ol/layer/VectorTile</a></td>
</tr><tr> </tr><tr>
<th>Controls</th><th>Interactions</th><th>Sources and formats</th> <th>Controls</th><th>Interactions</th><th>Sources and formats</th>
</tr><tr> </tr><tr>
<td>[Map default controls](module-ol_control_util.html#.defaults)<br> <td><a href="module-ol_control_util.html#.defaults">Map default controls</a><br>
[All controls](module-ol_control_Control-Control.html) <a href="module-ol_control_Control-Control.html">All controls</a>
</td> </td>
<td> <td>
[Map default interactions](module-ol_interaction.html#~defaults)<br> <a href="module-ol_interaction.html#~defaults">Map default interactions</a><br>
Interactions for [vector features](module-ol_Feature-Feature.html) Interactions for <a href="module-ol_Feature-Feature.html">vector features</a>
<ul><li>[ol/interaction/Select](module-ol_interaction_Select-Select.html)</li> <ul><li><a href="module-ol_interaction_Select-Select.html">ol/interaction/Select</a></li>
<li>[ol/interaction/Draw](module-ol_interaction_Draw-Draw.html)</li> <li><a href="module-ol_interaction_Draw-Draw.html">ol/interaction/Draw</a></li>
<li>[ol/interaction/Modify](module-ol_interaction_Modify-Modify.html)</li></ul> <li><a href="module-ol_interaction_Modify-Modify.html">ol/interaction/Modify</a></li></ul>
[All interactions](module-ol_interaction_Interaction-Interaction.html)</td> <a href="module-ol_interaction_Interaction-Interaction.html">All interactions</a></td>
<td>[Tile sources](module-ol_source_Tile-TileSource.html) for [ol/layer/Tile](module-ol_layer_Tile-TileLayer.html) <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>[Image sources](module-ol_source_Image-ImageSource.html) for [ol/layer/Image](module-ol_layer_Image-ImageLayer.html) <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>[Vector sources](module-ol_source_Vector-VectorSource.html) for [ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html) <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>[Vector tile sources](module-ol_source_VectorTile-VectorTile.html) for [ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html) <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>[Formats](module-ol_format_Feature-FeatureFormat.html) for reading/writing vector data <br><a href="module-ol_format_Feature-FeatureFormat.html">Formats</a> for reading/writing vector data
<br>[ol/format/WMSCapabilities](module-ol_format_WMSCapabilities-WMSCapabilities.html)</td></tr> <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><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> <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>
[ol/proj](module-ol_proj.html)</td> <a href="module-ol_proj.html">ol/proj</a></td>
<td><p>Changes to all [ol/Object](module-ol_Object-BaseObject.html)s can be observed by calling the [object.on('propertychange')](module-ol_Object-BaseObject.html#on) method. Listeners receive an [ol/Object.ObjectEvent](module-ol_Object-ObjectEvent.html) with information on the changed property and old value.</p> <td><p>Changes to all <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> <td>
[ol/Geolocation](module-ol_Geolocation.html)<br> <a href="module-ol_Geolocation.html">ol/Geolocation</a><br>
[ol/Overlay](module-ol_Overlay-Overlay.html)<br></td> <a href="module-ol_Overlay-Overlay.html">ol/Overlay</a><br></td>
</tr></table> </tr></table>
&nbsp; &nbsp;

View File

@@ -59,7 +59,9 @@ function includeAugments(doclet) {
}); });
} }
cls._hideConstructor = true; cls._hideConstructor = true;
delete cls.undocumented; if (!cls.undocumented) {
cls._documented = true;
}
} }
} }
} }
@@ -150,6 +152,9 @@ exports.handlers = {
// Remove all other undocumented symbols // Remove all other undocumented symbols
doclet.undocumented = true; doclet.undocumented = true;
} }
if (doclet._documented) {
delete doclet.undocumented;
}
} }
} }

View File

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

View File

@@ -214,55 +214,39 @@ function buildNav(members) {
} }
return 0; return 0;
}); });
function createEntry(type, v) {
return {
type: type,
longname: v.longname,
name: v.name,
classes: find({
kind: 'class',
memberof: v.longname
}).map(createEntry.bind(this, 'class')),
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
events: find({
kind: 'event',
memberof: v.longname
})
};
}
_.each(merged, function(v) { _.each(merged, function(v) {
// exclude interfaces from sidebar // exclude interfaces from sidebar
if (v.interface !== true) { if (v.interface !== true) {
if (v.kind == 'module') { if (v.kind == 'module') {
nav.push({ nav.push(createEntry('module', v));
type: 'module',
longname: v.longname,
name: v.name,
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
events: find({
kind: 'event',
memberof: v.longname
})
});
}
if (v.kind == 'class') {
nav.push({
type: 'class',
longname: v.longname,
name: v.name,
members: find({
kind: 'member',
memberof: v.longname
}),
methods: find({
kind: 'function',
memberof: v.longname
}),
typedefs: find({
kind: 'typedef',
memberof: v.longname
}),
fires: v.fires,
events: find({
kind: 'event',
memberof: v.longname
})
});
} }
} }
}); });

View File

@@ -12,13 +12,18 @@ $(function () {
var $item = $(v); var $item = $(v);
if ($item.data('name') && regexp.test($item.data('name'))) { if ($item.data('name') && regexp.test($item.data('name'))) {
const container = $item.parent().parent().parent();
container.show();
container.closest('.itemMembers').show();
container.closest('.item').show();
$item.show(); $item.show();
$item.closest('.itemMembers').show(); $item.closest('.itemMembers').show();
$item.closest('.item').show(); $item.closest('.item').show();
} }
}); });
} else { } else {
$el.find('.item, .itemMembers').show(); $el.find('.item, .itemMembers').hide();
$('.navigation>ul>li').show();
} }
$el.find('.list').scrollTop(0); $el.find('.list').scrollTop(0);

View File

@@ -18,7 +18,7 @@
<sup class="variation"><?js= doc.variation ?></sup> <sup class="variation"><?js= doc.variation ?></sup>
<?js } ?></h2> <?js } ?></h2>
<br> <br>
<?js if (doc.stability || doc.kind == 'namespace') { <?js if (doc.stability || doc.kind == 'namespace' || doc.kind == 'module') {
var ancestors = doc.ancestors.map(a => a.replace(/>\./g, '>').replace(/\.</g, '<')).join('/'); var ancestors = doc.ancestors.map(a => a.replace(/>\./g, '>').replace(/\.</g, '<')).join('/');
var parts = []; var parts = [];
if (ancestors) { if (ancestors) {
@@ -26,8 +26,21 @@
} }
var importPath = parts.join('/'); var importPath = parts.join('/');
?> ?>
<?js
var nameParts = doc.name.split('/');
var moduleName = nameParts[nameParts.length - 1];
if(moduleName) {
var firstChar = moduleName.charAt(0);
moduleName = firstChar.toUpperCase() + moduleName.slice(1);
var isClassModule = firstChar.toUpperCase() === firstChar;
}
?>
<?js if (doc.kind == 'module' && !isClassModule && nameParts.length < 3) {?>
<pre class="prettyprint source"><code>import * as ol<?js= moduleName ?> from '<?js= doc.name ?>';</code></pre>
<?js } else if(doc.kind !== 'module') { ?>
<pre class="prettyprint source"><code>import <?js= doc.name ?> from '<?js= importPath ?>';</code></pre> <pre class="prettyprint source"><code>import <?js= doc.name ?> from '<?js= importPath ?>';</code></pre>
<?js } ?> <?js } ?>
<?js } ?>
<?js if (doc.classdesc) { ?> <?js if (doc.classdesc) { ?>
<div class="class-description"><?js= doc.classdesc ?></div> <div class="class-description"><?js= doc.classdesc ?></div>
<?js } ?> <?js } ?>
@@ -143,6 +156,7 @@
<h3 class="subsection-title">Methods</h3> <h3 class="subsection-title">Methods</h3>
<dl><?js methods.forEach(function(m) { ?> <dl><?js methods.forEach(function(m) { ?>
<?js m.parent = doc ?>
<?js= self.partial('method.tmpl', m) ?> <?js= self.partial('method.tmpl', m) ?>
<?js }); ?></dl> <?js }); ?></dl>
<?js } ?> <?js } ?>

View File

@@ -27,6 +27,10 @@ var self = this;
</dt> </dt>
<dd class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>"> <dd class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
<?js if (data.parent && data.parent.kind == 'module' && data.parent.name.split('ol/').length < 3) { ?>
<pre class="prettyprint source"><code>import {<?js= data.name ?>} from '<?js= data.parent.name ?>';</code></pre>
<?js } ?>
<?js if (data.description) { ?> <?js if (data.description) { ?>
<div class="description"> <div class="description">
<?js= data.description ?> <?js= data.description ?>

View File

@@ -10,11 +10,12 @@ function toShortName(name) {
</div> </div>
<ul class="list"> <ul class="list">
<?js <?js
this.nav.forEach(function (item) { let navbuilder;
this.nav.forEach(navbuilder = function (item) {
?> ?>
<li class="item" data-name="<?js= item.longname ?>"> <li class="item" data-name="<?js= item.longname ?>">
<span class="title"> <span class="title">
<?js= self.linkto(item.longname, item.longname.replace('module:', '')) ?> <?js= self.linkto(item.longname, item.type === 'module' ? item.longname.replace('module:', '') : item.name) ?>
<?js if (item.type === 'namespace' && <?js if (item.type === 'namespace' &&
(item.members.length + item.typedefs.length + item.methods.length + (item.members.length + item.typedefs.length + item.methods.length +
item.events.length > 0)) { ?> item.events.length > 0)) { ?>
@@ -22,6 +23,18 @@ function toShortName(name) {
</span> </span>
<ul class="members itemMembers"> <ul class="members itemMembers">
<?js <?js
if (item.classes.length) {
?>
<span class="subtitle">Classes</span>
<?js
item.classes.forEach(function (v) {
navbuilder(v);
});
}
?>
</ul>
<ul class="members itemMembers">
<?js
if (item.members.length) { if (item.members.length) {
?> ?>
<span class="subtitle">Members</span> <span class="subtitle">Members</span>

View File

@@ -220,3 +220,19 @@ Duplicate item added to a unique collection. For example, it may be that you tr
### 59 ### 59
Invalid command found in the PBF. This indicates that the loaded vector tile may be corrupt. 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.
### 62
A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`.
### 63
Support for the `OES_element_index_uint` WebGL extension is mandatory for WebGL layers.

View File

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

View File

@@ -5,6 +5,7 @@ import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js'; import {OSM, Vector as VectorSource} from '../src/ol/source.js';
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js'; import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
/** @type {VectorSource<import("../src/ol/geom/SimpleGeometry.js").default>} */
const source = new VectorSource({ const source = new VectorSource({
url: 'data/geojson/switzerland.geojson', url: 'data/geojson/switzerland.geojson',
format: new GeoJSON() format: new GeoJSON()
@@ -51,21 +52,21 @@ const zoomtoswitzerland =
document.getElementById('zoomtoswitzerland'); document.getElementById('zoomtoswitzerland');
zoomtoswitzerland.addEventListener('click', function() { zoomtoswitzerland.addEventListener('click', function() {
const feature = source.getFeatures()[0]; const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry()); const polygon = feature.getGeometry();
view.fit(polygon, {padding: [170, 50, 30, 150]}); view.fit(polygon, {padding: [170, 50, 30, 150]});
}, false); }, false);
const zoomtolausanne = document.getElementById('zoomtolausanne'); const zoomtolausanne = document.getElementById('zoomtolausanne');
zoomtolausanne.addEventListener('click', function() { zoomtolausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1]; const feature = source.getFeatures()[1];
const point = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry()); const point = feature.getGeometry();
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50}); view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
}, false); }, false);
const centerlausanne = document.getElementById('centerlausanne'); const centerlausanne = document.getElementById('centerlausanne');
centerlausanne.addEventListener('click', function() { centerlausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1]; const feature = source.getFeatures()[1];
const point = /** @type {import("../src/ol/geom/Point.js").default} */ (feature.getGeometry()); const point = feature.getGeometry();
const size = map.getSize(); const size = map.getSize();
view.centerOn(point.getCoordinates(), size, [570, 500]); view.centerOn(point.getCoordinates(), size, [570, 500]);
}, false); }, false);

View File

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

View File

@@ -129,7 +129,7 @@ const map = new Map({
layers: [ layers: [
new TileLayer({ new TileLayer({
source: new TileJSON({ source: new TileJSON({
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure' url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json'
}) })
}), }),
new VectorLayer({ new VectorLayer({

View File

@@ -6,7 +6,7 @@ docs: >
The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a SVG element. The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a SVG element.
tags: "d3" tags: "d3"
resources: resources:
- https://unpkg.com/d3@4.12.0/build/d3.js - https://unpkg.com/d3@5.9.2/dist/d3.js
- https://unpkg.com/topojson@3.0.2/dist/topojson.js - https://unpkg.com/topojson@3.0.2/dist/topojson.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

4
examples/d3.js vendored
View File

@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import {getWidth, getCenter} from '../src/ol/extent.js'; import {getWidth, getCenter} from '../src/ol/extent.js';
import {Layer, Tile as TileLayer} from '../src/ol/layer.js'; import {Layer, Tile as TileLayer} from '../src/ol/layer.js';
import SourceState from '../src/ol/source/State'; import SourceState from '../src/ol/source/State.js';
import {fromLonLat, toLonLat} from '../src/ol/proj.js'; import {fromLonLat, toLonLat} from '../src/ol/proj.js';
import Stamen from '../src/ol/source/Stamen.js'; import Stamen from '../src/ol/source/Stamen.js';
@@ -85,7 +85,7 @@ const map = new Map({
/** /**
* Load the topojson data and create an ol/layer/Image for that data. * Load the topojson data and create an ol/layer/Image for that data.
*/ */
d3.json('data/topojson/us.json', function(error, us) { d3.json('data/topojson/us.json').then(function(us) {
const layer = new CanvasLayer({ const layer = new CanvasLayer({
features: topojson.feature(us, us.objects.counties) features: topojson.feature(us, us.objects.counties)

File diff suppressed because it is too large Load Diff

7
examples/data/square.svg Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg">
<g>
<rect width="20" height="20" style="fill:#fff" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 194 B

View File

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

6
examples/export-map.css Normal file
View File

@@ -0,0 +1,6 @@
.overlay {
background-color: yellow;
border-radius: 6px;
padding: 4px;
white-space: nowrap;
}

View File

@@ -3,12 +3,13 @@ layout: example.html
title: Map Export title: Map Export
shortdesc: Example of exporting a map as a PNG image. shortdesc: Example of exporting a map as a PNG image.
docs: > 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. library.
tags: "export, png, openstreetmap" 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> <div id="map" class="map"></div>
<div style="display: none;">
<div class="overlay" id="null">Null Island</div>
</div>
<a id="export-png" class="btn btn-default"><i class="fa fa-download"></i> Download PNG</a> <a id="export-png" class="btn btn-default"><i class="fa fa-download"></i> Download PNG</a>
<a id="image-download" download="map.png"></a> <a id="image-download" download="map.png"></a>

View File

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

View File

@@ -7,7 +7,6 @@ docs: >
tags: "export, pdf, openstreetmap" tags: "export, pdf, openstreetmap"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js - 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="row-fluid">
<div class="span12"> <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 {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {OSM, Vector as VectorSource} from '../src/ol/source.js'; import {OSM, Vector as VectorSource} from '../src/ol/source.js';
import {toJpeg} from 'html-to-image';
const raster = new TileLayer({ const raster = new TileLayer({
source: new OSM() source: new OSM()
}); });
@@ -41,6 +43,15 @@ const dims = {
a5: [210, 148] 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'); const exportButton = document.getElementById('export-pdf');
exportButton.addEventListener('click', function() { exportButton.addEventListener('click', function() {
@@ -57,15 +68,14 @@ exportButton.addEventListener('click', function() {
const extent = map.getView().calculateExtent(size); const extent = map.getView().calculateExtent(size);
map.once('rendercomplete', function() { 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); const pdf = new jsPDF('landscape', undefined, format);
pdf.addImage(dataUrl, 'JPEG', 0, 0, dim[0], dim[1]); pdf.addImage(dataUrl, 'JPEG', 0, 0, dim[0], dim[1]);
pdf.save('map.pdf'); pdf.save('map.pdf');
// Reset original map size // Reset original map size
map.setSize(size); map.setSize(size);
map.getView().fit(extent, { map.getView().fit(extent, {
size: size, size: size
constrainResolution: false
}); });
exportButton.disabled = false; exportButton.disabled = false;
document.body.style.cursor = 'auto'; document.body.style.cursor = 'auto';

View File

@@ -2,8 +2,8 @@ import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
import {defaults as defaultControls} from '../src/ol/control/util'; import {defaults as defaultControls} from '../src/ol/control.js';
import ZoomSlider from '../src/ol/control/ZoomSlider'; import ZoomSlider from '../src/ol/control/ZoomSlider.js';
const view = new View({ const view = new View({
center: [328627.563458, 5921296.662223], center: [328627.563458, 5921296.662223],

View File

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

View File

@@ -67,10 +67,10 @@ const routeFeature = new Feature({
type: 'route', type: 'route',
geometry: route geometry: route
}); });
const geoMarker = new Feature({ const geoMarker = /** @type Feature<import("../src/ol/geom/Point").default> */(new Feature({
type: 'geoMarker', type: 'geoMarker',
geometry: new Point(routeCoords[0]) geometry: new Point(routeCoords[0])
}); }));
const startMarker = new Feature({ const startMarker = new Feature({
type: 'icon', type: 'icon',
geometry: new Point(routeCoords[0]) geometry: new Point(routeCoords[0])
@@ -191,7 +191,7 @@ function stopAnimation(ended) {
// if animation cancelled set the marker at the beginning // if animation cancelled set the marker at the beginning
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0]; const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
const geometry = /** @type {import("../src/ol/geom/Point").default} */ (geoMarker.getGeometry()); const geometry = geoMarker.getGeometry();
geometry.setCoordinates(coord); geometry.setCoordinates(coord);
//remove listener //remove listener
vectorLayer.un('postrender', moveFeature); vectorLayer.un('postrender', moveFeature);

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,163 @@
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.js';
import Point from '../src/ol/geom/Point.js';
import VectorLayer from '../src/ol/layer/Vector.js';
import {Vector} from '../src/ol/source.js';
import {fromLonLat} from '../src/ol/proj.js';
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer.js';
import {clamp, lerp} from '../src/ol/math.js';
import Stamen from '../src/ol/source/Stamen.js';
const vectorSource = new Vector({
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,5 +1,6 @@
.map:-webkit-full-screen { .map:-webkit-full-screen {
height: 100%; height: 100%;
margin: 0;
} }
.map:-ms-fullscreen { .map:-ms-fullscreen {
height: 100%; height: 100%;

View File

@@ -1,5 +1,6 @@
.fullscreen:-webkit-full-screen { .fullscreen:-webkit-full-screen {
height: 100%; height: 100%;
margin: 0;
} }
.fullscreen:-ms-fullscreen { .fullscreen:-ms-fullscreen {
height: 100%; height: 100%;

View File

@@ -1,5 +1,6 @@
.map:-webkit-full-screen { .map:-webkit-full-screen {
height: 100%; height: 100%;
margin: 0;
} }
.map:-ms-fullscreen { .map:-ms-fullscreen {
height: 100%; height: 100%;

View File

@@ -6,7 +6,7 @@ import VectorTileSource from '../src/ol/source/VectorTile.js';
import {Tile as TileLayer, VectorTile as VectorTileLayer} from '../src/ol/layer.js'; import {Tile as TileLayer, VectorTile as VectorTileLayer} from '../src/ol/layer.js';
import Projection from '../src/ol/proj/Projection.js'; import Projection from '../src/ol/proj/Projection.js';
// Converts geojson-vt data to GeoJSON
const replacer = function(key, value) { const replacer = function(key, value) {
if (value.geometry) { if (value.geometry) {
let type; let type;
@@ -46,11 +46,6 @@ const replacer = function(key, value) {
} }
}; };
const tilePixels = new Projection({
code: 'TILE_PIXELS',
units: 'tile-pixels'
});
const map = new Map({ const map = new Map({
layers: [ layers: [
new TileLayer({ new TileLayer({
@@ -73,23 +68,22 @@ fetch(url).then(function(response) {
debug: 1 debug: 1
}); });
const vectorSource = new VectorTileSource({ const vectorSource = new VectorTileSource({
format: new GeoJSON(), format: new GeoJSON({
tileLoadFunction: function(tile) { // Data returned from geojson-vt is in tile pixel units
const format = tile.getFormat(); dataProjection: new Projection({
const tileCoord = tile.getTileCoord(); code: 'TILE_PIXELS',
units: 'tile-pixels',
extent: [0, 0, 4096, 4096]
})
}),
tileUrlFunction: function(tileCoord) {
const data = tileIndex.getTile(tileCoord[0], tileCoord[1], tileCoord[2]); const data = tileIndex.getTile(tileCoord[0], tileCoord[1], tileCoord[2]);
const geojson = JSON.stringify({
const features = format.readFeatures(
JSON.stringify({
type: 'FeatureCollection', type: 'FeatureCollection',
features: data ? data.features : [] features: data ? data.features : []
}, replacer)); }, replacer);
tile.setLoader(function() { return 'data:application/json;charset=UTF-8,' + geojson;
tile.setFeatures(features); }
tile.setProjection(tilePixels);
});
},
url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction
}); });
const vectorLayer = new VectorTileLayer({ const vectorLayer = new VectorTileLayer({
source: vectorSource source: vectorSource

View File

@@ -4,7 +4,7 @@ title: Earthquakes Heatmap
shortdesc: Demonstrates the use of a heatmap layer. shortdesc: Demonstrates the use of a heatmap layer.
docs: > docs: >
This example parses a KML file and renders the features as a <code>ol/layer/Heatmap</code> layer. This example parses a KML file and renders the features as a <code>ol/layer/Heatmap</code> layer.
tags: "heatmap, kml, vector, style" tags: "heatmap, kml, vector, style, webgl"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
<form> <form>

View File

@@ -25,7 +25,7 @@ rome.setStyle(new Style({
image: new Icon({ image: new Icon({
color: '#8959A8', color: '#8959A8',
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/square.svg'
}) })
})); }));
@@ -56,7 +56,7 @@ const vectorLayer = new VectorLayer({
const rasterLayer = new TileLayer({ const rasterLayer = new TileLayer({
source: new TileJSON({ source: new TileJSON({
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure', url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
crossOrigin: '' crossOrigin: ''
}) })
}); });

View File

@@ -13,5 +13,8 @@ docs: >
The dataset contains around 80k points and can be found here: https://www.kaggle.com/NUFORC/ufo-sightings The dataset contains around 80k points and can be found here: https://www.kaggle.com/NUFORC/ufo-sightings
tags: "webgl, icon, sprite, point, ufo" tags: "webgl, icon, sprite, point, ufo"
cloak:
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
value: Your Mapbox access token from https://mapbox.com/ here
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -1,16 +1,17 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import TileJSON from '../src/ol/source/TileJSON'; import TileJSON from '../src/ol/source/TileJSON.js';
import Feature from '../src/ol/Feature'; import Feature from '../src/ol/Feature.js';
import Point from '../src/ol/geom/Point'; import Point from '../src/ol/geom/Point.js';
import VectorLayer from '../src/ol/layer/Vector'; import VectorLayer from '../src/ol/layer/Vector.js';
import {Vector} from '../src/ol/source'; import {Vector} from '../src/ol/source.js';
import {fromLonLat} from '../src/ol/proj'; import {fromLonLat} from '../src/ol/proj.js';
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer'; import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer.js';
import {lerp} from '../src/ol/math'; import {lerp} from '../src/ol/math.js';
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
const features = [];
const vectorSource = new Vector({ const vectorSource = new Vector({
features: [], features: [],
attributions: 'National UFO Reporting Center' attributions: 'National UFO Reporting Center'
@@ -39,16 +40,17 @@ class WebglPointsLayer extends VectorLayer {
createRenderer() { createRenderer() {
return new WebGLPointsLayerRenderer(this, { return new WebGLPointsLayerRenderer(this, {
texture: texture, texture: texture,
colorCallback: function(feature, vertex, component) { colorCallback: function(feature, color) {
// component at index 3 is alpha
if (component === 3) {
return 1;
}
// color is interpolated based on year (min is 1910, max is 2013) // color is interpolated based on year (min is 1910, max is 2013)
// please note: most values are between 2000-2013 // please note: most values are between 2000-2013
const ratio = (feature.get('year') - 1950) / (2013 - 1950); 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) { texCoordCallback: function(feature, component) {
let coords = shapeTextureCoords[feature.get('shape')]; let coords = shapeTextureCoords[feature.get('shape')];
@@ -70,17 +72,14 @@ function loadData() {
client.open('GET', 'data/csv/ufo_sighting_data.csv'); client.open('GET', 'data/csv/ufo_sighting_data.csv');
client.onload = function() { client.onload = function() {
const csv = client.responseText; const csv = client.responseText;
let curIndex; const features = [];
let prevIndex = 0;
let line;
while ((curIndex = csv.indexOf('\n', prevIndex)) > 0) {
line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
prevIndex = curIndex + 1;
// skip header let prevIndex = csv.indexOf('\n') + 1; // scan past the header line
if (prevIndex === 0) {
continue; 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])]); const coords = fromLonLat([parseFloat(line[5]), parseFloat(line[4])]);
@@ -108,7 +107,7 @@ new Map({
layers: [ layers: [
new TileLayer({ new TileLayer({
source: new TileJSON({ source: new TileJSON({
url: 'https://api.tiles.mapbox.com/v3/mapbox.world-dark.json?secure', url: 'https://api.tiles.mapbox.com/v4/mapbox.world-dark.json?access_token=' + key,
crossOrigin: 'anonymous' crossOrigin: 'anonymous'
}) })
}), }),

View File

@@ -37,7 +37,7 @@ const vectorLayer = new VectorLayer({
const rasterLayer = new TileLayer({ const rasterLayer = new TileLayer({
source: new TileJSON({ source: new TileJSON({
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure', url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
crossOrigin: '' crossOrigin: ''
}) })
}); });

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 { body {
padding-top: 70px; padding-top: 70px;
} }
img.header-logo {
padding-left: 18px;
}
input.search-query { input.search-query {
color: #333; color: #333;
} }
@media (max-width: 480px) {
input.search-query {
width: 110px;
}
#count {
display: none;
}
}
@media (max-width: 374px) {
input.search-query {
display: none;
}
}
.example { .example {
display: block; display: block;
padding: 10px; padding: 10px;
@@ -182,9 +198,9 @@
<body> <body>
<header class="navbar navbar-fixed-top" role="navigation"> <header class="navbar navbar-fixed-top" role="navigation">
<div class="container"> <div class="container-fluid">
<div class="display-table pull-left"> <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"> <form class="navbar-form" role="search">
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus> <input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
<span id="count"></span> <span id="count"></span>

View File

@@ -3,12 +3,13 @@ layout: example.html
title: Mapbox-gl Layer title: Mapbox-gl Layer
shortdesc: Example of a Mapbox-gl-js layer integration. shortdesc: Example of a Mapbox-gl-js layer integration.
docs: > 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. Show how to add a mapbox-gl-js layer in an openlayers map. **Note**: Make sure to get your own API key at https://www.maptiler.com/cloud/ when using this example. No map will be visible when the API key has expired.
tags: "simple, mapbox, vector, tiles" tags: "simple, mapbox, vector, tiles, maptiler"
resources: 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: cloak:
- key: ER67WIiPdCQvhgsUjoWK - key: ER67WIiPdCQvhgsUjoWK
value: Your Mapbox access token from http://mapbox.com/ here value: Get your own API key at https://www.maptiler.com/cloud/
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -1,50 +1,21 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import Layer from '../src/ol/layer/Layer'; import Layer from '../src/ol/layer/Layer.js';
import {assign} from '../src/ol/obj'; import {toLonLat, fromLonLat} from '../src/ol/proj.js';
import {getTransform} from '../src/ol/proj';
import SourceState from '../src/ol/source/State';
import {Stroke, Style} from '../src/ol/style.js'; import {Stroke, Style} from '../src/ol/style.js';
import VectorLayer from '../src/ol/layer/Vector.js'; import VectorLayer from '../src/ol/layer/Vector.js';
import VectorSource from '../src/ol/source/Vector.js'; import VectorSource from '../src/ol/source/Vector.js';
import GeoJSON from '../src/ol/format/GeoJSON.js'; import GeoJSON from '../src/ol/format/GeoJSON.js';
class Mapbox extends Layer { const center = [-98.8, 37.9];
const key = 'ER67WIiPdCQvhgsUjoWK';
/** const mbMap = new mapboxgl.Map({
* @param {import('./Base.js').Options} options Layer options. style: 'https://api.maptiler.com/maps/bright/style.json?key=' + key,
*/
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, attributionControl: false,
boxZoom: false, boxZoom: false,
center, center: center,
container: map.getTargetElement(), container: 'map',
doubleClickZoom: false, doubleClickZoom: false,
dragPan: false, dragPan: false,
dragRotate: false, dragRotate: false,
@@ -52,137 +23,45 @@ class Mapbox extends Layer {
keyboard: false, keyboard: false,
pitchWithRotate: false, pitchWithRotate: false,
scrollZoom: false, scrollZoom: false,
touchZoomRotate: false, touchZoomRotate: false
zoom: view.getZoom() - 1 });
});
this.mbmap = new mapboxgl.Map(options); const mbLayer = new Layer({
this.mbmap.on('load', function() { render: function(frameState) {
this.mbmap.getCanvas().remove(); const canvas = mbMap.getCanvas();
this.loaded = true; const viewState = frameState.viewState;
this.map_.render();
[
'mapboxgl-control-container'
].forEach(className => document.getElementsByClassName(className)[0].remove());
}.bind(this));
this.mbmap.on('render', function() { const visible = mbLayer.getVisible();
// Reset offset canvas.style.display = visible ? 'block' : 'none';
if (this.centerNextRender) {
this.centerLastRender = this.centerNextRender;
}
if (this.zoomNextRender) {
this.zoomLastRender = this.zoomNextRender;
}
this.updateRenderedPosition([0, 0], 1);
}.bind(this));
} const opacity = mbLayer.getOpacity();
canvas.style.opacity = opacity;
/** // adjust view parameters in mapbox
* const rotation = viewState.rotation;
* @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) { if (rotation) {
this.mbmap.rotateTo(-rotation * 180 / Math.PI, { mbMap.rotateTo(-rotation * 180 / Math.PI, {
animate: false animate: false
}); });
} }
mbMap.jumpTo({
// Re-render mbmap center: toLonLat(viewState.center),
const center = transformToLatLng(this.centerNextRender); zoom: viewState.zoom - 1,
const zoom = view.getZoom() - 1; animate: false
this.mbmap.jumpTo({
center: center,
zoom: zoom
}); });
return this.mbmap.getCanvas();
// 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();
updateRenderedPosition(centerOffset, zoomOffset) { return canvas;
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({ const style = new Style({
stroke: new Stroke({ stroke: new Stroke({
@@ -202,21 +81,8 @@ const vectorLayer = new VectorLayer({
const map = new Map({ const map = new Map({
target: 'map', target: 'map',
view: new View({ view: new View({
center: [-10997148, 4569099], center: fromLonLat(center),
zoom: 4, zoom: 4
minZoom: 1, }),
extent: [-Infinity, -20048966.10, Infinity, 20048966.10], layers: [mbLayer, vectorLayer]
smoothExtentConstraint: false,
smoothResolutionConstraint: false
})
}); });
const key = 'ER67WIiPdCQvhgsUjoWK';
const mbLayer = new Mapbox({
map: map,
container: map.getTarget(),
style: 'https://maps.tilehosting.com/styles/bright/style.json?key=' + key
});
map.addLayer(mbLayer);
map.addLayer(vectorLayer);

View File

@@ -2,10 +2,10 @@
layout: example-verbatim.html layout: example-verbatim.html
title: Vector tiles created from a Mapbox Style object title: Vector tiles created from a Mapbox Style object
shortdesc: Example of using ol-mapbox-style with tiles from tilehosting.com. shortdesc: Example of using ol-mapbox-style with tiles from tilehosting.com.
tags: "vector tiles, mapbox style, ol-mapbox-style" tags: "vector tiles, mapbox style, ol-mapbox-style, maptiler"
cloak: cloak:
- key: lirfd6Fegsjkvs0lshxe - key: ER67WIiPdCQvhgsUjoWK
value: Your API key from http://tilehosting.com/ here value: Get your own API key at https://www.maptiler.com/cloud/
--- ---
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">

View File

@@ -1,3 +1,3 @@
import apply from 'ol-mapbox-style'; import apply from 'ol-mapbox-style';
apply('map', 'https://maps.tilehosting.com/styles/topo/style.json?key=ER67WIiPdCQvhgsUjoWK'); apply('map', 'https://api.maptiler.com/maps/topo/style.json?key=ER67WIiPdCQvhgsUjoWK');

View File

@@ -9,6 +9,6 @@ resources:
- resources/mapbox-streets-v6-style.js - resources/mapbox-streets-v6-style.js
cloak: cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q - 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 id="map" class="map"></div>

View File

@@ -9,6 +9,6 @@ resources:
- resources/mapbox-streets-v6-style.js - resources/mapbox-streets-v6-style.js
cloak: cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q - 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 id="map" class="map"></div>

View File

@@ -3,9 +3,9 @@ import View from '../src/ol/View.js';
import ImageLayer from '../src/ol/layer/Image.js'; import ImageLayer from '../src/ol/layer/Image.js';
import ImageMapGuide from '../src/ol/source/ImageMapGuide.js'; import ImageMapGuide from '../src/ol/source/ImageMapGuide.js';
const mdf = 'Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition'; const mdf = 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition';
const agentUrl = const agentUrl =
'http://www.buoyshark.com/mapguide/mapagent/mapagent.fcgi?'; 'http://138.197.230.93:8008/mapguide/mapagent/mapagent.fcgi?';
const bounds = [ const bounds = [
-87.865114442365922, -87.865114442365922,
43.665065564837931, 43.665065564837931,
@@ -24,8 +24,9 @@ const map = new Map({
params: { params: {
MAPDEFINITION: mdf, MAPDEFINITION: mdf,
FORMAT: 'PNG', FORMAT: 'PNG',
USERNAME: 'OpenLayers', VERSION: '3.0.0',
PASSWORD: 'OpenLayers' USERNAME: 'OLGuest',
PASSWORD: 'olguest'
}, },
ratio: 2 ratio: 2
}) })

View File

@@ -7,6 +7,9 @@ docs: >
Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, and a place for the content. To anchor the popup to the map, an <code>ol/Overlay</code> is created with the popup container. A listener is registered for the map's <code>click</code> event to display the popup, and another listener is set as the <code>click</code> handler for the close button to hide the popup. Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, and a place for the content. To anchor the popup to the map, an <code>ol/Overlay</code> is created with the popup container. A listener is registered for the map's <code>click</code> event to display the popup, and another listener is set as the <code>click</code> handler for the close button to hide the popup.
</p> </p>
tags: "overlay, popup" tags: "overlay, popup"
cloak:
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
value: Your Mapbox access token from https://mapbox.com/ here
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
<div id="popup" class="ol-popup"> <div id="popup" class="ol-popup">

View File

@@ -6,6 +6,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import {toLonLat} from '../src/ol/proj.js'; import {toLonLat} from '../src/ol/proj.js';
import TileJSON from '../src/ol/source/TileJSON.js'; import TileJSON from '../src/ol/source/TileJSON.js';
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
/** /**
* Elements that make up the popup. * Elements that make up the popup.
@@ -45,7 +46,7 @@ const map = new Map({
layers: [ layers: [
new TileLayer({ new TileLayer({
source: new TileJSON({ source: new TileJSON({
url: 'https://api.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy.json?secure', url: 'https://api.tiles.mapbox.com/v4/mapbox.natural-earth-hypso-bathy.json?access_token=' + key,
crossOrigin: 'anonymous' crossOrigin: 'anonymous'
}) })
}) })

View File

@@ -11,7 +11,7 @@ docs: >
tags: "raster, pixel operation, flood" tags: "raster, pixel operation, flood"
cloak: cloak:
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg - 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> <div id="map" class="map"></div>
<label> <label>

View File

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

View File

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

View File

@@ -78,7 +78,7 @@
<header class="navbar" role="navigation"> <header class="navbar" role="navigation">
<div class="container"> <div class="container">
<div class="display-table pull-left" id="navbar-logo-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> </div>
<!-- menu items that get hidden below 768px width --> <!-- menu items that get hidden below 768px width -->
<nav class='collapse navbar-collapse navbar-responsive-collapse'> <nav class='collapse navbar-collapse navbar-responsive-collapse'>
@@ -122,7 +122,7 @@
<a class="copy-button" id="copy-html-button" data-clipboard-target="#example-html-source"><i class="fa fa-clipboard"></i> Copy</a> <a class="copy-button" id="copy-html-button" data-clipboard-target="#example-html-source"><i class="fa fa-clipboard"></i> Copy</a>
</div> </div>
<pre><legend>index.html</legend><code id="example-html-source" class="language-markup">&lt;!DOCTYPE html&gt; <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;head&gt;
&lt;title&gt;{{ title }}&lt;/title&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;!-- The line below is only needed for old environments like Internet Explorer and Android 4.x --&gt;

View File

@@ -8,7 +8,7 @@ const map = new Map({
layers: [ layers: [
new TileLayer({ new TileLayer({
source: new TileJSON({ source: new TileJSON({
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure', url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
crossOrigin: 'anonymous' crossOrigin: 'anonymous'
}) })
}) })

View File

@@ -4,11 +4,11 @@ title: UTFGrid
shortdesc: This example shows how to read data from a UTFGrid source. shortdesc: This example shows how to read data from a UTFGrid source.
docs: > docs: >
<p>Point to a country to see its name and flag.</p> <p>Point to a country to see its name and flag.</p>
Tiles made with [TileMill](http://tilemill.com). Hosting on MapBox.com or with open-source [TileServer](https://github.com/klokantech/tileserver-php/). Tiles made with <a href="http://tilemill.com">TileMill</a>. Hosting on <a href="mapbox.com">mapbox.com</a> or with open-source <a href="https://github.com/klokantech/tileserver-php/">TileServer</a>.
tags: "utfgrid, tilejson" tags: "utfgrid, tilejson"
cloak: cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q - 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 id="map" class="map"></div>
<div style="display: none;"> <div style="display: none;">

View File

@@ -19,16 +19,25 @@ module.exports = {
context: src, context: src,
target: 'web', target: 'web',
entry: entry, entry: entry,
stats: 'minimal',
module: { module: {
rules: [{ rules: [{
test: /\.js$/,
use: { use: {
loader: 'buble-loader' loader: 'buble-loader'
}, },
test: /\.js$/,
include: [ include: [
path.join(__dirname, '..', '..', 'src'), path.join(__dirname, '..', '..', 'src'),
path.join(__dirname, '..') path.join(__dirname, '..')
] ]
}, {
test: /\.js$/,
use: {
loader: path.join(__dirname, './worker-loader.js')
},
include: [
path.join(__dirname, '../../src/ol/worker')
]
}] }]
}, },
optimization: { optimization: {

View File

@@ -0,0 +1,17 @@
const build = require('../../tasks/serialize-workers').build;
function loader() {
const callback = this.async();
const minify = this.mode === 'production';
build(this.resource, {minify})
.then(chunk => {
for (const filePath in chunk.modules) {
this.addDependency(filePath);
}
callback(null, chunk.code);
})
.catch(callback);
}
module.exports = loader;

View File

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

10
examples/worker.html Normal file
View File

@@ -0,0 +1,10 @@
---
layout: example.html
title: Worker
shortdesc: This example should be deleted.
docs: >
When you move the map, a message is sent to a worker. In response, the woker sends a
message back with the version identifier.
tags: "worker"
---
<div id="map" class="map"></div>

35
examples/worker.js Normal file
View File

@@ -0,0 +1,35 @@
/* eslint-disable no-console */
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 {create as createVersionWorker} from '../src/ol/worker/version.js';
const map = new Map({
layers: [
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
})
});
const worker = createVersionWorker();
worker.addEventListener('error', function(error) {
console.error('worker error', error);
});
worker.addEventListener('message', function(event) {
console.log('message from worker:', event.data);
});
map.on('moveend', function(event) {
const state = event.frameState.viewState;
worker.postMessage({zoom: state.zoom, center: state.center});
});

View File

@@ -11,5 +11,6 @@ tags: "zoomify, deep zoom, IIP, pixel, projection"
<select id="zoomifyProtocol"> <select id="zoomifyProtocol">
<option value="zoomify">Zoomify</option> <option value="zoomify">Zoomify</option>
<option value="iip">IIP</option> <option value="iip">IIP</option>
<option value="zoomifyretina">Zoomify Retina</option>
</select> </select>
</div> </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({ const layer = new TileLayer({
source: new Zoomify({ source: new Zoomify({
tileSize: 256,
tilePixelRatio: 1,
url: zoomifyUrl, url: zoomifyUrl,
size: [imgWidth, imgHeight], size: [imgWidth, imgHeight],
crossOrigin: 'anonymous' crossOrigin: 'anonymous'
@@ -20,12 +22,15 @@ const layer = new TileLayer({
const extent = [0, -imgHeight, imgWidth, 0]; const extent = [0, -imgHeight, imgWidth, 0];
const resolutions = layer.getSource().getTileGrid().getResolutions();
const map = new Map({ const map = new Map({
layers: [layer], layers: [layer],
target: 'map', target: 'map',
view: new View({ view: new View({
// adjust zoom levels to those provided by the source // 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 // constrain the center: center cannot be set outside this extent
extent: extent extent: extent
}) })
@@ -36,17 +41,73 @@ const control = document.getElementById('zoomifyProtocol');
control.addEventListener('change', function(event) { control.addEventListener('change', function(event) {
const value = event.currentTarget.value; const value = event.currentTarget.value;
if (value === 'iip') { if (value === 'iip') {
layer.setSource(new Zoomify({ const extent = [0, -imgHeight, imgWidth, 0];
layer.setSource(
new Zoomify({
tileSize: 256,
tilePixelRatio: 1,
url: iipUrl, url: iipUrl,
size: [imgWidth, imgHeight], size: [imgWidth, imgHeight],
crossOrigin: 'anonymous' 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') { } else if (value === 'zoomify') {
layer.setSource(new Zoomify({ const extent = [0, -imgHeight, imgWidth, 0];
layer.setSource(
new Zoomify({
tileSize: 256,
tilePixelRatio: 1,
url: zoomifyUrl, url: zoomifyUrl,
size: [imgWidth, imgHeight], size: [imgWidth, imgHeight],
crossOrigin: 'anonymous' 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", "name": "ol",
"version": "5.3.0", "version": "6.0.0-beta.10",
"description": "OpenLayers mapping library", "description": "OpenLayers mapping library",
"keywords": [ "keywords": [
"map", "map",
@@ -22,9 +22,9 @@
"build-index": "npm run build-package && node tasks/generate-index", "build-index": "npm run build-package && node tasks/generate-index",
"build-legacy": "shx rm -rf build && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css", "build-legacy": "shx rm -rf build && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css", "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", "transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers && tsc --project config/tsconfig-build.json",
"typecheck": "tsc --pretty", "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", "main": "index.js",
"repository": { "repository": {
@@ -38,59 +38,69 @@
"dependencies": { "dependencies": {
"pbf": "3.2.0", "pbf": "3.2.0",
"pixelworks": "1.1.0", "pixelworks": "1.1.0",
"rbush": "2.0.2" "rbush": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@openlayers/eslint-plugin": "^4.0.0-beta.1", "@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.4",
"@openlayers/eslint-plugin": "^4.0.0-beta.2",
"@types/arcgis-rest-api": "^10.4.4", "@types/arcgis-rest-api": "^10.4.4",
"@types/geojson": "^7946.0.6", "@types/geojson": "^7946.0.7",
"@types/pbf": "^3.0.1", "@types/pbf": "^3.0.1",
"@types/rbush": "^2.0.2",
"@types/topojson-specification": "^1.0.1", "@types/topojson-specification": "^1.0.1",
"babel-loader": "^8.0.5",
"buble": "^0.19.7", "buble": "^0.19.7",
"buble-loader": "^0.5.1", "buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4", "chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.2.1", "clean-css-cli": "4.3.0",
"copy-webpack-plugin": "^5.0.1", "copy-webpack-plugin": "^5.0.3",
"coveralls": "3.0.3", "coveralls": "3.0.4",
"eslint": "^5.15.2", "eslint": "^6.0.0",
"eslint-config-openlayers": "^11.0.0", "eslint-config-openlayers": "^12.0.0",
"expect.js": "0.3.1", "expect.js": "0.3.1",
"front-matter": "^3.0.1", "front-matter": "^3.0.2",
"fs-extra": "^7.0.1", "fs-extra": "^8.0.0",
"glob": "^7.1.2", "glob": "^7.1.4",
"globby": "^9.1.0", "globby": "^9.2.0",
"handlebars": "4.1.1", "handlebars": "4.1.2",
"html-to-image": "^0.1.0",
"istanbul": "0.4.5", "istanbul": "0.4.5",
"jquery": "3.3.1", "istanbul-instrumenter-loader": "^3.0.1",
"jsdoc": "3.5.5", "jquery": "3.4.1",
"jsdoc-plugin-typescript": "^1.0.7", "jsdoc": "3.6.2",
"karma": "^4.0.1", "jsdoc-plugin-typescript": "^2.0.1",
"karma": "^4.1.0",
"karma-chrome-launcher": "2.2.0", "karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.2", "karma-coverage": "^1.1.2",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-firefox-launcher": "^1.1.0", "karma-firefox-launcher": "^1.1.0",
"karma-mocha": "1.3.0", "karma-mocha": "1.3.0",
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.0-rc.2", "karma-webpack": "^4.0.0-rc.2",
"loglevelnext": "^3.0.0", "loglevelnext": "^3.0.1",
"marked": "0.6.1", "marked": "0.6.2",
"mocha": "6.0.2", "mocha": "6.1.4",
"ol-mapbox-style": "^4.2.1", "ol-mapbox-style": "^5.0.0-beta.2",
"pixelmatch": "^4.0.2", "pixelmatch": "^5.0.0",
"pngjs": "^3.4.0", "pngjs": "^3.4.0",
"proj4": "2.5.0", "proj4": "2.5.0",
"puppeteer": "~1.14.0", "puppeteer": "~1.18.0",
"serve-static": "^1.13.2", "rollup": "^1.12.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-terser": "^5.0.0",
"serve-static": "^1.14.0",
"shx": "^0.3.2", "shx": "^0.3.2",
"sinon": "^7.2.7", "sinon": "^7.3.2",
"terser-webpack-plugin": "^1.2.3", "terser-webpack-plugin": "^1.2.3",
"typescript": "^3.2.2", "typescript": "^3.4.5",
"url-polyfill": "^1.1.5", "url-polyfill": "^1.1.5",
"walk": "^2.3.9", "walk": "^2.3.9",
"webpack": "4.29.6", "webpack": "4.35.0",
"webpack-cli": "^3.3.0", "webpack-cli": "^3.3.2",
"webpack-dev-middleware": "^3.6.1", "webpack-dev-middleware": "^3.6.2",
"webpack-dev-server": "^3.2.1", "webpack-dev-server": "^3.3.1",
"yargs": "^13.2.2" "yargs": "^13.2.2"
}, },
"eslintConfig": { "eslintConfig": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -1,10 +1,10 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
import {Heatmap as HeatmapLayer} from '../../../src/ol/layer'; import {Heatmap as HeatmapLayer} from '../../../src/ol/layer.js';
import VectorSource from '../../../src/ol/source/Vector'; import VectorSource from '../../../src/ol/source/Vector.js';
import KML from '../../../src/ol/format/KML'; import KML from '../../../src/ol/format/KML.js';
const vector = new HeatmapLayer({ const vector = new HeatmapLayer({
source: new VectorSource({ source: new VectorSource({

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: 49 KiB

View File

@@ -0,0 +1,30 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import {Group as LayerGroup, Tile as TileLayer} from '../../../src/ol/layer.js';
import XYZ from '../../../src/ol/source/XYZ.js';
new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 3
}),
layers: new LayerGroup({
opacity: 0.75,
layers: [
new TileLayer({
opacity: 0.25,
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg'
})
}),
new TileLayer({
source: new XYZ({
url: '/data/tiles/stamen-labels/{z}/{x}/{y}.png'
})
})
]
})
});
render();

View File

@@ -5,7 +5,7 @@ import {
get as getProjection, get as getProjection,
transform, transform,
transformExtent transformExtent
} from '../../../src/ol/proj'; } from '../../../src/ol/proj.js';
import ImageLayer from '../../../src/ol/layer/Image.js'; import ImageLayer from '../../../src/ol/layer/Image.js';
const center = transform([-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'); const center = transform([-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -5,9 +5,9 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj'; import {fromLonLat} from '../../../src/ol/proj.js';
import {transformExtent} from '../../../src/ol/proj.js'; import {transformExtent} from '../../../src/ol/proj.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
const center = fromLonLat([7, 50]); const center = fromLonLat([7, 50]);
const extent = transformExtent([2, 47, 10, 53], 'EPSG:4326', 'EPSG:3857'); const extent = transformExtent([2, 47, 10, 53], 'EPSG:4326', 'EPSG:3857');

View File

@@ -1,7 +1,7 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
import {createXYZ} from '../../../src/ol/tilegrid.js'; import {createXYZ} from '../../../src/ol/tilegrid.js';
const center = [-10997148, 4569099]; const center = [-10997148, 4569099];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -1,8 +1,8 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj'; import {fromLonLat} from '../../../src/ol/proj.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
const center = fromLonLat([8.6, 50.1]); const center = fromLonLat([8.6, 50.1]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -1,8 +1,8 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj'; import {fromLonLat} from '../../../src/ol/proj.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
const center = fromLonLat([8.6, 50.1]); const center = fromLonLat([8.6, 50.1]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -1,8 +1,8 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj'; import {fromLonLat} from '../../../src/ol/proj.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
const center = fromLonLat([8.6, 50.1]); const center = fromLonLat([8.6, 50.1]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -1,8 +1,8 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj'; import {fromLonLat} from '../../../src/ol/proj.js';
import XYZ from '../../../src/ol/source/XYZ'; import XYZ from '../../../src/ol/source/XYZ.js';
const center = fromLonLat([8.6, 50.1]); const center = fromLonLat([8.6, 50.1]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -7,6 +7,7 @@ import Point from '../../../src/ol/geom/Point.js';
import Style from '../../../src/ol/style/Style.js'; import Style from '../../../src/ol/style/Style.js';
import Text from '../../../src/ol/style/Text.js'; import Text from '../../../src/ol/style/Text.js';
import CircleStyle from '../../../src/ol/style/Circle.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 Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js'; import LineString from '../../../src/ol/geom/LineString.js';
@@ -59,9 +60,10 @@ source1.addFeature(new Feature({
})); }));
layer1.setStyle(function(feature) { layer1.setStyle(function(feature) {
return new Style({ return new Style({
zIndex: feature.get('zIndex'),
image: new CircleStyle({ image: new CircleStyle({
radius: 15, radius: 15,
stroke: new Stroke({ fill: new Fill({
color: 'blue' color: 'blue'
}) })
}) })
@@ -69,7 +71,7 @@ layer1.setStyle(function(feature) {
}); });
map.addLayer(layer1); map.addLayer(layer1);
center = [center[0] + 500, center[1] + 500]; center = [center[0] + 500, center[1] + 700];
const feature2 = new Feature({ const feature2 = new Feature({
geometry: new Point(center), geometry: new Point(center),
text: 'center', text: 'center',
@@ -88,15 +90,16 @@ source2.addFeature(new Feature({
})); }));
layer2.setStyle(function(feature) { layer2.setStyle(function(feature) {
return new Style({ return new Style({
zIndex: feature.get('zIndex'),
text: new Text({ text: new Text({
text: feature.get('text'), text: feature.get('text'),
font: '16px Ubuntu' font: 'italic bold 18px Ubuntu'
}) })
}); });
}); });
map.addLayer(layer2); map.addLayer(layer2);
center = [center[0] + 500, center[1] + 500]; center = [center[0] + 500, center[1] + 300];
source3.addFeature(new Feature({ source3.addFeature(new Feature({
geometry: new Point(center), geometry: new Point(center),
text: 'center' text: 'center'
@@ -112,16 +115,17 @@ source3.addFeature(new Feature({
layer3.setStyle(function(feature) { layer3.setStyle(function(feature) {
return new Style({ return new Style({
image: new CircleStyle({ image: new CircleStyle({
radius: 5, radius: 10,
stroke: new Stroke({ stroke: new Stroke({
color: 'red' color: 'red',
width: 8
}) })
}), }),
text: new Text({ text: new Text({
text: feature.get('text'), text: feature.get('text'),
font: '16px Ubuntu', font: 'italic bold 18px Ubuntu',
textBaseline: 'bottom', textBaseline: 'bottom',
offsetY: -5 offsetY: -12
}) })
}); });
}); });
@@ -130,11 +134,12 @@ map.addLayer(layer3);
center = [center[0] - 2000, center[1] - 2000]; center = [center[0] - 2000, center[1] - 2000];
const point = new Feature(new Point(center)); const point = new Feature(new Point(center));
point.setStyle(new Style({ point.setStyle(new Style({
zIndex: 2, zIndex: 1,
image: new CircleStyle({ image: new CircleStyle({
radius: 8, radius: 8,
stroke: new Stroke({ stroke: new Stroke({
color: 'blue' color: 'blue',
width: 4
}) })
}) })
})); }));
@@ -143,7 +148,7 @@ const line = new Feature(new LineString([
[center[0] + 650, center[1] - 200] [center[0] + 650, center[1] - 200]
])); ]));
line.setStyle(new Style({ line.setStyle(new Style({
zIndex: 1, zIndex: 2,
stroke: new Stroke({ stroke: new Stroke({
color: '#CCC', color: '#CCC',
width: 12 width: 12
@@ -151,7 +156,7 @@ line.setStyle(new Style({
text: new Text({ text: new Text({
placement: 'line', placement: 'line',
text: 'east-west', text: 'east-west',
font: '16px Ubuntu', font: 'italic bold 18px Ubuntu',
overflow: true overflow: true
}) })
})); }));
@@ -159,4 +164,4 @@ source4.addFeature(point);
source4.addFeature(line); source4.addFeature(line);
map.addLayer(layer4); map.addLayer(layer4);
render({tolerance: 0.02}); render({tolerance: 0.007});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

After

Width:  |  Height:  |  Size: 1016 B

View File

@@ -42,7 +42,8 @@ const layer = new VectorLayer({
const view = new View({ const view = new View({
center: [-9.5, 78], center: [-9.5, 78],
zoom: 2, zoom: 2,
projection: 'EPSG:4326' projection: 'EPSG:4326',
multiWorld: true
}); });
new Map({ new Map({
pixelRatio: 1, pixelRatio: 1,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -1,72 +1,19 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/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 VectorImageLayer from '../../../src/ol/layer/VectorImage.js'; import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
import CircleStyle from '../../../src/ol/style/Circle.js'; import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js'; import Point from '../../../src/ol/geom/Point.js';
import LineString from '../../../src/ol/geom/LineString.js'; import Style from '../../../src/ol/style/Style.js';
import Text from '../../../src/ol/style/Text.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';
const center = [1825927.7316762917, 6143091.089223046]; let center = [1825927.7316762917, 6143091.089223046];
const source = new VectorSource();
const vectorLayer1 = new VectorImageLayer({
source: source,
style: function(feature) {
return new Style({
image: new CircleStyle({
radius: 15,
stroke: new Stroke({
color: 'blue'
})
}),
text: new Text({
text: feature.get('text'),
font: '16px Ubuntu'
})
});
}
});
const centerFeature = new Feature({
geometry: new Point(center),
text: 'center'
});
source.addFeature(centerFeature);
source.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west'
}));
source.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east'
}));
const line = new Feature(new LineString([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new Style({
stroke: new Stroke({
color: '#CCC',
width: 12
}),
text: new Text({
placement: 'line',
text: 'east-west',
font: '16px Ubuntu'
})
}));
source.addFeature(line);
const map = new Map({ const map = new Map({
pixelRatio: 1, pixelRatio: 1,
layers: [
vectorLayer1
],
target: 'map', target: 'map',
view: new View({ view: new View({
center: center, center: center,
@@ -74,6 +21,147 @@ const map = new Map({
}) })
}); });
map.getView().fit(source.getExtent()); const source1 = new VectorSource();
const layer1 = new VectorImageLayer({
declutter: true,
source: source1
});
render({tolerance: 0.02}); 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.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View File

@@ -1,9 +1,9 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import VectorTileSource from '../../../src/ol/source/VectorTile'; import VectorTileSource from '../../../src/ol/source/VectorTile.js';
import MVT from '../../../src/ol/format/MVT'; import MVT from '../../../src/ol/format/MVT.js';
import {createXYZ} from '../../../src/ol/tilegrid'; import {createXYZ} from '../../../src/ol/tilegrid.js';
import VectorTileLayer from '../../../src/ol/layer/VectorTile'; import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
const map = new Map({ const map = new Map({
pixelRatio: 2, pixelRatio: 2,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 138 KiB

View File

@@ -1,16 +1,16 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import VectorTileSource from '../../../src/ol/source/VectorTile'; import VectorTileSource from '../../../src/ol/source/VectorTile.js';
import MVT from '../../../src/ol/format/MVT'; import MVT from '../../../src/ol/format/MVT.js';
import {createXYZ} from '../../../src/ol/tilegrid'; import {createXYZ} from '../../../src/ol/tilegrid.js';
import VectorTileLayer from '../../../src/ol/layer/VectorTile'; import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
import VectorSource from '../../../src/ol/source/Vector'; import VectorSource from '../../../src/ol/source/Vector.js';
import Feature from '../../../src/ol/Feature'; import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point'; import Point from '../../../src/ol/geom/Point.js';
import VectorLayer from '../../../src/ol/layer/Vector'; import VectorLayer from '../../../src/ol/layer/Vector.js';
import Style from '../../../src/ol/style/Style'; import Style from '../../../src/ol/style/Style.js';
import CircleStyle from '../../../src/ol/style/Circle'; import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill'; import Fill from '../../../src/ol/style/Fill.js';
const vectorSource = new VectorSource({ const vectorSource = new VectorSource({
features: [ features: [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 138 KiB

View File

@@ -1,9 +1,9 @@
import Map from '../../../src/ol/Map.js'; import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js'; import View from '../../../src/ol/View.js';
import VectorTileSource from '../../../src/ol/source/VectorTile'; import VectorTileSource from '../../../src/ol/source/VectorTile.js';
import MVT from '../../../src/ol/format/MVT'; import MVT from '../../../src/ol/format/MVT.js';
import {createXYZ} from '../../../src/ol/tilegrid'; import {createXYZ} from '../../../src/ol/tilegrid.js';
import VectorTileLayer from '../../../src/ol/layer/VectorTile'; import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
const map = new Map({ const map = new Map({
layers: [ layers: [

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

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