Compare commits
436 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edec77dafc | ||
|
|
ff6eb89b06 | ||
|
|
bb68da2a0a | ||
|
|
d5c72f62d5 | ||
|
|
8d4c3b2887 | ||
|
|
6641832621 | ||
|
|
fe8f7c04ad | ||
|
|
07c2b360ce | ||
|
|
2ccd9bf6b9 | ||
|
|
0b70a7e165 | ||
|
|
3c5d0f223e | ||
|
|
8722d16158 | ||
|
|
02597229e3 | ||
|
|
5ff681563f | ||
|
|
0b3bd0721e | ||
|
|
bc79d59811 | ||
|
|
f43bc8d122 | ||
|
|
175695f877 | ||
|
|
934ad5b882 | ||
|
|
83c0a258e6 | ||
|
|
25a5e83910 | ||
|
|
00261dff54 | ||
|
|
12ce4cc82a | ||
|
|
15800da498 | ||
|
|
acb8008644 | ||
|
|
34fe288c6b | ||
|
|
b90ca8b521 | ||
|
|
35569a8427 | ||
|
|
47a4a63e3e | ||
|
|
0fb4b62b9b | ||
|
|
4ce3b3fed1 | ||
|
|
29a434314b | ||
|
|
c320b15177 | ||
|
|
319b64ed65 | ||
|
|
65c1575dc9 | ||
|
|
cc21f92bdb | ||
|
|
c8e340a623 | ||
|
|
03fcf1ca70 | ||
|
|
77658e5750 | ||
|
|
54bae0168f | ||
|
|
97246daf66 | ||
|
|
3082972cce | ||
|
|
9eb860f08c | ||
|
|
062d043e6e | ||
|
|
e727a3fe23 | ||
|
|
fe3603dee6 | ||
|
|
2eb0072e8c | ||
|
|
bba2989859 | ||
|
|
f63c02a57b | ||
|
|
92a0558cf2 | ||
|
|
a4915d0ef6 | ||
|
|
66d9c92f7d | ||
|
|
511d8e8795 | ||
|
|
6a5a1f7a72 | ||
|
|
c2bfe76ee5 | ||
|
|
cf0b8af356 | ||
|
|
1e08750398 | ||
|
|
f4ef2e15db | ||
|
|
cd3a205803 | ||
|
|
564af3e4d5 | ||
|
|
3c2dfb511a | ||
|
|
f91ce5692f | ||
|
|
38abbcbdd6 | ||
|
|
902f3c2fba | ||
|
|
7266f37f85 | ||
|
|
93897d92d5 | ||
|
|
81d14fb636 | ||
|
|
542b77eef8 | ||
|
|
a24c94487c | ||
|
|
d87f7b7d35 | ||
|
|
001cb98990 | ||
|
|
7805768942 | ||
|
|
f8f7f83be7 | ||
|
|
af307eb606 | ||
|
|
e3f9e250ab | ||
|
|
c373a3eafd | ||
|
|
4151e86c0a | ||
|
|
153bd7f5d1 | ||
|
|
902bdbabdc | ||
|
|
02b1ab71f1 | ||
|
|
2652c1a30d | ||
|
|
29ea779f66 | ||
|
|
9cf8fe9e05 | ||
|
|
2f7e681c32 | ||
|
|
e391be7de9 | ||
|
|
f2d5b6b116 | ||
|
|
7f6d77d811 | ||
|
|
2205937b2d | ||
|
|
bf57a23940 | ||
|
|
e820042748 | ||
|
|
a7bdee43b3 | ||
|
|
23d441f9f2 | ||
|
|
91b9058582 | ||
|
|
5ca4af125e | ||
|
|
1ee03decdd | ||
|
|
96ebacca1f | ||
|
|
a9e738c919 | ||
|
|
c9c616bd6f | ||
|
|
1eac18f94a | ||
|
|
e11db6de44 | ||
|
|
8c89ddceca | ||
|
|
89c5364b2f | ||
|
|
97cb0bbd77 | ||
|
|
3a5c8d637c | ||
|
|
4db204698e | ||
|
|
d1b2dfb669 | ||
|
|
5830a36131 | ||
|
|
83d65b61e1 | ||
|
|
c221cc7a46 | ||
|
|
a25e10524b | ||
|
|
afba861ab5 | ||
|
|
d670eba5eb | ||
|
|
3dff4f73e2 | ||
|
|
f87a7656ce | ||
|
|
8f7e5ce63c | ||
|
|
ca944c8ece | ||
|
|
9ce0d6159c | ||
|
|
f2ae509d07 | ||
|
|
e00cfeec06 | ||
|
|
fa9d4586a3 | ||
|
|
e2dc67546e | ||
|
|
e2b42c100f | ||
|
|
bf23dca068 | ||
|
|
23858dc09d | ||
|
|
9493d68217 | ||
|
|
730008cfad | ||
|
|
258bfeaecc | ||
|
|
9cc7ef4b96 | ||
|
|
3ac33ee723 | ||
|
|
62cd0cbcc9 | ||
|
|
2f094978ca | ||
|
|
de5cd5c664 | ||
|
|
8e2adf9955 | ||
|
|
adbab7992e | ||
|
|
df710e4d6f | ||
|
|
2112478b6b | ||
|
|
78378f0253 | ||
|
|
4c7f52c8a4 | ||
|
|
ee1b038714 | ||
|
|
1506e13b60 | ||
|
|
601bd7bae6 | ||
|
|
cbdd63a38b | ||
|
|
bc6f34d691 | ||
|
|
fd935bae53 | ||
|
|
eeec2b9e7d | ||
|
|
4e599a370b | ||
|
|
5ce532e3e4 | ||
|
|
56a6919d9a | ||
|
|
c4eea624f4 | ||
|
|
76e81bbc78 | ||
|
|
bbadfefc92 | ||
|
|
e4c98c58bd | ||
|
|
6d5602b569 | ||
|
|
f79cc24ff3 | ||
|
|
b2e81109b4 | ||
|
|
afe97ef04e | ||
|
|
ab607eb02a | ||
|
|
86cef49368 | ||
|
|
8e45a3378a | ||
|
|
ec265a04c7 | ||
|
|
ea1070193e | ||
|
|
e9ab684ef3 | ||
|
|
87a953c4ec | ||
|
|
e05641b6b8 | ||
|
|
bacc159fc6 | ||
|
|
8935cb509a | ||
|
|
02931d54b5 | ||
|
|
95a319a670 | ||
|
|
986e6d940c | ||
|
|
080ef7c56e | ||
|
|
810fab54ec | ||
|
|
3bac2e49d1 | ||
|
|
0512c690f8 | ||
|
|
f3d94b3132 | ||
|
|
34dc538122 | ||
|
|
c851f6c6bf | ||
|
|
88e3db4928 | ||
|
|
420e7d87ae | ||
|
|
44fab1000e | ||
|
|
a4735e0700 | ||
|
|
b26f570cb7 | ||
|
|
e2687da202 | ||
|
|
9f4dbd3c35 | ||
|
|
5a8df1d4e2 | ||
|
|
46d98201c3 | ||
|
|
21e9601d7b | ||
|
|
8125463e59 | ||
|
|
cb665b7ea7 | ||
|
|
c1c256040e | ||
|
|
5a1921d7bd | ||
|
|
adea3b48dc | ||
|
|
d60a153ca6 | ||
|
|
d1ef920fab | ||
|
|
ff2a33367d | ||
|
|
6d092cf1a6 | ||
|
|
68de72d1cc | ||
|
|
780e4f5fbd | ||
|
|
77c2c04ae6 | ||
|
|
c840d29f9f | ||
|
|
05a5f162d4 | ||
|
|
5b661ed84c | ||
|
|
bdc20e0293 | ||
|
|
fc46166821 | ||
|
|
90d61033e0 | ||
|
|
2875685b3c | ||
|
|
ae1ee192f3 | ||
|
|
bec747e513 | ||
|
|
6affeb0beb | ||
|
|
da6eed850c | ||
|
|
ae336f0a1b | ||
|
|
b91e1a893d | ||
|
|
f48704cac4 | ||
|
|
6063021792 | ||
|
|
ada6ff7290 | ||
|
|
5b3338b6f7 | ||
|
|
e8a17376b6 | ||
|
|
58482c6c64 | ||
|
|
9622a8ca93 | ||
|
|
e4ea272799 | ||
|
|
b68d5e139d | ||
|
|
4440994ec8 | ||
|
|
c66a19c9cc | ||
|
|
7bcc8fc73e | ||
|
|
05bc7f00ca | ||
|
|
0d9aec4b6b | ||
|
|
3d3fe9f41b | ||
|
|
daf8d0af6c | ||
|
|
79232ea668 | ||
|
|
d7a331fc7c | ||
|
|
ada892322a | ||
|
|
c60fd4decd | ||
|
|
739459f886 | ||
|
|
bcb78fe3a9 | ||
|
|
8496b5b4e0 | ||
|
|
dd9643cc07 | ||
|
|
28ae21e5dd | ||
|
|
8838565629 | ||
|
|
a4c3bce3b1 | ||
|
|
33389969ce | ||
|
|
d7eaacf923 | ||
|
|
33e24e9ce9 | ||
|
|
6c46eb1dd0 | ||
|
|
6f000e3155 | ||
|
|
f08a2ab3d1 | ||
|
|
caefe8c85b | ||
|
|
977b89c99d | ||
|
|
2b45bc054e | ||
|
|
23251947be | ||
|
|
3da3339c03 | ||
|
|
0632db0851 | ||
|
|
21831fc098 | ||
|
|
5bcfb9c10a | ||
|
|
e74000fbc0 | ||
|
|
1ab8445d29 | ||
|
|
84c2743879 | ||
|
|
7649f2484a | ||
|
|
b86ef23c99 | ||
|
|
1e2f3cbfbb | ||
|
|
c04b234be4 | ||
|
|
6113121d53 | ||
|
|
e9e6868b5c | ||
|
|
21fbf29b67 | ||
|
|
ac7a98933e | ||
|
|
67a8afd4ac | ||
|
|
7d90b5ffb7 | ||
|
|
ad6247fc6a | ||
|
|
b39cb7c00e | ||
|
|
3bf1931f39 | ||
|
|
122140e9f0 | ||
|
|
4c0bdda8b8 | ||
|
|
ab8e80fc98 | ||
|
|
4a8a7619d5 | ||
|
|
cae32edb02 | ||
|
|
ca0ce4986d | ||
|
|
6537fecc69 | ||
|
|
f8b145f82a | ||
|
|
6596a988c0 | ||
|
|
f13ebbee3f | ||
|
|
6684bc221a | ||
|
|
c1857efd81 | ||
|
|
8e0a8114d7 | ||
|
|
2e544cb677 | ||
|
|
e361391503 | ||
|
|
bbc1de280d | ||
|
|
f460198850 | ||
|
|
f52f72dd96 | ||
|
|
8911b96d3c | ||
|
|
38b278339d | ||
|
|
02b34a4c23 | ||
|
|
ff02dd6653 | ||
|
|
dc3e515c0e | ||
|
|
9939f082d0 | ||
|
|
36deaf9fd1 | ||
|
|
211368436f | ||
|
|
c3773c1419 | ||
|
|
dcadbf374a | ||
|
|
29d34b8694 | ||
|
|
da2d743023 | ||
|
|
c3d31c796f | ||
|
|
cefc57622b | ||
|
|
5f6ea987a5 | ||
|
|
174dea3232 | ||
|
|
d86d4db813 | ||
|
|
f9f8f9c7c5 | ||
|
|
29c55aacae | ||
|
|
a389903749 | ||
|
|
35b2a92c10 | ||
|
|
2790d50660 | ||
|
|
b4ae4ab86f | ||
|
|
aaae50e689 | ||
|
|
10f9a70d5f | ||
|
|
fb73bbaa00 | ||
|
|
d3b492d175 | ||
|
|
3530b4cf12 | ||
|
|
b1ebd03244 | ||
|
|
f6bb0a3ad6 | ||
|
|
b1b3544f4d | ||
|
|
3865a7c23a | ||
|
|
3f82a8be77 | ||
|
|
611946aa6f | ||
|
|
aaebab2831 | ||
|
|
66c1112c84 | ||
|
|
45d1e8f032 | ||
|
|
05169ccd1f | ||
|
|
bcaf3b5a9b | ||
|
|
8e9c8e8707 | ||
|
|
c70e385398 | ||
|
|
2b6925dc1e | ||
|
|
057650fe7d | ||
|
|
10a6284b0b | ||
|
|
f0a32e11d5 | ||
|
|
0a319ea2a2 | ||
|
|
75103e08ed | ||
|
|
d87caed50f | ||
|
|
cda01cfeb9 | ||
|
|
79074d31c1 | ||
|
|
e2c4670d6a | ||
|
|
e881e4bb99 | ||
|
|
28818e5b4e | ||
|
|
a66734dd20 | ||
|
|
7c4c4c47ec | ||
|
|
0e18a7007f | ||
|
|
ec7fc3e680 | ||
|
|
354d9aea8b | ||
|
|
3e7d0650b1 | ||
|
|
36586ec4a1 | ||
|
|
46f32d2387 | ||
|
|
6e3fd19b89 | ||
|
|
0d4bbd69fc | ||
|
|
6906784319 | ||
|
|
88b8b2f7cb | ||
|
|
6bada6ab98 | ||
|
|
93d3ddb033 | ||
|
|
d99c77b992 | ||
|
|
0ed57b8b7c | ||
|
|
a990b8e0bf | ||
|
|
8865f22020 | ||
|
|
fb7060a4d0 | ||
|
|
c3153075b2 | ||
|
|
2df22af3ca | ||
|
|
ae1e8b662d | ||
|
|
569deddd06 | ||
|
|
3e31551962 | ||
|
|
9317ad850e | ||
|
|
32932a7fd3 | ||
|
|
5d61d556a0 | ||
|
|
c5ad886d7c | ||
|
|
cf6cd09f58 | ||
|
|
3f8164250c | ||
|
|
bb6c02ae57 | ||
|
|
e5f5177969 | ||
|
|
b2e5098311 | ||
|
|
31854fd882 | ||
|
|
331dd7e1d7 | ||
|
|
ff17156c8f | ||
|
|
a75c18330d | ||
|
|
d0b4967ec0 | ||
|
|
b6185981c0 | ||
|
|
90bb31d81e | ||
|
|
4aabfb694d | ||
|
|
1641114c6a | ||
|
|
3cca945002 | ||
|
|
f784fe6e42 | ||
|
|
fcd98774a0 | ||
|
|
54c86b1a04 | ||
|
|
818113e3ce | ||
|
|
47216505de | ||
|
|
0a4c9edde7 | ||
|
|
30c4ce51b2 | ||
|
|
5dbd1e4cbb | ||
|
|
643a3ad86b | ||
|
|
fab8a449c3 | ||
|
|
8b036ba96c | ||
|
|
4fb301e3e5 | ||
|
|
9478cb1945 | ||
|
|
86b2026f54 | ||
|
|
c7a0512397 | ||
|
|
e1f707145b | ||
|
|
434096ed9a | ||
|
|
241e695f7f | ||
|
|
fc7cb5cd51 | ||
|
|
79a3091ba4 | ||
|
|
2581252f88 | ||
|
|
e016af83ee | ||
|
|
b65249326f | ||
|
|
5c24fc8514 | ||
|
|
0c052bf67c | ||
|
|
ecb42824f2 | ||
|
|
cf72a649cc | ||
|
|
6fe5c88614 | ||
|
|
6f6551ad75 | ||
|
|
59faeff1bf | ||
|
|
366d548b91 | ||
|
|
222a344ae9 | ||
|
|
3d1cef9aa2 | ||
|
|
3850bd1083 | ||
|
|
5c023adc08 | ||
|
|
ae66471e78 | ||
|
|
51c9b56254 | ||
|
|
d90a4569da | ||
|
|
48ec398037 | ||
|
|
77bc6897dd | ||
|
|
6978c69f20 | ||
|
|
146e38c7ef | ||
|
|
17fa323f50 | ||
|
|
a053fac728 | ||
|
|
978d620191 | ||
|
|
4e0e34e26b | ||
|
|
4f46d8ae32 | ||
|
|
7a2671650f | ||
|
|
2e2fa241fc | ||
|
|
200763bf97 | ||
|
|
d11cb02af4 | ||
|
|
f47fa8b407 | ||
|
|
9908433cfd | ||
|
|
937f7f613e |
@@ -11,7 +11,7 @@ jobs:
|
|||||||
|
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- v1-dependencies-{{ checksum "package.json" }}
|
- v1-dependencies-{{ checksum "package-lock.json" }}
|
||||||
- v1-dependencies-
|
- v1-dependencies-
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
- save_cache:
|
- save_cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules
|
- node_modules
|
||||||
key: v1-dependencies-{{ checksum "package.json" }}
|
key: v1-dependencies-{{ checksum "package-lock.json" }}
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Run Tests
|
name: Run Tests
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ Generally, the responsibility of applying center/rotation/resolutions constraint
|
|||||||
|
|
||||||
##### The view `extent` option now applies to the whole viewport
|
##### The view `extent` option now applies to the whole viewport
|
||||||
|
|
||||||
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainCenterOnly` in the view options.
|
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainOnlyCenter` in the view options.
|
||||||
|
|
||||||
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
|
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ Generally, the responsibility of applying center/rotation/resolutions constraint
|
|||||||
|
|
||||||
##### The view `extent` option now applies to the whole viewport
|
##### The view `extent` option now applies to the whole viewport
|
||||||
|
|
||||||
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainCenterOnly` in the view options.
|
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainOnlyCenter` in the view options.
|
||||||
|
|
||||||
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
|
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
|
||||||
|
|
||||||
|
|||||||
196
changelog/v6.2.0.md
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
# 6.2.0
|
||||||
|
|
||||||
|
With almost 90 pull requests, this release brings several new features, performance improvements and bug fixes. In addition to that, we once again improved the API documentation and the example pages.
|
||||||
|
|
||||||
|
## New features and improvements
|
||||||
|
|
||||||
|
* Mousewheel zooming now brings the same user experience as trackpad zooming. One click on the wheel no longer means a jump of a whole zoom level. Instead, depending on the speed of moving the wheel, the user has fine-grained control over zoom increments/decrements.
|
||||||
|
* Users now have better control over the initial map viewport when the aspect ratio of the map is different from a specified initial extent.
|
||||||
|
* Text rendering has been optimized for decluttering and improved for rotated views. This means lower memory footprint and no more blurry text when the map is rotated. **Note:** Whit this change, the label cache has been deprecated.
|
||||||
|
* A new `displacement` option for icon, circle and regular shape styles makes positioning of point symbolizers more flexible.
|
||||||
|
* Several improvements have been made to the KML parser for reading styles, bringing the rendered result much closer to Google Earth.
|
||||||
|
* OpenLayers is now less aggressive on stopping events and preventing event default behavior. This means that users have more control over events, making it easier to use interactive SVGs as layers and to embed maps on scrollable pages.
|
||||||
|
* Vector tile layers now have a `vector` render mode, which brings improved zooming experience for sources with not too much data.
|
||||||
|
* We replaced the previous pointer events polyfill to elm-pep, which should work better in web components.
|
||||||
|
|
||||||
|
## List of all changes
|
||||||
|
|
||||||
|
* [#10613](https://github.com/openlayers/openlayers/pull/10613) - Show KML name labels for Points in MultiGeometry ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10632](https://github.com/openlayers/openlayers/pull/10632) - Draw interaction: Append coordinates to polygons and lines (reworked) ([@jahow](https://github.com/jahow))
|
||||||
|
* [#9565](https://github.com/openlayers/openlayers/pull/9565) - Make mousewheel zoom behave like trackpad zoom. ([@dbrnz](https://github.com/dbrnz))
|
||||||
|
* [#10580](https://github.com/openlayers/openlayers/pull/10580) - Fix KML Polystyle outline 0 conflict with Linestyle for linestrings ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10612](https://github.com/openlayers/openlayers/pull/10612) - Make examples work in Internet Explorer ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10587](https://github.com/openlayers/openlayers/pull/10587) - Adds option to View for using larger resolution value when clamping #10586 ([@jeremy-smith-maco](https://github.com/jeremy-smith-maco))
|
||||||
|
* [#10607](https://github.com/openlayers/openlayers/pull/10607) - Update elm-pep to fix builds for IE < 11 ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10598](https://github.com/openlayers/openlayers/pull/10598) - Remove inheritDoc to work around JSDoc issue ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10574](https://github.com/openlayers/openlayers/pull/10574) - Text rendering improvements ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10591](https://github.com/openlayers/openlayers/pull/10591) - Remove obsolete license notice ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10588](https://github.com/openlayers/openlayers/pull/10588) - Sort doc navigation properly and add missing modules ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10581](https://github.com/openlayers/openlayers/pull/10581) - Use package-lock.json for the checksum calculation ([@DanielRuf](https://github.com/DanielRuf))
|
||||||
|
* [#10584](https://github.com/openlayers/openlayers/pull/10584) - fixed issue with version throwing an error if it is null ([@MrSoUndso](https://github.com/MrSoUndso))
|
||||||
|
* [#10575](https://github.com/openlayers/openlayers/pull/10575) - Fix ol/layer/Graticule rendercomplete problem ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10562](https://github.com/openlayers/openlayers/pull/10562) - Zoomify: Separate the service pixel ratio and the device pixel ratio ([@crubier](https://github.com/crubier))
|
||||||
|
* [#10573](https://github.com/openlayers/openlayers/pull/10573) - Replace Bing layer with MapTiler in example ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10570](https://github.com/openlayers/openlayers/pull/10570) - Use correct extent for the vector image ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10572](https://github.com/openlayers/openlayers/pull/10572) - Assert each layer is only added to the map once ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10563](https://github.com/openlayers/openlayers/pull/10563) - More compatible way of exporting a map as pdf ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10545](https://github.com/openlayers/openlayers/pull/10545) - Make KML point feature styles compatible with declutter ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10542](https://github.com/openlayers/openlayers/pull/10542) - Replace Bing layer with MapTiler in KML example ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10543](https://github.com/openlayers/openlayers/pull/10543) - @api tag must not have a value. ([@MoonE](https://github.com/MoonE))
|
||||||
|
* [#10547](https://github.com/openlayers/openlayers/pull/10547) - Only generate module apidoc pages when it contains api tags ([@MoonE](https://github.com/MoonE))
|
||||||
|
* [#10502](https://github.com/openlayers/openlayers/pull/10502) - Stop events that originate with a removed target ([@walkermatt](https://github.com/walkermatt))
|
||||||
|
* [#10527](https://github.com/openlayers/openlayers/pull/10527) - Remove label cache, render text directly to target canvas ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10534](https://github.com/openlayers/openlayers/pull/10534) - [GeoJSON] Read projection from CRS type EPSG ([@wussup](https://github.com/wussup))
|
||||||
|
* [#10430](https://github.com/openlayers/openlayers/pull/10430) - Offset regular shape ([@Razi91](https://github.com/Razi91))
|
||||||
|
* [#10513](https://github.com/openlayers/openlayers/pull/10513) - fixed flag-name in upgrade notes ([@fgubler](https://github.com/fgubler))
|
||||||
|
* [#10504](https://github.com/openlayers/openlayers/pull/10504) - Fix for reset north when rotation is 360 degrees ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10510](https://github.com/openlayers/openlayers/pull/10510) - Remove build/apidoc before running jsdoc again ([@MoonE](https://github.com/MoonE))
|
||||||
|
* [#10498](https://github.com/openlayers/openlayers/pull/10498) - Fixing issue #10497 on behalf of LarryHuang ([@gazza0](https://github.com/gazza0))
|
||||||
|
* [#10496](https://github.com/openlayers/openlayers/pull/10496) - Do not stop events when dragging ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10478](https://github.com/openlayers/openlayers/pull/10478) - Do not abort and dispose of tiles ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10495](https://github.com/openlayers/openlayers/pull/10495) - typo in view.fit ([@danielklim](https://github.com/danielklim))
|
||||||
|
* [#10473](https://github.com/openlayers/openlayers/pull/10473) - Fix for undefined source in Vector layer ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10484](https://github.com/openlayers/openlayers/pull/10484) - Use a function to get the value of the gradient ([@fredj](https://github.com/fredj))
|
||||||
|
* [#10262](https://github.com/openlayers/openlayers/pull/10262) - Rework to make Document and XMLSerializer lazy and injectable ([@bjornharrtell](https://github.com/bjornharrtell))
|
||||||
|
* [#10461](https://github.com/openlayers/openlayers/pull/10461) - Fix link in apidocs to ObjectEvent. ([@MoonE](https://github.com/MoonE))
|
||||||
|
* [#10413](https://github.com/openlayers/openlayers/pull/10413) - Limit the ZoomSlider's range to the view's constrained resolution. ([@MoonE](https://github.com/MoonE))
|
||||||
|
* [#10438](https://github.com/openlayers/openlayers/pull/10438) - Avoid accessing the DOM to read the viewport size too often ([@jahow](https://github.com/jahow))
|
||||||
|
* [#10439](https://github.com/openlayers/openlayers/pull/10439) - WebGL points layer / add support for symbol rotation ([@jahow](https://github.com/jahow))
|
||||||
|
* [#10434](https://github.com/openlayers/openlayers/pull/10434) - Disable image smoothing for the DEM source in the Sea Level example ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10417](https://github.com/openlayers/openlayers/pull/10417) - Replace Bing layer with MapTiler ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10415](https://github.com/openlayers/openlayers/pull/10415) - Control button span element pointer events ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10409](https://github.com/openlayers/openlayers/pull/10409) - Improve viewport computation in WebGL Postprocessing ([@jahow](https://github.com/jahow))
|
||||||
|
* [#10119](https://github.com/openlayers/openlayers/pull/10119) - Add crossOrigin option to ol/format/KML for icons ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10181](https://github.com/openlayers/openlayers/pull/10181) - add tags to example docs ([@roemhildtg](https://github.com/roemhildtg))
|
||||||
|
* [#10407](https://github.com/openlayers/openlayers/pull/10407) - Use render feature compatible extent check ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10340](https://github.com/openlayers/openlayers/pull/10340) - Draw circles and custom geometry in user coordinates ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10393](https://github.com/openlayers/openlayers/pull/10393) - getFeaturesInExtent function for ol/source/VectorTile ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10402](https://github.com/openlayers/openlayers/pull/10402) - Do not preventDefault on pointerdown ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10269](https://github.com/openlayers/openlayers/pull/10269) - Replace the BNG layer source in the Raster Reprojection example ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10394](https://github.com/openlayers/openlayers/pull/10394) - Remove map renderer element when disposing ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10391](https://github.com/openlayers/openlayers/pull/10391) - Use box-shadow css instead of filter ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10392](https://github.com/openlayers/openlayers/pull/10392) - Fix interim tile handing for vector tiles ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10380](https://github.com/openlayers/openlayers/pull/10380) - Adjust examples for layer canvas pixel ratio and rotation ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10384](https://github.com/openlayers/openlayers/pull/10384) - Include Transform typedef in API ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10385](https://github.com/openlayers/openlayers/pull/10385) - Import transpiled rbush ([@walkermatt](https://github.com/walkermatt))
|
||||||
|
* [#10363](https://github.com/openlayers/openlayers/pull/10363) - Interactive SVG layer example ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10120](https://github.com/openlayers/openlayers/pull/10120) - Resolve constraints using anchor if following a cancelled animation ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10370](https://github.com/openlayers/openlayers/pull/10370) - Replace Bing layer with MapTiler ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10362](https://github.com/openlayers/openlayers/pull/10362) - Remove line that was accidently added with #10332 ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10309](https://github.com/openlayers/openlayers/pull/10309) - Bring back vector render mode for vector tile layers ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10332](https://github.com/openlayers/openlayers/pull/10332) - Conditional default prevention instead of touch-action: none ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10301](https://github.com/openlayers/openlayers/pull/10301) - Create hit detection data per layer and without requestAnimationFrame ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10347](https://github.com/openlayers/openlayers/pull/10347) - Set utfgrid tile as loaded after load instead of empty ([@adube](https://github.com/adube))
|
||||||
|
* [#10344](https://github.com/openlayers/openlayers/pull/10344) - Fix lazy UTFGrid loading ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10321](https://github.com/openlayers/openlayers/pull/10321) - Support touch events for DragBox interaction ([@greggian](https://github.com/greggian))
|
||||||
|
* [#10315](https://github.com/openlayers/openlayers/pull/10315) - Replace Bing sources in some examples ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10330](https://github.com/openlayers/openlayers/pull/10330) - Fix modifying circle geometries ([@greggian](https://github.com/greggian))
|
||||||
|
* [#10318](https://github.com/openlayers/openlayers/pull/10318) - Use a minimalist pointer events polyfill ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10322](https://github.com/openlayers/openlayers/pull/10322) - Update tile grid option descriptions ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10308](https://github.com/openlayers/openlayers/pull/10308) - Fix feature lookup after removal of alpha ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10310](https://github.com/openlayers/openlayers/pull/10310) - Ensure that OverviewMap respects the initial rotation of attached Maps ([@brianhelba](https://github.com/brianhelba))
|
||||||
|
* [#10302](https://github.com/openlayers/openlayers/pull/10302) - Do not use Math.sign() to support very old browsers ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10295](https://github.com/openlayers/openlayers/pull/10295) - Do not fail when hit detecting features without style ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10293](https://github.com/openlayers/openlayers/pull/10293) - Do not hit detect while tile is loading ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10292](https://github.com/openlayers/openlayers/pull/10292) - Fix typo in jsdoc in ol/source/WMTS ([@jomue](https://github.com/jomue))
|
||||||
|
* [#10291](https://github.com/openlayers/openlayers/pull/10291) - tabindex without focus condition ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10286](https://github.com/openlayers/openlayers/pull/10286) - Use passive option to avoid Chrome warning ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10285](https://github.com/openlayers/openlayers/pull/10285) - Fix WMS GetLegendGraphic example codesandbox error ([@mike-000](https://github.com/mike-000))
|
||||||
|
* [#10283](https://github.com/openlayers/openlayers/pull/10283) - Use the originalEvent in the targetNotEditable condition ([@fredj](https://github.com/fredj))
|
||||||
|
* [#10282](https://github.com/openlayers/openlayers/pull/10282) - Fix documentation of Stroke.lineDash default value ([@jansule](https://github.com/jansule))
|
||||||
|
* [#10259](https://github.com/openlayers/openlayers/pull/10259) - Remove all the sketch features in abortDrawing ([@fredj](https://github.com/fredj))
|
||||||
|
* [#10265](https://github.com/openlayers/openlayers/pull/10265) - Update operators doc in WebGL points layer example ([@fredj](https://github.com/fredj))
|
||||||
|
* [#10256](https://github.com/openlayers/openlayers/pull/10256) - Do not bypass measureTextWidth ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#10264](https://github.com/openlayers/openlayers/pull/10264) - Remove unused variable from vertex shader ([@fredj](https://github.com/fredj))
|
||||||
|
* [#10257](https://github.com/openlayers/openlayers/pull/10257) - Allow View.adjust* methods to take a null opt_anchor ([@brianhelba](https://github.com/brianhelba))
|
||||||
|
* [#10261](https://github.com/openlayers/openlayers/pull/10261) - WebGL / do not throw error when shader compilation gives a warning ([@jahow](https://github.com/jahow))
|
||||||
|
* [#10255](https://github.com/openlayers/openlayers/pull/10255) - Don't use instanceof HTMLElement in handleMapBrowserEvent ([@fredj](https://github.com/fredj))
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Dependency Updates</summary>
|
||||||
|
|
||||||
|
* [#10629](https://github.com/openlayers/openlayers/pull/10629) - Bump ol-mapbox-style from 6.0.0 to 6.0.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10628](https://github.com/openlayers/openlayers/pull/10628) - Bump puppeteer from 2.1.0 to 2.1.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10627](https://github.com/openlayers/openlayers/pull/10627) - Bump handlebars from 4.7.2 to 4.7.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10626](https://github.com/openlayers/openlayers/pull/10626) - Bump webpack-dev-server from 3.10.2 to 3.10.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10600](https://github.com/openlayers/openlayers/pull/10600) - Bump puppeteer from 2.0.0 to 2.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10606](https://github.com/openlayers/openlayers/pull/10606) - Bump @babel/core from 7.8.3 to 7.8.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10605](https://github.com/openlayers/openlayers/pull/10605) - Bump webpack-dev-server from 3.10.1 to 3.10.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10604](https://github.com/openlayers/openlayers/pull/10604) - Bump rollup from 1.29.1 to 1.31.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10603](https://github.com/openlayers/openlayers/pull/10603) - Bump @babel/preset-env from 7.8.3 to 7.8.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10602](https://github.com/openlayers/openlayers/pull/10602) - Bump url-polyfill from 1.1.7 to 1.1.8 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10601](https://github.com/openlayers/openlayers/pull/10601) - Bump terser-webpack-plugin from 2.3.2 to 2.3.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10578](https://github.com/openlayers/openlayers/pull/10578) - Bump sinon from 8.1.0 to 8.1.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10577](https://github.com/openlayers/openlayers/pull/10577) - Bump mocha from 7.0.0 to 7.0.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10576](https://github.com/openlayers/openlayers/pull/10576) - Bump rollup from 1.29.0 to 1.29.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10551](https://github.com/openlayers/openlayers/pull/10551) - Bump handlebars from 4.7.1 to 4.7.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10550](https://github.com/openlayers/openlayers/pull/10550) - Bump @babel/preset-env from 7.8.2 to 7.8.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10549](https://github.com/openlayers/openlayers/pull/10549) - Bump sinon from 8.0.4 to 8.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10548](https://github.com/openlayers/openlayers/pull/10548) - Bump @babel/core from 7.8.0 to 7.8.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10518](https://github.com/openlayers/openlayers/pull/10518) - Bump front-matter from 3.0.2 to 3.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10516](https://github.com/openlayers/openlayers/pull/10516) - Bump handlebars from 4.5.3 to 4.7.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10514](https://github.com/openlayers/openlayers/pull/10514) - Bump terser-webpack-plugin from 2.3.1 to 2.3.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10523](https://github.com/openlayers/openlayers/pull/10523) - Bump sinon from 8.0.2 to 8.0.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10515](https://github.com/openlayers/openlayers/pull/10515) - Bump @babel/preset-env from 7.7.7 to 7.8.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10517](https://github.com/openlayers/openlayers/pull/10517) - Bump karma-firefox-launcher from 1.2.0 to 1.3.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10519](https://github.com/openlayers/openlayers/pull/10519) - Bump @babel/core from 7.7.7 to 7.8.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10520](https://github.com/openlayers/openlayers/pull/10520) - Bump globby from 10.0.1 to 11.0.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10521](https://github.com/openlayers/openlayers/pull/10521) - Bump rollup-plugin-terser from 5.1.3 to 5.2.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10522](https://github.com/openlayers/openlayers/pull/10522) - Bump rollup from 1.28.0 to 1.29.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10480](https://github.com/openlayers/openlayers/pull/10480) - Bump mocha from 6.2.2 to 7.0.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10482](https://github.com/openlayers/openlayers/pull/10482) - Bump sinon from 8.0.1 to 8.0.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10481](https://github.com/openlayers/openlayers/pull/10481) - Bump yargs from 15.0.2 to 15.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10479](https://github.com/openlayers/openlayers/pull/10479) - Bump rollup from 1.27.14 to 1.28.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10466](https://github.com/openlayers/openlayers/pull/10466) - Bump webpack from 4.41.4 to 4.41.5 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10467](https://github.com/openlayers/openlayers/pull/10467) - Bump sinon from 8.0.0 to 8.0.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10450](https://github.com/openlayers/openlayers/pull/10450) - Bump @babel/core from 7.7.5 to 7.7.7 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10449](https://github.com/openlayers/openlayers/pull/10449) - Bump eslint from 6.7.2 to 6.8.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10448](https://github.com/openlayers/openlayers/pull/10448) - Bump rollup from 1.27.13 to 1.27.14 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10447](https://github.com/openlayers/openlayers/pull/10447) - Bump @babel/preset-env from 7.7.6 to 7.7.7 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10446](https://github.com/openlayers/openlayers/pull/10446) - Bump sinon from 7.5.0 to 8.0.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10445](https://github.com/openlayers/openlayers/pull/10445) - Bump webpack from 4.41.2 to 4.41.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10444](https://github.com/openlayers/openlayers/pull/10444) - Bump terser-webpack-plugin from 2.3.0 to 2.3.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10443](https://github.com/openlayers/openlayers/pull/10443) - Bump webpack-dev-server from 3.9.0 to 3.10.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10425](https://github.com/openlayers/openlayers/pull/10425) - Bump elm-pep from 1.0.2 to 1.0.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10427](https://github.com/openlayers/openlayers/pull/10427) - Bump webpack-cli from 3.3.2 to 3.3.10 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10426](https://github.com/openlayers/openlayers/pull/10426) - Bump copy-webpack-plugin from 5.0.5 to 5.1.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10424](https://github.com/openlayers/openlayers/pull/10424) - Bump eslint from 6.7.1 to 6.7.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10423](https://github.com/openlayers/openlayers/pull/10423) - Bump marked from 0.7.0 to 0.8.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10422](https://github.com/openlayers/openlayers/pull/10422) - Bump url-polyfill from 1.1.5 to 1.1.7 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10421](https://github.com/openlayers/openlayers/pull/10421) - Bump rollup-plugin-terser from 5.1.2 to 5.1.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10420](https://github.com/openlayers/openlayers/pull/10420) - Bump terser-webpack-plugin from 2.2.2 to 2.3.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10419](https://github.com/openlayers/openlayers/pull/10419) - Bump rollup from 1.27.9 to 1.27.13 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10418](https://github.com/openlayers/openlayers/pull/10418) - Bump babel-loader from 8.0.5 to 8.0.6 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10399](https://github.com/openlayers/openlayers/pull/10399) - Bump rollup from 1.25.1 to 1.27.9 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10398](https://github.com/openlayers/openlayers/pull/10398) - Bump terser-webpack-plugin from 2.2.1 to 2.2.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10397](https://github.com/openlayers/openlayers/pull/10397) - Bump @babel/core from 7.7.4 to 7.7.5 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10396](https://github.com/openlayers/openlayers/pull/10396) - Bump @babel/preset-env from 7.7.4 to 7.7.6 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10365](https://github.com/openlayers/openlayers/pull/10365) - Bump @babel/preset-env from 7.6.3 to 7.7.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10366](https://github.com/openlayers/openlayers/pull/10366) - Bump karma-coverage-istanbul-reporter from 2.1.0 to 2.1.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10367](https://github.com/openlayers/openlayers/pull/10367) - Bump coveralls from 3.0.7 to 3.0.9 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10368](https://github.com/openlayers/openlayers/pull/10368) - Bump sinon from 7.3.2 to 7.5.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10369](https://github.com/openlayers/openlayers/pull/10369) - Bump @babel/core from 7.7.2 to 7.7.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10337](https://github.com/openlayers/openlayers/pull/10337) - Bump fs-extra from 8.0.1 to 8.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10336](https://github.com/openlayers/openlayers/pull/10336) - Bump eslint from 6.6.0 to 6.7.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10335](https://github.com/openlayers/openlayers/pull/10335) - Bump yargs from 14.2.0 to 15.0.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10334](https://github.com/openlayers/openlayers/pull/10334) - Bump webpack-dev-middleware from 3.6.2 to 3.7.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10333](https://github.com/openlayers/openlayers/pull/10333) - Bump copy-webpack-plugin from 5.0.4 to 5.0.5 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10306](https://github.com/openlayers/openlayers/pull/10306) - Bump puppeteer from 1.20.0 to 2.0.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10307](https://github.com/openlayers/openlayers/pull/10307) - Bump @babel/core from 7.6.4 to 7.7.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10305](https://github.com/openlayers/openlayers/pull/10305) - Bump proj4 from 2.5.0 to 2.6.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10304](https://github.com/openlayers/openlayers/pull/10304) - Bump handlebars from 4.4.5 to 4.5.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10303](https://github.com/openlayers/openlayers/pull/10303) - Bump glob from 7.1.5 to 7.1.6 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10280](https://github.com/openlayers/openlayers/pull/10280) - Bump rollup-plugin-commonjs from 10.0.0 to 10.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10279](https://github.com/openlayers/openlayers/pull/10279) - Bump rollup-plugin-terser from 5.0.0 to 5.1.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10278](https://github.com/openlayers/openlayers/pull/10278) - Bump eslint from 6.0.0 to 6.6.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10277](https://github.com/openlayers/openlayers/pull/10277) - Bump karma-webpack from 4.0.0-rc.6 to 4.0.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10276](https://github.com/openlayers/openlayers/pull/10276) - Bump webpack-dev-server from 3.3.1 to 3.9.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10251](https://github.com/openlayers/openlayers/pull/10251) - Bump @babel/preset-env from 7.4.4 to 7.6.3 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10250](https://github.com/openlayers/openlayers/pull/10250) - Bump buble from 0.19.7 to 0.19.8 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10249](https://github.com/openlayers/openlayers/pull/10249) - Bump karma-firefox-launcher from 1.1.0 to 1.2.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10248](https://github.com/openlayers/openlayers/pull/10248) - Bump html-to-image from 0.1.0 to 0.1.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#10247](https://github.com/openlayers/openlayers/pull/10247) - Bump terser-webpack-plugin from 2.0.1 to 2.2.1 ([@openlayers](https://github.com/openlayers))
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
@@ -34,7 +34,7 @@ Interactions for <a href="module-ol_Feature-Feature.html">vector features</a>
|
|||||||
<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 <a href="module-ol_proj.html#.transform">ol/proj#transform()</a> and <a href="module-ol_proj.html#.transformExtent">ol/proj#transformExtent()</a>.</p>
|
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use <a href="module-ol_proj.html#.transform">ol/proj#transform()</a> and <a href="module-ol_proj.html#.transformExtent">ol/proj#transformExtent()</a>.</p>
|
||||||
<a href="module-ol_proj.html">ol/proj</a></td>
|
<a href="module-ol_proj.html">ol/proj</a></td>
|
||||||
<td><p>Changes to all <a href="module-ol_Object-BaseObject.html">ol/Object</a>s can be observed by calling the <a href="module-ol_Object-BaseObject.html#on">object.on('propertychange')</a> method. Listeners receive an <a href="module-ol_Object-ObjectEvent.html">ol/Object.ObjectEvent</a> with information on the changed property and old value.</p>
|
<td><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>
|
||||||
<a href="module-ol_Geolocation.html">ol/Geolocation</a><br>
|
<a href="module-ol_Geolocation.html">ol/Geolocation</a><br>
|
||||||
<a href="module-ol_Overlay-Overlay.html">ol/Overlay</a><br></td>
|
<a href="module-ol_Overlay-Overlay.html">ol/Overlay</a><br></td>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
exports.defineTags = function(dictionary) {
|
exports.defineTags = function(dictionary) {
|
||||||
dictionary.defineTag('api', {
|
dictionary.defineTag('api', {
|
||||||
mustHaveValue: false,
|
mustNotHaveValue: true,
|
||||||
canHaveType: false,
|
canHaveType: false,
|
||||||
canHaveName: false,
|
canHaveName: false,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
@@ -119,7 +119,6 @@ exports.handlers = {
|
|||||||
api.push(doclet);
|
api.push(doclet);
|
||||||
}
|
}
|
||||||
if (doclet.kind == 'class') {
|
if (doclet.kind == 'class') {
|
||||||
modules[doclet.longname.split(/[~\.]/).shift()] = true;
|
|
||||||
if (!(doclet.longname in classes)) {
|
if (!(doclet.longname in classes)) {
|
||||||
classes[doclet.longname] = doclet;
|
classes[doclet.longname] = doclet;
|
||||||
} else if ('augments' in doclet) {
|
} else if ('augments' in doclet) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
exports.defineTags = function(dictionary) {
|
exports.defineTags = function(dictionary) {
|
||||||
dictionary.defineTag('inheritDoc', {
|
dictionary.defineTag('inheritDoc', {
|
||||||
mustHaveValue: false,
|
mustNotHaveValue: true,
|
||||||
canHaveType: false,
|
canHaveType: false,
|
||||||
canHaveName: false,
|
canHaveName: false,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
|
|||||||
@@ -188,6 +188,12 @@ function attachModuleSymbols(doclets, modules) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPrettyName(longname) {
|
||||||
|
return longname
|
||||||
|
.split('~')[0]
|
||||||
|
.replace('module:', '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the navigation sidebar.
|
* Create the navigation sidebar.
|
||||||
* @param {object} members The members that will be used to create the sidebar.
|
* @param {object} members The members that will be used to create the sidebar.
|
||||||
@@ -206,10 +212,12 @@ function buildNav(members) {
|
|||||||
// merge namespaces and classes, then sort
|
// merge namespaces and classes, then sort
|
||||||
const merged = members.modules.concat(members.classes);
|
const merged = members.modules.concat(members.classes);
|
||||||
merged.sort(function(a, b) {
|
merged.sort(function(a, b) {
|
||||||
if (a.longname > b.longname) {
|
const prettyNameA = getPrettyName(a.longname).toLowerCase();
|
||||||
|
const prettyNameB = getPrettyName(b.longname).toLowerCase();
|
||||||
|
if (prettyNameA > prettyNameB) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (a.longname < b.longname) {
|
if (prettyNameA < prettyNameB) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -221,9 +229,7 @@ function buildNav(members) {
|
|||||||
nav.push({
|
nav.push({
|
||||||
type: 'class',
|
type: 'class',
|
||||||
longname: v.longname,
|
longname: v.longname,
|
||||||
prettyname: v.longname
|
prettyname: getPrettyName(v.longname),
|
||||||
.split('~')[0]
|
|
||||||
.replace('module:', ''),
|
|
||||||
name: v.name,
|
name: v.name,
|
||||||
module: find({
|
module: find({
|
||||||
kind: 'module',
|
kind: 'module',
|
||||||
@@ -268,14 +274,13 @@ function buildNav(members) {
|
|||||||
kind: 'event',
|
kind: 'event',
|
||||||
memberof: v.longname
|
memberof: v.longname
|
||||||
});
|
});
|
||||||
// only add modules that have more to show than just a single class
|
// only add modules that have more to show than just classes
|
||||||
if (classes.length !== 1 && (classes.length + members.length + methods.length + typedefs.length + events.length > 0)) {
|
const numItems = classes.length - 1 + members.length + methods.length + typedefs.length + events.length;
|
||||||
|
if (!classes.length || (numItems > 0 && numItems !== classes.length)) {
|
||||||
nav.push({
|
nav.push({
|
||||||
type: 'module',
|
type: 'module',
|
||||||
longname: v.longname,
|
longname: v.longname,
|
||||||
prettyname: v.longname
|
prettyname: getPrettyName(v.longname),
|
||||||
.split('~')[0]
|
|
||||||
.replace('module:', ''),
|
|
||||||
name: v.name,
|
name: v.name,
|
||||||
members: members,
|
members: members,
|
||||||
methods: methods,
|
methods: methods,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Settable</th>
|
<th>Settable</th>
|
||||||
<th><a href="module-ol_Object-ObjectEvent.html">ol/Object.ObjectEvent</a> type</th>
|
<th><a href="module-ol_Object.ObjectEvent.html">ol/Object.ObjectEvent</a> type</th>
|
||||||
<th class="last">Description</th>
|
<th class="last">Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ exports.defineTags = function(dictionary) {
|
|||||||
|
|
||||||
const classTag = dictionary.lookUp('class');
|
const classTag = dictionary.lookUp('class');
|
||||||
dictionary.defineTag('interface', {
|
dictionary.defineTag('interface', {
|
||||||
mustHaveValue: false,
|
mustNotHaveValue: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
classTag.onTagged.apply(this, arguments);
|
classTag.onTagged.apply(this, arguments);
|
||||||
doclet.virtual = true;
|
doclet.virtual = true;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ Features for `updates` must have an id set by the feature reader or `ol.Feature#
|
|||||||
|
|
||||||
### 28
|
### 28
|
||||||
|
|
||||||
`renderMode` must be `'image'` or `'hybrid'`.
|
`renderMode` must be `'image'`, `'hybrid'` or `'vector'`.
|
||||||
|
|
||||||
### 29
|
### 29
|
||||||
|
|
||||||
@@ -245,3 +245,7 @@ Layer opacity must be a number.
|
|||||||
|
|
||||||
`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled.
|
`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled.
|
||||||
This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`.
|
This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`.
|
||||||
|
|
||||||
|
### 67
|
||||||
|
|
||||||
|
A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.
|
||||||
5188
examples/data/world.svg
Normal file
|
After Width: | Height: | Size: 3.2 MiB |
@@ -4,10 +4,10 @@ title: Drag-and-Drop Image Vector
|
|||||||
shortdesc: Example of using the drag-and-drop interaction with image vector rendering.
|
shortdesc: Example of using the drag-and-drop interaction with image vector rendering.
|
||||||
docs: >
|
docs: >
|
||||||
Example of using the drag-and-drop interaction with an `ol/layer/VectorImage` layer. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client.
|
Example of using the drag-and-drop interaction with an `ol/layer/VectorImage` layer. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client.
|
||||||
tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image"
|
tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, maptiler, vector, image"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<div id="info"> </div>
|
<div id="info"> </div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import {GPX, GeoJSON, IGC, KML, TopoJSON} from '../src/ol/format.js';
|
import {GPX, GeoJSON, IGC, KML, TopoJSON} from '../src/ol/format.js';
|
||||||
import {defaults as defaultInteractions, DragAndDrop} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions, DragAndDrop} from '../src/ol/interaction.js';
|
||||||
import {VectorImage as VectorImageLayer, Tile as TileLayer} from '../src/ol/layer.js';
|
import {VectorImage as VectorImageLayer, Tile as TileLayer} from '../src/ol/layer.js';
|
||||||
import {BingMaps, Vector as VectorSource} from '../src/ol/source.js';
|
import {XYZ, Vector as VectorSource} from '../src/ol/source.js';
|
||||||
|
|
||||||
const dragAndDropInteraction = new DragAndDrop({
|
const dragAndDropInteraction = new DragAndDrop({
|
||||||
formatConstructors: [
|
formatConstructors: [
|
||||||
@@ -15,13 +15,18 @@ const dragAndDropInteraction = new DragAndDrop({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
interactions: defaultInteractions().extend([dragAndDropInteraction]),
|
interactions: defaultInteractions().extend([dragAndDropInteraction]),
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
imagerySet: 'Aerial',
|
attributions: attributions,
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ title: Drag-and-Drop
|
|||||||
shortdesc: Example of using the drag-and-drop interaction.
|
shortdesc: Example of using the drag-and-drop interaction.
|
||||||
docs: >
|
docs: >
|
||||||
Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857.
|
Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857.
|
||||||
tags: "drag-and-drop, gpx, geojson, igc, kml, topojson"
|
tags: "drag-and-drop, gpx, geojson, igc, kml, topojson, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<div id="info"> </div>
|
<div id="info"> </div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import {GPX, GeoJSON, IGC, KML, TopoJSON} from '../src/ol/format.js';
|
import {GPX, GeoJSON, IGC, KML, TopoJSON} from '../src/ol/format.js';
|
||||||
import {defaults as defaultInteractions, DragAndDrop} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions, DragAndDrop} from '../src/ol/interaction.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 {BingMaps, Vector as VectorSource} from '../src/ol/source.js';
|
import {XYZ, Vector as VectorSource} from '../src/ol/source.js';
|
||||||
|
|
||||||
const dragAndDropInteraction = new DragAndDrop({
|
const dragAndDropInteraction = new DragAndDrop({
|
||||||
formatConstructors: [
|
formatConstructors: [
|
||||||
@@ -15,13 +15,18 @@ const dragAndDropInteraction = new DragAndDrop({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
interactions: defaultInteractions().extend([dragAndDropInteraction]),
|
interactions: defaultInteractions().extend([dragAndDropInteraction]),
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
imagerySet: 'Aerial',
|
attributions: attributions,
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ 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()
|
||||||
});
|
});
|
||||||
@@ -44,14 +42,6 @@ const dims = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 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() {
|
||||||
@@ -68,11 +58,22 @@ exportButton.addEventListener('click', function() {
|
|||||||
const viewResolution = map.getView().getResolution();
|
const viewResolution = map.getView().getResolution();
|
||||||
|
|
||||||
map.once('rendercomplete', function() {
|
map.once('rendercomplete', function() {
|
||||||
exportOptions.width = width;
|
const mapCanvas = document.createElement('canvas');
|
||||||
exportOptions.height = height;
|
mapCanvas.width = width;
|
||||||
toJpeg(map.getViewport(), exportOptions).then(function(dataUrl) {
|
mapCanvas.height = height;
|
||||||
|
const mapContext = mapCanvas.getContext('2d');
|
||||||
|
document.querySelectorAll('.ol-layer canvas').forEach(function(canvas) {
|
||||||
|
if (canvas.width > 0) {
|
||||||
|
const transform = canvas.style.transform;
|
||||||
|
// Get the transform parameters from the style's transform matrix
|
||||||
|
const matrix = transform.match(/^matrix\(([^\(]*)\)$/)[1].split(',').map(Number);
|
||||||
|
// Apply the transform to the export map context
|
||||||
|
CanvasRenderingContext2D.prototype.setTransform.apply(mapContext, matrix);
|
||||||
|
mapContext.drawImage(canvas, 0, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
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(mapCanvas.toDataURL('image/jpeg'), '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);
|
||||||
@@ -80,7 +81,6 @@ exportButton.addEventListener('click', function() {
|
|||||||
exportButton.disabled = false;
|
exportButton.disabled = false;
|
||||||
document.body.style.cursor = 'auto';
|
document.body.style.cursor = 'auto';
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Set print size
|
// Set print size
|
||||||
const printSize = [width, height];
|
const printSize = [width, height];
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ docs: >
|
|||||||
This example shows how to use <b>postrender</b> events and a <b>vector context</b> to
|
This example shows how to use <b>postrender</b> events and a <b>vector context</b> to
|
||||||
animate a marker feature along a line. In this example an encoded polyline
|
animate a marker feature along a line. In this example an encoded polyline
|
||||||
is being used.
|
is being used.
|
||||||
tags: "animation, feature, postrender, polyline"
|
tags: "animation, feature, postrender, polyline, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<label for="speed">
|
<label for="speed">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import View from '../src/ol/View.js';
|
|||||||
import Polyline from '../src/ol/format/Polyline.js';
|
import Polyline from '../src/ol/format/Polyline.js';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point.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 BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import {Circle as CircleStyle, Fill, Icon, Stroke, Style} from '../src/ol/style.js';
|
import {Circle as CircleStyle, Fill, Icon, Stroke, Style} from '../src/ol/style.js';
|
||||||
import {getVectorContext} from '../src/ol/render.js';
|
import {getVectorContext} from '../src/ol/render.js';
|
||||||
@@ -121,6 +121,10 @@ const vectorLayer = new VectorLayer({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const center = [-5639523.95, -3501274.52];
|
const center = [-5639523.95, -3501274.52];
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
target: document.getElementById('map'),
|
target: document.getElementById('map'),
|
||||||
@@ -132,9 +136,10 @@ const map = new Map({
|
|||||||
}),
|
}),
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
imagerySet: 'AerialWithLabelsOnDemand',
|
attributions: attributions,
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
|
url: 'https://api.maptiler.com/maps/hybrid/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
tileSize: 512
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
vectorLayer
|
vectorLayer
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ shortdesc: Example of drag rotate and zoom control with full screen effect.
|
|||||||
docs: >
|
docs: >
|
||||||
<p>Hold down <code>Shift+Drag</code> to rotate and zoom. Click the button in the top right corner to go full screen. Then do the <code>Shift+Drag</code> thing again.</p>
|
<p>Hold down <code>Shift+Drag</code> to rotate and zoom. Click the button in the top right corner to go full screen. Then do the <code>Shift+Drag</code> thing again.</p>
|
||||||
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
||||||
tags: "full-screen, drag, rotate, zoom, bing, bing-maps"
|
tags: "full-screen, drag, rotate, zoom, xyz, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ import View from '../src/ol/View.js';
|
|||||||
import {defaults as defaultControls, FullScreen} from '../src/ol/control.js';
|
import {defaults as defaultControls, FullScreen} from '../src/ol/control.js';
|
||||||
import {defaults as defaultInteractions, DragRotateAndZoom} from '../src/ol/interaction.js';
|
import {defaults as defaultInteractions, DragRotateAndZoom} from '../src/ol/interaction.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
controls: defaultControls().extend([
|
controls: defaultControls().extend([
|
||||||
new FullScreen()
|
new FullScreen()
|
||||||
@@ -15,13 +19,13 @@ const map = new Map({
|
|||||||
]),
|
]),
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
attributions: attributions,
|
||||||
imagerySet: 'Aerial'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
// Use the canvas renderer because it's currently the fastest
|
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new View({
|
view: new View({
|
||||||
center: [-33519607, 5616436],
|
center: [-33519607, 5616436],
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ shortdesc: Example of a full screen control.
|
|||||||
docs: >
|
docs: >
|
||||||
<p>Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
|
<p>Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
|
||||||
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
|
||||||
tags: "full-screen, bing, bing-maps"
|
tags: "full-screen, xyz, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
|
|||||||
@@ -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 {defaults as defaultControls, FullScreen} from '../src/ol/control.js';
|
import {defaults as defaultControls, FullScreen} from '../src/ol/control.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
|
||||||
|
|
||||||
const view = new View({
|
const view = new View({
|
||||||
@@ -10,15 +10,20 @@ const view = new View({
|
|||||||
zoom: 14
|
zoom: 14
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
controls: defaultControls().extend([
|
controls: defaultControls().extend([
|
||||||
new FullScreen()
|
new FullScreen()
|
||||||
]),
|
]),
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
attributions: attributions,
|
||||||
imagerySet: 'Aerial'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ title: GPX Data
|
|||||||
shortdesc: Example of using the GPX source.
|
shortdesc: Example of using the GPX source.
|
||||||
docs: >
|
docs: >
|
||||||
Example of using the GPX source.
|
Example of using the GPX source.
|
||||||
tags: "GPX"
|
tags: "GPX, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<div id="info"> </div>
|
<div id="info"> </div>
|
||||||
|
|||||||
@@ -2,14 +2,19 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import GPX from '../src/ol/format/GPX.js';
|
import GPX from '../src/ol/format/GPX.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 BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.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';
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const raster = new TileLayer({
|
const raster = new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
imagerySet: 'Aerial',
|
attributions: attributions,
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ docs: >
|
|||||||
<p>Layer rendering can be manipulated in <code>prerender</code> and <code>postrender</code> event listeners.
|
<p>Layer rendering can be manipulated in <code>prerender</code> and <code>postrender</code> event listeners.
|
||||||
These listeners get an event with a reference to the Canvas rendering context.
|
These listeners get an event with a reference to the Canvas rendering context.
|
||||||
In this example, the <code>postrender</code> listener applies a filter to the image data.</p>
|
In this example, the <code>postrender</code> listener applies a filter to the image data.</p>
|
||||||
tags: "filter, image manipulation"
|
tags: "filter, image manipulation, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<select id="kernel" name="kernel">
|
<select id="kernel" name="kernel">
|
||||||
|
|||||||
@@ -2,12 +2,19 @@ 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.js';
|
import {fromLonLat} from '../src/ol/proj.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
|
||||||
const key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const imagery = new TileLayer({
|
const imagery = new TileLayer({
|
||||||
source: new BingMaps({key: key, imagerySet: 'Aerial'})
|
source: new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20,
|
||||||
|
crossOrigin: ''
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
layout: example.html
|
|
||||||
title: Interaction Options
|
|
||||||
shortdesc: Shows interaction options for custom scroll and zoom behavior.
|
|
||||||
docs: >
|
|
||||||
This example uses a custom `ol/interaction/defaults` configuration:
|
|
||||||
by default, wheel/trackpad zoom and drag panning is always active, which
|
|
||||||
can be unexpected on pages with a lot of scrollable content and an embedded
|
|
||||||
map. To perform wheel/trackpad zoom and drag-pan actions only when the map
|
|
||||||
has the focus, set `onFocusOnly: true` as option. This requires a map div
|
|
||||||
with a `tabindex` attribute set.
|
|
||||||
tags: "trackpad, mousewheel, zoom, scroll, interaction, fractional"
|
|
||||||
---
|
|
||||||
<div tabindex="1" id="map" class="map"></div>
|
|
||||||
@@ -4,10 +4,10 @@ title: KML
|
|||||||
shortdesc: Rendering KML with a vector source.
|
shortdesc: Rendering KML with a vector source.
|
||||||
docs: >
|
docs: >
|
||||||
This example uses the <code>ol/format/KML</code> to parse KML for rendering with a vector source.
|
This example uses the <code>ol/format/KML</code> to parse KML for rendering with a vector source.
|
||||||
tags: "KML"
|
tags: "KML, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<div id="info"> </div>
|
<div id="info"> </div>
|
||||||
|
|||||||
@@ -2,13 +2,18 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import KML from '../src/ol/format/KML.js';
|
import KML from '../src/ol/format/KML.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 BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const raster = new TileLayer({
|
const raster = new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
imagerySet: 'Aerial',
|
attributions: attributions,
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,17 @@ const map = new Map({
|
|||||||
|
|
||||||
osm.on('prerender', function(event) {
|
osm.on('prerender', function(event) {
|
||||||
const ctx = event.context;
|
const ctx = event.context;
|
||||||
|
|
||||||
|
// calculate the pixel ratio and rotation of the canvas
|
||||||
|
const matrix = event.inversePixelTransform;
|
||||||
|
const canvasPixelRatio = Math.sqrt(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
|
||||||
|
const canvasRotation = -Math.atan2(matrix[1], matrix[0]);
|
||||||
ctx.save();
|
ctx.save();
|
||||||
const pixelRatio = event.frameState.pixelRatio;
|
// center the canvas and remove rotation to position clipping
|
||||||
const size = map.getSize();
|
ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2);
|
||||||
ctx.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
ctx.rotate(-canvasRotation);
|
||||||
ctx.scale(3 * pixelRatio, 3 * pixelRatio);
|
|
||||||
|
ctx.scale(3 * canvasPixelRatio, 3 * canvasPixelRatio);
|
||||||
ctx.translate(-75, -80);
|
ctx.translate(-75, -80);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(75, 40);
|
ctx.moveTo(75, 40);
|
||||||
@@ -34,8 +40,11 @@ osm.on('prerender', function(event) {
|
|||||||
ctx.bezierCurveTo(85, 25, 75, 37, 75, 40);
|
ctx.bezierCurveTo(85, 25, 75, 37, 75, 40);
|
||||||
ctx.clip();
|
ctx.clip();
|
||||||
ctx.translate(75, 80);
|
ctx.translate(75, 80);
|
||||||
ctx.scale(1 / 3 / pixelRatio, 1 / 3 / pixelRatio);
|
ctx.scale(1 / 3 / canvasPixelRatio, 1 / 3 / canvasPixelRatio);
|
||||||
ctx.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
|
||||||
|
// reapply canvas rotation and position
|
||||||
|
ctx.rotate(canvasRotation);
|
||||||
|
ctx.translate(-ctx.canvas.width / 2, -ctx.canvas.height / 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
osm.on('postrender', function(event) {
|
osm.on('postrender', function(event) {
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ docs: >
|
|||||||
In this example, the <code>prerender</code> listener sets a clipping mask around the most
|
In this example, the <code>prerender</code> listener sets a clipping mask around the most
|
||||||
recent mouse position, giving you a spyglass effect for viewing one layer over another.</p>
|
recent mouse position, giving you a spyglass effect for viewing one layer over another.</p>
|
||||||
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
|
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
|
||||||
tags: "spy, image manipulation"
|
tags: "spy, image manipulation, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
|
|||||||
@@ -2,16 +2,28 @@ 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.js';
|
import {fromLonLat} from '../src/ol/proj.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
import {getRenderPixel} from '../src/ol/render.js';
|
||||||
|
|
||||||
const key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const roads = new TileLayer({
|
const roads = new TileLayer({
|
||||||
source: new BingMaps({key: key, imagerySet: 'RoadOnDemand'})
|
source: new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=' + key,
|
||||||
|
tileSize: 512,
|
||||||
|
maxZoom: 22
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const imagery = new TileLayer({
|
const imagery = new TileLayer({
|
||||||
source: new BingMaps({key: key, imagerySet: 'Aerial'})
|
source: new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const container = document.getElementById('map');
|
const container = document.getElementById('map');
|
||||||
@@ -54,14 +66,15 @@ container.addEventListener('mouseout', function() {
|
|||||||
// before rendering the layer, do some clipping
|
// before rendering the layer, do some clipping
|
||||||
imagery.on('prerender', function(event) {
|
imagery.on('prerender', function(event) {
|
||||||
const ctx = event.context;
|
const ctx = event.context;
|
||||||
const pixelRatio = event.frameState.pixelRatio;
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
if (mousePosition) {
|
if (mousePosition) {
|
||||||
// only show a circle around the mouse
|
// only show a circle around the mouse
|
||||||
ctx.arc(mousePosition[0] * pixelRatio, mousePosition[1] * pixelRatio,
|
const pixel = getRenderPixel(event, mousePosition);
|
||||||
radius * pixelRatio, 0, 2 * Math.PI);
|
const offset = getRenderPixel(event, [mousePosition[0] + radius, mousePosition[1]]);
|
||||||
ctx.lineWidth = 5 * pixelRatio;
|
const canvasRadius = Math.sqrt(Math.pow(offset[0] - pixel[0], 2) + Math.pow(offset[1] - pixel[1], 2));
|
||||||
|
ctx.arc(pixel[0], pixel[1], canvasRadius, 0, 2 * Math.PI);
|
||||||
|
ctx.lineWidth = 5 * canvasRadius / radius;
|
||||||
ctx.strokeStyle = 'rgba(0,0,0,0.5)';
|
ctx.strokeStyle = 'rgba(0,0,0,0.5)';
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ title: Layer Swipe
|
|||||||
shortdesc: Example of a Layer swipe map.
|
shortdesc: Example of a Layer swipe map.
|
||||||
docs: >
|
docs: >
|
||||||
Example of a Layer swipe map.
|
Example of a Layer swipe map.
|
||||||
tags: "swipe, openstreetmap"
|
tags: "swipe, openstreetmap, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
<input id="swipe" type="range" style="width: 100%">
|
<input id="swipe" type="range" style="width: 100%">
|
||||||
|
|||||||
@@ -1,21 +1,28 @@
|
|||||||
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 BingMaps from '../src/ol/source/BingMaps.js';
|
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
import OSM from '../src/ol/source/OSM.js';
|
||||||
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
import {getRenderPixel} from '../src/ol/render.js';
|
||||||
|
|
||||||
const osm = new TileLayer({
|
const osm = new TileLayer({
|
||||||
source: new OSM()
|
source: new OSM()
|
||||||
});
|
});
|
||||||
const bing = new TileLayer({
|
|
||||||
source: new BingMaps({
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
imagerySet: 'Aerial'
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
|
const aerial = new TileLayer({
|
||||||
|
source: new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [osm, bing],
|
layers: [osm, aerial],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new View({
|
view: new View({
|
||||||
center: [0, 0],
|
center: [0, 0],
|
||||||
@@ -25,17 +32,26 @@ const map = new Map({
|
|||||||
|
|
||||||
const swipe = document.getElementById('swipe');
|
const swipe = document.getElementById('swipe');
|
||||||
|
|
||||||
bing.on('prerender', function(event) {
|
aerial.on('prerender', function(event) {
|
||||||
const ctx = event.context;
|
const ctx = event.context;
|
||||||
const width = ctx.canvas.width * (swipe.value / 100);
|
const mapSize = map.getSize();
|
||||||
|
const width = mapSize[0] * (swipe.value / 100);
|
||||||
|
const tl = getRenderPixel(event, [width, 0]);
|
||||||
|
const tr = getRenderPixel(event, [mapSize[0], 0]);
|
||||||
|
const bl = getRenderPixel(event, [width, mapSize[1]]);
|
||||||
|
const br = getRenderPixel(event, mapSize);
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height);
|
ctx.moveTo(tl[0], tl[1]);
|
||||||
|
ctx.lineTo(bl[0], bl[1]);
|
||||||
|
ctx.lineTo(br[0], br[1]);
|
||||||
|
ctx.lineTo(tr[0], tr[1]);
|
||||||
|
ctx.closePath();
|
||||||
ctx.clip();
|
ctx.clip();
|
||||||
});
|
});
|
||||||
|
|
||||||
bing.on('postrender', function(event) {
|
aerial.on('postrender', function(event) {
|
||||||
const ctx = event.context;
|
const ctx = event.context;
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ docs: >
|
|||||||
<p>This example makes use of the <code>postrender</code> event listener to
|
<p>This example makes use of the <code>postrender</code> event listener to
|
||||||
oversample imagery in a circle around the pointer location. Listeners for this event have access to the Canvas context and can manipulate image data.</p>
|
oversample imagery in a circle around the pointer location. Listeners for this event have access to the Canvas context and can manipulate image data.</p>
|
||||||
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the magnified circle size.</p>
|
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the magnified circle size.</p>
|
||||||
tags: "magnify, image manipulation"
|
tags: "magnify, image manipulation, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
|
|||||||
@@ -2,13 +2,20 @@ 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.js';
|
import {fromLonLat} from '../src/ol/proj.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import {getRenderPixel} from '../src/ol/render.js';
|
import {getRenderPixel} from '../src/ol/render.js';
|
||||||
|
|
||||||
const key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const imagery = new TileLayer({
|
const imagery = new TileLayer({
|
||||||
source: new BingMaps({key: key, imagerySet: 'Aerial'})
|
source: new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20,
|
||||||
|
crossOrigin: ''
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const container = document.getElementById('map');
|
const container = document.getElementById('map');
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ cloak:
|
|||||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
<title>Mapbox Style objects with ol-mapbox-style</title>
|
<title>Mapbox Style objects with ol-mapbox-style</title>
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
||||||
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,String.prototype.startsWith,Object.assign"></script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
html, body, .map {
|
html, body, .map {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
10
examples/page-scroll.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
layout: example.html
|
||||||
|
title: Page Scrolling
|
||||||
|
shortdesc: Shows a map that does not interrupt page scrolling.
|
||||||
|
docs: >
|
||||||
|
To perform wheel/trackpad zoom and drag-pan actions only when the map
|
||||||
|
has the focus, configure your map div with a `tabindex` attribute.
|
||||||
|
tags: "trackpad, mousewheel, zoom, scroll, page"
|
||||||
|
---
|
||||||
|
<div tabindex="1" id="map" class="map"></div>
|
||||||
@@ -1,14 +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 {defaults as defaultInteractions} from '../src/ol/interaction.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';
|
||||||
|
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
interactions: defaultInteractions({
|
|
||||||
onFocusOnly: true
|
|
||||||
}),
|
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new OSM()
|
source: new OSM()
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
.ol-popup {
|
.ol-popup {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
-webkit-filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
|
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
|
||||||
filter: drop-shadow(0 1px 4px rgba(0,0,0,0.2));
|
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 1px solid #cccccc;
|
border: 1px solid #cccccc;
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ docs: >
|
|||||||
those pixels based on a threshold value (values above the
|
those pixels based on a threshold value (values above the
|
||||||
threshold are green and those below are transparent).
|
threshold are green and those below are transparent).
|
||||||
</p>
|
</p>
|
||||||
tags: "raster, pixel"
|
tags: "raster, pixel, maptiler"
|
||||||
resources:
|
resources:
|
||||||
- https://unpkg.com/d3@4.12.0/build/d3.js
|
- https://unpkg.com/d3@4.12.0/build/d3.js
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.com/ here
|
value: Get your own API key at https://www.maptiler.com/cloud/
|
||||||
---
|
---
|
||||||
<div class="rel">
|
<div class="rel">
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -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 {Image as ImageLayer, Tile as TileLayer} from '../src/ol/layer.js';
|
import {Image as ImageLayer, Tile as TileLayer} from '../src/ol/layer.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import RasterSource from '../src/ol/source/Raster.js';
|
import RasterSource from '../src/ol/source/Raster.js';
|
||||||
|
|
||||||
const minVgi = 0;
|
const minVgi = 0;
|
||||||
@@ -46,9 +46,16 @@ function summarize(value, counts) {
|
|||||||
/**
|
/**
|
||||||
* Use aerial imagery as the input data for the raster source.
|
* Use aerial imagery as the input data for the raster source.
|
||||||
*/
|
*/
|
||||||
const bing = new BingMaps({
|
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
imagerySet: 'Aerial'
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
|
const aerial = new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20,
|
||||||
|
crossOrigin: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +64,7 @@ const bing = new BingMaps({
|
|||||||
* be colored green.
|
* be colored green.
|
||||||
*/
|
*/
|
||||||
const raster = new RasterSource({
|
const raster = new RasterSource({
|
||||||
sources: [bing],
|
sources: [aerial],
|
||||||
/**
|
/**
|
||||||
* Run calculations on pixel data.
|
* Run calculations on pixel data.
|
||||||
* @param {Array} pixels List of pixels (one per source).
|
* @param {Array} pixels List of pixels (one per source).
|
||||||
@@ -110,7 +117,7 @@ raster.on('afteroperations', function(event) {
|
|||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: bing
|
source: aerial
|
||||||
}),
|
}),
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
source: raster
|
source: raster
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ docs: >
|
|||||||
This example also shows how an additional function can be made available
|
This example also shows how an additional function can be made available
|
||||||
to the operation.
|
to the operation.
|
||||||
</p>
|
</p>
|
||||||
tags: "raster, region growing"
|
tags: "raster, region growing, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.com/ here
|
value: Get your own API key at https://www.maptiler.com/cloud/
|
||||||
---
|
---
|
||||||
<div id="map" class="map" style="cursor: pointer"></div>
|
<div id="map" class="map" style="cursor: pointer"></div>
|
||||||
<table class="controls">
|
<table class="controls">
|
||||||
|
|||||||
@@ -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 {Image as ImageLayer, Tile as TileLayer} from '../src/ol/layer.js';
|
import {Image as ImageLayer, Tile as TileLayer} from '../src/ol/layer.js';
|
||||||
import {fromLonLat} from '../src/ol/proj.js';
|
import {fromLonLat} from '../src/ol/proj.js';
|
||||||
import BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import RasterSource from '../src/ol/source/Raster.js';
|
import RasterSource from '../src/ol/source/Raster.js';
|
||||||
|
|
||||||
function growRegion(inputs, data) {
|
function growRegion(inputs, data) {
|
||||||
@@ -72,10 +72,17 @@ function next4Edges(edge) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
const key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const imagery = new TileLayer({
|
const imagery = new TileLayer({
|
||||||
source: new BingMaps({key: key, imagerySet: 'Aerial'})
|
source: new XYZ({
|
||||||
|
attributions: attributions,
|
||||||
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20,
|
||||||
|
crossOrigin: ''
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const raster = new RasterSource({
|
const raster = new RasterSource({
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ shortdesc: Example of some Regular Shape styles.
|
|||||||
docs: >
|
docs: >
|
||||||
This example shows how several regular shapes
|
This example shows how several regular shapes
|
||||||
or symbols (representing `x`, `cross`, `star`,
|
or symbols (representing `x`, `cross`, `star`,
|
||||||
`triangle` and `square`) can be created.
|
`triangle`, `square` and `stacked`) can be created.
|
||||||
|
|
||||||
|
Style `stacked` represents possility to stack multiple shapes with offset
|
||||||
tags: "vector, symbol, regularshape, style, square, cross, star, triangle, x"
|
tags: "vector, symbol, regularshape, style, square, cross, star, triangle, x"
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -59,18 +59,39 @@ const styles = {
|
|||||||
radius2: 0,
|
radius2: 0,
|
||||||
angle: Math.PI / 4
|
angle: Math.PI / 4
|
||||||
})
|
})
|
||||||
|
}),
|
||||||
|
'stacked': [
|
||||||
|
new Style({
|
||||||
|
image: new RegularShape({
|
||||||
|
fill: fill,
|
||||||
|
stroke: stroke,
|
||||||
|
points: 4,
|
||||||
|
radius: 5,
|
||||||
|
angle: Math.PI / 4,
|
||||||
|
displacement: [0, 10]
|
||||||
})
|
})
|
||||||
|
}),
|
||||||
|
new Style({
|
||||||
|
image: new RegularShape({
|
||||||
|
fill: fill,
|
||||||
|
stroke: stroke,
|
||||||
|
points: 4,
|
||||||
|
radius: 10,
|
||||||
|
angle: Math.PI / 4
|
||||||
|
})
|
||||||
|
})
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const styleKeys = ['x', 'cross', 'star', 'triangle', 'square'];
|
const styleKeys = ['x', 'cross', 'star', 'triangle', 'square', 'stacked'];
|
||||||
const count = 250;
|
const count = 250;
|
||||||
const features = new Array(count);
|
const features = new Array(count);
|
||||||
const e = 4500000;
|
const e = 4500000;
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
const coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e];
|
const coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e];
|
||||||
features[i] = new Feature(new Point(coordinates));
|
features[i] = new Feature(new Point(coordinates));
|
||||||
features[i].setStyle(styles[styleKeys[Math.floor(Math.random() * 5)]]);
|
features[i].setStyle(styles[styleKeys[Math.floor(Math.random() * 6)]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const source = new VectorSource({
|
const source = new VectorSource({
|
||||||
|
|||||||
@@ -55,15 +55,6 @@ proj54009.setExtent([-18e6, -9e6, 18e6, 9e6]);
|
|||||||
|
|
||||||
const layers = {};
|
const layers = {};
|
||||||
|
|
||||||
layers['bng'] = new TileLayer({
|
|
||||||
source: new XYZ({
|
|
||||||
projection: 'EPSG:27700',
|
|
||||||
url: 'https://tileserver.maptiler.com/miniscale/{z}/{x}/{y}.png',
|
|
||||||
crossOrigin: '',
|
|
||||||
maxZoom: 6
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
layers['osm'] = new TileLayer({
|
layers['osm'] = new TileLayer({
|
||||||
source: new OSM()
|
source: new OSM()
|
||||||
});
|
});
|
||||||
@@ -95,9 +86,11 @@ layers['wms21781'] = new TileLayer({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const parser = new WMTSCapabilities();
|
const parser = new WMTSCapabilities();
|
||||||
const url = 'https://map1.vis.earthdata.nasa.gov/wmts-arctic/' +
|
|
||||||
|
layers['wmts3413'] = new TileLayer();
|
||||||
|
const urlA = 'https://map1.vis.earthdata.nasa.gov/wmts-arctic/' +
|
||||||
'wmts.cgi?SERVICE=WMTS&request=GetCapabilities';
|
'wmts.cgi?SERVICE=WMTS&request=GetCapabilities';
|
||||||
fetch(url).then(function(response) {
|
fetch(urlA).then(function(response) {
|
||||||
return response.text();
|
return response.text();
|
||||||
}).then(function(text) {
|
}).then(function(text) {
|
||||||
const result = parser.read(text);
|
const result = parser.read(text);
|
||||||
@@ -108,9 +101,23 @@ fetch(url).then(function(response) {
|
|||||||
options.crossOrigin = '';
|
options.crossOrigin = '';
|
||||||
options.projection = 'EPSG:3413';
|
options.projection = 'EPSG:3413';
|
||||||
options.wrapX = false;
|
options.wrapX = false;
|
||||||
layers['wmts3413'] = new TileLayer({
|
layers['wmts3413'].setSource(new WMTS(options));
|
||||||
source: new WMTS(options)
|
});
|
||||||
|
|
||||||
|
layers['bng'] = new TileLayer();
|
||||||
|
const urlB = 'https://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Raster/MapServer/WMTS';
|
||||||
|
fetch(urlB).then(function(response) {
|
||||||
|
return response.text();
|
||||||
|
}).then(function(text) {
|
||||||
|
const result = parser.read(text);
|
||||||
|
const options = optionsFromCapabilities(result, {
|
||||||
|
layer: 'OS_Open_Raster'
|
||||||
});
|
});
|
||||||
|
options.attributions = 'Contains OS data © Crown Copyright and database right 2019';
|
||||||
|
options.crossOrigin = '';
|
||||||
|
options.projection = 'EPSG:27700';
|
||||||
|
options.wrapX = false;
|
||||||
|
layers['bng'].setSource(new WMTS(options));
|
||||||
});
|
});
|
||||||
|
|
||||||
layers['grandcanyon'] = new TileLayer({
|
layers['grandcanyon'] = new TileLayer({
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ docs: >
|
|||||||
<a href="https://www.mapbox.com/blog/terrain-rgb/">Mapbox Terrain-RGB tiles</a>
|
<a href="https://www.mapbox.com/blog/terrain-rgb/">Mapbox Terrain-RGB tiles</a>
|
||||||
to "flood" areas below the elevation shown on the sea level slider.
|
to "flood" areas below the elevation shown on the sea level slider.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<code>ol/source/Raster</code> can take either a tile source or layer.
|
||||||
|
In this case a layer is used to allow disabling at the <code>prerender</code> event
|
||||||
|
of image smoothing which would change the precise elevation values set in the pixels.
|
||||||
|
</p>
|
||||||
tags: "raster, pixel operation, flood"
|
tags: "raster, pixel operation, flood"
|
||||||
cloak:
|
cloak:
|
||||||
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
||||||
|
|||||||
@@ -22,9 +22,15 @@ 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 TileLayer({
|
||||||
|
source: 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'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
elevation.on('prerender', function(evt) {
|
||||||
|
evt.context.imageSmoothingEnabled = false;
|
||||||
|
evt.context.msImageSmoothingEnabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const raster = new RasterSource({
|
const raster = new RasterSource({
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ title: Shared Views
|
|||||||
shortdesc: Two maps share view properties
|
shortdesc: Two maps share view properties
|
||||||
docs: >
|
docs: >
|
||||||
Two maps (one Road, one Aerial) share the same center, resolution and rotation.
|
Two maps (one Road, one Aerial) share the same center, resolution and rotation.
|
||||||
tags: "side-by-side, bing, bing-maps"
|
tags: "side-by-side, xyz, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.com/ here
|
value: Get your own API key at https://www.maptiler.com/cloud/
|
||||||
---
|
---
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="half">
|
<div class="half">
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
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 BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const roadLayer = new TileLayer({
|
const roadLayer = new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
attributions: attributions,
|
||||||
imagerySet: 'RoadOnDemand',
|
url: 'https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=' + key,
|
||||||
maxZoom: 19
|
tileSize: 512,
|
||||||
|
maxZoom: 22
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const aerialLayer = new TileLayer({
|
const aerialLayer = new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
attributions: attributions,
|
||||||
imagerySet: 'Aerial',
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
maxZoom: 19
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ title: Street Labels
|
|||||||
shortdesc: Render street names.
|
shortdesc: Render street names.
|
||||||
docs: >
|
docs: >
|
||||||
Example showing the use of a text style with `placement: 'line'` to render text along a path.
|
Example showing the use of a text style with `placement: 'line'` to render text along a path.
|
||||||
tags: "vector, label, streets"
|
tags: "vector, label, streets, maptiler"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import {getCenter} from '../src/ol/extent.js';
|
import {getCenter} from '../src/ol/extent.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 BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import {Fill, Style, Text} from '../src/ol/style.js';
|
import {Fill, Style, Text} from '../src/ol/style.js';
|
||||||
|
|
||||||
@@ -17,12 +17,17 @@ const style = new Style({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const viewExtent = [1817379, 6139595, 1827851, 6143616];
|
const viewExtent = [1817379, 6139595, 1827851, 6143616];
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [new TileLayer({
|
layers: [new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
attributions: attributions,
|
||||||
imagerySet: 'Aerial'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key,
|
||||||
|
maxZoom: 20
|
||||||
})
|
})
|
||||||
}), new VectorLayer({
|
}), new VectorLayer({
|
||||||
declutter: true,
|
declutter: true,
|
||||||
|
|||||||
7
examples/svg-layer.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#map {
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.svg-layer path:hover {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
9
examples/svg-layer.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
layout: example.html
|
||||||
|
title: SVG Layer
|
||||||
|
shortdesc: Example of a map with an interactive svg layer.
|
||||||
|
docs: >
|
||||||
|
With a plain `ol/Layer` and a `render` function, we can use an interactive svg as layer. Hover over countries to see the interactivity that is defined purely with a css `:hover` pseudo-class.
|
||||||
|
tags: "svg, layer, render, transform"
|
||||||
|
---
|
||||||
|
<div id="map" class="map"></div>
|
||||||
48
examples/svg-layer.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import Map from '../src/ol/Map.js';
|
||||||
|
import View from '../src/ol/View.js';
|
||||||
|
import Layer from '../src/ol/layer/Layer.js';
|
||||||
|
import {composeCssTransform} from '../src/ol/transform.js';
|
||||||
|
|
||||||
|
const map = new Map({
|
||||||
|
target: 'map',
|
||||||
|
view: new View({
|
||||||
|
center: [0, 0],
|
||||||
|
extent: [-180, -90, 180, 90],
|
||||||
|
projection: 'EPSG:4326',
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const svgContainer = document.createElement('div');
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'data/world.svg');
|
||||||
|
xhr.addEventListener('load', function() {
|
||||||
|
const svg = xhr.responseXML.documentElement;
|
||||||
|
svgContainer.ownerDocument.importNode(svg);
|
||||||
|
svgContainer.appendChild(svg);
|
||||||
|
});
|
||||||
|
xhr.send();
|
||||||
|
|
||||||
|
const width = 2560;
|
||||||
|
const height = 1280;
|
||||||
|
const svgResolution = 360 / width;
|
||||||
|
svgContainer.style.width = width + 'px';
|
||||||
|
svgContainer.style.height = height + 'px';
|
||||||
|
svgContainer.style.transformOrigin = 'top left';
|
||||||
|
svgContainer.className = 'svg-layer';
|
||||||
|
|
||||||
|
map.addLayer(new Layer({
|
||||||
|
render: function(frameState) {
|
||||||
|
const scale = svgResolution / frameState.viewState.resolution;
|
||||||
|
const center = frameState.viewState.center;
|
||||||
|
const size = frameState.size;
|
||||||
|
const cssTransform = composeCssTransform(
|
||||||
|
size[0] / 2, size[1] / 2,
|
||||||
|
scale, scale,
|
||||||
|
frameState.viewState.rotation,
|
||||||
|
-center[0] / svgResolution - width / 2, center[1] / svgResolution - height / 2);
|
||||||
|
svgContainer.style.transform = cssTransform;
|
||||||
|
svgContainer.style.opacity = this.getOpacity();
|
||||||
|
return svgContainer;
|
||||||
|
}
|
||||||
|
}));
|
||||||
@@ -108,7 +108,14 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<a class="codepen-button pull-right"><i class="fa fa-codepen"></i> Edit</a>
|
<a class="codepen-button pull-right"><i class="fa fa-codepen"></i> Edit</a>
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<h4 id="title">{{ title }}</h4>
|
<h4 id="title">
|
||||||
|
{{ title }}
|
||||||
|
</h4>
|
||||||
|
<p class="tags">
|
||||||
|
{{#each tags}}
|
||||||
|
<a href="./index.html?q={{.}}" class="label label-primary">{{.}}</a>
|
||||||
|
{{/each}}
|
||||||
|
</p>
|
||||||
{{{ contents }}}
|
{{{ contents }}}
|
||||||
</div>
|
</div>
|
||||||
<form method="POST" id="codepen-form" target="_blank" action="https://codesandbox.io/api/v1/sandboxes/define">
|
<form method="POST" id="codepen-form" target="_blank" action="https://codesandbox.io/api/v1/sandboxes/define">
|
||||||
@@ -132,7 +139,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
|
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
|
||||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>{{#if extraHead.remote}}
|
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame,Element.prototype.classList,URL"></script>{{#if extraHead.remote}}
|
||||||
{{ indent extraHead.remote spaces=4 }}{{/if}}
|
{{ indent extraHead.remote spaces=4 }}{{/if}}
|
||||||
<style>
|
<style>
|
||||||
.map {
|
.map {
|
||||||
|
|||||||
22
examples/tracing.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
layout: example.html
|
||||||
|
title: Tracing around a polygon
|
||||||
|
shortdesc: Example of setting up a draw interaction to easily snap to an existing feature.
|
||||||
|
docs: >
|
||||||
|
This example showcases how the draw interaction API can be set up to make snapping along
|
||||||
|
an existing geometry easier while preserving topology, which is sometimes called "tracing".
|
||||||
|
When the user clicks on two different points on the Idaho state border,
|
||||||
|
the part of the border comprised between these two points is added to
|
||||||
|
the currently drawn feature.
|
||||||
|
This leverages the `appendCoordinates` method of the `ol/interaction/Draw` interaction.
|
||||||
|
tags: "draw, trace, snap, vector, topology"
|
||||||
|
---
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
<form class="form-inline">
|
||||||
|
<label>Geometry type </label>
|
||||||
|
<select id="type">
|
||||||
|
<option value="Polygon">Polygon</option>
|
||||||
|
<option value="LineString">LineString</option>
|
||||||
|
<option value="None">None</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
253
examples/tracing.js
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
import Map from '../src/ol/Map.js';
|
||||||
|
import View from '../src/ol/View.js';
|
||||||
|
import Draw from '../src/ol/interaction/Draw.js';
|
||||||
|
import Snap from '../src/ol/interaction/Snap.js';
|
||||||
|
import Style from '../src/ol/style/Style.js';
|
||||||
|
import Stroke from '../src/ol/style/Stroke.js';
|
||||||
|
import Fill from '../src/ol/style/Fill.js';
|
||||||
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
|
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||||
|
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
||||||
|
import LineString from '../src/ol/geom/LineString.js';
|
||||||
|
import Feature from '../src/ol/Feature.js';
|
||||||
|
|
||||||
|
// math utilities
|
||||||
|
|
||||||
|
// coordinates; will return the length of the [a, b] segment
|
||||||
|
function length(a, b) {
|
||||||
|
return Math.sqrt((b[0] - a[0]) * (b[0] - a[0]) + (b[1] - a[1]) * (b[1] - a[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
// coordinates; will return true if c is on the [a, b] segment
|
||||||
|
function isOnSegment(c, a, b) {
|
||||||
|
const lengthAc = length(a, c);
|
||||||
|
const lengthAb = length(a, b);
|
||||||
|
const dot = ((c[0] - a[0]) * (b[0] - a[0]) + (c[1] - a[1]) * (b[1] - a[1])) / lengthAb;
|
||||||
|
return Math.abs(lengthAc - dot) < 1e-6 && lengthAc < lengthAb;
|
||||||
|
}
|
||||||
|
|
||||||
|
// modulo for negative values, eg: mod(-1, 4) returns 3
|
||||||
|
function mod(a, b) {
|
||||||
|
return ((a % b) + b) % b;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns a coordinates array which contains the segments of the feature's
|
||||||
|
// outer ring between the start and end points
|
||||||
|
// Note: this assumes the base feature is a single polygon
|
||||||
|
function getPartialRingCoords(feature, startPoint, endPoint) {
|
||||||
|
let polygon = feature.getGeometry();
|
||||||
|
if (polygon.getType() === 'MultiPolygon') {
|
||||||
|
polygon = polygon.getPolygon(0);
|
||||||
|
}
|
||||||
|
const ringCoords = polygon.getLinearRing().getCoordinates();
|
||||||
|
|
||||||
|
let i, pointA, pointB, startSegmentIndex = -1;
|
||||||
|
for (i = 0; i < ringCoords.length; i++) {
|
||||||
|
pointA = ringCoords[i];
|
||||||
|
pointB = ringCoords[mod(i + 1, ringCoords.length)];
|
||||||
|
|
||||||
|
// check if this is the start segment dot product
|
||||||
|
if (isOnSegment(startPoint, pointA, pointB)) {
|
||||||
|
startSegmentIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const cwCoordinates = [];
|
||||||
|
let cwLength = 0;
|
||||||
|
const ccwCoordinates = [];
|
||||||
|
let ccwLength = 0;
|
||||||
|
|
||||||
|
// build clockwise coordinates
|
||||||
|
for (i = 0; i < ringCoords.length; i++) {
|
||||||
|
pointA = i === 0 ? startPoint : ringCoords[mod(i + startSegmentIndex, ringCoords.length)];
|
||||||
|
pointB = ringCoords[mod(i + startSegmentIndex + 1, ringCoords.length)];
|
||||||
|
cwCoordinates.push(pointA);
|
||||||
|
|
||||||
|
if (isOnSegment(endPoint, pointA, pointB)) {
|
||||||
|
cwCoordinates.push(endPoint);
|
||||||
|
cwLength += length(pointA, endPoint);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
cwLength += length(pointA, pointB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// build counter-clockwise coordinates
|
||||||
|
for (i = 0; i < ringCoords.length; i++) {
|
||||||
|
pointA = ringCoords[mod(startSegmentIndex - i, ringCoords.length)];
|
||||||
|
pointB = i === 0 ? startPoint : ringCoords[mod(startSegmentIndex - i + 1, ringCoords.length)];
|
||||||
|
ccwCoordinates.push(pointB);
|
||||||
|
|
||||||
|
if (isOnSegment(endPoint, pointA, pointB)) {
|
||||||
|
ccwCoordinates.push(endPoint);
|
||||||
|
ccwLength += length(endPoint, pointB);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
ccwLength += length(pointA, pointB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// keep the shortest path
|
||||||
|
return ccwLength < cwLength ? ccwCoordinates : cwCoordinates;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// layers definition
|
||||||
|
|
||||||
|
const raster = new TileLayer({
|
||||||
|
source: new OSM()
|
||||||
|
});
|
||||||
|
|
||||||
|
// features in this layer will be snapped to
|
||||||
|
const baseVector = new VectorLayer({
|
||||||
|
source: new VectorSource({
|
||||||
|
format: new GeoJSON(),
|
||||||
|
url: 'https://ahocevar.com/geoserver/wfs?service=wfs&request=getfeature&typename=topp:states&cql_filter=STATE_NAME=\'Idaho\'&outputformat=application/json'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// this is were the drawn features go
|
||||||
|
const drawVector = new VectorLayer({
|
||||||
|
source: new VectorSource(),
|
||||||
|
style: new Style({
|
||||||
|
stroke: new Stroke({
|
||||||
|
color: 'rgba(100, 255, 0, 1)',
|
||||||
|
width: 2
|
||||||
|
}),
|
||||||
|
fill: new Fill({
|
||||||
|
color: 'rgba(100, 255, 0, 0.3)'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// this line only appears when we're tracing a feature outer ring
|
||||||
|
const previewLine = new Feature({
|
||||||
|
geometry: new LineString([])
|
||||||
|
});
|
||||||
|
const previewVector = new VectorLayer({
|
||||||
|
source: new VectorSource({
|
||||||
|
features: [previewLine]
|
||||||
|
}),
|
||||||
|
style: new Style({
|
||||||
|
stroke: new Stroke({
|
||||||
|
color: 'rgba(255, 0, 0, 1)',
|
||||||
|
width: 2
|
||||||
|
})
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const map = new Map({
|
||||||
|
layers: [raster, baseVector, drawVector, previewVector],
|
||||||
|
target: 'map',
|
||||||
|
view: new View({
|
||||||
|
center: [-12986427, 5678422],
|
||||||
|
zoom: 5
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
let drawInteraction, tracingFeature, startPoint, endPoint;
|
||||||
|
let drawing = false;
|
||||||
|
|
||||||
|
const getFeatureOptions = {
|
||||||
|
hitTolerance: 10,
|
||||||
|
layerFilter: (layer) => {
|
||||||
|
return layer === baseVector;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// the click event is used to start/end tracing around a feature
|
||||||
|
map.on('click', (event) => {
|
||||||
|
if (!drawing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let hit = false;
|
||||||
|
map.forEachFeatureAtPixel(
|
||||||
|
event.pixel,
|
||||||
|
(feature) => {
|
||||||
|
if (tracingFeature && feature !== tracingFeature) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hit = true;
|
||||||
|
const coord = map.getCoordinateFromPixel(event.pixel);
|
||||||
|
|
||||||
|
// second click on the tracing feature: append the ring coordinates
|
||||||
|
if (feature === tracingFeature) {
|
||||||
|
endPoint = tracingFeature.getGeometry().getClosestPoint(coord);
|
||||||
|
const appendCoords = getPartialRingCoords(tracingFeature, startPoint, endPoint);
|
||||||
|
drawInteraction.removeLastPoint();
|
||||||
|
drawInteraction.appendCoordinates(appendCoords);
|
||||||
|
tracingFeature = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// start tracing on the feature ring
|
||||||
|
tracingFeature = feature;
|
||||||
|
startPoint = tracingFeature.getGeometry().getClosestPoint(coord);
|
||||||
|
},
|
||||||
|
getFeatureOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hit) {
|
||||||
|
// clear current tracing feature & preview
|
||||||
|
previewLine.getGeometry().setCoordinates([]);
|
||||||
|
tracingFeature = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// the pointermove event is used to show a preview of the result of the tracing
|
||||||
|
map.on('pointermove', (event) => {
|
||||||
|
if (tracingFeature && drawing) {
|
||||||
|
let coord = null;
|
||||||
|
map.forEachFeatureAtPixel(
|
||||||
|
event.pixel,
|
||||||
|
(feature) => {
|
||||||
|
if (tracingFeature === feature) {
|
||||||
|
coord = map.getCoordinateFromPixel(event.pixel);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getFeatureOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
let previewCoords = [];
|
||||||
|
if (coord) {
|
||||||
|
endPoint = tracingFeature.getGeometry().getClosestPoint(coord);
|
||||||
|
previewCoords = getPartialRingCoords(tracingFeature, startPoint, endPoint);
|
||||||
|
}
|
||||||
|
previewLine.getGeometry().setCoordinates(previewCoords);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const snapInteraction = new Snap({
|
||||||
|
source: baseVector.getSource()
|
||||||
|
});
|
||||||
|
|
||||||
|
const typeSelect = document.getElementById('type');
|
||||||
|
|
||||||
|
function addInteraction() {
|
||||||
|
const value = typeSelect.value;
|
||||||
|
if (value !== 'None') {
|
||||||
|
drawInteraction = new Draw({
|
||||||
|
source: drawVector.getSource(),
|
||||||
|
type: typeSelect.value
|
||||||
|
});
|
||||||
|
drawInteraction.on('drawstart', () => {
|
||||||
|
drawing = true;
|
||||||
|
});
|
||||||
|
drawInteraction.on('drawend', () => {
|
||||||
|
drawing = false;
|
||||||
|
previewLine.getGeometry().setCoordinates([]);
|
||||||
|
tracingFeature = null;
|
||||||
|
});
|
||||||
|
map.addInteraction(drawInteraction);
|
||||||
|
map.addInteraction(snapInteraction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typeSelect.onchange = function() {
|
||||||
|
map.removeInteraction(drawInteraction);
|
||||||
|
map.removeInteraction(snapInteraction);
|
||||||
|
addInteraction();
|
||||||
|
};
|
||||||
|
addInteraction();
|
||||||
12
examples/two-finger-pan-scroll.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
layout: example.html
|
||||||
|
title: Panning and page scrolling
|
||||||
|
shortdesc: Shows a map that allows page scrolling unless two fingers or Cmd/Ctrl are used to pan the map.
|
||||||
|
docs: >
|
||||||
|
This example shows a common behavior for page scrolling: on touch devices, when one finger
|
||||||
|
is placed on the map, it can be used to scroll the page. Only two fingers will perform drag pan.
|
||||||
|
For mouse or trackpad devices, the platform modifier key (Cmd or Ctrl) will enable drag pan on
|
||||||
|
the map, otherwise the page will scroll.
|
||||||
|
tags: "trackpad, mousewheel, zoom, scroll, page"
|
||||||
|
---
|
||||||
|
<div id="map" class="map"></div>
|
||||||
29
examples/two-finger-pan-scroll.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import Map from '../src/ol/Map.js';
|
||||||
|
import View from '../src/ol/View.js';
|
||||||
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
|
import OSM from '../src/ol/source/OSM.js';
|
||||||
|
import {defaults, DragPan, MouseWheelZoom} from '../src/ol/interaction.js';
|
||||||
|
import {platformModifierKeyOnly} from '../src/ol/events/condition.js';
|
||||||
|
|
||||||
|
const map = new Map({
|
||||||
|
interactions: defaults({dragPan: false, mouseWheelZoom: false}).extend([
|
||||||
|
new DragPan({
|
||||||
|
condition: function(event) {
|
||||||
|
return this.getPointerCount() === 2 || platformModifierKeyOnly(event);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
new MouseWheelZoom({
|
||||||
|
condition: platformModifierKeyOnly
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
layers: [
|
||||||
|
new TileLayer({
|
||||||
|
source: new OSM()
|
||||||
|
})
|
||||||
|
],
|
||||||
|
target: 'map',
|
||||||
|
view: new View({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
@@ -5,7 +5,11 @@ shortdesc: Select features from vector tiles.
|
|||||||
docs: >
|
docs: >
|
||||||
<p>
|
<p>
|
||||||
Click a rendered vector-tile feature to highlight it on the map. Click on an empty spot (ocean) to reset the selection.
|
Click a rendered vector-tile feature to highlight it on the map. Click on an empty spot (ocean) to reset the selection.
|
||||||
By changing the action type to "Multi Select" you can select multiple features at a time.
|
By changing the action type to "Multi Select" you can select multiple features at a time. With "Single Select on hover",
|
||||||
|
features will be higlighted when the pointer is above them.
|
||||||
|
</p><p>
|
||||||
|
The selection layer is configured with `renderMode: 'vector'` for better performance on frequent redraws,
|
||||||
|
i.e. when 'Single select on hover' is selected.
|
||||||
</p>
|
</p>
|
||||||
tags: "vector tiles, selection"
|
tags: "vector tiles, selection"
|
||||||
---
|
---
|
||||||
@@ -15,5 +19,6 @@ tags: "vector tiles, selection"
|
|||||||
<select id="type" class="form-control">
|
<select id="type" class="form-control">
|
||||||
<option value="singleselect" selected>Single Select</option>
|
<option value="singleselect" selected>Single Select</option>
|
||||||
<option value="multiselect">Multi Select</option>
|
<option value="multiselect">Multi Select</option>
|
||||||
|
<option value="singleselect-hover">Single Select on hover</option>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -8,6 +8,25 @@ import {Fill, Stroke, Style} from '../src/ol/style.js';
|
|||||||
// lookup for selection objects
|
// lookup for selection objects
|
||||||
let selection = {};
|
let selection = {};
|
||||||
|
|
||||||
|
const country = new Style({
|
||||||
|
stroke: new Stroke({
|
||||||
|
color: 'gray',
|
||||||
|
width: 1
|
||||||
|
}),
|
||||||
|
fill: new Fill({
|
||||||
|
color: 'rgba(20,20,20,0.9)'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
const selectedCountry = new Style({
|
||||||
|
stroke: new Stroke({
|
||||||
|
color: 'rgba(200,20,20,0.8)',
|
||||||
|
width: 2
|
||||||
|
}),
|
||||||
|
fill: new Fill({
|
||||||
|
color: 'rgba(200,20,20,0.4)'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
const vtLayer = new VectorTileLayer({
|
const vtLayer = new VectorTileLayer({
|
||||||
declutter: true,
|
declutter: true,
|
||||||
source: new VectorTileSource({
|
source: new VectorTileSource({
|
||||||
@@ -18,18 +37,7 @@ const vtLayer = new VectorTileLayer({
|
|||||||
url: 'https://ahocevar.com/geoserver/gwc/service/tms/1.0.0/' +
|
url: 'https://ahocevar.com/geoserver/gwc/service/tms/1.0.0/' +
|
||||||
'ne:ne_10m_admin_0_countries@EPSG%3A900913@pbf/{z}/{x}/{-y}.pbf'
|
'ne:ne_10m_admin_0_countries@EPSG%3A900913@pbf/{z}/{x}/{-y}.pbf'
|
||||||
}),
|
}),
|
||||||
style: function(feature) {
|
style: country
|
||||||
const selected = !!selection[feature.getId()];
|
|
||||||
return new Style({
|
|
||||||
stroke: new Stroke({
|
|
||||||
color: selected ? 'rgba(200,20,20,0.8)' : 'gray',
|
|
||||||
width: selected ? 2 : 1
|
|
||||||
}),
|
|
||||||
fill: new Fill({
|
|
||||||
color: selected ? 'rgba(200,20,20,0.2)' : 'rgba(20,20,20,0.9)'
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
@@ -39,18 +47,34 @@ const map = new Map({
|
|||||||
target: 'map',
|
target: 'map',
|
||||||
view: new View({
|
view: new View({
|
||||||
center: [0, 0],
|
center: [0, 0],
|
||||||
zoom: 2
|
zoom: 2,
|
||||||
|
multiWorld: true
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Selection
|
||||||
|
const selectionLayer = new VectorTileLayer({
|
||||||
|
map: map,
|
||||||
|
renderMode: 'vector',
|
||||||
|
source: vtLayer.getSource(),
|
||||||
|
style: function(feature) {
|
||||||
|
if (feature.getId() in selection) {
|
||||||
|
return selectedCountry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const selectElement = document.getElementById('type');
|
const selectElement = document.getElementById('type');
|
||||||
|
|
||||||
map.on('click', function(event) {
|
map.on(['click', 'pointermove'], function(event) {
|
||||||
|
if (selectElement.value === 'singleselect-hover' && event.type !== 'pointermove' ||
|
||||||
|
selectElement.value !== 'singleselect-hover' && event.type === 'pointermove') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
vtLayer.getFeatures(event.pixel).then(function(features) {
|
vtLayer.getFeatures(event.pixel).then(function(features) {
|
||||||
if (!features.length) {
|
if (!features.length) {
|
||||||
selection = {};
|
selection = {};
|
||||||
// force redraw of layer style
|
selectionLayer.changed();
|
||||||
vtLayer.setStyle(vtLayer.getStyle());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const feature = features[0];
|
const feature = features[0];
|
||||||
@@ -59,14 +83,12 @@ map.on('click', function(event) {
|
|||||||
}
|
}
|
||||||
const fid = feature.getId();
|
const fid = feature.getId();
|
||||||
|
|
||||||
if (selectElement.value === 'singleselect') {
|
if (selectElement.value.startsWith('singleselect')) {
|
||||||
selection = {};
|
selection = {};
|
||||||
}
|
}
|
||||||
// add selected feature to lookup
|
// add selected feature to lookup
|
||||||
selection[fid] = feature;
|
selection[fid] = feature;
|
||||||
|
|
||||||
// force redraw of layer style
|
selectionLayer.changed();
|
||||||
vtLayer.setStyle(vtLayer.getStyle());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ docs: >
|
|||||||
Example showing vector tiles in EPSG:4326 (styled using `ol-mapbox-style`) loaded from maptiler.com.
|
Example showing vector tiles in EPSG:4326 (styled using `ol-mapbox-style`) loaded from maptiler.com.
|
||||||
**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.
|
**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: "vector tiles, epsg4326, mapbox style, ol-mapbox-style, maptiler"
|
tags: "vector tiles, epsg4326, mapbox style, ol-mapbox-style, maptiler"
|
||||||
|
resources:
|
||||||
|
- https://cdn.polyfill.io/v2/polyfill.min.js?features=String.prototype.startsWith,Object.assign"
|
||||||
cloak:
|
cloak:
|
||||||
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Get your own API key at https://www.maptiler.com/cloud/
|
value: Get your own API key at https://www.maptiler.com/cloud/
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import VectorTileSource from '../src/ol/source/VectorTile.js';
|
|||||||
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
|
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
|
||||||
|
|
||||||
import olms from 'ol-mapbox-style';
|
import olms from 'ol-mapbox-style';
|
||||||
import {defaultResolutions} from 'ol-mapbox-style/util.js';
|
import {defaultResolutions} from 'ol-mapbox-style/dist/util.js';
|
||||||
|
|
||||||
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
|
||||||
|
|||||||
@@ -3,19 +3,67 @@ layout: example.html
|
|||||||
title: WebGL points layer
|
title: WebGL points layer
|
||||||
shortdesc: Using a WebGL-optimized layer to render a large quantities of points
|
shortdesc: Using a WebGL-optimized layer to render a large quantities of points
|
||||||
docs: >
|
docs: >
|
||||||
<p>This example shows how to use a <code>WebGLPointsLayer</code> to show a large amount of points on the map.</p>
|
This example shows how to use a `WebGLPointsLayer` to show a large amount of points on the map.
|
||||||
<p>The layer is given a style in JSON format which allows a certain level of customization of the final reprensentation.</p>
|
The layer is given a style in JSON format which allows a certain level of customization of the final reprensentation.
|
||||||
<p>
|
|
||||||
The following operators can be used for numerical values:
|
The following operators can be used:
|
||||||
<ul>
|
|
||||||
<li><code>["get", "attributeName"]</code> fetches a numeric attribute value for each feature</li>
|
* Reading operators:
|
||||||
<li><code>["+", value, value]</code> adds two values (which an either be numeric, or the result of another operator)</li>
|
* `['get', 'attributeName']` fetches a feature attribute (it will be prefixed by `a_` in the shader)
|
||||||
<li><code>["*", value, value]</code> multiplies two values</li>
|
Note: those will be taken from the attributes provided to the renderer
|
||||||
<li><code>["clamp", value, min, max]</code> outputs a value between <code>min</code> and <code>max</code></li>
|
* `['var', 'varName']` fetches a value from the style variables, or 0 if undefined
|
||||||
<li><code>["stretch", value, low1, high1, low2, high2]</code> outputs a value which has been mapped from the
|
* `['time']` returns the time in seconds since the creation of the layer
|
||||||
<code>low1..high1</code> range to the <code>low2..high2</code> range</li>
|
* `['zoom']` returns the current zoom level
|
||||||
</ul>
|
* `['resolution']` returns the current resolution
|
||||||
</p>
|
|
||||||
|
* Math operators:
|
||||||
|
* `['*', value1, value2]` multiplies `value1` by `value2`
|
||||||
|
* `['/', value1, value2]` divides `value1` by `value2`
|
||||||
|
* `['+', value1, value2]` adds `value1` and `value2`
|
||||||
|
* `['-', value1, value2]` subtracts `value2` from `value1`
|
||||||
|
* `['clamp', value, low, high]` clamps `value` between `low` and `high`
|
||||||
|
* `['%', value1, value2]` returns the result of `value1 % value2` (modulo)
|
||||||
|
* `['^', value1, value2]` returns the value of `value1` raised to the `value2` power
|
||||||
|
|
||||||
|
* Transform operators:
|
||||||
|
* `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding
|
||||||
|
condition evaluates to `true`. If no match is found, returns the `fallback` value.
|
||||||
|
All conditions should be `boolean`, output and fallback can be any kind.
|
||||||
|
* `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all
|
||||||
|
provided `matchX` values, returning the output associated with the first valid match. If no match is found,
|
||||||
|
returns the `fallback` value.
|
||||||
|
`input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and
|
||||||
|
`fallback` values must be of the same type, and can be of any kind.
|
||||||
|
* `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between
|
||||||
|
pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is
|
||||||
|
the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value
|
||||||
|
of 1 is equivalent to `['linear']`.
|
||||||
|
`input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.
|
||||||
|
Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised
|
||||||
|
between `output1` and `outputN`.
|
||||||
|
|
||||||
|
* Logical operators:
|
||||||
|
* `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.
|
||||||
|
* `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.
|
||||||
|
* `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.
|
||||||
|
* `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.
|
||||||
|
* `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.
|
||||||
|
* `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.
|
||||||
|
* `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
|
||||||
|
* `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
|
||||||
|
(inclusively), or `false` otherwise.
|
||||||
|
|
||||||
|
* Conversion operators:
|
||||||
|
* `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of
|
||||||
|
values can currently only be 2, 3 or 4.
|
||||||
|
* `['color', red, green, blue, alpha]` creates a `color` value from `number` values; the `alpha` parameter is
|
||||||
|
optional; if not specified, it will be set to 1.
|
||||||
|
Note: `red`, `green` and `blue` components must be values between 0 and 255; `alpha` between 0 and 1.
|
||||||
|
Values can either be literals or another operator, as they will be evaluated recursively.
|
||||||
|
Literal values can be of the following types:
|
||||||
|
* `boolean`
|
||||||
|
* `number`
|
||||||
|
* `string`
|
||||||
|
|
||||||
tags: "webgl, point, layer, feature"
|
tags: "webgl, point, layer, feature"
|
||||||
experimental: true
|
experimental: true
|
||||||
@@ -29,6 +77,7 @@ experimental: true
|
|||||||
<option value="triangles-latitude">Triangles, color related to latitude</option>
|
<option value="triangles-latitude">Triangles, color related to latitude</option>
|
||||||
<option value="circles">Circles, size related to population</option>
|
<option value="circles">Circles, size related to population</option>
|
||||||
<option value="circles-zoom">Circles, size related to zoom</option>
|
<option value="circles-zoom">Circles, size related to zoom</option>
|
||||||
|
<option value="rotating-bars">Rotating bars</option>
|
||||||
</select>
|
</select>
|
||||||
<textarea style="width: 100%; height: 20rem; font-family: monospace; font-size: small;" id="style-editor"></textarea>
|
<textarea style="width: 100%; height: 20rem; font-family: monospace; font-size: small;" id="style-editor"></textarea>
|
||||||
<small>
|
<small>
|
||||||
|
|||||||
@@ -95,6 +95,35 @@ const predefinedStyles = {
|
|||||||
offset: [0, 0],
|
offset: [0, 0],
|
||||||
opacity: 0.95
|
opacity: 0.95
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'rotating-bars': {
|
||||||
|
symbol: {
|
||||||
|
symbolType: 'square',
|
||||||
|
rotation: ['*', [
|
||||||
|
'time'
|
||||||
|
], 0.1],
|
||||||
|
size: ['array', 4, [
|
||||||
|
'interpolate',
|
||||||
|
['linear'],
|
||||||
|
['get', 'population'],
|
||||||
|
20000, 4,
|
||||||
|
300000, 28]
|
||||||
|
],
|
||||||
|
color: [
|
||||||
|
'interpolate',
|
||||||
|
['linear'],
|
||||||
|
['get', 'population'],
|
||||||
|
20000, '#ffdc00',
|
||||||
|
300000, '#ff5b19'
|
||||||
|
],
|
||||||
|
offset: ['array', 0, [
|
||||||
|
'interpolate',
|
||||||
|
['linear'],
|
||||||
|
['get', 'population'],
|
||||||
|
20000, 2,
|
||||||
|
300000, 14]
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -167,3 +196,10 @@ function onSelectChange() {
|
|||||||
}
|
}
|
||||||
onSelectChange();
|
onSelectChange();
|
||||||
select.addEventListener('change', onSelectChange);
|
select.addEventListener('change', onSelectChange);
|
||||||
|
|
||||||
|
// animate the map
|
||||||
|
function animate() {
|
||||||
|
map.render();
|
||||||
|
window.requestAnimationFrame(animate);
|
||||||
|
}
|
||||||
|
animate();
|
||||||
|
|||||||
@@ -138,9 +138,13 @@ ExampleBuilder.prototype.apply = function(compiler) {
|
|||||||
.filter(chunk => chunk.names[0] !== this.common);
|
.filter(chunk => chunk.names[0] !== this.common);
|
||||||
|
|
||||||
const exampleData = [];
|
const exampleData = [];
|
||||||
|
const uniqueTags = new Set();
|
||||||
const promises = chunks.map(async chunk => {
|
const promises = chunks.map(async chunk => {
|
||||||
const [assets, data] = await this.render(compiler.context, chunk);
|
const [assets, data] = await this.render(compiler.context, chunk);
|
||||||
|
|
||||||
|
// collect tags for main page... TODO: implement index tag links
|
||||||
|
data.tags.forEach(tag => uniqueTags.add(tag));
|
||||||
|
|
||||||
exampleData.push({
|
exampleData.push({
|
||||||
link: data.filename,
|
link: data.filename,
|
||||||
example: data.filename,
|
example: data.filename,
|
||||||
@@ -158,7 +162,8 @@ ExampleBuilder.prototype.apply = function(compiler) {
|
|||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
examples: exampleData,
|
examples: exampleData,
|
||||||
index: createWordIndex(exampleData)
|
index: createWordIndex(exampleData),
|
||||||
|
tags: Array.from(uniqueTags)
|
||||||
};
|
};
|
||||||
|
|
||||||
const indexSource = `var info = ${JSON.stringify(info)}`;
|
const indexSource = `var info = ${JSON.stringify(info)}`;
|
||||||
@@ -182,6 +187,13 @@ ExampleBuilder.prototype.render = async function(dir, chunk) {
|
|||||||
data.olVersion = pkg.version;
|
data.olVersion = pkg.version;
|
||||||
data.filename = htmlName;
|
data.filename = htmlName;
|
||||||
|
|
||||||
|
// process tags
|
||||||
|
if (data.tags) {
|
||||||
|
data.tags = data.tags.replace(/[\s"]+/g, '').split(',');
|
||||||
|
} else {
|
||||||
|
data.tags = [];
|
||||||
|
}
|
||||||
|
|
||||||
// add in script tag
|
// add in script tag
|
||||||
const jsName = `${name}.js`;
|
const jsName = `${name}.js`;
|
||||||
let jsSource = getJsSource(chunk, path.join('.', jsName));
|
let jsSource = getJsSource(chunk, path.join('.', jsName));
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ tags: "GetLegendGraphic, getLegendUrl, WMS"
|
|||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
Legend:
|
Legend:
|
||||||
<div><img id="legend" src=""/></div>
|
<div><img id="legend"/></div>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ title: Constrained Zoom
|
|||||||
shortdesc: Example of a zoom constrained view.
|
shortdesc: Example of a zoom constrained view.
|
||||||
docs: >
|
docs: >
|
||||||
This map has a view that is constrained between zoom levels 9 and 13. This is done using the `minZoom` and `maxZoom` view options.
|
This map has a view that is constrained between zoom levels 9 and 13. This is done using the `minZoom` and `maxZoom` view options.
|
||||||
tags: "bing, zoom, minZoom, maxZoom"
|
tags: "maptiler, zoom, minZoom, maxZoom"
|
||||||
cloak:
|
cloak:
|
||||||
- key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
|
- key: get_your_own_D6rA4zTHduk6KOKTXzGB
|
||||||
value: Your Bing Maps Key from http://www.bingmapsportal.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>
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
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 BingMaps from '../src/ol/source/BingMaps.js';
|
import XYZ from '../src/ol/source/XYZ.js';
|
||||||
|
|
||||||
|
|
||||||
|
const key = 'get_your_own_D6rA4zTHduk6KOKTXzGB';
|
||||||
|
const attributions = '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> ' +
|
||||||
|
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
target: 'map',
|
target: 'map',
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new BingMaps({
|
source: new XYZ({
|
||||||
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
|
attributions: attributions,
|
||||||
imagerySet: 'Aerial'
|
url: 'https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=' + key
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ tags: "zoomify, deep zoom, IIP, pixel, projection"
|
|||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select id="zoomifyProtocol">
|
<select id="zoomifyProtocol">
|
||||||
<option value="zoomify">Zoomify</option>
|
<option value="zoomify">Zoomify</option>
|
||||||
<option value="iip">IIP</option>
|
|
||||||
<option value="zoomifyretina">Zoomify Retina</option>
|
<option value="zoomifyretina">Zoomify Retina</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,36 +3,42 @@ import View from '../src/ol/View.js';
|
|||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import Zoomify from '../src/ol/source/Zoomify.js';
|
import Zoomify from '../src/ol/source/Zoomify.js';
|
||||||
|
|
||||||
const imgWidth = 9911;
|
const imgWidth = 4000;
|
||||||
const imgHeight = 6100;
|
const imgHeight = 3000;
|
||||||
|
|
||||||
const zoomifyUrl = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?zoomify=' +
|
const zoomifyUrl = 'https://ol-zoomify.surge.sh/zoomify/';
|
||||||
'/mnt/MD1/AD00/plan_CHU-4HD-01/FOND.TIF/';
|
|
||||||
const iipUrl = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?FIF=' + '/mnt/MD1/AD00/plan_CHU-4HD-01/FOND.TIF' + '&JTL={z},{tileIndex}';
|
|
||||||
|
|
||||||
const layer = new TileLayer({
|
const source = new Zoomify({
|
||||||
source: new Zoomify({
|
|
||||||
tileSize: 256,
|
|
||||||
tilePixelRatio: 1,
|
|
||||||
url: zoomifyUrl,
|
url: zoomifyUrl,
|
||||||
size: [imgWidth, imgHeight],
|
size: [imgWidth, imgHeight],
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous',
|
||||||
})
|
zDirection: -1 // Ensure we get a tile with the screen resolution or higher
|
||||||
|
});
|
||||||
|
const extent = source.getTileGrid().getExtent();
|
||||||
|
|
||||||
|
const retinaPixelRatio = 2;
|
||||||
|
const retinaSource = new Zoomify({
|
||||||
|
url: zoomifyUrl,
|
||||||
|
size: [imgWidth, imgHeight],
|
||||||
|
crossOrigin: 'anonymous',
|
||||||
|
zDirection: -1, // Ensure we get a tile with the screen resolution or higher
|
||||||
|
tilePixelRatio: retinaPixelRatio, // Display retina tiles
|
||||||
|
tileSize: 256 / retinaPixelRatio // from a higher zoom level
|
||||||
});
|
});
|
||||||
|
|
||||||
const extent = [0, -imgHeight, imgWidth, 0];
|
const layer = new TileLayer({
|
||||||
|
source: source
|
||||||
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
|
||||||
minResolution: resolutions[resolutions.length - 1],
|
resolutions: layer.getSource().getTileGrid().getResolutions(),
|
||||||
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,
|
||||||
|
constrainOnlyCenter: true
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.getView().fit(extent);
|
map.getView().fit(extent);
|
||||||
@@ -40,74 +46,11 @@ map.getView().fit(extent);
|
|||||||
const control = document.getElementById('zoomifyProtocol');
|
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 === 'zoomify') {
|
||||||
const extent = [0, -imgHeight, imgWidth, 0];
|
layer.setSource(source);
|
||||||
layer.setSource(
|
|
||||||
new Zoomify({
|
|
||||||
tileSize: 256,
|
|
||||||
tilePixelRatio: 1,
|
|
||||||
url: iipUrl,
|
|
||||||
size: [imgWidth, imgHeight],
|
|
||||||
crossOrigin: 'anonymous'
|
|
||||||
})
|
|
||||||
);
|
|
||||||
const resolutions = layer.getSource().getTileGrid().getResolutions();
|
|
||||||
map.setView(
|
|
||||||
new View({
|
|
||||||
// adjust zoom levels to those provided by the source
|
|
||||||
minResolution: resolutions[resolutions.length - 1],
|
|
||||||
maxResolution: resolutions[0],
|
|
||||||
// constrain the center: center cannot be set outside this extent
|
|
||||||
extent: extent
|
|
||||||
})
|
|
||||||
);
|
|
||||||
map.getView().fit(extent);
|
|
||||||
} else if (value === 'zoomify') {
|
|
||||||
const extent = [0, -imgHeight, imgWidth, 0];
|
|
||||||
layer.setSource(
|
|
||||||
new Zoomify({
|
|
||||||
tileSize: 256,
|
|
||||||
tilePixelRatio: 1,
|
|
||||||
url: zoomifyUrl,
|
|
||||||
size: [imgWidth, imgHeight],
|
|
||||||
crossOrigin: 'anonymous'
|
|
||||||
})
|
|
||||||
);
|
|
||||||
const resolutions = layer.getSource().getTileGrid().getResolutions();
|
|
||||||
map.setView(
|
|
||||||
new View({
|
|
||||||
// adjust zoom levels to those provided by the source
|
|
||||||
minResolution: resolutions[resolutions.length - 1],
|
|
||||||
maxResolution: resolutions[0],
|
|
||||||
// constrain the center: center cannot be set outside this extent
|
|
||||||
extent: extent
|
|
||||||
})
|
|
||||||
);
|
|
||||||
map.getView().fit(extent);
|
|
||||||
} else if (value === 'zoomifyretina') {
|
} else if (value === 'zoomifyretina') {
|
||||||
const pixelRatio = 4;
|
layer.setSource(retinaSource);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4580
package-lock.json
generated
28
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ol",
|
"name": "ol",
|
||||||
"version": "6.1.1",
|
"version": "6.2.0",
|
||||||
"description": "OpenLayers mapping library",
|
"description": "OpenLayers mapping library",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"map",
|
"map",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"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 && node tasks/serialize-workers && 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 -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
|
"apidoc": "shx rm -rf build/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": {
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"url": "https://github.com/openlayers/openlayers/issues"
|
"url": "https://github.com/openlayers/openlayers/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openlayers/pepjs": "^0.5.3",
|
"elm-pep": "^1.0.4",
|
||||||
"pbf": "3.2.1",
|
"pbf": "3.2.1",
|
||||||
"pixelworks": "1.1.0",
|
"pixelworks": "1.1.0",
|
||||||
"rbush": "^3.0.1"
|
"rbush": "^3.0.1"
|
||||||
@@ -55,15 +55,15 @@
|
|||||||
"chaikin-smooth": "^1.0.4",
|
"chaikin-smooth": "^1.0.4",
|
||||||
"clean-css-cli": "4.3.0",
|
"clean-css-cli": "4.3.0",
|
||||||
"copy-webpack-plugin": "^5.0.4",
|
"copy-webpack-plugin": "^5.0.4",
|
||||||
"coveralls": "3.0.7",
|
"coveralls": "3.0.9",
|
||||||
"eslint": "^6.0.0",
|
"eslint": "^6.0.0",
|
||||||
"eslint-config-openlayers": "^13.0.0",
|
"eslint-config-openlayers": "^13.0.0",
|
||||||
"expect.js": "0.3.1",
|
"expect.js": "0.3.1",
|
||||||
"front-matter": "^3.0.2",
|
"front-matter": "^3.0.2",
|
||||||
"fs-extra": "^8.0.0",
|
"fs-extra": "^8.0.0",
|
||||||
"glob": "^7.1.5",
|
"glob": "^7.1.5",
|
||||||
"globby": "^10.0.0",
|
"globby": "^11.0.0",
|
||||||
"handlebars": "4.4.5",
|
"handlebars": "4.7.3",
|
||||||
"html-to-image": "^0.1.0",
|
"html-to-image": "^0.1.0",
|
||||||
"istanbul": "0.4.5",
|
"istanbul": "0.4.5",
|
||||||
"istanbul-instrumenter-loader": "^3.0.1",
|
"istanbul-instrumenter-loader": "^3.0.1",
|
||||||
@@ -79,13 +79,13 @@
|
|||||||
"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.1",
|
"loglevelnext": "^3.0.1",
|
||||||
"marked": "0.7.0",
|
"marked": "0.8.0",
|
||||||
"mocha": "6.2.2",
|
"mocha": "7.0.1",
|
||||||
"ol-mapbox-style": "^5.0.2",
|
"ol-mapbox-style": "^6.0.0",
|
||||||
"pixelmatch": "^5.1.0",
|
"pixelmatch": "^5.1.0",
|
||||||
"pngjs": "^3.4.0",
|
"pngjs": "^3.4.0",
|
||||||
"proj4": "2.5.0",
|
"proj4": "2.6.0",
|
||||||
"puppeteer": "~1.20.0",
|
"puppeteer": "~2.1.0",
|
||||||
"rollup": "^1.25.1",
|
"rollup": "^1.25.1",
|
||||||
"rollup-plugin-babel": "^4.3.3",
|
"rollup-plugin-babel": "^4.3.3",
|
||||||
"rollup-plugin-commonjs": "^10.0.0",
|
"rollup-plugin-commonjs": "^10.0.0",
|
||||||
@@ -93,16 +93,16 @@
|
|||||||
"rollup-plugin-terser": "^5.0.0",
|
"rollup-plugin-terser": "^5.0.0",
|
||||||
"serve-static": "^1.14.0",
|
"serve-static": "^1.14.0",
|
||||||
"shx": "^0.3.2",
|
"shx": "^0.3.2",
|
||||||
"sinon": "^7.3.2",
|
"sinon": "^8.0.0",
|
||||||
"terser-webpack-plugin": "^2.0.1",
|
"terser-webpack-plugin": "^2.0.1",
|
||||||
"typescript": "3.5.3",
|
"typescript": "3.5.3",
|
||||||
"url-polyfill": "^1.1.5",
|
"url-polyfill": "^1.1.5",
|
||||||
"walk": "^2.3.9",
|
"walk": "^2.3.9",
|
||||||
"webpack": "4.41.2",
|
"webpack": "4.41.5",
|
||||||
"webpack-cli": "^3.3.2",
|
"webpack-cli": "^3.3.2",
|
||||||
"webpack-dev-middleware": "^3.6.2",
|
"webpack-dev-middleware": "^3.6.2",
|
||||||
"webpack-dev-server": "^3.3.1",
|
"webpack-dev-server": "^3.3.1",
|
||||||
"yargs": "^14.2.0"
|
"yargs": "^15.0.2"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "openlayers",
|
"extends": "openlayers",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
rendering/cases/layer-vectortile-rendermode-vector/expected.png
Normal file
|
After Width: | Height: | Size: 139 KiB |
31
rendering/cases/layer-vectortile-rendermode-vector/main.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import Map from '../../../src/ol/Map.js';
|
||||||
|
import View from '../../../src/ol/View.js';
|
||||||
|
import VectorTileSource from '../../../src/ol/source/VectorTile.js';
|
||||||
|
import MVT from '../../../src/ol/format/MVT.js';
|
||||||
|
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||||
|
import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
|
||||||
|
import VectorTileRenderType from '../../../src/ol/layer/VectorTileRenderType.js';
|
||||||
|
|
||||||
|
new Map({
|
||||||
|
layers: [
|
||||||
|
new VectorTileLayer({
|
||||||
|
renderMode: VectorTileRenderType.VECTOR,
|
||||||
|
source: new VectorTileSource({
|
||||||
|
format: new MVT(),
|
||||||
|
tileGrid: createXYZ(),
|
||||||
|
url: '/data/tiles/mapbox-streets-v6/{z}/{x}/{y}.vector.pbf',
|
||||||
|
transition: 0
|
||||||
|
})
|
||||||
|
})
|
||||||
|
],
|
||||||
|
target: 'map',
|
||||||
|
view: new View({
|
||||||
|
center: [1825927.7316762917, 6143091.089223046],
|
||||||
|
zoom: 14
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
render({
|
||||||
|
message: 'Vector tile layer renders with vector render mode',
|
||||||
|
tolerance: 0.01
|
||||||
|
});
|
||||||
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 145 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 101 KiB |
@@ -13,16 +13,17 @@ const vectorSource = new VectorSource();
|
|||||||
function createFeatures(stroke, fill, offSet = [0, 0]) {
|
function createFeatures(stroke, fill, offSet = [0, 0]) {
|
||||||
let feature;
|
let feature;
|
||||||
feature = new Feature({
|
feature = new Feature({
|
||||||
geometry: new Point([-15 + offSet[0], 15 + offSet[1]])
|
geometry: new Point([offSet[0], offSet[1]])
|
||||||
});
|
});
|
||||||
// square
|
// square with offset
|
||||||
feature.setStyle(new Style({
|
feature.setStyle(new Style({
|
||||||
image: new RegularShape({
|
image: new RegularShape({
|
||||||
fill: fill,
|
fill: fill,
|
||||||
stroke: stroke,
|
stroke: stroke,
|
||||||
points: 4,
|
points: 4,
|
||||||
radius: 10,
|
radius: 10,
|
||||||
angle: Math.PI / 4
|
angle: Math.PI / 4,
|
||||||
|
displacement: [-15, 15]
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
vectorSource.addFeature(feature);
|
vectorSource.addFeature(feature);
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
@@ -58,20 +58,6 @@ class ImageTile extends Tile {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
disposeInternal() {
|
|
||||||
if (this.state == TileState.LOADING) {
|
|
||||||
this.unlistenImage_();
|
|
||||||
this.image_ = getBlankImage();
|
|
||||||
}
|
|
||||||
if (this.interimTile) {
|
|
||||||
this.interimTile.dispose();
|
|
||||||
}
|
|
||||||
super.disposeInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTML image element for this tile (may be a Canvas, Image, or Video).
|
* Get the HTML image element for this tile (may be a Canvas, Image, or Video).
|
||||||
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
|
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
* @module ol/MapBrowserEventHandler
|
* @module ol/MapBrowserEventHandler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '@openlayers/pepjs';
|
import 'elm-pep';
|
||||||
import {DEVICE_PIXEL_RATIO} from './has.js';
|
import {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';
|
||||||
import MapBrowserEventType from './MapBrowserEventType.js';
|
import MapBrowserEventType from './MapBrowserEventType.js';
|
||||||
import MapBrowserPointerEvent from './MapBrowserPointerEvent.js';
|
import MapBrowserPointerEvent from './MapBrowserPointerEvent.js';
|
||||||
import {listen, unlistenByKey} from './events.js';
|
import {listen, unlistenByKey} from './events.js';
|
||||||
import EventTarget from './events/Target.js';
|
import EventTarget from './events/Target.js';
|
||||||
import PointerEventType from './pointer/EventType.js';
|
import PointerEventType from './pointer/EventType.js';
|
||||||
|
import EventType from './events/EventType.js';
|
||||||
|
|
||||||
class MapBrowserEventHandler extends EventTarget {
|
class MapBrowserEventHandler extends EventTarget {
|
||||||
|
|
||||||
@@ -84,6 +85,12 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
PointerEventType.POINTERDOWN,
|
PointerEventType.POINTERDOWN,
|
||||||
this.handlePointerDown_, this);
|
this.handlePointerDown_, this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {PointerEvent}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.originalPointerMoveEvent_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {?import("./events.js").EventsKey}
|
* @type {?import("./events.js").EventsKey}
|
||||||
* @private
|
* @private
|
||||||
@@ -92,6 +99,13 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
PointerEventType.POINTERMOVE,
|
PointerEventType.POINTERMOVE,
|
||||||
this.relayEvent_, this);
|
this.relayEvent_, this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this);
|
||||||
|
|
||||||
|
this.element_.addEventListener(EventType.TOUCHMOVE, this.boundHandleTouchMove_,
|
||||||
|
PASSIVE_EVENT_LISTENERS ? {passive: false} : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -246,11 +260,26 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
relayEvent_(pointerEvent) {
|
relayEvent_(pointerEvent) {
|
||||||
|
this.originalPointerMoveEvent_ = pointerEvent;
|
||||||
const dragging = !!(this.down_ && this.isMoving_(pointerEvent));
|
const dragging = !!(this.down_ && this.isMoving_(pointerEvent));
|
||||||
this.dispatchEvent(new MapBrowserPointerEvent(
|
this.dispatchEvent(new MapBrowserPointerEvent(
|
||||||
pointerEvent.type, this.map_, pointerEvent, dragging));
|
pointerEvent.type, this.map_, pointerEvent, dragging));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flexible handling of a `touch-action: none` css equivalent: because calling
|
||||||
|
* `preventDefault()` on a `pointermove` event does not stop native page scrolling
|
||||||
|
* and zooming, we also listen for `touchmove` and call `preventDefault()` on it
|
||||||
|
* when an interaction (currently `DragPan` handles the event.
|
||||||
|
* @param {TouchEvent} event Event.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
handleTouchMove_(event) {
|
||||||
|
if (this.originalPointerMoveEvent_.defaultPrevented) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {PointerEvent} pointerEvent Pointer
|
* @param {PointerEvent} pointerEvent Pointer
|
||||||
* event.
|
* event.
|
||||||
@@ -271,6 +300,8 @@ class MapBrowserEventHandler extends EventTarget {
|
|||||||
unlistenByKey(this.relayedListenerKey_);
|
unlistenByKey(this.relayedListenerKey_);
|
||||||
this.relayedListenerKey_ = null;
|
this.relayedListenerKey_ = null;
|
||||||
}
|
}
|
||||||
|
this.element_.removeEventListener(EventType.TOUCHMOVE, this.boundHandleTouchMove_);
|
||||||
|
|
||||||
if (this.pointerdownListenerKey_) {
|
if (this.pointerdownListenerKey_) {
|
||||||
unlistenByKey(this.pointerdownListenerKey_);
|
unlistenByKey(this.pointerdownListenerKey_);
|
||||||
this.pointerdownListenerKey_ = null;
|
this.pointerdownListenerKey_ = null;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/PluggableMap
|
* @module ol/PluggableMap
|
||||||
*/
|
*/
|
||||||
import {getUid} from './util.js';
|
|
||||||
import Collection from './Collection.js';
|
import Collection from './Collection.js';
|
||||||
import CollectionEventType from './CollectionEventType.js';
|
import CollectionEventType from './CollectionEventType.js';
|
||||||
import MapBrowserEvent from './MapBrowserEvent.js';
|
import MapBrowserEvent from './MapBrowserEvent.js';
|
||||||
@@ -22,7 +21,7 @@ import {listen, unlistenByKey} from './events.js';
|
|||||||
import EventType from './events/EventType.js';
|
import EventType from './events/EventType.js';
|
||||||
import {clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty} from './extent.js';
|
import {clone, createOrUpdateEmpty, equals, getForViewAndSize, isEmpty} from './extent.js';
|
||||||
import {TRUE} from './functions.js';
|
import {TRUE} from './functions.js';
|
||||||
import {DEVICE_PIXEL_RATIO, IMAGE_DECODE} from './has.js';
|
import {DEVICE_PIXEL_RATIO, IMAGE_DECODE, PASSIVE_EVENT_LISTENERS} from './has.js';
|
||||||
import LayerGroup from './layer/Group.js';
|
import LayerGroup from './layer/Group.js';
|
||||||
import {hasArea} from './size.js';
|
import {hasArea} from './size.js';
|
||||||
import {DROP} from './structs/PriorityQueue.js';
|
import {DROP} from './structs/PriorityQueue.js';
|
||||||
@@ -131,17 +130,6 @@ import {toUserCoordinate, fromUserCoordinate} from './proj.js';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {HTMLElement} element Element.
|
|
||||||
* @param {string} touchAction Value for `touch-action'.
|
|
||||||
*/
|
|
||||||
function setTouchAction(element, touchAction) {
|
|
||||||
element.style.msTouchAction = touchAction;
|
|
||||||
element.style.touchAction = touchAction;
|
|
||||||
element.setAttribute('touch-action', touchAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fires import("./MapBrowserEvent.js").MapBrowserEvent
|
* @fires import("./MapBrowserEvent.js").MapBrowserEvent
|
||||||
* @fires import("./MapEvent.js").MapEvent
|
* @fires import("./MapEvent.js").MapEvent
|
||||||
@@ -305,15 +293,10 @@ class PluggableMap extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
this.keyHandlerKeys_ = null;
|
this.keyHandlerKeys_ = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {?Array<import("./events.js").EventsKey>}
|
|
||||||
*/
|
|
||||||
this.focusHandlerKeys_ = null;
|
|
||||||
|
|
||||||
const handleBrowserEvent = this.handleBrowserEvent.bind(this);
|
const handleBrowserEvent = this.handleBrowserEvent.bind(this);
|
||||||
this.viewport_.addEventListener(EventType.CONTEXTMENU, handleBrowserEvent, false);
|
this.viewport_.addEventListener(EventType.CONTEXTMENU, handleBrowserEvent, false);
|
||||||
this.viewport_.addEventListener(EventType.WHEEL, handleBrowserEvent, false);
|
this.viewport_.addEventListener(EventType.WHEEL, handleBrowserEvent,
|
||||||
|
PASSIVE_EVENT_LISTENERS ? {passive: false} : false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Collection<import("./control/Control.js").default>}
|
* @type {Collection<import("./control/Control.js").default>}
|
||||||
@@ -949,12 +932,16 @@ class PluggableMap extends BaseObject {
|
|||||||
// coordinates so interactions cannot be used.
|
// coordinates so interactions cannot be used.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let target = mapBrowserEvent.originalEvent.target;
|
const target = /** @type {Node} */ (mapBrowserEvent.originalEvent.target);
|
||||||
while (target instanceof HTMLElement) {
|
if (!mapBrowserEvent.dragging) {
|
||||||
if (target.parentElement === this.overlayContainerStopEvent_) {
|
if (this.overlayContainerStopEvent_.contains(target) || !document.body.contains(target)) {
|
||||||
|
// Abort if the event target is a child of the container that doesn't allow
|
||||||
|
// event propagation or is no longer in the page. It's possible for the target to no longer
|
||||||
|
// be in the page if it has been removed in an event listener, this might happen in a Control
|
||||||
|
// that recreates it's content based on user interaction either manually or via a render
|
||||||
|
// in something like https://reactjs.org/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
target = target.parentElement;
|
|
||||||
}
|
}
|
||||||
mapBrowserEvent.frameState = this.frameState_;
|
mapBrowserEvent.frameState = this.frameState_;
|
||||||
const interactionsArray = this.getInteractions().getArray();
|
const interactionsArray = this.getInteractions().getArray();
|
||||||
@@ -1043,12 +1030,6 @@ class PluggableMap extends BaseObject {
|
|||||||
targetElement = this.getTargetElement();
|
targetElement = this.getTargetElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.focusHandlerKeys_) {
|
|
||||||
for (let i = 0, ii = this.focusHandlerKeys_.length; i < ii; ++i) {
|
|
||||||
unlistenByKey(this.focusHandlerKeys_[i]);
|
|
||||||
}
|
|
||||||
this.focusHandlerKeys_ = null;
|
|
||||||
}
|
|
||||||
if (this.keyHandlerKeys_) {
|
if (this.keyHandlerKeys_) {
|
||||||
for (let i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) {
|
for (let i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) {
|
||||||
unlistenByKey(this.keyHandlerKeys_[i]);
|
unlistenByKey(this.keyHandlerKeys_[i]);
|
||||||
@@ -1077,15 +1058,6 @@ class PluggableMap extends BaseObject {
|
|||||||
if (!this.renderer_) {
|
if (!this.renderer_) {
|
||||||
this.renderer_ = this.createRenderer();
|
this.renderer_ = this.createRenderer();
|
||||||
}
|
}
|
||||||
let hasFocus = true;
|
|
||||||
if (targetElement.hasAttribute('tabindex')) {
|
|
||||||
hasFocus = document.activeElement === targetElement;
|
|
||||||
this.focusHandlerKeys_ = [
|
|
||||||
listen(targetElement, EventType.FOCUS, setTouchAction.bind(this, this.viewport_, 'none')),
|
|
||||||
listen(targetElement, EventType.BLUR, setTouchAction.bind(this, this.viewport_, 'auto'))
|
|
||||||
];
|
|
||||||
}
|
|
||||||
setTouchAction(this.viewport_, hasFocus ? 'none' : 'auto');
|
|
||||||
|
|
||||||
const keyboardEventTarget = !this.keyboardEventTarget_ ?
|
const keyboardEventTarget = !this.keyboardEventTarget_ ?
|
||||||
targetElement : this.keyboardEventTarget_;
|
targetElement : this.keyboardEventTarget_;
|
||||||
@@ -1133,7 +1105,8 @@ class PluggableMap extends BaseObject {
|
|||||||
}
|
}
|
||||||
const view = this.getView();
|
const view = this.getView();
|
||||||
if (view) {
|
if (view) {
|
||||||
this.viewport_.setAttribute('data-view', getUid(view));
|
this.updateViewportSize_();
|
||||||
|
|
||||||
this.viewPropertyListenerKey_ = listen(
|
this.viewPropertyListenerKey_ = listen(
|
||||||
view, ObjectEventType.PROPERTYCHANGE,
|
view, ObjectEventType.PROPERTYCHANGE,
|
||||||
this.handleViewPropertyChanged_, this);
|
this.handleViewPropertyChanged_, this);
|
||||||
@@ -1391,6 +1364,27 @@ class PluggableMap extends BaseObject {
|
|||||||
parseFloat(computedStyle['borderBottomWidth'])
|
parseFloat(computedStyle['borderBottomWidth'])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateViewportSize_();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recomputes the viewport size and save it on the view object (if any)
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
updateViewportSize_() {
|
||||||
|
const view = this.getView();
|
||||||
|
if (view) {
|
||||||
|
let size = undefined;
|
||||||
|
const computedStyle = getComputedStyle(this.viewport_);
|
||||||
|
if (computedStyle.width && computedStyle.height) {
|
||||||
|
size = [
|
||||||
|
parseInt(computedStyle.width, 10),
|
||||||
|
parseInt(computedStyle.height, 10)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
view.setViewportSize(size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,10 +145,9 @@ class Tile extends EventTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* Called by the tile cache when the tile is removed from the cache due to expiry
|
||||||
*/
|
*/
|
||||||
disposeInternal() {
|
release() {
|
||||||
this.setState(TileState.ABORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,15 +6,6 @@ import {fromKey, getKey} from './tilecoord.js';
|
|||||||
|
|
||||||
class TileCache extends LRUCache {
|
class TileCache extends LRUCache {
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {number=} opt_highWaterMark High water mark.
|
|
||||||
*/
|
|
||||||
constructor(opt_highWaterMark) {
|
|
||||||
|
|
||||||
super(opt_highWaterMark);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Object<string, import("./TileRange.js").default>} usedTiles Used tiles.
|
* @param {!Object<string, import("./TileRange.js").default>} usedTiles Used tiles.
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +15,7 @@ class TileCache extends LRUCache {
|
|||||||
if (tile.getKey() in usedTiles) {
|
if (tile.getKey() in usedTiles) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
this.pop().dispose();
|
this.pop().release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +33,7 @@ class TileCache extends LRUCache {
|
|||||||
this.forEach(function(tile) {
|
this.forEach(function(tile) {
|
||||||
if (tile.tileCoord[0] !== z) {
|
if (tile.tileCoord[0] !== z) {
|
||||||
this.remove(getKey(tile.tileCoord));
|
this.remove(getKey(tile.tileCoord));
|
||||||
tile.dispose();
|
tile.release();
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,8 +84,7 @@ class TileQueue extends PriorityQueue {
|
|||||||
handleTileChange(event) {
|
handleTileChange(event) {
|
||||||
const tile = /** @type {import("./Tile.js").default} */ (event.target);
|
const tile = /** @type {import("./Tile.js").default} */ (event.target);
|
||||||
const state = tile.getState();
|
const state = tile.getState();
|
||||||
if (tile.hifi && state === TileState.LOADED || state === TileState.ERROR ||
|
if (tile.hifi && state === TileState.LOADED || state === TileState.ERROR || state === TileState.EMPTY) {
|
||||||
state === TileState.EMPTY || state === TileState.ABORT) {
|
|
||||||
tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);
|
tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);
|
||||||
const tileKey = tile.getKey();
|
const tileKey = tile.getKey();
|
||||||
if (tileKey in this.tilesLoadingKeys_) {
|
if (tileKey in this.tilesLoadingKeys_) {
|
||||||
@@ -102,27 +101,19 @@ class TileQueue extends PriorityQueue {
|
|||||||
*/
|
*/
|
||||||
loadMoreTiles(maxTotalLoading, maxNewLoads) {
|
loadMoreTiles(maxTotalLoading, maxNewLoads) {
|
||||||
let newLoads = 0;
|
let newLoads = 0;
|
||||||
let abortedTiles = false;
|
|
||||||
let state, tile, tileKey;
|
let state, tile, tileKey;
|
||||||
while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads &&
|
while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads &&
|
||||||
this.getCount() > 0) {
|
this.getCount() > 0) {
|
||||||
tile = /** @type {import("./Tile.js").default} */ (this.dequeue()[0]);
|
tile = /** @type {import("./Tile.js").default} */ (this.dequeue()[0]);
|
||||||
tileKey = tile.getKey();
|
tileKey = tile.getKey();
|
||||||
state = tile.getState();
|
state = tile.getState();
|
||||||
if (state === TileState.ABORT) {
|
if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
|
||||||
abortedTiles = true;
|
|
||||||
} else if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {
|
|
||||||
this.tilesLoadingKeys_[tileKey] = true;
|
this.tilesLoadingKeys_[tileKey] = true;
|
||||||
++this.tilesLoading_;
|
++this.tilesLoading_;
|
||||||
++newLoads;
|
++newLoads;
|
||||||
tile.load();
|
tile.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newLoads === 0 && abortedTiles) {
|
|
||||||
// Do not stop the render loop when all wanted tiles were aborted due to
|
|
||||||
// a small, saturated tile cache.
|
|
||||||
this.tileChangeCallback_();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,5 @@ export default {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
ERROR: 3,
|
ERROR: 3,
|
||||||
EMPTY: 4,
|
EMPTY: 4
|
||||||
ABORT: 5
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import {getUid} from './util.js';
|
import {getUid} from './util.js';
|
||||||
import Tile from './Tile.js';
|
import Tile from './Tile.js';
|
||||||
import {createCanvasContext2D} from './dom.js';
|
import {createCanvasContext2D} from './dom.js';
|
||||||
import {unlistenByKey} from './events.js';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,6 +18,10 @@ import {unlistenByKey} from './events.js';
|
|||||||
* @property {number} renderedTileZ
|
* @property {number} renderedTileZ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Array<HTMLCanvasElement>}
|
||||||
|
*/
|
||||||
|
const canvasPool = [];
|
||||||
|
|
||||||
class VectorRenderTile extends Tile {
|
class VectorRenderTile extends Tile {
|
||||||
|
|
||||||
@@ -26,13 +29,10 @@ class VectorRenderTile extends Tile {
|
|||||||
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
* @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
|
||||||
* @param {import("./TileState.js").default} state State.
|
* @param {import("./TileState.js").default} state State.
|
||||||
* @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
|
* @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
|
||||||
* @param {import("./tilegrid/TileGrid.js").default} sourceTileGrid Tile grid of the source.
|
|
||||||
* @param {function(VectorRenderTile):Array<import("./VectorTile").default>} getSourceTiles Function
|
* @param {function(VectorRenderTile):Array<import("./VectorTile").default>} getSourceTiles Function
|
||||||
* to get an source tiles for this tile.
|
* to get source tiles for this tile.
|
||||||
* @param {function(VectorRenderTile):void} removeSourceTiles Function to remove this tile from its
|
|
||||||
* source tiles's consumer count.
|
|
||||||
*/
|
*/
|
||||||
constructor(tileCoord, state, urlTileCoord, sourceTileGrid, getSourceTiles, removeSourceTiles) {
|
constructor(tileCoord, state, urlTileCoord, getSourceTiles) {
|
||||||
|
|
||||||
super(tileCoord, state, {transition: 0});
|
super(tileCoord, state, {transition: 0});
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ class VectorRenderTile extends Tile {
|
|||||||
this.errorSourceTileKeys = {};
|
this.errorSourceTileKeys = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ImageData}
|
* @type {Object<number, ImageData>}
|
||||||
*/
|
*/
|
||||||
this.hitDetectionImageData = null;
|
this.hitDetectionImageData = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -71,6 +71,11 @@ class VectorRenderTile extends Tile {
|
|||||||
*/
|
*/
|
||||||
this.replayState_ = {};
|
this.replayState_ = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Array<import("./VectorTile.js").default>}
|
||||||
|
*/
|
||||||
|
this.sourceTiles = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
@@ -79,23 +84,7 @@ class VectorRenderTile extends Tile {
|
|||||||
/**
|
/**
|
||||||
* @type {!function():Array<import("./VectorTile.js").default>}
|
* @type {!function():Array<import("./VectorTile.js").default>}
|
||||||
*/
|
*/
|
||||||
this.getSourceTiles = getSourceTiles.bind(this, this);
|
this.getSourceTiles = getSourceTiles.bind(undefined, this);
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {!function(import("./VectorRenderTile.js").default):void}
|
|
||||||
*/
|
|
||||||
this.removeSourceTiles_ = removeSourceTiles;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {import("./tilegrid/TileGrid.js").default}
|
|
||||||
*/
|
|
||||||
this.sourceTileGrid_ = sourceTileGrid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Array<import("./events.js").EventsKey>}
|
|
||||||
*/
|
|
||||||
this.sourceTileListenerKeys = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* z of the source tiles of the last getSourceTiles call.
|
* z of the source tiles of the last getSourceTiles call.
|
||||||
@@ -115,27 +104,6 @@ class VectorRenderTile extends Tile {
|
|||||||
this.wrappedTileCoord = urlTileCoord;
|
this.wrappedTileCoord = urlTileCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
disposeInternal() {
|
|
||||||
this.sourceTileListenerKeys.forEach(unlistenByKey);
|
|
||||||
this.sourceTileListenerKeys.length = 0;
|
|
||||||
this.removeSourceTiles_(this);
|
|
||||||
for (const key in this.context_) {
|
|
||||||
const canvas = this.context_[key].canvas;
|
|
||||||
canvas.width = 0;
|
|
||||||
canvas.height = 0;
|
|
||||||
}
|
|
||||||
for (const key in this.executorGroups) {
|
|
||||||
const executorGroups = this.executorGroups[key];
|
|
||||||
for (let i = 0, ii = executorGroups.length; i < ii; ++i) {
|
|
||||||
executorGroups[i].disposeInternal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.disposeInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("./layer/Layer.js").default} layer Layer.
|
* @param {import("./layer/Layer.js").default} layer Layer.
|
||||||
* @return {CanvasRenderingContext2D} The rendering context.
|
* @return {CanvasRenderingContext2D} The rendering context.
|
||||||
@@ -143,7 +111,7 @@ class VectorRenderTile extends Tile {
|
|||||||
getContext(layer) {
|
getContext(layer) {
|
||||||
const key = getUid(layer);
|
const key = getUid(layer);
|
||||||
if (!(key in this.context_)) {
|
if (!(key in this.context_)) {
|
||||||
this.context_[key] = createCanvasContext2D();
|
this.context_[key] = createCanvasContext2D(1, 1, canvasPool);
|
||||||
}
|
}
|
||||||
return this.context_[key];
|
return this.context_[key];
|
||||||
}
|
}
|
||||||
@@ -192,6 +160,16 @@ class VectorRenderTile extends Tile {
|
|||||||
load() {
|
load() {
|
||||||
this.getSourceTiles();
|
this.getSourceTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
release() {
|
||||||
|
for (const key in this.context_) {
|
||||||
|
canvasPool.push(this.context_[key].canvas);
|
||||||
|
}
|
||||||
|
super.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ class VectorTile extends Tile {
|
|||||||
|
|
||||||
super(tileCoord, state, opt_options);
|
super(tileCoord, state, opt_options);
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
this.consumers = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extent of this tile; set by the source.
|
* Extent of this tile; set by the source.
|
||||||
* @type {import("./extent.js").Extent}
|
* @type {import("./extent.js").Extent}
|
||||||
@@ -105,9 +100,11 @@ class VectorTile extends Tile {
|
|||||||
if (this.state == TileState.IDLE) {
|
if (this.state == TileState.IDLE) {
|
||||||
this.setState(TileState.LOADING);
|
this.setState(TileState.LOADING);
|
||||||
this.tileLoadFunction_(this, this.url_);
|
this.tileLoadFunction_(this, this.url_);
|
||||||
|
if (this.loader_) {
|
||||||
this.loader_(this.extent, this.resolution, this.projection);
|
this.loader_(this.extent, this.resolution, this.projection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for successful tile load.
|
* Handler for successful tile load.
|
||||||
|
|||||||
117
src/ol/View.js
@@ -2,7 +2,6 @@
|
|||||||
* @module ol/View
|
* @module ol/View
|
||||||
*/
|
*/
|
||||||
import {DEFAULT_TILE_SIZE} from './tilegrid/common.js';
|
import {DEFAULT_TILE_SIZE} from './tilegrid/common.js';
|
||||||
import {getUid} from './util.js';
|
|
||||||
import {VOID} from './functions.js';
|
import {VOID} from './functions.js';
|
||||||
import {createExtent, none as centerNone} from './centerconstraint.js';
|
import {createExtent, none as centerNone} from './centerconstraint.js';
|
||||||
import BaseObject from './Object.js';
|
import BaseObject from './Object.js';
|
||||||
@@ -130,6 +129,14 @@ import {createMinMaxResolution} from './resolutionconstraint.js';
|
|||||||
* @property {boolean} [smoothResolutionConstraint=true] If true, the resolution
|
* @property {boolean} [smoothResolutionConstraint=true] If true, the resolution
|
||||||
* min/max values will be applied smoothly, i. e. allow the view to exceed slightly
|
* min/max values will be applied smoothly, i. e. allow the view to exceed slightly
|
||||||
* the given resolution or zoom bounds.
|
* the given resolution or zoom bounds.
|
||||||
|
* @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to
|
||||||
|
* show the full configured extent. By default, when a view is configured with an
|
||||||
|
* extent, users will not be able to zoom out so the viewport exceeds the extent in
|
||||||
|
* either dimension. This means the full extent may not be visible if the viewport
|
||||||
|
* is taller or wider than the aspect ratio of the configured extent. If
|
||||||
|
* showFullExtent is true, the user will be able to zoom out so that the viewport
|
||||||
|
* exceeds the height or width of the configured extent, but not both, allowing the
|
||||||
|
* full extent to be shown.
|
||||||
* @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
|
* @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
|
||||||
* projection. The default is Spherical Mercator.
|
* projection. The default is Spherical Mercator.
|
||||||
* @property {number} [resolution] The initial resolution for the view. The
|
* @property {number} [resolution] The initial resolution for the view. The
|
||||||
@@ -294,6 +301,12 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
this.projection_ = createProjection(options.projection, 'EPSG:3857');
|
this.projection_ = createProjection(options.projection, 'EPSG:3857');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {import("./size.js").Size}
|
||||||
|
*/
|
||||||
|
this.viewportSize_ = [100, 100];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {import("./coordinate.js").Coordinate|undefined}
|
* @type {import("./coordinate.js").Coordinate|undefined}
|
||||||
@@ -312,6 +325,12 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
this.targetRotation_;
|
this.targetRotation_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {import("./coordinate.js").Coordinate|undefined}
|
||||||
|
*/
|
||||||
|
this.cancelAnchor_ = undefined;
|
||||||
|
|
||||||
if (options.center) {
|
if (options.center) {
|
||||||
options.center = fromUserCoordinate(options.center, this.projection_);
|
options.center = fromUserCoordinate(options.center, this.projection_);
|
||||||
}
|
}
|
||||||
@@ -584,13 +603,19 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
cancelAnimations() {
|
cancelAnimations() {
|
||||||
this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);
|
this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);
|
||||||
|
let anchor;
|
||||||
for (let i = 0, ii = this.animations_.length; i < ii; ++i) {
|
for (let i = 0, ii = this.animations_.length; i < ii; ++i) {
|
||||||
const series = this.animations_[i];
|
const series = this.animations_[i];
|
||||||
if (series[0].callback) {
|
if (series[0].callback) {
|
||||||
animationCallback(series[0].callback, false);
|
animationCallback(series[0].callback, false);
|
||||||
}
|
}
|
||||||
|
anchor = anchor ||
|
||||||
|
series.filter(function(animation) {
|
||||||
|
return !animation.complete;
|
||||||
|
})[0].anchor;
|
||||||
}
|
}
|
||||||
this.animations_.length = 0;
|
this.animations_.length = 0;
|
||||||
|
this.cancelAnchor_ = anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -637,7 +662,7 @@ class View extends BaseObject {
|
|||||||
animation.targetResolution :
|
animation.targetResolution :
|
||||||
animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);
|
animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);
|
||||||
if (animation.anchor) {
|
if (animation.anchor) {
|
||||||
const size = this.getSizeFromViewport_(this.getRotation());
|
const size = this.getViewportSize_(this.getRotation());
|
||||||
const constrainedResolution = this.constraints_.resolution(resolution, 0, size, true);
|
const constrainedResolution = this.constraints_.resolution(resolution, 0, size, true);
|
||||||
this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor);
|
this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor);
|
||||||
}
|
}
|
||||||
@@ -710,27 +735,34 @@ class View extends BaseObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the current viewport size.
|
||||||
* @private
|
* @private
|
||||||
* @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size
|
* @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size
|
||||||
* @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
|
* @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
|
||||||
*/
|
*/
|
||||||
getSizeFromViewport_(opt_rotation) {
|
getViewportSize_(opt_rotation) {
|
||||||
const size = [100, 100];
|
const size = this.viewportSize_;
|
||||||
const selector = '.ol-viewport[data-view="' + getUid(this) + '"]';
|
|
||||||
const element = document.querySelector(selector);
|
|
||||||
if (element) {
|
|
||||||
const metrics = getComputedStyle(element);
|
|
||||||
size[0] = parseInt(metrics.width, 10);
|
|
||||||
size[1] = parseInt(metrics.height, 10);
|
|
||||||
}
|
|
||||||
if (opt_rotation) {
|
if (opt_rotation) {
|
||||||
const w = size[0];
|
const w = size[0];
|
||||||
const h = size[1];
|
const h = size[1];
|
||||||
size[0] = Math.abs(w * Math.cos(opt_rotation)) + Math.abs(h * Math.sin(opt_rotation));
|
return [
|
||||||
size[1] = Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation));
|
Math.abs(w * Math.cos(opt_rotation)) + Math.abs(h * Math.sin(opt_rotation)),
|
||||||
}
|
Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation))
|
||||||
|
];
|
||||||
|
} else {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the viewport size on the view. The viewport size is not read every time from the DOM
|
||||||
|
* to avoid performance hit and layout reflow.
|
||||||
|
* This should be done on map size change.
|
||||||
|
* @param {import("./size.js").Size=} opt_size Viewport size; if undefined, [100, 100] is assumed
|
||||||
|
*/
|
||||||
|
setViewportSize(opt_size) {
|
||||||
|
this.viewportSize_ = Array.isArray(opt_size) ? opt_size.slice() : [100, 100];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the view center.
|
* Get the view center.
|
||||||
@@ -780,8 +812,8 @@ class View extends BaseObject {
|
|||||||
* The size is the pixel dimensions of the box into which the calculated extent
|
* The size is the pixel dimensions of the box into which the calculated extent
|
||||||
* should fit. In most cases you want to get the extent of the entire map,
|
* should fit. In most cases you want to get the extent of the entire map,
|
||||||
* that is `map.getSize()`.
|
* that is `map.getSize()`.
|
||||||
* @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size of the
|
* @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size
|
||||||
* first map that uses this view will be used.
|
* of the map that uses this view will be used.
|
||||||
* @return {import("./extent.js").Extent} Extent.
|
* @return {import("./extent.js").Extent} Extent.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -796,7 +828,7 @@ class View extends BaseObject {
|
|||||||
* @return {import("./extent.js").Extent} Extent.
|
* @return {import("./extent.js").Extent} Extent.
|
||||||
*/
|
*/
|
||||||
calculateExtentInternal(opt_size) {
|
calculateExtentInternal(opt_size) {
|
||||||
const size = opt_size || this.getSizeFromViewport_();
|
const size = opt_size || this.getViewportSize_();
|
||||||
const center = /** @type {!import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
|
const center = /** @type {!import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
|
||||||
assert(center, 1); // The view center is not defined
|
assert(center, 1); // The view center is not defined
|
||||||
const resolution = /** @type {!number} */ (this.getResolution());
|
const resolution = /** @type {!number} */ (this.getResolution());
|
||||||
@@ -919,7 +951,7 @@ class View extends BaseObject {
|
|||||||
* the given size.
|
* the given size.
|
||||||
*/
|
*/
|
||||||
getResolutionForExtentInternal(extent, opt_size) {
|
getResolutionForExtentInternal(extent, opt_size) {
|
||||||
const size = opt_size || this.getSizeFromViewport_();
|
const size = opt_size || this.getViewportSize_();
|
||||||
const xResolution = getWidth(extent) / size[0];
|
const xResolution = getWidth(extent) / size[0];
|
||||||
const yResolution = getHeight(extent) / size[1];
|
const yResolution = getHeight(extent) / size[1];
|
||||||
return Math.max(xResolution, yResolution);
|
return Math.max(xResolution, yResolution);
|
||||||
@@ -933,7 +965,7 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
getResolutionForValueFunction(opt_power) {
|
getResolutionForValueFunction(opt_power) {
|
||||||
const power = opt_power || 2;
|
const power = opt_power || 2;
|
||||||
const maxResolution = this.maxResolution_;
|
const maxResolution = this.getConstrainedResolution(this.maxResolution_);
|
||||||
const minResolution = this.minResolution_;
|
const minResolution = this.minResolution_;
|
||||||
const max = Math.log(maxResolution / minResolution) / Math.log(power);
|
const max = Math.log(maxResolution / minResolution) / Math.log(power);
|
||||||
return (
|
return (
|
||||||
@@ -964,17 +996,17 @@ class View extends BaseObject {
|
|||||||
* @return {function(number): number} Value for resolution function.
|
* @return {function(number): number} Value for resolution function.
|
||||||
*/
|
*/
|
||||||
getValueForResolutionFunction(opt_power) {
|
getValueForResolutionFunction(opt_power) {
|
||||||
const power = opt_power || 2;
|
const logPower = Math.log(opt_power || 2);
|
||||||
const maxResolution = this.maxResolution_;
|
const maxResolution = this.getConstrainedResolution(this.maxResolution_);
|
||||||
const minResolution = this.minResolution_;
|
const minResolution = this.minResolution_;
|
||||||
const max = Math.log(maxResolution / minResolution) / Math.log(power);
|
const max = Math.log(maxResolution / minResolution) / logPower;
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @return {number} Value.
|
* @return {number} Value.
|
||||||
*/
|
*/
|
||||||
function(resolution) {
|
function(resolution) {
|
||||||
const value = (Math.log(maxResolution / resolution) / Math.log(power)) / max;
|
const value = (Math.log(maxResolution / resolution) / logPower) / max;
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1067,7 +1099,7 @@ class View extends BaseObject {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
fit(geometryOrExtent, opt_options) {
|
fit(geometryOrExtent, opt_options) {
|
||||||
const options = assign({size: this.getSizeFromViewport_()}, opt_options || {});
|
const options = assign({size: this.getViewportSize_()}, opt_options || {});
|
||||||
|
|
||||||
/** @type {import("./geom/SimpleGeometry.js").default} */
|
/** @type {import("./geom/SimpleGeometry.js").default} */
|
||||||
let geometry;
|
let geometry;
|
||||||
@@ -1085,7 +1117,7 @@ class View extends BaseObject {
|
|||||||
} else {
|
} else {
|
||||||
const userProjection = getUserProjection();
|
const userProjection = getUserProjection();
|
||||||
if (userProjection) {
|
if (userProjection) {
|
||||||
geometry = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry.clone().transform(userProjection, this.getProjection()));
|
geometry = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometryOrExtent.clone().transform(userProjection, this.getProjection()));
|
||||||
} else {
|
} else {
|
||||||
geometry = geometryOrExtent;
|
geometry = geometryOrExtent;
|
||||||
}
|
}
|
||||||
@@ -1102,7 +1134,7 @@ class View extends BaseObject {
|
|||||||
const options = opt_options || {};
|
const options = opt_options || {};
|
||||||
let size = options.size;
|
let size = options.size;
|
||||||
if (!size) {
|
if (!size) {
|
||||||
size = this.getSizeFromViewport_();
|
size = this.getViewportSize_();
|
||||||
}
|
}
|
||||||
const padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];
|
const padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];
|
||||||
const nearest = options.nearest !== undefined ? options.nearest : false;
|
const nearest = options.nearest !== undefined ? options.nearest : false;
|
||||||
@@ -1249,10 +1281,10 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
adjustResolutionInternal(ratio, opt_anchor) {
|
adjustResolutionInternal(ratio, opt_anchor) {
|
||||||
const isMoving = this.getAnimating() || this.getInteracting();
|
const isMoving = this.getAnimating() || this.getInteracting();
|
||||||
const size = this.getSizeFromViewport_(this.getRotation());
|
const size = this.getViewportSize_(this.getRotation());
|
||||||
const newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);
|
const newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);
|
||||||
|
|
||||||
if (opt_anchor !== undefined) {
|
if (opt_anchor) {
|
||||||
this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);
|
this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1292,7 +1324,7 @@ class View extends BaseObject {
|
|||||||
adjustRotationInternal(delta, opt_anchor) {
|
adjustRotationInternal(delta, opt_anchor) {
|
||||||
const isMoving = this.getAnimating() || this.getInteracting();
|
const isMoving = this.getAnimating() || this.getInteracting();
|
||||||
const newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);
|
const newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);
|
||||||
if (opt_anchor !== undefined) {
|
if (opt_anchor) {
|
||||||
this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);
|
this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);
|
||||||
}
|
}
|
||||||
this.targetRotation_ += delta;
|
this.targetRotation_ += delta;
|
||||||
@@ -1373,7 +1405,7 @@ class View extends BaseObject {
|
|||||||
|
|
||||||
// compute rotation
|
// compute rotation
|
||||||
const newRotation = this.constraints_.rotation(this.targetRotation_, isMoving);
|
const newRotation = this.constraints_.rotation(this.targetRotation_, isMoving);
|
||||||
const size = this.getSizeFromViewport_(newRotation);
|
const size = this.getViewportSize_(newRotation);
|
||||||
const newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving);
|
const newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving);
|
||||||
const newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving);
|
const newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving);
|
||||||
|
|
||||||
@@ -1390,6 +1422,7 @@ class View extends BaseObject {
|
|||||||
if (this.getAnimating() && !opt_doNotCancelAnims) {
|
if (this.getAnimating() && !opt_doNotCancelAnims) {
|
||||||
this.cancelAnimations();
|
this.cancelAnimations();
|
||||||
}
|
}
|
||||||
|
this.cancelAnchor_ = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1406,11 +1439,11 @@ class View extends BaseObject {
|
|||||||
const direction = opt_resolutionDirection || 0;
|
const direction = opt_resolutionDirection || 0;
|
||||||
|
|
||||||
const newRotation = this.constraints_.rotation(this.targetRotation_);
|
const newRotation = this.constraints_.rotation(this.targetRotation_);
|
||||||
const size = this.getSizeFromViewport_(newRotation);
|
const size = this.getViewportSize_(newRotation);
|
||||||
const newResolution = this.constraints_.resolution(this.targetResolution_, direction, size);
|
const newResolution = this.constraints_.resolution(this.targetResolution_, direction, size);
|
||||||
const newCenter = this.constraints_.center(this.targetCenter_, newResolution, size);
|
const newCenter = this.constraints_.center(this.targetCenter_, newResolution, size);
|
||||||
|
|
||||||
if (duration === 0) {
|
if (duration === 0 && !this.cancelAnchor_) {
|
||||||
this.targetResolution_ = newResolution;
|
this.targetResolution_ = newResolution;
|
||||||
this.targetRotation_ = newRotation;
|
this.targetRotation_ = newRotation;
|
||||||
this.targetCenter_ = newCenter;
|
this.targetCenter_ = newCenter;
|
||||||
@@ -1418,6 +1451,9 @@ class View extends BaseObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const anchor = opt_anchor || (duration === 0 ? this.cancelAnchor_ : undefined);
|
||||||
|
this.cancelAnchor_ = undefined;
|
||||||
|
|
||||||
if (this.getResolution() !== newResolution ||
|
if (this.getResolution() !== newResolution ||
|
||||||
this.getRotation() !== newRotation ||
|
this.getRotation() !== newRotation ||
|
||||||
!this.getCenterInternal() ||
|
!this.getCenterInternal() ||
|
||||||
@@ -1433,7 +1469,7 @@ class View extends BaseObject {
|
|||||||
resolution: newResolution,
|
resolution: newResolution,
|
||||||
duration: duration,
|
duration: duration,
|
||||||
easing: easeOut,
|
easing: easeOut,
|
||||||
anchor: opt_anchor
|
anchor: anchor
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1484,7 +1520,7 @@ class View extends BaseObject {
|
|||||||
* @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
|
* @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
|
||||||
*/
|
*/
|
||||||
getConstrainedCenter(targetCenter, opt_targetResolution) {
|
getConstrainedCenter(targetCenter, opt_targetResolution) {
|
||||||
const size = this.getSizeFromViewport_(this.getRotation());
|
const size = this.getViewportSize_(this.getRotation());
|
||||||
return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size);
|
return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1513,7 +1549,7 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
getConstrainedResolution(targetResolution, opt_direction) {
|
getConstrainedResolution(targetResolution, opt_direction) {
|
||||||
const direction = opt_direction || 0;
|
const direction = opt_direction || 0;
|
||||||
const size = this.getSizeFromViewport_(this.getRotation());
|
const size = this.getViewportSize_(this.getRotation());
|
||||||
|
|
||||||
return this.constraints_.resolution(targetResolution, direction, size);
|
return this.constraints_.resolution(targetResolution, direction, size);
|
||||||
}
|
}
|
||||||
@@ -1583,6 +1619,9 @@ export function createResolutionConstraint(options) {
|
|||||||
const smooth =
|
const smooth =
|
||||||
options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true;
|
options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true;
|
||||||
|
|
||||||
|
const showFullExtent =
|
||||||
|
options.showFullExtent !== undefined ? options.showFullExtent : false;
|
||||||
|
|
||||||
const projection = createProjection(options.projection, 'EPSG:3857');
|
const projection = createProjection(options.projection, 'EPSG:3857');
|
||||||
const projExtent = projection.getExtent();
|
const projExtent = projection.getExtent();
|
||||||
let constrainOnlyCenter = options.constrainOnlyCenter;
|
let constrainOnlyCenter = options.constrainOnlyCenter;
|
||||||
@@ -1600,10 +1639,10 @@ export function createResolutionConstraint(options) {
|
|||||||
|
|
||||||
if (options.constrainResolution) {
|
if (options.constrainResolution) {
|
||||||
resolutionConstraint = createSnapToResolutions(resolutions, smooth,
|
resolutionConstraint = createSnapToResolutions(resolutions, smooth,
|
||||||
!constrainOnlyCenter && extent);
|
!constrainOnlyCenter && extent, showFullExtent);
|
||||||
} else {
|
} else {
|
||||||
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth,
|
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth,
|
||||||
!constrainOnlyCenter && extent);
|
!constrainOnlyCenter && extent, showFullExtent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// calculate the default min and max resolution
|
// calculate the default min and max resolution
|
||||||
@@ -1649,10 +1688,10 @@ export function createResolutionConstraint(options) {
|
|||||||
if (options.constrainResolution) {
|
if (options.constrainResolution) {
|
||||||
resolutionConstraint = createSnapToPower(
|
resolutionConstraint = createSnapToPower(
|
||||||
zoomFactor, maxResolution, minResolution, smooth,
|
zoomFactor, maxResolution, minResolution, smooth,
|
||||||
!constrainOnlyCenter && extent);
|
!constrainOnlyCenter && extent, showFullExtent);
|
||||||
} else {
|
} else {
|
||||||
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth,
|
resolutionConstraint = createMinMaxResolution(maxResolution, minResolution, smooth,
|
||||||
!constrainOnlyCenter && extent);
|
!constrainOnlyCenter && extent, showFullExtent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {constraint: resolutionConstraint, maxResolution: maxResolution,
|
return {constraint: resolutionConstraint, maxResolution: maxResolution,
|
||||||
|
|||||||
@@ -325,7 +325,6 @@ class Attribution extends Control {
|
|||||||
* Update the attribution element.
|
* Update the attribution element.
|
||||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||||
* @this {Attribution}
|
* @this {Attribution}
|
||||||
* @api
|
|
||||||
*/
|
*/
|
||||||
export function render(mapEvent) {
|
export function render(mapEvent) {
|
||||||
this.updateElement_(mapEvent.frameState);
|
this.updateElement_(mapEvent.frameState);
|
||||||
|
|||||||
@@ -79,9 +79,10 @@ class Control extends BaseObject {
|
|||||||
this.listenerKeys = [];
|
this.listenerKeys = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @private
|
||||||
* @type {function(import("../MapEvent.js").default): void}
|
* @type {function(import("../MapEvent.js").default): void}
|
||||||
*/
|
*/
|
||||||
this.render = options.render ? options.render : VOID;
|
this.render_ = options.render ? options.render : VOID;
|
||||||
|
|
||||||
if (options.target) {
|
if (options.target) {
|
||||||
this.setTarget(options.target);
|
this.setTarget(options.target);
|
||||||
@@ -134,6 +135,16 @@ class Control extends BaseObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the projection. Rendering of the coordinates is done in
|
||||||
|
* `handleMouseMove` and `handleMouseUp`.
|
||||||
|
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
render(mapEvent) {
|
||||||
|
this.render_.call(this, mapEvent);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to set a target element for the control. It has no
|
* This function is used to set a target element for the control. It has no
|
||||||
* effect if it is called after the control has been added to the map (i.e.
|
* effect if it is called after the control has been added to the map (i.e.
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/control/MousePosition
|
* @module ol/control/MousePosition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import 'elm-pep';
|
||||||
import {listen} from '../events.js';
|
import {listen} from '../events.js';
|
||||||
import EventType from '../pointer/EventType.js';
|
import EventType from '../pointer/EventType.js';
|
||||||
import {getChangeEventType} from '../Object.js';
|
import {getChangeEventType} from '../Object.js';
|
||||||
import Control from './Control.js';
|
import Control from './Control.js';
|
||||||
import {getTransformFromProjections, identityTransform, get as getProjection, getUserProjection} from '../proj.js';
|
import {getTransformFromProjections, identityTransform, get as getProjection, getUserProjection} from '../proj.js';
|
||||||
import '@openlayers/pepjs';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -247,7 +248,6 @@ class MousePosition extends Control {
|
|||||||
* `handleMouseMove` and `handleMouseUp`.
|
* `handleMouseMove` and `handleMouseUp`.
|
||||||
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
||||||
* @this {MousePosition}
|
* @this {MousePosition}
|
||||||
* @api
|
|
||||||
*/
|
*/
|
||||||
export function render(mapEvent) {
|
export function render(mapEvent) {
|
||||||
const frameState = mapEvent.frameState;
|
const frameState = mapEvent.frameState;
|
||||||
|
|||||||