Compare commits
660 Commits
r3.0.0-alp
...
r3.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e29d0aa52c | ||
|
|
5d5a248344 | ||
|
|
09a50ad442 | ||
|
|
1d6e428e8f | ||
|
|
cd14753495 | ||
|
|
445f85b3e2 | ||
|
|
a2bc986785 | ||
|
|
2974c74f1a | ||
|
|
943bad6e17 | ||
|
|
a19cb9ca64 | ||
|
|
e6e98a6ca2 | ||
|
|
aab5c8472c | ||
|
|
b7412552a5 | ||
|
|
fa4d2d485d | ||
|
|
07d790260c | ||
|
|
d6f442bbee | ||
|
|
f360dd86a0 | ||
|
|
dc9d7e857a | ||
|
|
e84c484677 | ||
|
|
79e0c81301 | ||
|
|
ec4110ee54 | ||
|
|
8565201c74 | ||
|
|
b555c52013 | ||
|
|
a4e8e529c4 | ||
|
|
d96ea1cb97 | ||
|
|
a7ca22dde0 | ||
|
|
71153d26d1 | ||
|
|
42aa94de21 | ||
|
|
30d947521d | ||
|
|
f06208920f | ||
|
|
16e23a33fb | ||
|
|
0958674765 | ||
|
|
e0a3f8ca07 | ||
|
|
3800676e97 | ||
|
|
87dda95b18 | ||
|
|
ae7b342ee9 | ||
|
|
020d528e73 | ||
|
|
4ccff4e8b6 | ||
|
|
3dc8c4bc7b | ||
|
|
72532b7dd6 | ||
|
|
34acea5366 | ||
|
|
4e5ef05e5e | ||
|
|
1eaf82ead5 | ||
|
|
70fef73869 | ||
|
|
c81057780a | ||
|
|
1f23a245e4 | ||
|
|
2577d3f7d6 | ||
|
|
9928730bd3 | ||
|
|
233595ac75 | ||
|
|
8e8b26805f | ||
|
|
cab983f826 | ||
|
|
c7da7e4c2e | ||
|
|
b04a36ede7 | ||
|
|
a663d8fcae | ||
|
|
38b784d672 | ||
|
|
d70a9eba01 | ||
|
|
bd5d9d572e | ||
|
|
5e309e244b | ||
|
|
53abedaada | ||
|
|
72d32ec71a | ||
|
|
f0567f5053 | ||
|
|
36d10bef11 | ||
|
|
62eb0dd72b | ||
|
|
bb1b0cba95 | ||
|
|
c05fb8c61b | ||
|
|
2528581642 | ||
|
|
4a617871da | ||
|
|
3de330eb99 | ||
|
|
6d6ec357e1 | ||
|
|
582a52849c | ||
|
|
be636d7f46 | ||
|
|
6458f98996 | ||
|
|
2fd8f4cb00 | ||
|
|
973606e67a | ||
|
|
d5e133b7d8 | ||
|
|
3a3f9bc20b | ||
|
|
9d5424236c | ||
|
|
7c2550fefa | ||
|
|
2492515e8f | ||
|
|
e6f03c8f22 | ||
|
|
26a7d907a2 | ||
|
|
a0bd736948 | ||
|
|
803b3a3f7d | ||
|
|
40b12410f0 | ||
|
|
379ac82688 | ||
|
|
38c8927ae2 | ||
|
|
6d0badcf2a | ||
|
|
d920d8e578 | ||
|
|
13d0b8b084 | ||
|
|
3643ea164f | ||
|
|
ce67aa2617 | ||
|
|
737d669e4a | ||
|
|
7a1e69e288 | ||
|
|
cb9725bdfb | ||
|
|
29b77a2dac | ||
|
|
fbb028e15e | ||
|
|
2f7e74ab35 | ||
|
|
f050546fe2 | ||
|
|
153df45f95 | ||
|
|
b2ff793ea1 | ||
|
|
c4867bafec | ||
|
|
7800e9b0cc | ||
|
|
052b973b39 | ||
|
|
20b66fc447 | ||
|
|
0abcbb9854 | ||
|
|
ed2e21dffa | ||
|
|
1f68522837 | ||
|
|
a87ebfe97b | ||
|
|
d7e0d043f3 | ||
|
|
063b461ffd | ||
|
|
9edc9ebcc5 | ||
|
|
f272350e00 | ||
|
|
5baa38b82c | ||
|
|
957b6db3d7 | ||
|
|
50f94911b1 | ||
|
|
4d62cea700 | ||
|
|
0844df8cc2 | ||
|
|
a748665646 | ||
|
|
040c80a5ad | ||
|
|
193cf4de50 | ||
|
|
81b344715a | ||
|
|
a5343161bf | ||
|
|
84a9fb40ef | ||
|
|
88fd0fda64 | ||
|
|
48130670ca | ||
|
|
ca3e1f0843 | ||
|
|
40b10c13dc | ||
|
|
23e54e4543 | ||
|
|
38893eaf8c | ||
|
|
cd13e700ac | ||
|
|
fab12b10c1 | ||
|
|
f462adbe53 | ||
|
|
e5d6ccd6ba | ||
|
|
a427719a22 | ||
|
|
a14b21d80c | ||
|
|
d1eec80324 | ||
|
|
bb915cbf3d | ||
|
|
129e4d5704 | ||
|
|
5a95d606f8 | ||
|
|
388967d00c | ||
|
|
20527ab1f1 | ||
|
|
a9f01a4390 | ||
|
|
d10eff97a2 | ||
|
|
3f169b1751 | ||
|
|
f697450523 | ||
|
|
a405279f34 | ||
|
|
b30dcdd35a | ||
|
|
d6be28a7bb | ||
|
|
7a620de1bf | ||
|
|
be33fd58b3 | ||
|
|
54378f394a | ||
|
|
7bf24eb918 | ||
|
|
5cc3e189eb | ||
|
|
af0764b1ca | ||
|
|
27c23f676b | ||
|
|
1c5f466e61 | ||
|
|
61fcbd560e | ||
|
|
f20e6002cc | ||
|
|
89c23b5560 | ||
|
|
aa62764d90 | ||
|
|
0aacf197bf | ||
|
|
3afd8b4242 | ||
|
|
1826b7a9be | ||
|
|
3fc4fc3eb8 | ||
|
|
8fe0027d98 | ||
|
|
2a7b9381bc | ||
|
|
23f09937bc | ||
|
|
04344ed184 | ||
|
|
9cac8a92df | ||
|
|
c4ce85c847 | ||
|
|
f83fe424fb | ||
|
|
91a8703852 | ||
|
|
b7a1ada94d | ||
|
|
4217c5e47a | ||
|
|
22adf354e2 | ||
|
|
b0dde2ecb4 | ||
|
|
10f03a360c | ||
|
|
d250f4449c | ||
|
|
ba87c2e5ab | ||
|
|
f316b79bcd | ||
|
|
be86b83b67 | ||
|
|
9d63217778 | ||
|
|
b85520f504 | ||
|
|
11cfcda37c | ||
|
|
61f89bab6e | ||
|
|
9e3ca1c13c | ||
|
|
cb9f4972df | ||
|
|
7353e05a90 | ||
|
|
c17424deec | ||
|
|
cbf0402471 | ||
|
|
aa1a71ed96 | ||
|
|
79980bc7be | ||
|
|
56c2b85fce | ||
|
|
2ee0805075 | ||
|
|
6adedacaf8 | ||
|
|
bf9b0b4dd2 | ||
|
|
81a167ef01 | ||
|
|
517b4b27d7 | ||
|
|
fd5f4f3dd8 | ||
|
|
bed44dd82c | ||
|
|
2bd87313cd | ||
|
|
f99fd26386 | ||
|
|
916dde0045 | ||
|
|
4392feef1b | ||
|
|
153fea538a | ||
|
|
c54d81258a | ||
|
|
11cbbab901 | ||
|
|
b71bf9607c | ||
|
|
7b9ac53ace | ||
|
|
be0149e478 | ||
|
|
24953e5f0e | ||
|
|
29b5af9c87 | ||
|
|
caefacac35 | ||
|
|
37b369e0d7 | ||
|
|
cbf88de606 | ||
|
|
941432af75 | ||
|
|
826556775c | ||
|
|
0968e2b00b | ||
|
|
c02e2530f1 | ||
|
|
6b904573a0 | ||
|
|
950b53f6dc | ||
|
|
d552d27a35 | ||
|
|
0237675711 | ||
|
|
ba8684b585 | ||
|
|
b08a086a11 | ||
|
|
489879eb0d | ||
|
|
e0dd15567c | ||
|
|
1e9ccab806 | ||
|
|
9751bde8d1 | ||
|
|
3fab93fc4a | ||
|
|
1de3ffe57e | ||
|
|
bb980abe8c | ||
|
|
9726be64c6 | ||
|
|
f7fd1cf2b0 | ||
|
|
ea02626c28 | ||
|
|
8dc97790bc | ||
|
|
55b3cbaf17 | ||
|
|
9647567704 | ||
|
|
e56a791d41 | ||
|
|
e7d6bae0ad | ||
|
|
a631c50979 | ||
|
|
2964cc922c | ||
|
|
bbb95e15fa | ||
|
|
fc79a0ef3b | ||
|
|
e8ab4f9f0c | ||
|
|
526c38a698 | ||
|
|
489459f313 | ||
|
|
4d4a654a8e | ||
|
|
79f99485c1 | ||
|
|
ea8c970d6e | ||
|
|
9b00967df0 | ||
|
|
b66b0be8b4 | ||
|
|
15e5242611 | ||
|
|
c431cc7f63 | ||
|
|
448e300a03 | ||
|
|
7cd5266d39 | ||
|
|
f83fedb9e1 | ||
|
|
3a6c7cf204 | ||
|
|
77d22c4038 | ||
|
|
34becd6871 | ||
|
|
d05bb872f3 | ||
|
|
85ca39cf0c | ||
|
|
a858664035 | ||
|
|
286438ae0e | ||
|
|
ece2a4b64c | ||
|
|
fd62963ad2 | ||
|
|
4f0e09c00e | ||
|
|
461d2a1ba8 | ||
|
|
57e36f4eda | ||
|
|
5850dff254 | ||
|
|
45572931a1 | ||
|
|
e260255ce8 | ||
|
|
38c0e24bcd | ||
|
|
3225a07f6f | ||
|
|
db2f805ed9 | ||
|
|
42f15f000b | ||
|
|
f61edacb5c | ||
|
|
674468268e | ||
|
|
f55fed9bc3 | ||
|
|
2484cf2c55 | ||
|
|
8f86288614 | ||
|
|
1690cb9cae | ||
|
|
4cc5441579 | ||
|
|
e4b5ec8f0b | ||
|
|
bed8c44859 | ||
|
|
ac48fae0af | ||
|
|
93ba55d357 | ||
|
|
d51cdc0e48 | ||
|
|
7fd2e1ffca | ||
|
|
bcf7707b01 | ||
|
|
07694c52b0 | ||
|
|
a1a7e21f92 | ||
|
|
5560829695 | ||
|
|
b746116a20 | ||
|
|
4d5149a35f | ||
|
|
56ac30de91 | ||
|
|
1d7ca27e61 | ||
|
|
a2316e6e14 | ||
|
|
be081fd44e | ||
|
|
93fd685ca7 | ||
|
|
84b1886666 | ||
|
|
075f4aadc7 | ||
|
|
e9adc06bee | ||
|
|
984002a7ec | ||
|
|
46553c719c | ||
|
|
5e5d8e5b17 | ||
|
|
7e20ea160c | ||
|
|
3d0f7f3b70 | ||
|
|
317281b37b | ||
|
|
795ea69982 | ||
|
|
11672db967 | ||
|
|
c0cfc7872e | ||
|
|
e744a1b6e9 | ||
|
|
975e180b26 | ||
|
|
7046ebe261 | ||
|
|
f4d54ace1d | ||
|
|
8b539cd4cc | ||
|
|
20982bba31 | ||
|
|
f64e35e8bb | ||
|
|
268c18988b | ||
|
|
42b6ed5d2a | ||
|
|
b021bfd70f | ||
|
|
6900c90bc5 | ||
|
|
1c77fb2357 | ||
|
|
c28f64efde | ||
|
|
82d2fa373a | ||
|
|
9968a5feda | ||
|
|
0f3c151058 | ||
|
|
b921bece0e | ||
|
|
81bffb464f | ||
|
|
e2fa562326 | ||
|
|
dab8c8dcd0 | ||
|
|
836700669f | ||
|
|
a162b6fab3 | ||
|
|
f0baf2efc2 | ||
|
|
18b1789512 | ||
|
|
d80ded31ee | ||
|
|
aaa4fec141 | ||
|
|
a871f29e75 | ||
|
|
ea1ee73392 | ||
|
|
32c663cf2c | ||
|
|
3cdb9f130b | ||
|
|
476e35c276 | ||
|
|
7f22455eed | ||
|
|
439a8a5330 | ||
|
|
fa970f1ae2 | ||
|
|
3ee533a9b0 | ||
|
|
e63423eafe | ||
|
|
392d529168 | ||
|
|
5a3ac559be | ||
|
|
111b127bf7 | ||
|
|
9881411090 | ||
|
|
6e80a35960 | ||
|
|
d8232bb484 | ||
|
|
f8ef902af4 | ||
|
|
a452915d8a | ||
|
|
8c0f1f979a | ||
|
|
d1beaff8e4 | ||
|
|
4b0c43fb8b | ||
|
|
93b067b6bc | ||
|
|
10e3a16f40 | ||
|
|
513115ea3b | ||
|
|
597405c288 | ||
|
|
2d765a6cf9 | ||
|
|
2991c4ab57 | ||
|
|
fc12370765 | ||
|
|
7ba4045e59 | ||
|
|
cf605f2d52 | ||
|
|
0f0ea7e63f | ||
|
|
969b47c78c | ||
|
|
db34b37716 | ||
|
|
3a83f1b861 | ||
|
|
dc922b4ffa | ||
|
|
783e6d33d5 | ||
|
|
32d669ccc8 | ||
|
|
485245fbfd | ||
|
|
a2927a0dd9 | ||
|
|
77e60f8417 | ||
|
|
7d544e0868 | ||
|
|
0f4a5c09af | ||
|
|
97d48277b5 | ||
|
|
2b410cf2d0 | ||
|
|
9dd4dc3730 | ||
|
|
bf510b570a | ||
|
|
958ee7af51 | ||
|
|
2ff2e85fbb | ||
|
|
79e4ee2717 | ||
|
|
dc4ca15430 | ||
|
|
38752f4700 | ||
|
|
02ba8a86e6 | ||
|
|
ecea771801 | ||
|
|
b3ad00da13 | ||
|
|
0aa4fe258e | ||
|
|
921aa28b42 | ||
|
|
3e3b5ab02d | ||
|
|
585887b04e | ||
|
|
9342ebdc98 | ||
|
|
5d7cdd2646 | ||
|
|
22c4508c27 | ||
|
|
e50c314c33 | ||
|
|
bb16820ab0 | ||
|
|
bf8c12d9f7 | ||
|
|
3e6cdf8901 | ||
|
|
cde4ef435c | ||
|
|
1929403cda | ||
|
|
c245794e56 | ||
|
|
7ed51f97aa | ||
|
|
8084e20e64 | ||
|
|
7a800068ed | ||
|
|
824397e6ba | ||
|
|
2d5c0df7cd | ||
|
|
b7f0f9ba86 | ||
|
|
4e7ffc2711 | ||
|
|
037e44e084 | ||
|
|
32ea32521d | ||
|
|
e8ed1674ea | ||
|
|
2ad3ee6f99 | ||
|
|
5ad4734c24 | ||
|
|
124b195d3e | ||
|
|
42cc4d7683 | ||
|
|
4c144c3d5c | ||
|
|
87b3a3274d | ||
|
|
72fce33956 | ||
|
|
3a4fc2a99a | ||
|
|
88352092ee | ||
|
|
c845682ecb | ||
|
|
4e51888651 | ||
|
|
9685c87bc9 | ||
|
|
7a71f107cb | ||
|
|
2944b31c69 | ||
|
|
41fb355804 | ||
|
|
410f35bb44 | ||
|
|
917e78a096 | ||
|
|
d71c690794 | ||
|
|
c34d637de1 | ||
|
|
c9299f3b8d | ||
|
|
ca332a3fef | ||
|
|
4b7f3e85c2 | ||
|
|
f47ac87f12 | ||
|
|
17e779177b | ||
|
|
31930290cf | ||
|
|
a96031f435 | ||
|
|
53b85c99ae | ||
|
|
7b256c3ec6 | ||
|
|
fa1eb354f2 | ||
|
|
1d709cc6ac | ||
|
|
8779b90f7c | ||
|
|
c69e5c1dba | ||
|
|
0b09148fb5 | ||
|
|
9286d63133 | ||
|
|
b4598aa5d9 | ||
|
|
96c3a86314 | ||
|
|
97510ba0be | ||
|
|
2ad5dea737 | ||
|
|
14e073fb5a | ||
|
|
b698b1736f | ||
|
|
9c59116dd1 | ||
|
|
ab9fc9cc71 | ||
|
|
b7e2a9b40e | ||
|
|
09feaedd00 | ||
|
|
f31a4f8549 | ||
|
|
525d5c5337 | ||
|
|
f08814250e | ||
|
|
8c396e5afb | ||
|
|
019fc86ac5 | ||
|
|
c105a98443 | ||
|
|
666a010e3b | ||
|
|
aa3cc0cec4 | ||
|
|
3fc0f2b47d | ||
|
|
f219393149 | ||
|
|
10b690b5f9 | ||
|
|
865404a0d3 | ||
|
|
fdfe057efe | ||
|
|
331a5260c9 | ||
|
|
b070b572d0 | ||
|
|
70fc6879db | ||
|
|
a9b5f003e5 | ||
|
|
c1ddc55a12 | ||
|
|
ffe9105891 | ||
|
|
1ab9de8b2c | ||
|
|
0541053fa9 | ||
|
|
0e69af847e | ||
|
|
6e1f049456 | ||
|
|
65f891a30d | ||
|
|
fe9fee1609 | ||
|
|
bd9d723315 | ||
|
|
2690410cbe | ||
|
|
070c286c54 | ||
|
|
539529af59 | ||
|
|
d2979fc4ff | ||
|
|
f0df0d7bf2 | ||
|
|
984121e095 | ||
|
|
efccede678 | ||
|
|
fcc079a5f2 | ||
|
|
c012afdbae | ||
|
|
59a4155651 | ||
|
|
2d83003b64 | ||
|
|
c3348d1734 | ||
|
|
8fb8a718c3 | ||
|
|
6366bd05b3 | ||
|
|
00777de581 | ||
|
|
d2c81db06a | ||
|
|
58c8b07ab5 | ||
|
|
cc1b70c74b | ||
|
|
a0340faa63 | ||
|
|
7ed672752d | ||
|
|
daa975d01f | ||
|
|
66d95316f1 | ||
|
|
09d245c54b | ||
|
|
7a8d29f5e0 | ||
|
|
28fcbbf1fe | ||
|
|
1281d9987a | ||
|
|
aa5a571ab1 | ||
|
|
a723b4e215 | ||
|
|
6976fd96e3 | ||
|
|
1ff8df8936 | ||
|
|
37ef03c956 | ||
|
|
2447f09128 | ||
|
|
14da0cfd11 | ||
|
|
ca7081bde3 | ||
|
|
390cc17161 | ||
|
|
b666fc49b7 | ||
|
|
cfa29b0022 | ||
|
|
5bfef2805d | ||
|
|
65a2aef4ed | ||
|
|
ef915e1cd0 | ||
|
|
01d06d0a2e | ||
|
|
b3e5ac2717 | ||
|
|
3643908427 | ||
|
|
e8109919e9 | ||
|
|
09fe09e42b | ||
|
|
fa2582a2f1 | ||
|
|
c576b2a34e | ||
|
|
d8a4b19b54 | ||
|
|
e7eb07197e | ||
|
|
4828835292 | ||
|
|
a1af290d18 | ||
|
|
4094ace04b | ||
|
|
cec47dbfc3 | ||
|
|
6b74dcf75b | ||
|
|
9defa59d2d | ||
|
|
bd0512fea7 | ||
|
|
2b48f03e0f | ||
|
|
51905b54a2 | ||
|
|
43f313cb18 | ||
|
|
db1ab50938 | ||
|
|
1a72e59c54 | ||
|
|
ed5433d290 | ||
|
|
bedfa5e2d3 | ||
|
|
5842d771fe | ||
|
|
4da61e8ae9 | ||
|
|
9e8d20aee4 | ||
|
|
2dff59a4d4 | ||
|
|
a36b4a0466 | ||
|
|
3b9699fbc8 | ||
|
|
48d4554317 | ||
|
|
cc33727fad | ||
|
|
d1b2e4e483 | ||
|
|
808de79d16 | ||
|
|
76a9f80545 | ||
|
|
75ac8a4847 | ||
|
|
8d29bf3c20 | ||
|
|
d90f292c71 | ||
|
|
003ac5536e | ||
|
|
ef17d4f3b8 | ||
|
|
eb9f6c027b | ||
|
|
f2836ea111 | ||
|
|
a4d8e1c4d8 | ||
|
|
baf8cc49a1 | ||
|
|
a85363ac03 | ||
|
|
c78602ba7a | ||
|
|
d3d0d1e007 | ||
|
|
6751c2640d | ||
|
|
b2987d3054 | ||
|
|
b5076091fa | ||
|
|
29e69d3833 | ||
|
|
11efafffd8 | ||
|
|
e9a5eff753 | ||
|
|
29137b5ad1 | ||
|
|
e3bec11d2e | ||
|
|
8e8804caf1 | ||
|
|
2dfe36b588 | ||
|
|
7547b50bd8 | ||
|
|
f681a99ce0 | ||
|
|
334b2276cf | ||
|
|
8515e30ad8 | ||
|
|
c16b941909 | ||
|
|
0421ad71e8 | ||
|
|
e686eff886 | ||
|
|
6c369ae907 | ||
|
|
71e06761f0 | ||
|
|
3c541045bb | ||
|
|
744f72355b | ||
|
|
c2e1623529 | ||
|
|
d8357ae932 | ||
|
|
abbbe3d41b | ||
|
|
feb6c4c2d7 | ||
|
|
d45a63ee5c | ||
|
|
bc3dc0fd74 | ||
|
|
4c42f4e1ba | ||
|
|
ee2e448220 | ||
|
|
8264343e54 | ||
|
|
fe1475105a | ||
|
|
9d901d26b2 | ||
|
|
a5519c2645 | ||
|
|
4f1b7c70b8 | ||
|
|
e6f354ce7c | ||
|
|
ddb295cc77 | ||
|
|
be7228f78e | ||
|
|
945d2f6f5d | ||
|
|
ac557d4eca | ||
|
|
b2cc0c9bd8 | ||
|
|
c48b9c5118 | ||
|
|
ac489c6938 | ||
|
|
fb0f1fb209 | ||
|
|
879d9758c0 | ||
|
|
72a83b99b7 | ||
|
|
68440e7e0f | ||
|
|
e9b0e2b0e8 | ||
|
|
332fd250b4 | ||
|
|
f047e5f6bd | ||
|
|
7979726327 | ||
|
|
d964bbc605 | ||
|
|
f5611d6cd6 | ||
|
|
388e530420 | ||
|
|
fe5c8a97d4 | ||
|
|
37d3f7b4c1 | ||
|
|
72767f5d17 | ||
|
|
965776160f | ||
|
|
a642868cfa | ||
|
|
f81658f542 | ||
|
|
953f9c2e7a | ||
|
|
01168e805a | ||
|
|
a413f3046a | ||
|
|
1d4eaf6824 | ||
|
|
305089d84f | ||
|
|
10d1be695d | ||
|
|
465e24cf4e | ||
|
|
aff9f5dbf9 | ||
|
|
583564e484 | ||
|
|
559e85bc76 | ||
|
|
9708fb4ea6 | ||
|
|
10354cf607 | ||
|
|
f0c812482f | ||
|
|
e868954d9c | ||
|
|
c2ff8347d9 | ||
|
|
e50253e316 | ||
|
|
9773314803 | ||
|
|
7d21bd8133 | ||
|
|
ca8647c808 | ||
|
|
b4f7259c7f | ||
|
|
16f70ba1a0 | ||
|
|
0da8b0ae7f | ||
|
|
1ad7765f2f | ||
|
|
7d610bde7b | ||
|
|
b24c46dd19 | ||
|
|
43cfc2a4cd | ||
|
|
d291d23092 | ||
|
|
85a95a0036 | ||
|
|
f274cc99f6 |
@@ -111,7 +111,9 @@ class Class(Exportable):
|
|||||||
lines.append(' }\n')
|
lines.append(' }\n')
|
||||||
lines.append(' goog.base(this, arg);\n')
|
lines.append(' goog.base(this, arg);\n')
|
||||||
lines.append('};\n')
|
lines.append('};\n')
|
||||||
lines.append('goog.inherits(%sExport, %s);\n' % (self.name, self.name))
|
lines.append('goog.inherits(\n')
|
||||||
|
lines.append(' %sExport,\n' % (self.name,));
|
||||||
|
lines.append(' %s);\n' % (self.name,));
|
||||||
lines.append('goog.exportSymbol(\n')
|
lines.append('goog.exportSymbol(\n')
|
||||||
lines.append(' \'%s\',\n' % (self.name,))
|
lines.append(' \'%s\',\n' % (self.name,))
|
||||||
lines.append(' %s);\n' % (self.export_name(),))
|
lines.append(' %s);\n' % (self.export_name(),))
|
||||||
@@ -276,7 +278,7 @@ def main(argv):
|
|||||||
components = m.group('name').split('.')
|
components = m.group('name').split('.')
|
||||||
if re.match(r'[A-Z]', components[-1]):
|
if re.match(r'[A-Z]', components[-1]):
|
||||||
requires.add(name)
|
requires.add(name)
|
||||||
elif len(components) > 2:
|
elif len(components) > 1:
|
||||||
requires.add('.'.join(components[:-1]))
|
requires.add('.'.join(components[:-1]))
|
||||||
continue
|
continue
|
||||||
raise RuntimeError(line)
|
raise RuntimeError(line)
|
||||||
|
|||||||
@@ -65,12 +65,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CLOSURE_NO_DEPS has an effect in "raw" and "whitespace" modes only (i.e.
|
||||||
|
// when COMPILED is false). In "raw" mode we use our own deps file
|
||||||
|
// (ol-deps.js), so we set CLOSURE_NO_DEPS to true to prevent Google
|
||||||
|
// Library's base.js script to load deps.js. In "whitespace" mode
|
||||||
|
// no deps file is needed at all, yet base.js will attempt to load deps.js
|
||||||
|
// if CLOSURE_NO_DEPS is not set to true.
|
||||||
|
window.CLOSURE_NO_DEPS = true;
|
||||||
|
|
||||||
var scriptId = encodeURIComponent(scriptParams.id);
|
var scriptId = encodeURIComponent(scriptParams.id);
|
||||||
document.write('<link rel="stylesheet" href="../build/ol.css" type="text/css">');
|
document.write('<link rel="stylesheet" href="../build/ol.css" type="text/css">');
|
||||||
if (mode != 'raw') {
|
if (mode != 'raw') {
|
||||||
document.write('<scr' + 'ipt type="text/javascript" src="../build/' + oljs + '"></scr' + 'ipt>');
|
document.write('<scr' + 'ipt type="text/javascript" src="../build/' + oljs + '"></scr' + 'ipt>');
|
||||||
} else {
|
} else {
|
||||||
window.CLOSURE_NO_DEPS = true; // we've got our own deps file
|
|
||||||
document.write('<scr' + 'ipt type="text/javascript" src="../closure-library/closure/goog/base.js"></scr' + 'ipt>');
|
document.write('<scr' + 'ipt type="text/javascript" src="../closure-library/closure/goog/base.js"></scr' + 'ipt>');
|
||||||
document.write('<scr' + 'ipt type="text/javascript" src="../build/ol-deps.js"></scr' + 'ipt>');
|
document.write('<scr' + 'ipt type="text/javascript" src="../build/ol-deps.js"></scr' + 'ipt>');
|
||||||
document.write('<scr' + 'ipt type="text/javascript" src="' + scriptId + '-require.js"></scr' + 'ipt>');
|
document.write('<scr' + 'ipt type="text/javascript" src="' + scriptId + '-require.js"></scr' + 'ipt>');
|
||||||
|
|||||||
47
build.py
47
build.py
@@ -309,8 +309,10 @@ def examples_star_json(name, match):
|
|||||||
'../externs/bingmaps.js',
|
'../externs/bingmaps.js',
|
||||||
'../externs/bootstrap.js',
|
'../externs/bootstrap.js',
|
||||||
'../externs/geojson.js',
|
'../externs/geojson.js',
|
||||||
|
'../externs/oli.js',
|
||||||
'../externs/proj4js.js',
|
'../externs/proj4js.js',
|
||||||
'../externs/tilejson.js',
|
'../externs/tilejson.js',
|
||||||
|
'../externs/w3c_device_sensor_event.js',
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
with open(t.name, 'w') as f:
|
with open(t.name, 'w') as f:
|
||||||
@@ -332,8 +334,7 @@ def examples_star_combined_js(name, match):
|
|||||||
return Target(name, action=action, dependencies=dependencies)
|
return Target(name, action=action, dependencies=dependencies)
|
||||||
|
|
||||||
|
|
||||||
@target('serve', PLOVR_JAR, INTERNAL_SRC, 'build/test/requireall.js',
|
@target('serve', PLOVR_JAR, 'test-deps', 'examples')
|
||||||
'examples')
|
|
||||||
def serve(t):
|
def serve(t):
|
||||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'buildcfg/ol.json',
|
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'buildcfg/ol.json',
|
||||||
'buildcfg/ol-all.json', EXAMPLES_JSON, 'buildcfg/test.json')
|
'buildcfg/ol-all.json', EXAMPLES_JSON, 'buildcfg/test.json')
|
||||||
@@ -345,19 +346,35 @@ def serve_precommit(t):
|
|||||||
'buildcfg/ol-all.json', 'buildcfg/test.json')
|
'buildcfg/ol-all.json', 'buildcfg/test.json')
|
||||||
|
|
||||||
|
|
||||||
virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp',
|
virtual('lint', 'build/lint-timestamp', 'build/lint-generated-timestamp',
|
||||||
'build/check-whitespace-timestamp')
|
'build/check-requires-timestamp', 'build/check-whitespace-timestamp')
|
||||||
|
|
||||||
|
|
||||||
@target('build/lint-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC,
|
@target('build/lint-timestamp', SRC, EXAMPLES_SRC, SPEC, precious=True)
|
||||||
SPEC, precious=True)
|
|
||||||
def build_lint_src_timestamp(t):
|
def build_lint_src_timestamp(t):
|
||||||
|
t.run('%(GJSLINT)s',
|
||||||
|
'--jslint_error=all',
|
||||||
|
'--strict',
|
||||||
|
t.newer(t.dependencies))
|
||||||
|
t.touch()
|
||||||
|
|
||||||
|
|
||||||
|
@target('build/lint-generated-timestamp', INTERNAL_SRC, EXTERNAL_SRC,
|
||||||
|
precious=True)
|
||||||
|
def build_lint_generated_timestamp(t):
|
||||||
limited_doc_files = [
|
limited_doc_files = [
|
||||||
path
|
path
|
||||||
for path in ifind('externs', 'build/src/external/externs')
|
for path in ifind('externs', 'build/src/external/externs')
|
||||||
if path.endswith('.js')]
|
if path.endswith('.js')]
|
||||||
t.run('%(GJSLINT)s', '--strict', '--limited_doc_files=%s' %
|
t.run('%(GJSLINT)s',
|
||||||
(','.join(limited_doc_files),), t.newer(t.dependencies))
|
'--jslint_error=all',
|
||||||
|
# ignore error for max line length (for these auto-generated sources)
|
||||||
|
'--disable=110',
|
||||||
|
# for a complete list of error codes to allow, see
|
||||||
|
# http://closure-linter.googlecode.com/svn/trunk/closure_linter/errors.py
|
||||||
|
'--limited_doc_files=%s' % (','.join(limited_doc_files),),
|
||||||
|
'--strict',
|
||||||
|
t.newer(t.dependencies))
|
||||||
t.touch()
|
t.touch()
|
||||||
|
|
||||||
|
|
||||||
@@ -477,6 +494,7 @@ def build_check_requires_timestamp(t):
|
|||||||
provides = set()
|
provides = set()
|
||||||
requires = set()
|
requires = set()
|
||||||
uses = set()
|
uses = set()
|
||||||
|
uses_linenos = {}
|
||||||
for lineno, line in _strip_comments(open(filename)):
|
for lineno, line in _strip_comments(open(filename)):
|
||||||
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
|
m = re.match(r'goog.provide\(\'(.*)\'\);', line)
|
||||||
if m:
|
if m:
|
||||||
@@ -491,6 +509,7 @@ def build_check_requires_timestamp(t):
|
|||||||
m = provide_re.search(line)
|
m = provide_re.search(line)
|
||||||
if m:
|
if m:
|
||||||
uses.add(m.group())
|
uses.add(m.group())
|
||||||
|
uses_linenos[m.group()] = lineno
|
||||||
line = line[:m.start()] + line[m.end():]
|
line = line[:m.start()] + line[m.end():]
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@@ -504,9 +523,10 @@ def build_check_requires_timestamp(t):
|
|||||||
uses.discard('ol.renderer.%s.Map' % (m.group(1),))
|
uses.discard('ol.renderer.%s.Map' % (m.group(1),))
|
||||||
missing_requires = uses - requires - provides
|
missing_requires = uses - requires - provides
|
||||||
if missing_requires:
|
if missing_requires:
|
||||||
t.info('%s: missing goog.requires: %s', filename, ', '.join(
|
for missing_require in sorted(missing_requires):
|
||||||
sorted(missing_requires)))
|
t.info("%s:%d missing goog.require('%s')" %
|
||||||
missing_count += len(missing_requires)
|
(filename, uses_linenos[missing_require], missing_require))
|
||||||
|
missing_count += 1
|
||||||
if unused_count or missing_count:
|
if unused_count or missing_count:
|
||||||
t.error('%d unused goog.requires, %d missing goog.requires' %
|
t.error('%d unused goog.requires, %d missing goog.requires' %
|
||||||
(unused_count, missing_count))
|
(unused_count, missing_count))
|
||||||
@@ -682,7 +702,10 @@ def proj4js_zip(t):
|
|||||||
t.info('downloaded %r', t.name)
|
t.info('downloaded %r', t.name)
|
||||||
|
|
||||||
|
|
||||||
@target('test', INTERNAL_SRC, PROJ4JS, 'build/test/requireall.js', phony=True)
|
virtual('test-deps', INTERNAL_SRC, PROJ4JS, 'build/test/requireall.js')
|
||||||
|
|
||||||
|
|
||||||
|
@target('test', 'test-deps', phony=True)
|
||||||
def test(t):
|
def test(t):
|
||||||
t.run('%(PHANTOMJS)s', 'test/mocha-phantomjs.coffee', 'test/ol.html')
|
t.run('%(PHANTOMJS)s', 'test/mocha-phantomjs.coffee', 'test/ol.html')
|
||||||
|
|
||||||
|
|||||||
@@ -42,19 +42,64 @@
|
|||||||
"//json.js",
|
"//json.js",
|
||||||
"../externs/bingmaps.js",
|
"../externs/bingmaps.js",
|
||||||
"../externs/geojson.js",
|
"../externs/geojson.js",
|
||||||
|
"../externs/oli.js",
|
||||||
"../externs/proj4js.js",
|
"../externs/proj4js.js",
|
||||||
"../externs/tilejson.js"
|
"../externs/tilejson.js",
|
||||||
|
"../externs/w3c_device_sensor_event.js"
|
||||||
],
|
],
|
||||||
|
|
||||||
"level": "VERBOSE",
|
"level": "VERBOSE",
|
||||||
|
|
||||||
"mode": "ADVANCED",
|
"mode": "ADVANCED",
|
||||||
|
|
||||||
|
"name-suffixes-to-strip": [
|
||||||
|
"logger",
|
||||||
|
"logger_"
|
||||||
|
],
|
||||||
|
|
||||||
"paths": [
|
"paths": [
|
||||||
"../build/src/internal/src",
|
"../build/src/internal/src",
|
||||||
"../src"
|
"../src"
|
||||||
],
|
],
|
||||||
|
|
||||||
"treat-warnings-as-errors": false
|
"treat-warnings-as-errors": false,
|
||||||
|
|
||||||
|
"type-prefixes-to-strip": [
|
||||||
|
"goog.asserts",
|
||||||
|
"goog.debug.Console",
|
||||||
|
"goog.debug.DebugWindow",
|
||||||
|
"goog.debug.DevCss",
|
||||||
|
"goog.debug.DivConsole",
|
||||||
|
"goog.debug.EntryPointMonitor",
|
||||||
|
"goog.debug.ErrorHandler",
|
||||||
|
"goog.debug.ErrorReporter",
|
||||||
|
"goog.debug.FancyWindow",
|
||||||
|
"goog.debug.Formatter",
|
||||||
|
"goog.debug.FpsDisplay",
|
||||||
|
"goog.debug.GcDiagnostics",
|
||||||
|
"goog.debug.HtmlFormatter",
|
||||||
|
"goog.debug.LogBuffer",
|
||||||
|
"goog.debug.LogManager",
|
||||||
|
"goog.debug.LogRecord",
|
||||||
|
"goog.debug.Logger",
|
||||||
|
"goog.debug.RelativeTimeProvider",
|
||||||
|
"goog.debug.TextFormatter",
|
||||||
|
"goog.debug.Trace",
|
||||||
|
"goog.debug.catchErrors",
|
||||||
|
"goog.debug.deepExpose",
|
||||||
|
"goog.debug.enhanceError",
|
||||||
|
"goog.debug.entryPointRegistry",
|
||||||
|
"goog.debug.errorHandlerWeakDep",
|
||||||
|
"goog.debug.expose",
|
||||||
|
"goog.debug.exposeArray",
|
||||||
|
"goog.debug.exposeException",
|
||||||
|
"goog.debug.getFunctionName",
|
||||||
|
"goog.debug.getStacktrace",
|
||||||
|
"goog.debug.getStacktraceSimple",
|
||||||
|
"goog.debug.logRecordSerializer",
|
||||||
|
"goog.debug.makeWhitespaceVisible",
|
||||||
|
"goog.debug.normalizeErrorObject",
|
||||||
|
"goog.debug.reflect"
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
"../build/src/external/externs/types.js",
|
"../build/src/external/externs/types.js",
|
||||||
"../externs/bingmaps.js",
|
"../externs/bingmaps.js",
|
||||||
"../externs/geojson.js",
|
"../externs/geojson.js",
|
||||||
|
"../externs/oli.js",
|
||||||
"../externs/proj4js.js",
|
"../externs/proj4js.js",
|
||||||
"../externs/tilejson.js"
|
"../externs/tilejson.js",
|
||||||
|
"../externs/w3c_device_sensor_event.js"
|
||||||
],
|
],
|
||||||
|
|
||||||
"inherits": "base.json",
|
"inherits": "base.json",
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
"//json.js",
|
"//json.js",
|
||||||
"../externs/bingmaps.js",
|
"../externs/bingmaps.js",
|
||||||
"../externs/geojson.js",
|
"../externs/geojson.js",
|
||||||
|
"../externs/oli.js",
|
||||||
"../externs/proj4js.js",
|
"../externs/proj4js.js",
|
||||||
"../externs/tilejson.js"
|
"../externs/tilejson.js",
|
||||||
|
"../externs/w3c_device_sensor_event.js"
|
||||||
],
|
],
|
||||||
|
|
||||||
"inherits": "ol.json",
|
"inherits": "ol.json",
|
||||||
|
|||||||
@@ -17,8 +17,10 @@
|
|||||||
"//json.js",
|
"//json.js",
|
||||||
"../externs/bingmaps.js",
|
"../externs/bingmaps.js",
|
||||||
"../externs/geojson.js",
|
"../externs/geojson.js",
|
||||||
|
"../externs/oli.js",
|
||||||
"../externs/proj4js.js",
|
"../externs/proj4js.js",
|
||||||
"../externs/tilejson.js"
|
"../externs/tilejson.js",
|
||||||
|
"../externs/w3c_device_sensor_event.js"
|
||||||
],
|
],
|
||||||
|
|
||||||
"inherits": "ol.json",
|
"inherits": "ol.json",
|
||||||
|
|||||||
@@ -17,8 +17,10 @@
|
|||||||
"../build/src/external/externs/types.js",
|
"../build/src/external/externs/types.js",
|
||||||
"../externs/bingmaps.js",
|
"../externs/bingmaps.js",
|
||||||
"../externs/geojson.js",
|
"../externs/geojson.js",
|
||||||
|
"../externs/oli.js",
|
||||||
"../externs/proj4js.js",
|
"../externs/proj4js.js",
|
||||||
"../externs/tilejson.js"
|
"../externs/tilejson.js",
|
||||||
|
"../externs/w3c_device_sensor_event.js"
|
||||||
],
|
],
|
||||||
|
|
||||||
"inherits": "base.json",
|
"inherits": "base.json",
|
||||||
|
|||||||
17
css/ol.css
17
css/ol.css
@@ -1,21 +1,27 @@
|
|||||||
.ol-attribution {
|
.ol-attribution {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 10px;
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
color: #eeeeee;
|
color: #eeeeee;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: rgba(0,60,136,0.3);
|
background: rgba(0,60,136,0.3);
|
||||||
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
|
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
|
||||||
padding: 2px 4px;
|
padding: 6px;
|
||||||
}
|
}
|
||||||
.ol-attribution a {
|
.ol-attribution a {
|
||||||
color: white;
|
color: white;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
.ol-attribution ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 12px;
|
||||||
|
}
|
||||||
.ol-attribution li {
|
.ol-attribution li {
|
||||||
display: inline;
|
display: inline;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
line-height: inherit;
|
||||||
}
|
}
|
||||||
.ol-attribution li:not(:last-child):after {
|
.ol-attribution li:not(:last-child):after {
|
||||||
content: "\2003";
|
content: "\2003";
|
||||||
@@ -81,6 +87,13 @@ a.ol-full-screen-true:after {
|
|||||||
display: inline;
|
display: inline;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ol-mouse-position {
|
||||||
|
top: 8px;
|
||||||
|
right: 8px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
.ol-scale-line {
|
.ol-scale-line {
|
||||||
background: rgba(0,60,136,0.3);
|
background: rgba(0,60,136,0.3);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|||||||
@@ -30,22 +30,27 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<button id="rotate-left"><i class="icon-arrow-left"></i></button>
|
|
||||||
<button>Rotate</button>
|
|
||||||
<button id="rotate-right"><i class="icon-arrow-right"></i></button>
|
|
||||||
</div>
|
</div>
|
||||||
<button id="pan-to-london">Pan to London</button>
|
</div>
|
||||||
<button id="elastic-to-moscow">Elastic to Moscow</button>
|
|
||||||
<button id="bounce-to-istanbul">Bounce to Istanbul</button>
|
<div class="row-fluid">
|
||||||
<button id="spin-to-rome">Spin to Rome</button>
|
<div class="span12">
|
||||||
<button id="fly-to-bern">Fly to Bern</button>
|
<button id="rotate-left"><i class="icon-arrow-left"></i></button>
|
||||||
|
<button id="rotate-right"><i class="icon-arrow-right"></i></button>
|
||||||
|
<button id="pan-to-london">Pan to London</button>
|
||||||
|
<button id="elastic-to-moscow">Elastic to Moscow</button>
|
||||||
|
<button id="bounce-to-istanbul">Bounce to Istanbul</button>
|
||||||
|
<button id="spin-to-rome">Spin to Rome</button>
|
||||||
|
<button id="fly-to-bern">Fly to Bern</button>
|
||||||
|
<button id="spiral-to-madrid">Spiral to Madrid</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Animation example</h4>
|
<h4 id="title">Animation example</h4>
|
||||||
<p id="shortdesc">Example animations.</p>
|
<p id="shortdesc">Demonstrates animated pan, zoom, and rotation.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>See the <a href="animation.js" target="_blank">animation.js source</a> to see how this is done.</p>
|
<p>See the <a href="animation.js" target="_blank">animation.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,20 +4,16 @@ goog.require('ol.View2D');
|
|||||||
goog.require('ol.animation');
|
goog.require('ol.animation');
|
||||||
goog.require('ol.easing');
|
goog.require('ol.easing');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
|
||||||
var london = ol.projection.transform(
|
var london = ol.proj.transform([-0.12755, 51.507222], 'EPSG:4326', 'EPSG:3857');
|
||||||
[-0.12755, 51.507222], 'EPSG:4326', 'EPSG:3857');
|
var moscow = ol.proj.transform([37.6178, 55.7517], 'EPSG:4326', 'EPSG:3857');
|
||||||
var moscow = ol.projection.transform(
|
var istanbul = ol.proj.transform([28.9744, 41.0128], 'EPSG:4326', 'EPSG:3857');
|
||||||
[37.6178, 55.7517], 'EPSG:4326', 'EPSG:3857');
|
var rome = ol.proj.transform([12.5, 41.9], 'EPSG:4326', 'EPSG:3857');
|
||||||
var istanbul = ol.projection.transform(
|
var bern = ol.proj.transform([7.4458, 46.95], 'EPSG:4326', 'EPSG:3857');
|
||||||
[28.9744, 41.0128], 'EPSG:4326', 'EPSG:3857');
|
var madrid = ol.proj.transform([-3.683333, 40.4], 'EPSG:4326', 'EPSG:3857');
|
||||||
var rome = ol.projection.transform(
|
|
||||||
[12.5, 41.9], 'EPSG:4326', 'EPSG:3857');
|
|
||||||
var bern = ol.projection.transform(
|
|
||||||
[7.4458, 46.95], 'EPSG:4326', 'EPSG:3857');
|
|
||||||
|
|
||||||
var view = new ol.View2D({
|
var view = new ol.View2D({
|
||||||
// the view's initial state
|
// the view's initial state
|
||||||
@@ -37,7 +33,6 @@ var map = new ol.Map({
|
|||||||
view: view
|
view: view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var rotateLeft = document.getElementById('rotate-left');
|
var rotateLeft = document.getElementById('rotate-left');
|
||||||
rotateLeft.addEventListener('click', function() {
|
rotateLeft.addEventListener('click', function() {
|
||||||
var rotateLeft = ol.animation.rotate({
|
var rotateLeft = ol.animation.rotate({
|
||||||
@@ -123,3 +118,26 @@ flyToBern.addEventListener('click', function() {
|
|||||||
map.addPreRenderFunctions([pan, bounce]);
|
map.addPreRenderFunctions([pan, bounce]);
|
||||||
view.setCenter(bern);
|
view.setCenter(bern);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
var spiralToMadrid = document.getElementById('spiral-to-madrid');
|
||||||
|
spiralToMadrid.addEventListener('click', function() {
|
||||||
|
var duration = 2000;
|
||||||
|
var start = +new Date();
|
||||||
|
var pan = ol.animation.pan({
|
||||||
|
duration: duration,
|
||||||
|
source: view.getCenter(),
|
||||||
|
start: start
|
||||||
|
});
|
||||||
|
var bounce = ol.animation.bounce({
|
||||||
|
duration: duration,
|
||||||
|
resolution: 2 * view.getResolution(),
|
||||||
|
start: start
|
||||||
|
});
|
||||||
|
var rotate = ol.animation.rotate({
|
||||||
|
duration: duration,
|
||||||
|
rotation: -4 * Math.PI,
|
||||||
|
start: start
|
||||||
|
});
|
||||||
|
map.addPreRenderFunctions([pan, bounce, rotate]);
|
||||||
|
view.setCenter(madrid);
|
||||||
|
}, false);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Bind HTML input example</h4>
|
<h4 id="title">Bind HTML input example</h4>
|
||||||
<p id="shortdesc">Bind an HTML input to an ol object.</p>
|
<p id="shortdesc">Demonstrates two-way binding of HTML input elements to OpenLayers objects.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>See the <a href="bind-input.js" target="_blank">bind-input.js source</a> to see how this is done.</p>
|
<p>See the <a href="bind-input.js" target="_blank">bind-input.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -71,7 +71,8 @@
|
|||||||
<legend>View</legend>
|
<legend>View</legend>
|
||||||
<label>rotation</label>
|
<label>rotation</label>
|
||||||
<input id="rotation" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
|
<input id="rotation" type="range" min="-3.141592653589793" max="3.141592653589793" step="0.01"/>
|
||||||
</fieldset>
|
<label>resolution</label>
|
||||||
|
<input id="resolution" type="number" min="0" step="250"/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,3 +39,6 @@ brightness.bindTo('value', layer, 'brightness');
|
|||||||
|
|
||||||
var rotation = new ol.dom.Input(document.getElementById('rotation'));
|
var rotation = new ol.dom.Input(document.getElementById('rotation'));
|
||||||
rotation.bindTo('value', map.getView(), 'rotation');
|
rotation.bindTo('value', map.getView(), 'rotation');
|
||||||
|
|
||||||
|
var resolution = new ol.dom.Input(document.getElementById('resolution'));
|
||||||
|
resolution.bindTo('value', map.getView(), 'resolution');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.BingMaps');
|
goog.require('ol.source.BingMaps');
|
||||||
|
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transform([-123.1, 49.25], 'EPSG:4326', 'EPSG:3857'),
|
center: ol.proj.transform([-123.1, 49.25], 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 8
|
zoom: 8
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,14 @@
|
|||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
<title>Brightness/contrast example</title>
|
<title>Brightness/contrast example</title>
|
||||||
|
<style>
|
||||||
|
#reset-brightness {
|
||||||
|
min-width: 138px;
|
||||||
|
}
|
||||||
|
#reset-contrast {
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
@@ -20,27 +20,46 @@ var map = new ol.Map({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var increaseBrightness = document.getElementById('increase-brightness');
|
var increaseBrightness = document.getElementById('increase-brightness');
|
||||||
increaseBrightness.addEventListener('click', function() {
|
|
||||||
layer.setBrightness(layer.getBrightness() + 0.125);
|
|
||||||
}, false);
|
|
||||||
var resetBrightness = document.getElementById('reset-brightness');
|
var resetBrightness = document.getElementById('reset-brightness');
|
||||||
|
var decreaseBrightness = document.getElementById('decrease-brightness');
|
||||||
|
|
||||||
|
function setResetBrightnessButtonHTML() {
|
||||||
|
resetBrightness.innerHTML = 'Brightness (' +
|
||||||
|
layer.getBrightness().toFixed(3) + ')';
|
||||||
|
}
|
||||||
|
setResetBrightnessButtonHTML();
|
||||||
|
|
||||||
|
increaseBrightness.addEventListener('click', function() {
|
||||||
|
layer.setBrightness(Math.min(layer.getBrightness() + 0.125, 1));
|
||||||
|
setResetBrightnessButtonHTML();
|
||||||
|
}, false);
|
||||||
resetBrightness.addEventListener('click', function() {
|
resetBrightness.addEventListener('click', function() {
|
||||||
layer.setBrightness(0);
|
layer.setBrightness(0);
|
||||||
|
setResetBrightnessButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var decreaseBrightness = document.getElementById('decrease-brightness');
|
|
||||||
decreaseBrightness.addEventListener('click', function() {
|
decreaseBrightness.addEventListener('click', function() {
|
||||||
layer.setBrightness(layer.getBrightness() - 0.125);
|
layer.setBrightness(Math.max(layer.getBrightness() - 0.125, -1));
|
||||||
|
setResetBrightnessButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
var increaseContrast = document.getElementById('increase-contrast');
|
var increaseContrast = document.getElementById('increase-contrast');
|
||||||
|
var resetContrast = document.getElementById('reset-contrast');
|
||||||
|
var decreaseContrast = document.getElementById('decrease-contrast');
|
||||||
|
|
||||||
|
function setResetContrastButtonHTML() {
|
||||||
|
resetContrast.innerHTML = 'Contrast (' + layer.getContrast().toFixed(3) + ')';
|
||||||
|
}
|
||||||
|
setResetContrastButtonHTML();
|
||||||
|
|
||||||
increaseContrast.addEventListener('click', function() {
|
increaseContrast.addEventListener('click', function() {
|
||||||
layer.setContrast(layer.getContrast() + 0.125);
|
layer.setContrast(layer.getContrast() + 0.125);
|
||||||
|
setResetContrastButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var resetContrast = document.getElementById('reset-contrast');
|
|
||||||
resetContrast.addEventListener('click', function() {
|
resetContrast.addEventListener('click', function() {
|
||||||
layer.setContrast(1);
|
layer.setContrast(1);
|
||||||
|
setResetContrastButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var decreaseContrast = document.getElementById('decrease-contrast');
|
|
||||||
decreaseContrast.addEventListener('click', function() {
|
decreaseContrast.addEventListener('click', function() {
|
||||||
layer.setContrast(layer.getContrast() - 0.125);
|
layer.setContrast(Math.max(layer.getContrast() - 0.125, 0));
|
||||||
|
setResetContrastButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -37,8 +37,9 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Canvas tiles example</h4>
|
<h4 id="title">Canvas tiles example</h4>
|
||||||
<p id="shortdesc">The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).</p>
|
<p id="shortdesc">Renders tiles with coordinates for debugging.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
|
<p>The black grid tiles are generated on the client with an HTML5 canvas. Note that the tile coordinates are ol3 normalized tile coordinates (origin bottom left), not OSM tile coordinates (origin top left).</p>
|
||||||
<p>See the <a href="canvas-tiles.js" target="_blank">canvas-tiles.js source</a> to see how this is done.</p>
|
<p>See the <a href="canvas-tiles.js" target="_blank">canvas-tiles.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">layers, openstreetmap, canvas</div>
|
<div id="tags">layers, openstreetmap, canvas</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.DebugTileSource');
|
goog.require('ol.source.DebugTileSource');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
goog.require('ol.tilegrid.XYZ');
|
goog.require('ol.tilegrid.XYZ');
|
||||||
@@ -25,7 +25,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transform(
|
center: ol.proj.transform(
|
||||||
[-0.1275, 51.507222], 'EPSG:4326', 'EPSG:3857'),
|
[-0.1275, 51.507222], 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 10
|
zoom: 10
|
||||||
})
|
})
|
||||||
|
|||||||
94
examples/custom-controls.html
Normal file
94
examples/custom-controls.html
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<style type="text/css">
|
||||||
|
.zoom-extent {
|
||||||
|
position: absolute;
|
||||||
|
top: 65px;
|
||||||
|
left: 8px;
|
||||||
|
background: rgba(255,255,255,0.4);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
.zoom-extent a {
|
||||||
|
display: block;
|
||||||
|
margin: 1px;
|
||||||
|
padding: 0;
|
||||||
|
color: white;
|
||||||
|
font-size: 18px;
|
||||||
|
font-family: 'Lucida Grande',Verdana,Geneva,Lucida,Arial,Helvetica,sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
text-align: center;
|
||||||
|
height: 22px;
|
||||||
|
width: 22px;
|
||||||
|
line-height: 19px;
|
||||||
|
background: rgba(0,60,136,0.5);
|
||||||
|
}
|
||||||
|
.zoom-extent a:hover {
|
||||||
|
background: rgba(0,60,136,0.7);
|
||||||
|
}
|
||||||
|
.zoom-to {
|
||||||
|
border-radius: 2px 2px 0 0;
|
||||||
|
}
|
||||||
|
.zoom-to:before {
|
||||||
|
content: "E";
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<title>ol3 custom controls example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">Custom controls</h4>
|
||||||
|
<p id="shortdesc">This example shows how to create custom controls.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>
|
||||||
|
This example creates a "zoom to extent" button.
|
||||||
|
See the <a href="custom-controls.js" target="_blank">custom-controls.js
|
||||||
|
source</a> to see how this is done.
|
||||||
|
Per default, the zoom extent control use the map projection extent.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">
|
||||||
|
custom, control
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=custom-controls" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
109
examples/custom-controls.js
Normal file
109
examples/custom-controls.js
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
goog.require('ol');
|
||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHints');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.control.Control');
|
||||||
|
goog.require('ol.control.defaults');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a namespace for the application.
|
||||||
|
*/
|
||||||
|
window.app = {};
|
||||||
|
var app = window.app;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define zoom extent control.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @extends {ol.control.Control}
|
||||||
|
* @param {Object=} opt_options Control options.
|
||||||
|
*/
|
||||||
|
app.ZoomExtentControl = function(opt_options) {
|
||||||
|
|
||||||
|
var options = opt_options || {};
|
||||||
|
this.extent_ = options.extent;
|
||||||
|
|
||||||
|
var anchor = document.createElement('a');
|
||||||
|
anchor.href = '#zoom-to';
|
||||||
|
anchor.className = 'zoom-to';
|
||||||
|
|
||||||
|
var this_ = this;
|
||||||
|
var handleZoomTo = function(e) {
|
||||||
|
this_.handleZoomTo(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
anchor.addEventListener('click', handleZoomTo, false);
|
||||||
|
anchor.addEventListener('touchstart', handleZoomTo, false);
|
||||||
|
|
||||||
|
var element = document.createElement('div');
|
||||||
|
element.className = 'zoom-extent ol-unselectable';
|
||||||
|
element.appendChild(anchor);
|
||||||
|
|
||||||
|
ol.control.Control.call(this, {
|
||||||
|
element: element,
|
||||||
|
map: options.map,
|
||||||
|
target: options.target
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
ol.inherits(app.ZoomExtentControl, ol.control.Control);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Event} e Browser event.
|
||||||
|
*/
|
||||||
|
app.ZoomExtentControl.prototype.handleZoomTo = function(e) {
|
||||||
|
// prevent #zoomTo anchor from getting appended to the url
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var map = this.getMap();
|
||||||
|
var view = map.getView();
|
||||||
|
view.fitExtent(this.extent_, map.getSize());
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overload setMap to use the view projection's validity extent
|
||||||
|
* if no extent was passed to the constructor.
|
||||||
|
* @param {ol.Map} map Map.
|
||||||
|
*/
|
||||||
|
app.ZoomExtentControl.prototype.setMap = function(map) {
|
||||||
|
ol.control.Control.prototype.setMap.call(this, map);
|
||||||
|
if (map && !this.extent_) {
|
||||||
|
this.extent_ = map.getView().getProjection().getExtent();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create map, giving it a zoom extent control.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
controls: ol.control.defaults({}, [
|
||||||
|
new app.ZoomExtentControl({
|
||||||
|
extent: [813079.7791264898, 848966.9639063801,
|
||||||
|
5929220.284081122, 5936863.986909639]
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.OSM()
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
1
examples/data/IGNWMTSCapabilities.xml
Normal file
1
examples/data/IGNWMTSCapabilities.xml
Normal file
File diff suppressed because one or more lines are too long
2
examples/data/gml/topp-states-wfs.xml
Normal file
2
examples/data/gml/topp-states-wfs.xml
Normal file
File diff suppressed because one or more lines are too long
1073
examples/data/gpx/yahoo.xml
Normal file
1073
examples/data/gpx/yahoo.xml
Normal file
File diff suppressed because it is too large
Load Diff
1608
examples/data/kml/timezones.kml
Normal file
1608
examples/data/kml/timezones.kml
Normal file
File diff suppressed because one or more lines are too long
62
examples/device-orientation.html
Normal file
62
examples/device-orientation.html
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>Device-Orientation example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">Device orientation example</h4>
|
||||||
|
<label class="checkbox" for="track">
|
||||||
|
<input id="track" type="checkbox"/>track changes
|
||||||
|
</label>
|
||||||
|
<p>α : <code id="alpha"></code></p>
|
||||||
|
<p>β : <code id="beta"></code></p>
|
||||||
|
<p>γ : <code id="gamma"></code></p>
|
||||||
|
<p>heading : <code id="heading"></code></p>
|
||||||
|
<p id="shortdesc">Listen to DeviceOrientation events</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>See the <a href="device-orientation.js" target="_blank">device-orientation.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">orientation, openstreetmap</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=device-orientation" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
46
examples/device-orientation.js
Normal file
46
examples/device-orientation.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
goog.require('ol.DeviceOrientation');
|
||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHints');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.dom.Input');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.OSM()
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
|
var view = map.getView();
|
||||||
|
|
||||||
|
var deviceOrientation = new ol.DeviceOrientation();
|
||||||
|
var track = new ol.dom.Input(document.getElementById('track'));
|
||||||
|
track.bindTo('checked', deviceOrientation, 'tracking');
|
||||||
|
|
||||||
|
deviceOrientation.on('change', function(event) {
|
||||||
|
document.getElementById('alpha').innerHTML = event.target.getAlpha();
|
||||||
|
document.getElementById('beta').innerHTML = event.target.getBeta();
|
||||||
|
document.getElementById('gamma').innerHTML = event.target.getGamma();
|
||||||
|
document.getElementById('heading').innerHTML = event.target.getHeading();
|
||||||
|
});
|
||||||
|
|
||||||
|
// tilt the map
|
||||||
|
deviceOrientation.on(['change:beta', 'change:gamma'], function(event) {
|
||||||
|
var center = view.getCenter();
|
||||||
|
var resolution = view.getResolution();
|
||||||
|
var beta = event.target.getBeta() || 0;
|
||||||
|
var gamma = event.target.getGamma() || 0;
|
||||||
|
|
||||||
|
center[0] -= resolution * gamma * 25;
|
||||||
|
center[1] += resolution * beta * 25;
|
||||||
|
|
||||||
|
view.setCenter(center);
|
||||||
|
});
|
||||||
56
examples/drag-rotate-and-zoom.html
Normal file
56
examples/drag-rotate-and-zoom.html
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>Drag rotate and zoom example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">Drag rotate and zoom example</h4>
|
||||||
|
<p id="shortdesc">A single interaction to drag, rotate, and zoom.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p><code>Shift</code> + Drag to rotate and zoom the map around its center.</p>
|
||||||
|
<p>See the <a href="drag-rotate-and-zoom.js" target="_blank">drag-rotate-and-zoom.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">drag, rotate, zoom, interaction</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=drag-rotate-and-zoom" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
25
examples/drag-rotate-and-zoom.js
Normal file
25
examples/drag-rotate-and-zoom.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHints');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.interaction.DragRotateAndZoom');
|
||||||
|
goog.require('ol.interaction.defaults');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
|
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
interactions: ol.interaction.defaults({}, [
|
||||||
|
new ol.interaction.DragRotateAndZoom()
|
||||||
|
]),
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.MapQuestOpenAerial()
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
68
examples/full-screen-drag-rotate-and-zoom.html
Normal file
68
examples/full-screen-drag-rotate-and-zoom.html
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<style>
|
||||||
|
.map:-moz-full-screen {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.map:-webkit-full-screen {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.map:full-screen {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<title>Full screen drag rotate and zoom example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">Full screen drag rotate and zoom example</h4>
|
||||||
|
<p id="shortdesc">Example of drag rotate and zoom control with full screen effect.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>Hold down <code>Shift</code> + drag to rotate and zoom. Click the button in the top right corner to go full screen. Then do the <code>Shift</code> + drag 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>See the <a href="full-screen-drag-rotate-and-zoom.js" target="_blank">full-screen-drag-rotate-and-zoom.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">full-screen, drag, rotate, zoom, bing, bing-maps</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=full-screen-drag-rotate-and-zoom" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
35
examples/full-screen-drag-rotate-and-zoom.js
Normal file
35
examples/full-screen-drag-rotate-and-zoom.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.control.FullScreen');
|
||||||
|
goog.require('ol.control.defaults');
|
||||||
|
goog.require('ol.interaction.DragRotateAndZoom');
|
||||||
|
goog.require('ol.interaction.defaults');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.BingMaps');
|
||||||
|
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
controls: ol.control.defaults({}, [
|
||||||
|
new ol.control.FullScreen()
|
||||||
|
]),
|
||||||
|
interactions: ol.interaction.defaults({}, [
|
||||||
|
new ol.interaction.DragRotateAndZoom()
|
||||||
|
]),
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.BingMaps({
|
||||||
|
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
|
||||||
|
style: 'Aerial'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
],
|
||||||
|
// Use the canvas renderer because it's currently the fastest
|
||||||
|
renderer: ol.RendererHint.CANVAS,
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [-33519607, 5616436],
|
||||||
|
rotation: -Math.PI / 8,
|
||||||
|
zoom: 8
|
||||||
|
})
|
||||||
|
});
|
||||||
@@ -48,9 +48,10 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Full screen control example</h4>
|
<h4 id="title">Full screen control example</h4>
|
||||||
<p id="shortdesc">Example of a full screen control. Click the control in the top right corner to go full screen. Click it again to exit full screen.</p>
|
<p id="shortdesc">Example of a full screen control.</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>
|
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
|
<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>See the <a href="full-screen.js" target="_blank">full-screen.js source</a> to see how this is done.</p>
|
<p>See the <a href="full-screen.js" target="_blank">full-screen.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">full-screen, bing, bing-maps</div>
|
<div id="tags">full-screen, bing, bing-maps</div>
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
text-shadow: 2px 2px 3px #013;
|
text-shadow: 2px 2px 3px #013;
|
||||||
}
|
}
|
||||||
|
.tooltip-inner {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<title>Geolocation example</title>
|
<title>Geolocation example</title>
|
||||||
</head>
|
</head>
|
||||||
@@ -50,8 +53,9 @@
|
|||||||
<button id="locate"><i class="icon-screenshot"></i> locate</button>
|
<button id="locate"><i class="icon-screenshot"></i> locate</button>
|
||||||
<div id="tags">geolocation, openstreetmap</div>
|
<div id="tags">geolocation, openstreetmap</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span4 pull-right">
|
||||||
</div>
|
<div id="info" class="alert alert-error" style="display: none;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -31,11 +31,17 @@ var marker = new ol.Overlay({
|
|||||||
// bind the marker position to the device location.
|
// bind the marker position to the device location.
|
||||||
marker.bindTo('position', geolocation);
|
marker.bindTo('position', geolocation);
|
||||||
|
|
||||||
geolocation.addEventListener('accuracy_changed', function() {
|
geolocation.on('change:accuracy', function() {
|
||||||
$(marker.getElement()).tooltip({
|
$(marker.getElement()).tooltip({
|
||||||
title: this.getAccuracy() + 'm from this point'
|
title: this.getAccuracy() + 'm from this point'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
geolocation.on('error', function(error) {
|
||||||
|
var info = document.getElementById('info');
|
||||||
|
info.innerHTML = error.message;
|
||||||
|
info.style.display = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#locate').click(function() {
|
$('#locate').click(function() {
|
||||||
geolocation.setTracking(true);
|
geolocation.setTracking(true);
|
||||||
|
|||||||
55
examples/gml.html
Normal file
55
examples/gml.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>GML example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">GML example</h4>
|
||||||
|
<p id="shortdesc">Example of using the GML parser.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>See the <a href="gml.js" target="_blank">gml.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">GML</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=gml" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
examples/gml.js
Normal file
60
examples/gml.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.layer.Vector');
|
||||||
|
goog.require('ol.parser.ogc.GML_v3');
|
||||||
|
goog.require('ol.proj');
|
||||||
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
|
goog.require('ol.source.Vector');
|
||||||
|
goog.require('ol.style.Polygon');
|
||||||
|
goog.require('ol.style.Rule');
|
||||||
|
goog.require('ol.style.Style');
|
||||||
|
|
||||||
|
var raster = new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.MapQuestOpenAerial()
|
||||||
|
});
|
||||||
|
|
||||||
|
var vector = new ol.layer.Vector({
|
||||||
|
source: new ol.source.Vector({
|
||||||
|
projection: ol.proj.get('EPSG:4326')
|
||||||
|
}),
|
||||||
|
style: new ol.style.Style({rules: [
|
||||||
|
new ol.style.Rule({
|
||||||
|
symbolizers: [
|
||||||
|
new ol.style.Polygon({
|
||||||
|
strokeColor: '#bada55'
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]})
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: [raster, vector],
|
||||||
|
renderer: ol.RendererHint.CANVAS,
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [-10997171.194994785, 5206335.565590534],
|
||||||
|
zoom: 4
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
var gml = new ol.parser.ogc.GML_v3({axisOrientation: 'neu'});
|
||||||
|
|
||||||
|
var url = 'data/gml/topp-states-wfs.xml';
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', url, true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onload handler for the XHR request.
|
||||||
|
*/
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
// this is silly to have to tell the layer the destination projection
|
||||||
|
var projection = map.getView().getProjection();
|
||||||
|
vector.parseFeatures(xhr.responseText, gml, projection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
59
examples/gpx.html
Normal file
59
examples/gpx.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>GPX example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">GPX example</h4>
|
||||||
|
<p id="shortdesc">Example of using the GPX parser.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>See the <a href="gpx.js" target="_blank">gpx.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">GPX</div>
|
||||||
|
</div>
|
||||||
|
<div class="span4 pull-right">
|
||||||
|
<div id="info" class="alert alert-success">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=gpx" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
65
examples/gpx.js
Normal file
65
examples/gpx.js
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.layer.Vector');
|
||||||
|
goog.require('ol.parser.GPX');
|
||||||
|
goog.require('ol.proj');
|
||||||
|
goog.require('ol.source.OSM');
|
||||||
|
goog.require('ol.source.Vector');
|
||||||
|
|
||||||
|
var raster = new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.OSM()
|
||||||
|
});
|
||||||
|
|
||||||
|
var vector = new ol.layer.Vector({
|
||||||
|
source: new ol.source.Vector({
|
||||||
|
projection: ol.proj.get('EPSG:4326')
|
||||||
|
}),
|
||||||
|
transformFeatureInfo: function(features) {
|
||||||
|
var info = [];
|
||||||
|
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||||
|
info.push(features[i].get('name') + ': ' + features[i].get('type'));
|
||||||
|
}
|
||||||
|
return info.join(', ');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: [raster, vector],
|
||||||
|
renderer: ol.RendererHint.CANVAS,
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [-7916461.9312699, 5226343.9091441],
|
||||||
|
zoom: 11
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
map.on(['click', 'mousemove'], function(evt) {
|
||||||
|
map.getFeatureInfo({
|
||||||
|
pixel: evt.getPixel(),
|
||||||
|
layers: [vector],
|
||||||
|
success: function(featureInfo) {
|
||||||
|
document.getElementById('info').innerHTML = featureInfo[0] || ' ';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var gpx = new ol.parser.GPX();
|
||||||
|
|
||||||
|
var url = 'data/gpx/yahoo.xml';
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', url, true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onload handler for the XHR request.
|
||||||
|
*/
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
// this is silly to have to tell the layer the destination projection
|
||||||
|
var projection = map.getView().getProjection();
|
||||||
|
vector.parseFeatures(xhr.responseText, gpx, projection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
@@ -8,6 +8,14 @@
|
|||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
<title>Hue/saturation example</title>
|
<title>Hue/saturation example</title>
|
||||||
|
<style>
|
||||||
|
#reset-hue {
|
||||||
|
min-width: 90px;
|
||||||
|
}
|
||||||
|
#reset-saturation {
|
||||||
|
min-width: 124px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.BingMaps');
|
goog.require('ol.source.BingMaps');
|
||||||
|
|
||||||
|
|
||||||
@@ -18,34 +18,52 @@ var map = new ol.Map({
|
|||||||
renderer: ol.RendererHint.WEBGL,
|
renderer: ol.RendererHint.WEBGL,
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transform(
|
center: ol.proj.transform([-9.375, 51.483333], 'EPSG:4326', 'EPSG:3857'),
|
||||||
[-9.375, 51.483333], 'EPSG:4326', 'EPSG:3857'),
|
|
||||||
zoom: 15
|
zoom: 15
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var increaseHue = document.getElementById('increase-hue');
|
var increaseHue = document.getElementById('increase-hue');
|
||||||
|
var resetHue = document.getElementById('reset-hue');
|
||||||
|
var decreaseHue = document.getElementById('decrease-hue');
|
||||||
|
|
||||||
|
function setResetHueButtonHTML() {
|
||||||
|
resetHue.innerHTML = 'Hue (' + layer.getHue().toFixed(2) + ')';
|
||||||
|
}
|
||||||
|
setResetHueButtonHTML();
|
||||||
|
|
||||||
increaseHue.addEventListener('click', function() {
|
increaseHue.addEventListener('click', function() {
|
||||||
layer.setHue(layer.getHue() + 0.25);
|
layer.setHue(layer.getHue() + 0.25);
|
||||||
|
setResetHueButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var resetHue = document.getElementById('reset-hue');
|
|
||||||
resetHue.addEventListener('click', function() {
|
resetHue.addEventListener('click', function() {
|
||||||
layer.setHue(0);
|
layer.setHue(0);
|
||||||
|
setResetHueButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var decreaseHue = document.getElementById('decrease-hue');
|
|
||||||
decreaseHue.addEventListener('click', function() {
|
decreaseHue.addEventListener('click', function() {
|
||||||
layer.setHue(layer.getHue() - 0.25);
|
layer.setHue(layer.getHue() - 0.25);
|
||||||
|
setResetHueButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
var increaseSaturation = document.getElementById('increase-saturation');
|
var increaseSaturation = document.getElementById('increase-saturation');
|
||||||
|
var resetSaturation = document.getElementById('reset-saturation');
|
||||||
|
var decreaseSaturation = document.getElementById('decrease-saturation');
|
||||||
|
|
||||||
|
function setResetSaturationButtonHTML() {
|
||||||
|
resetSaturation.innerHTML = 'Saturation (' +
|
||||||
|
layer.getSaturation().toFixed(2) + ')';
|
||||||
|
}
|
||||||
|
setResetSaturationButtonHTML();
|
||||||
|
|
||||||
increaseSaturation.addEventListener('click', function() {
|
increaseSaturation.addEventListener('click', function() {
|
||||||
layer.setSaturation(layer.getSaturation() + 0.25);
|
layer.setSaturation(layer.getSaturation() + 0.25);
|
||||||
|
setResetSaturationButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var resetSaturation = document.getElementById('reset-saturation');
|
|
||||||
resetSaturation.addEventListener('click', function() {
|
resetSaturation.addEventListener('click', function() {
|
||||||
layer.setSaturation(1);
|
layer.setSaturation(1);
|
||||||
|
setResetSaturationButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
var decreaseSaturation = document.getElementById('decrease-saturation');
|
|
||||||
decreaseSaturation.addEventListener('click', function() {
|
decreaseSaturation.addEventListener('click', function() {
|
||||||
layer.setSaturation(layer.getSaturation() - 0.25);
|
layer.setSaturation(Math.max(layer.getSaturation() - 0.25, 0));
|
||||||
|
setResetSaturationButtonHTML();
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
68
examples/kml-timezones.html
Normal file
68
examples/kml-timezones.html
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>Timezones in KML</title>
|
||||||
|
<style>
|
||||||
|
#map {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
#info {
|
||||||
|
position: absolute;
|
||||||
|
height: 1px;
|
||||||
|
width: 1px;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"><div id="info"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">Timezones in KML</h4>
|
||||||
|
<p id="shortdesc">Demonstrates rendering timezones from KML.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>This example parses a KML file and renders the features as a vector layer. The layer is given a <code>ol.style.Style</code> that fills timezones yellow with an opacity calculated based on the current offset to local noon.</p>
|
||||||
|
<p>See the <a href="kml-timezones.js" target="_blank">kml-timezones.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">KML, vector, style</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="jquery.min.js" type="text/javascript"></script>
|
||||||
|
<script src="../resources/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||||
|
<script src="loader.js?id=kml-timezones" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
123
examples/kml-timezones.js
Normal file
123
examples/kml-timezones.js
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.expr');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.layer.Vector');
|
||||||
|
goog.require('ol.parser.KML');
|
||||||
|
goog.require('ol.proj');
|
||||||
|
goog.require('ol.source.Stamen');
|
||||||
|
goog.require('ol.source.Vector');
|
||||||
|
goog.require('ol.style.Polygon');
|
||||||
|
goog.require('ol.style.Rule');
|
||||||
|
goog.require('ol.style.Style');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a function to be used in a symbolizer. Here we want the opacity
|
||||||
|
* of polygons to be based on the offset from local noon. For example, a
|
||||||
|
* timezone where it is currently noon would have an opacity of 0.75. And a
|
||||||
|
* timezone where it is currently midnight would have an opacity of 0. This
|
||||||
|
* doesn't account for daylight savings, so don't use it to plan your vacation.
|
||||||
|
*/
|
||||||
|
ol.expr.register('getOpacity', function() {
|
||||||
|
var feature = this;
|
||||||
|
var offset = 0;
|
||||||
|
var name = feature.get('name'); // e.g. GMT -08:30
|
||||||
|
var match = name.match(/([-+]\d{2}):(\d{2})$/);
|
||||||
|
if (match) {
|
||||||
|
var hours = parseInt(match[1], 10);
|
||||||
|
var minutes = parseInt(match[2], 10);
|
||||||
|
offset = 60 * hours + minutes;
|
||||||
|
}
|
||||||
|
var date = new Date();
|
||||||
|
var local = new Date(date.getTime() +
|
||||||
|
(date.getTimezoneOffset() + offset) * 60000);
|
||||||
|
// offset from local noon (in hours)
|
||||||
|
var delta = Math.abs(12 - local.getHours() + (local.getMinutes() / 60));
|
||||||
|
if (delta > 12) {
|
||||||
|
delta = 24 - delta;
|
||||||
|
}
|
||||||
|
return 0.75 * (1 - delta / 12);
|
||||||
|
});
|
||||||
|
|
||||||
|
var style = new ol.style.Style({rules: [
|
||||||
|
new ol.style.Rule({
|
||||||
|
symbolizers: [
|
||||||
|
new ol.style.Polygon({
|
||||||
|
fillColor: '#ffff33',
|
||||||
|
strokeColor: '#ffffff',
|
||||||
|
opacity: ol.expr.parse('getOpacity()')
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]});
|
||||||
|
|
||||||
|
var vector = new ol.layer.Vector({
|
||||||
|
source: new ol.source.Vector({
|
||||||
|
projection: ol.proj.get('EPSG:4326')
|
||||||
|
}),
|
||||||
|
style: style
|
||||||
|
});
|
||||||
|
|
||||||
|
var raster = new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.Stamen({
|
||||||
|
layer: 'toner'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: [raster, vector],
|
||||||
|
renderer: ol.RendererHint.CANVAS,
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
var info = $('#info');
|
||||||
|
info.tooltip({
|
||||||
|
animation: false,
|
||||||
|
trigger: 'manual'
|
||||||
|
});
|
||||||
|
map.on(['click', 'mousemove'], function(evt) {
|
||||||
|
var pixel = evt.getPixel();
|
||||||
|
info.css({
|
||||||
|
left: pixel[0] + 'px',
|
||||||
|
top: (pixel[1] - 15) + 'px'
|
||||||
|
});
|
||||||
|
map.getFeatures({
|
||||||
|
pixel: pixel,
|
||||||
|
layers: [vector],
|
||||||
|
success: function(layerFeatures) {
|
||||||
|
var feature = layerFeatures[0][0];
|
||||||
|
if (feature) {
|
||||||
|
info.tooltip('hide')
|
||||||
|
.attr('data-original-title', feature.get('name'))
|
||||||
|
.tooltip('fixTitle')
|
||||||
|
.tooltip('show');
|
||||||
|
} else {
|
||||||
|
info.tooltip('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var kml = new ol.parser.KML({dimension: 2});
|
||||||
|
|
||||||
|
var url = 'data/kml/timezones.kml';
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', url, true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onload handler for the XHR request.
|
||||||
|
*/
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
var projection = map.getView().getProjection();
|
||||||
|
vector.parseFeatures(xhr.responseText, kml, projection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
@@ -43,12 +43,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="tags">KML</div>
|
<div id="tags">KML</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span4 pull-right">
|
||||||
|
<div id="info" class="alert alert-success">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="jquery.min.js" type="text/javascript"></script>
|
|
||||||
<script src="loader.js?id=kml" type="text/javascript"></script>
|
<script src="loader.js?id=kml" type="text/javascript"></script>
|
||||||
<script src="../resources/social-links.js" type="text/javascript"></script>
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
goog.require('ol.Collection');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.parser.KML');
|
goog.require('ol.parser.KML');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.TiledWMS');
|
goog.require('ol.source.TiledWMS');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
|
|
||||||
@@ -21,16 +20,23 @@ var raster = new ol.layer.TileLayer({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
var epsg4326 = ol.projection.get('EPSG:4326');
|
var epsg4326 = ol.proj.get('EPSG:4326');
|
||||||
|
|
||||||
var vector = new ol.layer.Vector({
|
var vector = new ol.layer.Vector({
|
||||||
source: new ol.source.Vector({
|
source: new ol.source.Vector({
|
||||||
projection: epsg4326
|
projection: epsg4326
|
||||||
})
|
}),
|
||||||
|
transformFeatureInfo: function(features) {
|
||||||
|
var info = [];
|
||||||
|
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||||
|
info.push(features[i].get('name'));
|
||||||
|
}
|
||||||
|
return info.join(', ');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
layers: new ol.Collection([raster, vector]),
|
layers: [raster, vector],
|
||||||
renderer: ol.RendererHint.CANVAS,
|
renderer: ol.RendererHint.CANVAS,
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
@@ -43,8 +49,28 @@ var map = new ol.Map({
|
|||||||
var kml = new ol.parser.KML({
|
var kml = new ol.parser.KML({
|
||||||
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true});
|
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true});
|
||||||
|
|
||||||
$.ajax({
|
map.on(['click', 'mousemove'], function(evt) {
|
||||||
url: 'data/kml/lines.kml'
|
map.getFeatureInfo({
|
||||||
}).done(function(data) {
|
pixel: evt.getPixel(),
|
||||||
vector.parseFeatures(data, kml, epsg4326);
|
layers: [vector],
|
||||||
|
success: function(featureInfo) {
|
||||||
|
document.getElementById('info').innerHTML = featureInfo[0] || ' ';
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var url = 'data/kml/lines.kml';
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', url, true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onload handler for the XHR request.
|
||||||
|
*/
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
// this is silly to have to tell the layer the destination projection
|
||||||
|
vector.parseFeatures(xhr.responseText, kml, epsg4326);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.MapQuestOSM');
|
goog.require('ol.source.MapQuestOSM');
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transform(
|
center: ol.proj.transform(
|
||||||
[139.6917, 35.689506], 'EPSG:4326', 'EPSG:3857'),
|
[139.6917, 35.689506], 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 9
|
zoom: 9
|
||||||
})
|
})
|
||||||
|
|||||||
27
examples/mobile-full-screen.html
Normal file
27
examples/mobile-full-screen.html
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<title>Mobile full screen example</title>
|
||||||
|
<style type="text/css">
|
||||||
|
html, body, .map {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
<script src="loader.js?id=mobile-full-screen" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<div style="display: none;">
|
||||||
|
<div id="title">Mobile full screen example</div>
|
||||||
|
<div id="shortdesc">Example of a full screen map.</div>
|
||||||
|
<div id="tags">fullscreen, bing, geolocation, mobile</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
35
examples/mobile-full-screen.js
Normal file
35
examples/mobile-full-screen.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
goog.require('ol.Geolocation');
|
||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHints');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.BingMaps');
|
||||||
|
|
||||||
|
|
||||||
|
var view = new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.BingMaps({
|
||||||
|
key: 'AlQLZ0-5yk301_ESrmNLma3LYxEKNSg7w-e_knuRfyYFtld-UFvXVs38NOulku3Q',
|
||||||
|
style: 'Road'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
|
target: 'map',
|
||||||
|
view: view
|
||||||
|
});
|
||||||
|
|
||||||
|
var geolocation = new ol.Geolocation({
|
||||||
|
tracking: true
|
||||||
|
});
|
||||||
|
geolocation.bindTo('projection', view);
|
||||||
|
geolocation.once('change:position', function() {
|
||||||
|
view.setCenter(geolocation.getPosition());
|
||||||
|
view.setResolution(2.388657133911758);
|
||||||
|
});
|
||||||
@@ -30,7 +30,6 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<small id="mouse-position"></small>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -44,7 +43,23 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="tags">mouse-position, openstreetmap</div>
|
<div id="tags">mouse-position, openstreetmap</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span8 pull-right">
|
||||||
|
<div id="mouse-position"> </div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span8">
|
||||||
|
<form>
|
||||||
|
<label>Projection </label>
|
||||||
|
<select id="projection">
|
||||||
|
<option value="EPSG:4326">EPSG:4326</option>
|
||||||
|
<option value="EPSG:3857">EPSG:3857</option>
|
||||||
|
</select>
|
||||||
|
<label>Precision </label>
|
||||||
|
<input id="precision" type="number" min="0" max="12" value="4"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,19 +4,23 @@ goog.require('ol.View2D');
|
|||||||
goog.require('ol.control.MousePosition');
|
goog.require('ol.control.MousePosition');
|
||||||
goog.require('ol.control.defaults');
|
goog.require('ol.control.defaults');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
|
goog.require('ol.dom.Input');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
var mousePositionControl = new ol.control.MousePosition({
|
||||||
|
coordinateFormat: ol.coordinate.createStringXY(4),
|
||||||
|
projection: 'EPSG:4326',
|
||||||
|
// comment the following two lines to have the mouse position
|
||||||
|
// be placed within the map.
|
||||||
|
className: 'custom-mouse-position',
|
||||||
|
target: document.getElementById('mouse-position'),
|
||||||
|
undefinedHTML: ' '
|
||||||
|
});
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
controls: ol.control.defaults({}, [
|
controls: ol.control.defaults({}, [mousePositionControl]),
|
||||||
new ol.control.MousePosition({
|
|
||||||
coordinateFormat: ol.coordinate.toStringHDMS,
|
|
||||||
projection: 'EPSG:4326',
|
|
||||||
target: document.getElementById('mouse-position'),
|
|
||||||
undefinedHTML: ' '
|
|
||||||
})
|
|
||||||
]),
|
|
||||||
layers: [
|
layers: [
|
||||||
new ol.layer.TileLayer({
|
new ol.layer.TileLayer({
|
||||||
source: new ol.source.OSM()
|
source: new ol.source.OSM()
|
||||||
@@ -29,3 +33,14 @@ var map = new ol.Map({
|
|||||||
zoom: 2
|
zoom: 2
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var projectionSelect = new ol.dom.Input(document.getElementById('projection'));
|
||||||
|
projectionSelect.on('change:value', function() {
|
||||||
|
mousePositionControl.setProjection(ol.proj.get(projectionSelect.getValue()));
|
||||||
|
});
|
||||||
|
|
||||||
|
var precisionInput = new ol.dom.Input(document.getElementById('precision'));
|
||||||
|
precisionInput.on('change:value', function() {
|
||||||
|
var format = ol.coordinate.createStringXY(precisionInput.getValue());
|
||||||
|
mousePositionControl.setCoordinateFormat(format);
|
||||||
|
});
|
||||||
|
|||||||
@@ -49,9 +49,10 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Overlay example</h4>
|
<h4 id="title">Overlay example</h4>
|
||||||
<p id="shortdesc">Demonstrates overlays. The popups are created using
|
<p id="shortdesc">Demonstrates overlays.</p>
|
||||||
<a href="http://twitter.github.com/bootstrap/javascript.html#popovers">Popovers</a> from Bootstrap.</p>
|
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
|
<p>The popups are created using
|
||||||
|
<a href="http://twitter.github.com/bootstrap/javascript.html#popovers">Popovers</a> from Bootstrap.</p>
|
||||||
<p>See the <a href="overlay.js" target="_blank">overlay.js source</a> to see how this is done.</p>
|
<p>See the <a href="overlay.js" target="_blank">overlay.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">overlay, popup, bootstrap, popover, mapquest, openaerial</div>
|
<div id="tags">overlay, popup, bootstrap, popover, mapquest, openaerial</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ goog.require('ol.RendererHints');
|
|||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.MapQuestOpenAerial');
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ var map = new ol.Map({
|
|||||||
// Vienna label
|
// Vienna label
|
||||||
var vienna = new ol.Overlay({
|
var vienna = new ol.Overlay({
|
||||||
map: map,
|
map: map,
|
||||||
position: ol.projection.transform(
|
position: ol.proj.transform(
|
||||||
[16.3725, 48.208889], 'EPSG:4326', 'EPSG:3857'),
|
[16.3725, 48.208889], 'EPSG:4326', 'EPSG:3857'),
|
||||||
element: document.getElementById('vienna')
|
element: document.getElementById('vienna')
|
||||||
});
|
});
|
||||||
@@ -38,7 +38,7 @@ var popup = new ol.Overlay({
|
|||||||
map.on('click', function(evt) {
|
map.on('click', function(evt) {
|
||||||
var element = popup.getElement();
|
var element = popup.getElement();
|
||||||
var coordinate = evt.getCoordinate();
|
var coordinate = evt.getCoordinate();
|
||||||
var hdms = ol.coordinate.toStringHDMS(ol.projection.transform(
|
var hdms = ol.coordinate.toStringHDMS(ol.proj.transform(
|
||||||
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||||
|
|
||||||
$(element).popover('destroy');
|
$(element).popover('destroy');
|
||||||
|
|||||||
@@ -40,8 +40,9 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Preload example</h4>
|
<h4 id="title">Preload example</h4>
|
||||||
<p id="shortdesc">Example of tile preloading. Low resolution tiles for the map are preloaded, the map on the right does not use any preloading. Try zooming out and panning to see the difference.</p>
|
<p id="shortdesc">Example of tile preloading.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
|
<p>Low resolution tiles for the map are preloaded, the map on the right does not use any preloading. Try zooming out and panning to see the difference.</p>
|
||||||
<p>See the <a href="preload.js" target="_blank">preload.js source</a> to see how this is done.</p>
|
<p>See the <a href="preload.js" target="_blank">preload.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">preload, bing</div>
|
<div id="tags">preload, bing</div>
|
||||||
|
|||||||
@@ -37,8 +37,9 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Rotation example</h4>
|
<h4 id="title">Rotation example</h4>
|
||||||
<p id="shortdesc">Example of a rotated map. Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p>
|
<p id="shortdesc">Example of a rotated map.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
|
<p>Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p>
|
||||||
<p>See the <a href="rotation.js" target="_blank">rotation.js source</a> to see how this is done.</p>
|
<p>See the <a href="rotation.js" target="_blank">rotation.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">rotation, openstreetmap</div>
|
<div id="tags">rotation, openstreetmap</div>
|
||||||
|
|||||||
@@ -30,6 +30,11 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
<select id="units">
|
||||||
|
<option value="degrees">degrees</option>
|
||||||
|
<option value="imperial">imperial</option>
|
||||||
|
<option value="metric">metric</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,17 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.control.ScaleLine');
|
goog.require('ol.control.ScaleLine');
|
||||||
goog.require('ol.control.ScaleLineUnits');
|
|
||||||
goog.require('ol.control.defaults');
|
goog.require('ol.control.defaults');
|
||||||
|
goog.require('ol.dom.Input');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
|
||||||
|
var scaleLineControl = new ol.control.ScaleLine();
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
controls: ol.control.defaults({}, [
|
controls: ol.control.defaults({}, [
|
||||||
new ol.control.ScaleLine({
|
scaleLineControl
|
||||||
units: ol.control.ScaleLineUnits.IMPERIAL
|
|
||||||
})
|
|
||||||
]),
|
]),
|
||||||
layers: [
|
layers: [
|
||||||
new ol.layer.TileLayer({
|
new ol.layer.TileLayer({
|
||||||
@@ -26,3 +26,7 @@ var map = new ol.Map({
|
|||||||
zoom: 2
|
zoom: 2
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var unitsSelect = new ol.dom.Input(document.getElementById('units'));
|
||||||
|
unitsSelect.bindTo('value', scaleLineControl, 'units');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.MapQuestOpenAerial');
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
goog.require('ol.source.TileJSON');
|
goog.require('ol.source.TileJSON');
|
||||||
|
|
||||||
@@ -22,8 +22,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transform(
|
center: ol.proj.transform([-77.93255, 37.9555], 'EPSG:4326', 'EPSG:3857'),
|
||||||
[-77.93255, 37.9555], 'EPSG:4326', 'EPSG:3857'),
|
|
||||||
zoom: 5
|
zoom: 5
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ goog.require('ol.Map');
|
|||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.Stamen');
|
goog.require('ol.source.Stamen');
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ var map = new ol.Map({
|
|||||||
renderers: ol.RendererHints.createFromQueryData(),
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
center: ol.projection.transform(
|
center: ol.proj.transform(
|
||||||
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
|
[-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857'),
|
||||||
zoom: 12
|
zoom: 12
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,36 +1,32 @@
|
|||||||
goog.require('ol.Collection');
|
|
||||||
goog.require('ol.Expression');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.control.defaults');
|
goog.require('ol.control.defaults');
|
||||||
goog.require('ol.filter.Filter');
|
goog.require('ol.expr');
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.parser.GeoJSON');
|
goog.require('ol.parser.GeoJSON');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
goog.require('ol.style.Line');
|
goog.require('ol.style.Line');
|
||||||
goog.require('ol.style.Rule');
|
goog.require('ol.style.Rule');
|
||||||
|
goog.require('ol.style.Shape');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
goog.require('ol.style.Text');
|
||||||
|
|
||||||
|
|
||||||
var style = new ol.style.Style({rules: [
|
var style = new ol.style.Style({rules: [
|
||||||
new ol.style.Rule({
|
new ol.style.Rule({
|
||||||
filter: new ol.filter.Filter(function(feature) {
|
filter: 'where == "outer"',
|
||||||
return feature.get('where') == 'outer';
|
|
||||||
}),
|
|
||||||
symbolizers: [
|
symbolizers: [
|
||||||
new ol.style.Line({
|
new ol.style.Line({
|
||||||
strokeColor: new ol.Expression('color'),
|
strokeColor: ol.expr.parse('color'),
|
||||||
strokeWidth: 4,
|
strokeWidth: 4,
|
||||||
opacity: 1
|
opacity: 1
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
new ol.style.Rule({
|
new ol.style.Rule({
|
||||||
filter: new ol.filter.Filter(function(feature) {
|
filter: 'where == "inner"',
|
||||||
return feature.get('where') == 'inner';
|
|
||||||
}),
|
|
||||||
symbolizers: [
|
symbolizers: [
|
||||||
new ol.style.Line({
|
new ol.style.Line({
|
||||||
strokeColor: '#013',
|
strokeColor: '#013',
|
||||||
@@ -38,18 +34,33 @@ var style = new ol.style.Style({rules: [
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
}),
|
}),
|
||||||
new ol.style.Line({
|
new ol.style.Line({
|
||||||
strokeColor: new ol.Expression('color'),
|
strokeColor: ol.expr.parse('color'),
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
opacity: 1
|
opacity: 1
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
}),
|
||||||
|
new ol.style.Rule({
|
||||||
|
filter: 'geometryType("point")',
|
||||||
|
symbolizers: [
|
||||||
|
new ol.style.Shape({
|
||||||
|
size: 40,
|
||||||
|
fillColor: '#013'
|
||||||
|
}),
|
||||||
|
new ol.style.Text({
|
||||||
|
color: '#bada55',
|
||||||
|
text: ol.expr.parse('label'),
|
||||||
|
fontFamily: 'Calibri,sans-serif',
|
||||||
|
fontSize: 14
|
||||||
|
})
|
||||||
|
]
|
||||||
})
|
})
|
||||||
]});
|
]});
|
||||||
|
|
||||||
var vector = new ol.layer.Vector({
|
var vector = new ol.layer.Vector({
|
||||||
style: style,
|
style: style,
|
||||||
source: new ol.source.Vector({
|
source: new ol.source.Vector({
|
||||||
projection: ol.projection.get('EPSG:3857')
|
projection: ol.proj.get('EPSG:3857')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,8 +126,44 @@ vector.parseFeatures({
|
|||||||
'type': 'LineString',
|
'type': 'LineString',
|
||||||
'coordinates': [[10000000, -10000000], [-10000000, -10000000]]
|
'coordinates': [[10000000, -10000000], [-10000000, -10000000]]
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
'type': 'Feature',
|
||||||
|
'properties': {
|
||||||
|
'label': 'South'
|
||||||
|
},
|
||||||
|
'geometry': {
|
||||||
|
'type': 'Point',
|
||||||
|
'coordinates': [0, -6000000]
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'type': 'Feature',
|
||||||
|
'properties': {
|
||||||
|
'label': 'West'
|
||||||
|
},
|
||||||
|
'geometry': {
|
||||||
|
'type': 'Point',
|
||||||
|
'coordinates': [-6000000, 0]
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'type': 'Feature',
|
||||||
|
'properties': {
|
||||||
|
'label': 'North'
|
||||||
|
},
|
||||||
|
'geometry': {
|
||||||
|
'type': 'Point',
|
||||||
|
'coordinates': [0, 6000000]
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'type': 'Feature',
|
||||||
|
'properties': {
|
||||||
|
'label': 'East'
|
||||||
|
},
|
||||||
|
'geometry': {
|
||||||
|
'type': 'Point',
|
||||||
|
'coordinates': [6000000, 0]
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
}, new ol.parser.GeoJSON(), ol.projection.get('EPSG:3857'));
|
}, new ol.parser.GeoJSON(), ol.proj.get('EPSG:3857'));
|
||||||
|
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
|
|||||||
65
examples/teleport.html
Normal file
65
examples/teleport.html
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>Teleport example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span8">
|
||||||
|
<div id="map1" class="map"></div>
|
||||||
|
</div>
|
||||||
|
<div class="span4">
|
||||||
|
<div id="map2" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<a id="teleport" href="#" class="btn">Teleport</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span6">
|
||||||
|
<h4 id="title">Teleport example</h4>
|
||||||
|
<p id="shortdesc">Example of moving a map from one target to another.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>Click on the Teleport button below the map to move the map from one target to another.</p>
|
||||||
|
<p>See the <a href="teleport.js" target="_blank">teleport.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">teleport, openstreetmap</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=teleport" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
examples/teleport.js
Normal file
28
examples/teleport.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHints');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.OSM()
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 2
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
map.setTarget('map1');
|
||||||
|
|
||||||
|
var teleportButton = document.getElementById('teleport');
|
||||||
|
|
||||||
|
teleportButton.addEventListener('click', function() {
|
||||||
|
var target = map.getTarget().id === 'map1' ? 'map2' : 'map1';
|
||||||
|
map.setTarget(target);
|
||||||
|
}, false);
|
||||||
55
examples/ten-thousand-points.html
Normal file
55
examples/ten-thousand-points.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>Ten thousand points example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">Ten thousand points example</h4>
|
||||||
|
<p id="shortdesc">Example of a map with ten thousand points.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>See the <a href="ten-thousand-points.js" target="_blank">ten-thousand-points.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">points, vector, openstreetmap</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=ten-thousand-points" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
68
examples/ten-thousand-points.js
Normal file
68
examples/ten-thousand-points.js
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.control.MousePosition');
|
||||||
|
goog.require('ol.control.defaults');
|
||||||
|
goog.require('ol.geom2.LineStringCollection');
|
||||||
|
goog.require('ol.geom2.PointCollection');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.layer.VectorLayer2');
|
||||||
|
goog.require('ol.source.OSM');
|
||||||
|
goog.require('ol.source.VectorSource2');
|
||||||
|
|
||||||
|
|
||||||
|
// WARNING
|
||||||
|
// This example is an experimental testbed for WebGL vector work. The function
|
||||||
|
// calls used here are internal and low-level and are not representative of the
|
||||||
|
// final API.
|
||||||
|
|
||||||
|
|
||||||
|
var pointCollection = ol.geom2.PointCollection.createEmpty(101 * 101);
|
||||||
|
var i, j, x, y;
|
||||||
|
for (i = 0; i < 101; ++i) {
|
||||||
|
for (j = 0; j < 101; ++j) {
|
||||||
|
x = 20000000 * (i - 50) / 50;
|
||||||
|
y = 20000000 * (j - 50) / 50;
|
||||||
|
pointCollection.add([x, y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var k = 1000000;
|
||||||
|
var lineStringCollection = ol.geom2.LineStringCollection.pack([
|
||||||
|
[[-20 * k, -20 * k], [20 * k, 20 * k]],
|
||||||
|
[[-20 * k, 20 * k], [20 * k, -20 * k]],
|
||||||
|
[[0 * k, 15 * k],
|
||||||
|
[10 * k, 5 * k],
|
||||||
|
[5 * k, 5 * k],
|
||||||
|
[5 * k, -15 * k],
|
||||||
|
[-5 * k, -15 * k],
|
||||||
|
[-5 * k, 5 * k],
|
||||||
|
[-10 * k, 5 * k],
|
||||||
|
[0 * k, 15 * k]]
|
||||||
|
]);
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
controls: ol.control.defaults({}, [
|
||||||
|
new ol.control.MousePosition({
|
||||||
|
undefinedHTML: ' '
|
||||||
|
})
|
||||||
|
]),
|
||||||
|
layers: [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.OSM()
|
||||||
|
}),
|
||||||
|
new ol.layer.VectorLayer2({
|
||||||
|
source: new ol.source.VectorSource2({
|
||||||
|
lineStringCollections: [lineStringCollection],
|
||||||
|
projection: 'EPSG:3857',
|
||||||
|
pointCollections: [pointCollection]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
],
|
||||||
|
renderer: ol.RendererHint.WEBGL,
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [0, 0],
|
||||||
|
zoom: 0
|
||||||
|
})
|
||||||
|
});
|
||||||
@@ -37,12 +37,17 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Vector layer example</h4>
|
<h4 id="title">Vector layer example</h4>
|
||||||
<p id="shortdesc">Example of a vector layer.</p>
|
<p id="shortdesc">Example of a countries vector layer with country information on hover and country labels at higher zoom levels.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>See the <a href="vector-layer.js" target="_blank">vector-layer.js source</a> to see how this is done.</p>
|
<p>See the <a href="vector-layer.js" target="_blank">vector-layer.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">vector, geojson, style</div>
|
<div id="tags">vector, geojson, style</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span4 pull-right">
|
||||||
|
<div id="info" class="alert alert-success">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,31 @@
|
|||||||
goog.require('ol.Collection');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.expr');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.parser.GeoJSON');
|
goog.require('ol.parser.GeoJSON');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.MapQuestOpenAerial');
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
goog.require('ol.style.Polygon');
|
goog.require('ol.style.Polygon');
|
||||||
goog.require('ol.style.Rule');
|
goog.require('ol.style.Rule');
|
||||||
goog.require('ol.style.Style');
|
goog.require('ol.style.Style');
|
||||||
|
goog.require('ol.style.Text');
|
||||||
|
|
||||||
|
|
||||||
var raster = new ol.layer.TileLayer({
|
var raster = new ol.layer.TileLayer({
|
||||||
source: new ol.source.MapQuestOpenAerial()
|
source: new ol.source.MapQuestOpenAerial()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: discuss scale dependent rules
|
||||||
|
ol.expr.register('resolution', function() {
|
||||||
|
return map.getView().getView2D().getResolution();
|
||||||
|
});
|
||||||
|
|
||||||
var vector = new ol.layer.Vector({
|
var vector = new ol.layer.Vector({
|
||||||
source: new ol.source.Vector({
|
source: new ol.source.Vector({
|
||||||
projection: ol.projection.get('EPSG:4326')
|
projection: ol.proj.get('EPSG:4326')
|
||||||
}),
|
}),
|
||||||
style: new ol.style.Style({rules: [
|
style: new ol.style.Style({rules: [
|
||||||
new ol.style.Rule({
|
new ol.style.Rule({
|
||||||
@@ -28,12 +34,27 @@ var vector = new ol.layer.Vector({
|
|||||||
strokeColor: '#bada55'
|
strokeColor: '#bada55'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
}),
|
||||||
|
new ol.style.Rule({
|
||||||
|
filter: 'resolution() < 5000',
|
||||||
|
symbolizers: [
|
||||||
|
new ol.style.Text({
|
||||||
|
color: '#bada55',
|
||||||
|
text: ol.expr.parse('name'),
|
||||||
|
fontFamily: 'Calibri,sans-serif',
|
||||||
|
fontSize: 12
|
||||||
|
})
|
||||||
|
]
|
||||||
})
|
})
|
||||||
]})
|
]}),
|
||||||
|
transformFeatureInfo: function(features) {
|
||||||
|
return features.length > 0 ?
|
||||||
|
features[0].getFeatureId() + ': ' + features[0].get('name') : ' ';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
layers: new ol.Collection([raster, vector]),
|
layers: [raster, vector],
|
||||||
renderer: ol.RendererHint.CANVAS,
|
renderer: ol.RendererHint.CANVAS,
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new ol.View2D({
|
view: new ol.View2D({
|
||||||
@@ -42,9 +63,19 @@ var map = new ol.Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
map.on(['click', 'mousemove'], function(evt) {
|
||||||
|
map.getFeatureInfo({
|
||||||
|
pixel: evt.getPixel(),
|
||||||
|
layers: [vector],
|
||||||
|
success: function(featureInfo) {
|
||||||
|
document.getElementById('info').innerHTML = featureInfo[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var geojson = new ol.parser.GeoJSON();
|
var geojson = new ol.parser.GeoJSON();
|
||||||
var url = 'data/countries.json';
|
var url = 'data/countries.geojson';
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
<title>Tiled WMS with custom projection example</title>
|
<title>Tiled WMS with Proj4js projection example</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Tiled WMS with custom projection example</h4>
|
<h4 id="title">Tiled WMS with Proj4js projection example</h4>
|
||||||
<p id="shortdesc">Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
|
<p id="shortdesc">Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>See the <a href="wms-custom-proj.js" target="_blank">wms-custom-proj.js source</a> to see how this is done.</p>
|
<p>See the <a href="wms-custom-proj.js" target="_blank">wms-custom-proj.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">wms, tile, tilelayer, projection</div>
|
<div id="tags">wms, tile, tilelayer, proj4js, projection</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Extent');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
@@ -7,16 +6,16 @@ goog.require('ol.control.ScaleLine');
|
|||||||
goog.require('ol.control.ScaleLineUnits');
|
goog.require('ol.control.ScaleLineUnits');
|
||||||
goog.require('ol.control.defaults');
|
goog.require('ol.control.defaults');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.TiledWMS');
|
goog.require('ol.source.TiledWMS');
|
||||||
|
|
||||||
|
|
||||||
var projection = ol.projection.configureProj4jsProjection({
|
var projection = ol.proj.configureProj4jsProjection({
|
||||||
code: 'EPSG:21781',
|
code: 'EPSG:21781',
|
||||||
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
|
extent: [485869.5728, 837076.5648, 76443.1884, 299941.7864]
|
||||||
});
|
});
|
||||||
|
|
||||||
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
var extent = [420000, 900000, 30000, 350000];
|
||||||
var layers = [
|
var layers = [
|
||||||
new ol.layer.TileLayer({
|
new ol.layer.TileLayer({
|
||||||
source: new ol.source.TiledWMS({
|
source: new ol.source.TiledWMS({
|
||||||
|
|||||||
55
examples/wms-no-proj.html
Normal file
55
examples/wms-no-proj.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>WMS without client projection example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span4">
|
||||||
|
<h4 id="title">WMS without client projection example</h4>
|
||||||
|
<p id="shortdesc">Example of two WMS layers using the projection EPSG:21781, which is unknown to the client.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>See the <a href="wms-no-proj.js" target="_blank">wms-no-proj.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">wms, projection</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="loader.js?id=wms-no-proj" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
58
examples/wms-no-proj.js
Normal file
58
examples/wms-no-proj.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
goog.require('ol.Attribution');
|
||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.Projection');
|
||||||
|
goog.require('ol.ProjectionUnits');
|
||||||
|
goog.require('ol.RendererHints');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.ImageLayer');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.source.SingleImageWMS');
|
||||||
|
goog.require('ol.source.TiledWMS');
|
||||||
|
|
||||||
|
|
||||||
|
var layers = [
|
||||||
|
new ol.layer.TileLayer({
|
||||||
|
source: new ol.source.TiledWMS({
|
||||||
|
attributions: [new ol.Attribution(
|
||||||
|
'© ' +
|
||||||
|
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
|
||||||
|
'Pixelmap 1:1000000 / geo.admin.ch</a>')],
|
||||||
|
crossOrigin: 'anonymous',
|
||||||
|
params: {
|
||||||
|
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
|
||||||
|
'FORMAT': 'image/jpeg'
|
||||||
|
},
|
||||||
|
url: 'http://wms.geo.admin.ch/'
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
new ol.layer.ImageLayer({
|
||||||
|
source: new ol.source.SingleImageWMS({
|
||||||
|
attributions: [new ol.Attribution(
|
||||||
|
'© ' +
|
||||||
|
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
|
||||||
|
'National parks / geo.admin.ch</a>')],
|
||||||
|
crossOrigin: 'anonymous',
|
||||||
|
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
|
||||||
|
url: 'http://wms.geo.admin.ch/'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
// A minimal projection object is configured with only the SRS code and the map
|
||||||
|
// units. No client side coordinate transforms are possible with such a
|
||||||
|
// projection object.
|
||||||
|
var projection = new ol.Projection({
|
||||||
|
code: 'EPSG:21781',
|
||||||
|
units: ol.ProjectionUnits.METERS
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
layers: layers,
|
||||||
|
renderers: ol.RendererHints.createFromQueryData(),
|
||||||
|
target: 'map',
|
||||||
|
view: new ol.View2D({
|
||||||
|
center: [660000, 190000],
|
||||||
|
projection: projection,
|
||||||
|
zoom: 9
|
||||||
|
})
|
||||||
|
});
|
||||||
@@ -37,8 +37,9 @@
|
|||||||
|
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<h4 id="title">Single image WMS with custom projection example</h4>
|
<h4 id="title">Single image WMS with custom projection example</h4>
|
||||||
<p id="shortdesc">Example of two single image WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
|
<p id="shortdesc">Example of two single image WMS layers.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
|
<p id="shortdesc">Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
|
||||||
<p>See the <a href="wms-single-image-custom-proj.js" target="_blank">wms-single-image-custom-proj.js source</a> to see how this is done.</p>
|
<p>See the <a href="wms-single-image-custom-proj.js" target="_blank">wms-single-image-custom-proj.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">wms, single image, projection</div>
|
<div id="tags">wms, single image, projection</div>
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Extent');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHints');
|
goog.require('ol.RendererHints');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.ImageLayer');
|
goog.require('ol.layer.ImageLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.SingleImageWMS');
|
goog.require('ol.source.SingleImageWMS');
|
||||||
|
|
||||||
|
|
||||||
var projection = ol.projection.configureProj4jsProjection({
|
var projection = ol.proj.configureProj4jsProjection({
|
||||||
code: 'EPSG:21781',
|
code: 'EPSG:21781',
|
||||||
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
|
extent: [485869.5728, 837076.5648, 76443.1884, 299941.7864]
|
||||||
});
|
});
|
||||||
|
|
||||||
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
var extent = [420000, 900000, 30000, 350000];
|
||||||
var layers = [
|
var layers = [
|
||||||
new ol.layer.ImageLayer({
|
new ol.layer.ImageLayer({
|
||||||
source: new ol.source.SingleImageWMS({
|
source: new ol.source.SingleImageWMS({
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
goog.require('ol.Extent');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
@@ -16,7 +15,7 @@ var layers = [
|
|||||||
source: new ol.source.SingleImageWMS({
|
source: new ol.source.SingleImageWMS({
|
||||||
url: 'http://demo.opengeo.org/geoserver/wms',
|
url: 'http://demo.opengeo.org/geoserver/wms',
|
||||||
params: {'LAYERS': 'topp:states'},
|
params: {'LAYERS': 'topp:states'},
|
||||||
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
|
extent: [-13884991, -7455066, 2870341, 6338219]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
goog.require('ol.Extent');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
@@ -15,7 +14,7 @@ var layers = [
|
|||||||
source: new ol.source.TiledWMS({
|
source: new ol.source.TiledWMS({
|
||||||
url: 'http://demo.opengeo.org/geoserver/wms',
|
url: 'http://demo.opengeo.org/geoserver/wms',
|
||||||
params: {'LAYERS': 'topp:states', 'TILED': true},
|
params: {'LAYERS': 'topp:states', 'TILED': true},
|
||||||
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
|
extent: [-13884991, -7455066, 2870341, 6338219]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
goog.require('ol.parser.ogc.WMTSCapabilities');
|
goog.require('ol.parser.ogc.WMTSCapabilities');
|
||||||
goog.require('ol.projection.addCommonProjections');
|
goog.require('ol.proj.addCommonProjections');
|
||||||
|
|
||||||
ol.projection.addCommonProjections();
|
ol.proj.addCommonProjections();
|
||||||
Proj4js.defs['EPSG:31256'] = '+proj=tmerc +lat_0=0 ' +
|
Proj4js.defs['EPSG:31256'] = '+proj=tmerc +lat_0=0 ' +
|
||||||
'+lon_0=16.33333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel ' +
|
'+lon_0=16.33333333333333 +k=1 +x_0=0 +y_0=-5000000 +ellps=bessel ' +
|
||||||
'+towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 ' +
|
'+towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 ' +
|
||||||
|
|||||||
64
examples/wmts-ign.html
Normal file
64
examples/wmts-ign.html
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
<title>IGN WMTS example</title>
|
||||||
|
<style>
|
||||||
|
.ol-logo ul li {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">OpenLayers 3 Examples</a>
|
||||||
|
<ul class="nav pull-right">
|
||||||
|
<li><iframe class="github-watch-button" src="http://ghbtns.com/github-btn.html?user=openlayers&repo=ol3&type=watch&count=true"
|
||||||
|
allowtransparency="true" frameborder="0" scrolling="0" height="20" width="90"></iframe></li>
|
||||||
|
<li><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-hashtags="openlayers"> </a></li>
|
||||||
|
<li><div class="g-plusone-wrapper"><div class="g-plusone" data-size="medium" data-annotation="none"></div></div></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
<h4 id="title">IGN WMTS example</h4>
|
||||||
|
<p id="shortdesc">Demonstrates displaying IGN (France) WMTS layers.</p>
|
||||||
|
<div id="docs">
|
||||||
|
<p>In this example two IGN WMTS layers are displayed: <em>Ortho imagery and Cadastral parcels.</em>.
|
||||||
|
For more information on IGN's WMTS service see the
|
||||||
|
<a href="http://professionnels.ign.fr/api-sig">IGN Géoportail API web page</a> (french).</p>
|
||||||
|
<p>See the <a href="wmts-ign.js" target="_blank">wmts-ign.js source</a> to see how this is done.</p>
|
||||||
|
</div>
|
||||||
|
<div id="tags">french, ign, geoportail, wmts</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
||||||
|
<script src="loader.js?id=wmts-ign" type="text/javascript"></script>
|
||||||
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
83
examples/wmts-ign.js
Normal file
83
examples/wmts-ign.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
goog.require('ol.Attribution');
|
||||||
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.RendererHint');
|
||||||
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.layer.TileLayer');
|
||||||
|
goog.require('ol.parser.ogc.WMTSCapabilities');
|
||||||
|
goog.require('ol.source.WMTS');
|
||||||
|
|
||||||
|
|
||||||
|
// The WMTS Capabilities document includes IGNF:WGS84G as a supported
|
||||||
|
// CRS. We include the Proj4js definition of that projection to prevent
|
||||||
|
// Proj4js from requesting that definition from spatialreference.org.
|
||||||
|
|
||||||
|
Proj4js.defs['IGNF:WGS84G'] = '+title=World Geodetic System 1984 ' +
|
||||||
|
'+proj=longlat +towgs84=0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,' +
|
||||||
|
'0.000000 +a=6378137.0000 +rf=298.2572221010000 +units=m +no_defs <>';
|
||||||
|
|
||||||
|
// API key valid for "localhost" and "ol3js.org". Expiration date
|
||||||
|
// is 21/06/2014.
|
||||||
|
var key = 'crrypaoz7j1ifbalcobnumb0';
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
renderer: ol.RendererHint.CANVAS,
|
||||||
|
target: 'map'
|
||||||
|
});
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
|
// data/IGNWMTSCapabilities.xml downloaded from
|
||||||
|
// http://wxs.ign.fr/cle/geoportail/wmts?SERVICE=WMTS&REQUEST=GetCapabilities
|
||||||
|
// Stored locally because of the Same Origin Policy.
|
||||||
|
xhr.open('GET', 'data/IGNWMTSCapabilities.xml', true);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* onload handler for the XHR request.
|
||||||
|
*/
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
var parser = new ol.parser.ogc.WMTSCapabilities();
|
||||||
|
var capabilities = parser.read(xhr.responseXML);
|
||||||
|
|
||||||
|
var wmtsUrl = 'http://wxs.ign.fr/' + key + '/geoportail/wmts';
|
||||||
|
|
||||||
|
var layerIdentifiers = [
|
||||||
|
'ORTHOIMAGERY.ORTHOPHOTOS',
|
||||||
|
'CADASTRALPARCELS.PARCELS'
|
||||||
|
];
|
||||||
|
var layerLogos = [
|
||||||
|
'http://gpp3-wxs.ign.fr/static/logos/PLANETOBSERVER/PLANETOBSERVER.gif',
|
||||||
|
'http://gpp3-wxs.ign.fr/static/logos/IGN/IGN.gif'
|
||||||
|
];
|
||||||
|
|
||||||
|
var attribution = new ol.Attribution(
|
||||||
|
'<a href="http://www.geoportail.fr/" target="_blank">' +
|
||||||
|
'<img src="http://api.ign.fr/geoportail/api/js/latest/' +
|
||||||
|
'theme/geoportal/img/logo_gp.gif"></a>');
|
||||||
|
|
||||||
|
var sourceOptions;
|
||||||
|
var source;
|
||||||
|
var layer;
|
||||||
|
var i;
|
||||||
|
|
||||||
|
for (i = 0; i < layerIdentifiers.length; ++i) {
|
||||||
|
sourceOptions = ol.source.WMTS.optionsFromCapabilities(
|
||||||
|
capabilities, layerIdentifiers[i]);
|
||||||
|
// we need to set the URL because it must include the key.
|
||||||
|
sourceOptions.urls = [wmtsUrl];
|
||||||
|
sourceOptions.attributions = [attribution];
|
||||||
|
sourceOptions.logo = layerLogos[i];
|
||||||
|
source = new ol.source.WMTS(sourceOptions);
|
||||||
|
layer = new ol.layer.TileLayer({source: source});
|
||||||
|
map.addLayer(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
var view = new ol.View2D();
|
||||||
|
view.fitExtent([257596.65942095537, 262082.55751844167,
|
||||||
|
6250898.984085131, 6251854.446938695], map.getSize());
|
||||||
|
map.setView(view);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
goog.require('ol.Extent');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.RendererHint');
|
goog.require('ol.RendererHint');
|
||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
|
goog.require('ol.extent');
|
||||||
goog.require('ol.layer.TileLayer');
|
goog.require('ol.layer.TileLayer');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
goog.require('ol.source.WMTS');
|
goog.require('ol.source.WMTS');
|
||||||
goog.require('ol.tilegrid.WMTS');
|
goog.require('ol.tilegrid.WMTS');
|
||||||
|
|
||||||
|
|
||||||
var projection = ol.projection.get('EPSG:900913');
|
var projection = ol.proj.get('EPSG:900913');
|
||||||
var projectionExtent = projection.getExtent();
|
var projectionExtent = projection.getExtent();
|
||||||
var size = projectionExtent.getWidth() / 256;
|
var size = ol.extent.getWidth(projectionExtent) / 256;
|
||||||
var resolutions = new Array(26);
|
var resolutions = new Array(26);
|
||||||
var matrixIds = new Array(26);
|
var matrixIds = new Array(26);
|
||||||
for (var z = 0; z < 26; ++z) {
|
for (var z = 0; z < 26; ++z) {
|
||||||
@@ -34,12 +34,12 @@ var map = new ol.Map({
|
|||||||
format: 'image/png',
|
format: 'image/png',
|
||||||
projection: projection,
|
projection: projection,
|
||||||
tileGrid: new ol.tilegrid.WMTS({
|
tileGrid: new ol.tilegrid.WMTS({
|
||||||
origin: projectionExtent.getTopLeft(),
|
origin: ol.extent.getTopLeft(projectionExtent),
|
||||||
resolutions: resolutions,
|
resolutions: resolutions,
|
||||||
matrixIds: matrixIds
|
matrixIds: matrixIds
|
||||||
}),
|
}),
|
||||||
style: '_null',
|
style: '_null',
|
||||||
extent: new ol.Extent(-13682835, 5204068, -13667473, 5221690)
|
extent: [-13682835, -13667473, 5204068, 5221690]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
29
externs/oli.js
Normal file
29
externs/oli.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* @externs
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
var oli;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @interface
|
||||||
|
*/
|
||||||
|
oli.control.Control = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.MapEvent} mapEvent Map event.
|
||||||
|
* @return {undefined} Undefined.
|
||||||
|
*/
|
||||||
|
oli.control.Control.prototype.handleMapPostrender = function(mapEvent) {};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Map} map Map.
|
||||||
|
* @return {undefined} Undefined.
|
||||||
|
*/
|
||||||
|
oli.control.Control.prototype.setMap = function(map) {};
|
||||||
@@ -76,6 +76,12 @@ Proj4js.Proj.prototype.units;
|
|||||||
Proj4js.Proj.prototype.srsCode;
|
Proj4js.Proj.prototype.srsCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
Proj4js.Proj.prototype.to_meter;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @nosideeffects
|
* @nosideeffects
|
||||||
* @param {Proj4js.Proj} source
|
* @param {Proj4js.Proj} source
|
||||||
|
|||||||
89
externs/w3c_device_sensor_event.js
Normal file
89
externs/w3c_device_sensor_event.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 The Closure Compiler Authors
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileoverview Definitions for W3C's device orientation and device motion
|
||||||
|
* events specification.
|
||||||
|
* This file depends on w3c_event.js.
|
||||||
|
* The whole file has been partially type annotated.
|
||||||
|
* Created from http://dev.w3.org/geo/api/spec-source-orientation.
|
||||||
|
*
|
||||||
|
* @externs
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @extends {Event}
|
||||||
|
*/
|
||||||
|
function DeviceOrientationEvent() {}
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceOrientationEvent.prototype.alpha;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceOrientationEvent.prototype.beta;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceOrientationEvent.prototype.gamma;
|
||||||
|
|
||||||
|
/** @type {boolean} */
|
||||||
|
DeviceOrientationEvent.prototype.absolute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function DeviceAcceleration() {}
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceAcceleration.prototype.x;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceAcceleration.prototype.y;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceAcceleration.prototype.z;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function DeviceRotationRate() {}
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceOrientationEvent.prototype.alpha;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceOrientationEvent.prototype.beta;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceOrientationEvent.prototype.gamma;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @extends {Event}
|
||||||
|
*/
|
||||||
|
function DeviceMotionEvent() {}
|
||||||
|
|
||||||
|
/** @type {?DeviceAcceleration} */
|
||||||
|
DeviceMotionEvent.prototype.acceleration;
|
||||||
|
|
||||||
|
/** @type {?DeviceAcceleration} */
|
||||||
|
DeviceMotionEvent.prototype.accelerationIncludingGravity;
|
||||||
|
|
||||||
|
/** @type {?DeviceRotationRate} */
|
||||||
|
DeviceMotionEvent.prototype.rotationRate;
|
||||||
|
|
||||||
|
/** @type {?number} */
|
||||||
|
DeviceMotionEvent.prototype.interval;
|
||||||
@@ -6,6 +6,7 @@ body {
|
|||||||
.map {
|
.map {
|
||||||
height: 400px;
|
height: 400px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
background: url(textured_paper.jpeg) repeat;
|
||||||
}
|
}
|
||||||
.ol-attribution {
|
.ol-attribution {
|
||||||
max-width: 50%;
|
max-width: 50%;
|
||||||
|
|||||||
BIN
resources/textured_paper.jpeg
Normal file
BIN
resources/textured_paper.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -1 +0,0 @@
|
|||||||
@exportSymbol goog.require goog.nullFunction
|
|
||||||
@@ -1,13 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* @typedef {Object} ol.DeviceOrientationOptions
|
||||||
|
* @property {boolean|undefined} tracking Tracking.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.GeolocationOptions
|
||||||
|
* @property {boolean|undefined} tracking Tracking.
|
||||||
|
* @property {GeolocationPositionOptions|undefined} trackingOptions Tracking options.
|
||||||
|
* @property {ol.ProjectionLike} projection Projection.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.GetFeatureInfoOptions
|
||||||
|
* @property {ol.Pixel} pixel Pixel coordinate relative to the map viewport.
|
||||||
|
* @property {Array.<ol.layer.Layer>|undefined} layers Layers to restrict the
|
||||||
|
* query to. All map layers will be queried if not provided.
|
||||||
|
* @property {function(Array.<string|undefined>)} success Callback for
|
||||||
|
* successful queries. The passed argument is the resulting feature
|
||||||
|
* information for each layer, with array indices being the same as in the
|
||||||
|
* passed `layers` array or in the layer collection as returned from
|
||||||
|
* `ol.Map#getLayers()` if no `layers` were provided.
|
||||||
|
* @property {function(Object)|undefined} error Callback for unsuccessful
|
||||||
|
* queries. Note that queries with no matching features trigger the success
|
||||||
|
* callback, not the error callback.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.GetFeaturesOptions
|
||||||
|
* @property {ol.Pixel} pixel Pixel coordinate relative to the map viewport.
|
||||||
|
* @property {Array.<ol.layer.Layer>|undefined} layers Layers to restrict the
|
||||||
|
* query to. All layers will be queried if not provided.
|
||||||
|
* @property {function(Array.<Array.<ol.Feature|undefined>>)} success Callback
|
||||||
|
* for successful queries. The passed argument is the resulting features for
|
||||||
|
* each layer, with array indices being the same as in the passed `layers`
|
||||||
|
* array or in the layer collection as returned from `ol.Map#getLayers()` if
|
||||||
|
* no layers were provided.
|
||||||
|
* @property {function(Object)|undefined} error Callback for unsuccessful
|
||||||
|
* queries. Note that queries with no matching features trigger the success
|
||||||
|
* callback, not the error callback.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object literal with config options for the map.
|
* Object literal with config options for the map.
|
||||||
* @typedef {Object} ol.MapOptions
|
* @typedef {Object} ol.MapOptions
|
||||||
* @property {Array.<ol.control.Control>|undefined} controls Controls initially
|
* @property {ol.Collection|Array.<ol.control.Control>|undefined} controls
|
||||||
* added to the map.
|
* Controls initially added to the map.
|
||||||
* @property {ol.Collection|undefined} interactions Interactions.
|
* @property {ol.Collection|undefined} interactions Interactions.
|
||||||
* @property {Array.<ol.layer.Layer>|ol.Collection|undefined} layers Layers.
|
* @property {Array.<ol.layer.Layer>|ol.Collection|undefined} layers Layers.
|
||||||
* @property {ol.RendererHint|undefined} renderer Renderer.
|
* @property {ol.RendererHint|undefined} renderer Renderer.
|
||||||
* @property {Array.<ol.RendererHint>|undefined} renderers Renderers.
|
* @property {Array.<ol.RendererHint>|undefined} renderers Renderers.
|
||||||
* @property {Element|string} target The container for the map.
|
* @property {Element|string|undefined} target The container for the map.
|
||||||
* @property {ol.IView|undefined} view The map's view. Currently
|
* @property {ol.IView|undefined} view The map's view. Currently
|
||||||
* {@link ol.View2D} is available as view.
|
* {@link ol.View2D} is available as view.
|
||||||
*/
|
*/
|
||||||
@@ -26,7 +68,7 @@
|
|||||||
* Object literal with config options for the Proj4js projection.
|
* Object literal with config options for the Proj4js projection.
|
||||||
* @typedef {Object} ol.Proj4jsProjectionOptions
|
* @typedef {Object} ol.Proj4jsProjectionOptions
|
||||||
* @property {string} code The SRS identifier code, e.g. 'EPSG:31256'.
|
* @property {string} code The SRS identifier code, e.g. 'EPSG:31256'.
|
||||||
* @property {ol.Extent} extent The validity extent for the SRS.
|
* @property {ol.Extent|undefined} extent The validity extent for the SRS.
|
||||||
* @property {boolean|undefined} global Whether the projection is valid for the
|
* @property {boolean|undefined} global Whether the projection is valid for the
|
||||||
* whole globe. Default is false.
|
* whole globe. Default is false.
|
||||||
*/
|
*/
|
||||||
@@ -36,7 +78,7 @@
|
|||||||
* @typedef {Object} ol.ProjectionOptions
|
* @typedef {Object} ol.ProjectionOptions
|
||||||
* @property {string} code The SRS identifier code, e.g. 'EPSG:4326'.
|
* @property {string} code The SRS identifier code, e.g. 'EPSG:4326'.
|
||||||
* @property {ol.ProjectionUnits} units Units.
|
* @property {ol.ProjectionUnits} units Units.
|
||||||
* @property {ol.Extent} extent The validity extent for the SRS.
|
* @property {ol.Extent|undefined} extent The validity extent for the SRS.
|
||||||
* @property {string|undefined} axisOrientation The axis orientation as
|
* @property {string|undefined} axisOrientation The axis orientation as
|
||||||
* specified in Proj4. The default is 'enu'.
|
* specified in Proj4. The default is 'enu'.
|
||||||
* @property {boolean|undefined} global Whether the projection is valid for the
|
* @property {boolean|undefined} global Whether the projection is valid for the
|
||||||
@@ -97,10 +139,18 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.AttributionOptions
|
* @typedef {Object} ol.control.AttributionOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
* @property {Element|undefined} target Target.
|
* @property {Element|undefined} target Target.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.control.ControlOptions
|
||||||
|
* @property {Element|undefined} element Element.
|
||||||
|
* @property {ol.Map|undefined} map Map.
|
||||||
|
* @property {Element|undefined} target Target.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.DefaultsOptions
|
* @typedef {Object} ol.control.DefaultsOptions
|
||||||
* @property {boolean|undefined} attribution Attribution.
|
* @property {boolean|undefined} attribution Attribution.
|
||||||
@@ -114,6 +164,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.FullScreenOptions
|
* @typedef {Object} ol.control.FullScreenOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {boolean|undefined} keys Full keyboard access.
|
* @property {boolean|undefined} keys Full keyboard access.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
* @property {Element|undefined} target Target.
|
* @property {Element|undefined} target Target.
|
||||||
@@ -121,12 +172,14 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.LogoOptions
|
* @typedef {Object} ol.control.LogoOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
* @property {Element|undefined} target Target.
|
* @property {Element|undefined} target Target.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.MousePositionOptions
|
* @typedef {Object} ol.control.MousePositionOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate
|
* @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate
|
||||||
* format.
|
* format.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
@@ -137,6 +190,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.ScaleLineOptions
|
* @typedef {Object} ol.control.ScaleLineOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
* @property {number|undefined} minWidth Minimum width in pixels.
|
* @property {number|undefined} minWidth Minimum width in pixels.
|
||||||
* @property {Element|undefined} target Target.
|
* @property {Element|undefined} target Target.
|
||||||
@@ -145,6 +199,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.ZoomOptions
|
* @typedef {Object} ol.control.ZoomOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {number|undefined} delta Delta.
|
* @property {number|undefined} delta Delta.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
* @property {Element|undefined} target Target.
|
* @property {Element|undefined} target Target.
|
||||||
@@ -152,14 +207,44 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.control.ZoomSliderOptions
|
* @typedef {Object} ol.control.ZoomSliderOptions
|
||||||
|
* @property {string|undefined} className Class name.
|
||||||
* @property {ol.Map|undefined} map Map.
|
* @property {ol.Map|undefined} map Map.
|
||||||
* @property {number|undefined} maxResolution Maximum resolution.
|
* @property {number|undefined} maxResolution Maximum resolution.
|
||||||
* @property {number|undefined} minResolution Minimum resolution.
|
* @property {number|undefined} minResolution Minimum resolution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.DoubleClickZoomOptions
|
||||||
|
* @property {number|undefined} delta The zoom delta applied on each double
|
||||||
|
* click.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.DragPanOptions
|
||||||
|
* @property {ol.Kinetic|undefined} kinetic Kinetic.
|
||||||
|
* @property {ol.interaction.ConditionType|undefined} condition Conditon.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.DragRotateOptions
|
||||||
|
* @property {ol.interaction.ConditionType|undefined} condition Condition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.DragRotateAndZoomOptions
|
||||||
|
* @property {ol.interaction.ConditionType|undefined} condition Condition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.DragZoomOptions
|
||||||
|
* @property {ol.interaction.ConditionType|undefined} condition Condition.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactions for the map. Default is true for all options.
|
* Interactions for the map. Default is true for all options.
|
||||||
* @typedef {Object} ol.interaction.DefaultsOptions
|
* @typedef {Object} ol.interaction.DefaultsOptions
|
||||||
|
* @property {boolean|undefined} altShiftDragRotate Whether Alt-Shift-drag
|
||||||
|
* rotate is desired.
|
||||||
* @property {boolean|undefined} doubleClickZoom Whether double click zoom is
|
* @property {boolean|undefined} doubleClickZoom Whether double click zoom is
|
||||||
* desired.
|
* desired.
|
||||||
* @property {boolean|undefined} dragPan Whether drag-pan is desired.
|
* @property {boolean|undefined} dragPan Whether drag-pan is desired.
|
||||||
@@ -173,18 +258,31 @@
|
|||||||
* desired.
|
* desired.
|
||||||
* @property {boolean|undefined} touchRotate Whether touch rotate is desired.
|
* @property {boolean|undefined} touchRotate Whether touch rotate is desired.
|
||||||
* @property {boolean|undefined} touchZoom Whether touch zoom is desired.
|
* @property {boolean|undefined} touchZoom Whether touch zoom is desired.
|
||||||
|
* @property {number|undefined} zoomDelta Zoom delta.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.interaction.KeyboardPanOptions
|
* @typedef {Object} ol.interaction.KeyboardPanOptions
|
||||||
|
* @property {ol.interaction.ConditionType|undefined} condition Condition.
|
||||||
* @property {number|undefined} pixelDelta Pixel delta
|
* @property {number|undefined} pixelDelta Pixel delta
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.interaction.KeyboardZoomOptions
|
* @typedef {Object} ol.interaction.KeyboardZoomOptions
|
||||||
|
* @property {ol.interaction.ConditionType|undefined} condition Condition.
|
||||||
* @property {number|undefined} delta Delta.
|
* @property {number|undefined} delta Delta.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.TouchPanOptions
|
||||||
|
* @property {ol.Kinetic|undefined} kinetic Kinetic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.interaction.TouchRotateOptions
|
||||||
|
* @property {number|undefined} threshold Minimal angle to start a rotation.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.layer.LayerOptions
|
* @typedef {Object} ol.layer.LayerOptions
|
||||||
* @property {number|undefined} brightness Brightness.
|
* @property {number|undefined} brightness Brightness.
|
||||||
@@ -210,12 +308,88 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.layer.VectorLayerOptions
|
* @typedef {Object} ol.layer.VectorLayerOptions
|
||||||
|
* @property {function(Array.<ol.Feature>):string|undefined} transformFeatureInfo
|
||||||
|
* Function to render an array of
|
||||||
|
* features into feature info markup. If not provided, a comma separated
|
||||||
|
* list of the unique ids of the resulting features will be returned.
|
||||||
* @property {number|undefined} opacity Opacity. 0-1. Default is 1.
|
* @property {number|undefined} opacity Opacity. 0-1. Default is 1.
|
||||||
* @property {ol.source.Source} source Source for this layer.
|
* @property {ol.source.Source} source Source for this layer.
|
||||||
* @property {ol.style.Style|undefined} style Style.
|
* @property {ol.style.Style|undefined} style Style.
|
||||||
* @property {boolean|undefined} visible Visibility. Default is true (visible).
|
* @property {boolean|undefined} visible Visibility. Default is true (visible).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.parser.KMLOptions
|
||||||
|
* @property {number|undefined} dimension Create geometries with `dimension`
|
||||||
|
* dimensions. Default is 3.
|
||||||
|
* @property {boolean|undefined} extractAttributes Should we extract attributes
|
||||||
|
* from the KML? Default is `true´.
|
||||||
|
* @property {boolean|undefined} extractStyles Should we extract styles from the
|
||||||
|
* KML? Default is `false`.
|
||||||
|
* @property {number|undefined} maxDepth Maximum depth to follow network links.
|
||||||
|
* Default is 0, which means we don't follow network links at all.
|
||||||
|
* @property {Array.<string>|undefined} trackAttributes Track attributes to
|
||||||
|
* parse.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.parser.GMLOptions
|
||||||
|
* @property {string|undefined} axisOrientation The axis orientation as
|
||||||
|
* specified in Proj4. The default is 'enu'.
|
||||||
|
* @property {boolean|undefined} curve Write gml:Curve instead of
|
||||||
|
* gml:LineString elements. This also affects the elements in multi-part
|
||||||
|
* geometries. Default is `false´. This only applies to GML version 3.
|
||||||
|
* @property {boolean|undefined} extractAttributes Should we extract attributes
|
||||||
|
* from the GML? Default is `true´.
|
||||||
|
* @property {string|undefined} featureNS The feature namespace. If not set it
|
||||||
|
* will be automatically configured from the GML.
|
||||||
|
* @property {Array.<string>|string|undefined} featureType The local
|
||||||
|
* (without prefix) feature typeName(s).
|
||||||
|
* @property {string|undefined} geometryName Name of geometry element.
|
||||||
|
* Defaults to `geometry´. If null, it will be set on <read> when the
|
||||||
|
* first geometry is parsed.
|
||||||
|
* @property {boolean|undefined} multiCurve Write gml:MultiCurve instead of
|
||||||
|
* gml:MultiLineString. Since the latter is deprecated in GML 3, the
|
||||||
|
* default is `true´. This only applies to GML version 3.
|
||||||
|
* @property {boolean|undefined} multiSurface Write gml:multiSurface instead
|
||||||
|
* of gml:MultiPolygon. Since the latter is deprecated in GML 3, the
|
||||||
|
* default is `true´. This only applies to GML version 3.
|
||||||
|
* @property {string|undefined} schemaLocation Optional schemaLocation to use
|
||||||
|
* when writing out the GML, this will override the default provided.
|
||||||
|
* @property {string|undefined} srsName URI for spatial reference system.
|
||||||
|
* This is optional for single part geometries and mandatory for
|
||||||
|
* collections and multis. If set, the srsName attribute will be written
|
||||||
|
* for all geometries. Default is null.
|
||||||
|
* @property {boolean|undefined} surface Write gml:Surface instead of
|
||||||
|
* gml:Polygon elements. This also affects the elements in multi-part
|
||||||
|
* geometries. Default is `false´. This only applies to GML version 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.parser.GPXOptions
|
||||||
|
* @property {string|undefined} creator The creator attribute to be added to
|
||||||
|
* the written GPX files. Defaults to `OpenLayers´.
|
||||||
|
* @property {string|undefined} defaultDesc Default description for the
|
||||||
|
* waypoints/tracks in the case where the feature has no 'description'
|
||||||
|
* attribute. Default is 'No description available'.
|
||||||
|
* @property {boolean|undefined} extractAttributes Should we extract attributes
|
||||||
|
* from the GPX? Default is `true´.
|
||||||
|
* @property {boolean|undefined} extractWaypoints Extract waypoints from GPX.
|
||||||
|
* Default is `true´.
|
||||||
|
* @property {boolean|undefined} extractTracks Extract tracks from GPX.
|
||||||
|
* Default is `true´.
|
||||||
|
* @property {boolean|undefined} extractRoutes Extract routes from GPX.
|
||||||
|
* Default is `true´.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.parser.GPXWriteOptions
|
||||||
|
* @property {Array.<ol.Feature>|ol.Feature} features The features to write
|
||||||
|
* out.
|
||||||
|
* @property {Object|undefined} metadata Metadata key/value pair with keys:
|
||||||
|
* name, desc and author.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.source.BingMapsOptions
|
* @typedef {Object} ol.source.BingMapsOptions
|
||||||
* @property {string|undefined} culture Culture.
|
* @property {string|undefined} culture Culture.
|
||||||
@@ -312,6 +486,17 @@
|
|||||||
* of `url` when the WMS supports multiple urls for GetMap requests.
|
* of `url` when the WMS supports multiple urls for GetMap requests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.source.VectorSource2Options
|
||||||
|
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
||||||
|
* @property {ol.Extent|undefined} extent Extent.
|
||||||
|
* @property {Array.<ol.geom2.LineStringCollection>|undefined}
|
||||||
|
* lineStringCollections Line string collections.
|
||||||
|
* @property {Array.<ol.geom2.PointCollection>|undefined} pointCollections
|
||||||
|
* Point collections.
|
||||||
|
* @property {ol.ProjectionLike} projection Projection.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.source.WMTSOptions
|
* @typedef {Object} ol.source.WMTSOptions
|
||||||
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
||||||
@@ -319,7 +504,7 @@
|
|||||||
* requeests.
|
* requeests.
|
||||||
* @property {ol.Extent|undefined} extent Extent.
|
* @property {ol.Extent|undefined} extent Extent.
|
||||||
* @property {ol.tilegrid.WMTS} tileGrid Tile grid.
|
* @property {ol.tilegrid.WMTS} tileGrid Tile grid.
|
||||||
* @property {ol.Projection|undefined} projection Projection.
|
* @property {ol.ProjectionLike} projection Projection.
|
||||||
* @property {ol.source.WMTSRequestEncoding|undefined} requestEncoding Request
|
* @property {ol.source.WMTSRequestEncoding|undefined} requestEncoding Request
|
||||||
* encoding.
|
* encoding.
|
||||||
* @property {string} layer Layer.
|
* @property {string} layer Layer.
|
||||||
@@ -334,53 +519,54 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.style.IconOptions
|
* @typedef {Object} ol.style.IconOptions
|
||||||
* @property {string|ol.Expression} url Icon image url.
|
* @property {string|ol.expr.Expression} url Icon image url.
|
||||||
* @property {number|ol.Expression|undefined} width Width of the icon in pixels.
|
* @property {number|ol.expr.Expression|undefined} width Width of the icon
|
||||||
* Default is the width of the icon image.
|
* in pixels. Default is the width of the icon image.
|
||||||
* @property {number|ol.Expression|undefined} height Height of the icon in
|
* @property {number|ol.expr.Expression|undefined} height Height of the
|
||||||
* pixels. Default is the height of the icon image.
|
* icon in pixels. Default is the height of the icon image.
|
||||||
* @property {number|ol.Expression|undefined} opacity Icon opacity (0-1).
|
* @property {number|ol.expr.Expression|undefined} opacity Icon opacity
|
||||||
* @property {number|ol.Expression|undefined} rotation Rotation in degrees
|
* (0-1).
|
||||||
* (0-360).
|
* @property {number|ol.expr.Expression|undefined} rotation Rotation in
|
||||||
|
* degrees (0-360).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.style.LineOptions
|
* @typedef {Object} ol.style.LineOptions
|
||||||
* @property {string|ol.Expression|undefined} strokeColor Stroke color as hex
|
* @property {string|ol.expr.Expression|undefined} strokeColor Stroke
|
||||||
* color code.
|
* color as hex color code.
|
||||||
* @property {number|ol.Expression|undefined} strokeWidth Stroke width in
|
* @property {number|ol.expr.Expression|undefined} strokeWidth Stroke
|
||||||
* pixels.
|
* width in pixels.
|
||||||
* @property {number|ol.Expression|undefined} opacity Opacity (0-1).
|
* @property {number|ol.expr.Expression|undefined} opacity Opacity (0-1).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.style.PolygonOptions
|
* @typedef {Object} ol.style.PolygonOptions
|
||||||
* @property {string|ol.Expression|undefined} fillColor Fill color as hex color
|
* @property {string|ol.expr.Expression|undefined} fillColor Fill color as
|
||||||
* code.
|
* hex color code.
|
||||||
* @property {string|ol.Expression|undefined} strokeColor Stroke color as hex
|
* @property {string|ol.expr.Expression|undefined} strokeColor Stroke
|
||||||
* color code.
|
* color as hex color code.
|
||||||
* @property {number|ol.Expression|undefined} strokeWidth Stroke width in
|
* @property {number|ol.expr.Expression|undefined} strokeWidth Stroke
|
||||||
* pixels.
|
* width in pixels.
|
||||||
* @property {number|ol.Expression|undefined} opacity Opacity (0-1).
|
* @property {number|ol.expr.Expression|undefined} opacity Opacity (0-1).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.style.RuleOptions
|
* @typedef {Object} ol.style.RuleOptions
|
||||||
* @property {ol.filter.Filter|undefined} filter Filter.
|
* @property {ol.expr.Expression|string|undefined} filter Filter.
|
||||||
* @property {Array.<ol.style.Symbolizer>|undefined} symbolizers Symbolizers.
|
* @property {Array.<ol.style.Symbolizer>|undefined} symbolizers Symbolizers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.style.ShapeOptions
|
* @typedef {Object} ol.style.ShapeOptions
|
||||||
* @property {ol.style.ShapeType|undefined} type Type.
|
* @property {ol.style.ShapeType|undefined} type Type.
|
||||||
* @property {number|ol.Expression|undefined} size Size in pixels.
|
* @property {number|ol.expr.Expression|undefined} size Size in pixels.
|
||||||
* @property {string|ol.Expression|undefined} fillColor Fill color as hex color
|
* @property {string|ol.expr.Expression|undefined} fillColor Fill color as
|
||||||
* code.
|
* hex color code.
|
||||||
* @property {string|ol.Expression|undefined} strokeColor Stroke color as hex
|
* @property {string|ol.expr.Expression|undefined} strokeColor Stroke
|
||||||
* color code.
|
* color as hex color code.
|
||||||
* @property {number|ol.Expression|undefined} strokeWidth Stroke width in
|
* @property {number|ol.expr.Expression|undefined} strokeWidth Stroke
|
||||||
* pixels.
|
* width in pixels.
|
||||||
* @property {number|ol.Expression|undefined} opacity Opacity (0-1).
|
* @property {number|ol.expr.Expression|undefined} opacity Opacity (0-1).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -388,8 +574,18 @@
|
|||||||
* @property {Array.<ol.style.Rule>} rules Rules.
|
* @property {Array.<ol.style.Rule>} rules Rules.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ol.style.TextOptions
|
||||||
|
* @property {string|ol.expr.Expression|undefined} color Color.
|
||||||
|
* @property {string|ol.expr.Expression|undefined} fontFamily Font family.
|
||||||
|
* @property {number|ol.expr.Expression|undefined} fontSize Font size in pixels.
|
||||||
|
* @property {string|ol.expr.Expression} text Text for the label.
|
||||||
|
* @property {number|ol.expr.Expression|undefined} opacity Opacity (0-1).
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.tilegrid.TileGridOptions
|
* @typedef {Object} ol.tilegrid.TileGridOptions
|
||||||
|
* @property {number|undefined} minZoom Minimum zoom.
|
||||||
* @property {ol.Coordinate|undefined} origin Origin.
|
* @property {ol.Coordinate|undefined} origin Origin.
|
||||||
* @property {Array.<ol.Coordinate>|undefined} origins Origins.
|
* @property {Array.<ol.Coordinate>|undefined} origins Origins.
|
||||||
* @property {!Array.<number>} resolutions Resolutions.
|
* @property {!Array.<number>} resolutions Resolutions.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
@exportSymbol ol.animation
|
@exportSymbol ol.animation.bounce
|
||||||
@exportProperty ol.animation.bounce
|
@exportSymbol ol.animation.pan
|
||||||
@exportProperty ol.animation.pan
|
@exportSymbol ol.animation.rotate
|
||||||
@exportProperty ol.animation.rotate
|
@exportSymbol ol.animation.zoom
|
||||||
@exportProperty ol.animation.zoom
|
|
||||||
|
|||||||
@@ -17,22 +17,27 @@ ol.animation.bounce = function(options) {
|
|||||||
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
||||||
var easing = goog.isDef(options.easing) ?
|
var easing = goog.isDef(options.easing) ?
|
||||||
options.easing : ol.easing.upAndDown;
|
options.easing : ol.easing.upAndDown;
|
||||||
return function(map, frameState) {
|
return (
|
||||||
if (frameState.time < start) {
|
/**
|
||||||
frameState.animate = true;
|
* @param {ol.Map} map Map.
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
* @param {?ol.FrameState} frameState Frame state.
|
||||||
return true;
|
*/
|
||||||
} else if (frameState.time < start + duration) {
|
function(map, frameState) {
|
||||||
var delta = easing((frameState.time - start) / duration);
|
if (frameState.time < start) {
|
||||||
var deltaResolution = resolution - frameState.view2DState.resolution;
|
frameState.animate = true;
|
||||||
frameState.animate = true;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
frameState.view2DState.resolution += delta * deltaResolution;
|
return true;
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
} else if (frameState.time < start + duration) {
|
||||||
return true;
|
var delta = easing((frameState.time - start) / duration);
|
||||||
} else {
|
var deltaResolution = resolution - frameState.view2DState.resolution;
|
||||||
return false;
|
frameState.animate = true;
|
||||||
}
|
frameState.view2DState.resolution += delta * deltaResolution;
|
||||||
};
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -48,24 +53,29 @@ ol.animation.pan = function(options) {
|
|||||||
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
||||||
var easing = goog.isDef(options.easing) ?
|
var easing = goog.isDef(options.easing) ?
|
||||||
options.easing : ol.easing.inAndOut;
|
options.easing : ol.easing.inAndOut;
|
||||||
return function(map, frameState) {
|
return (
|
||||||
if (frameState.time < start) {
|
/**
|
||||||
frameState.animate = true;
|
* @param {ol.Map} map Map.
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
* @param {?ol.FrameState} frameState Frame state.
|
||||||
return true;
|
*/
|
||||||
} else if (frameState.time < start + duration) {
|
function(map, frameState) {
|
||||||
var delta = 1 - easing((frameState.time - start) / duration);
|
if (frameState.time < start) {
|
||||||
var deltaX = sourceX - frameState.view2DState.center[0];
|
frameState.animate = true;
|
||||||
var deltaY = sourceY - frameState.view2DState.center[1];
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
frameState.animate = true;
|
return true;
|
||||||
frameState.view2DState.center[0] += delta * deltaX;
|
} else if (frameState.time < start + duration) {
|
||||||
frameState.view2DState.center[1] += delta * deltaY;
|
var delta = 1 - easing((frameState.time - start) / duration);
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
var deltaX = sourceX - frameState.view2DState.center[0];
|
||||||
return true;
|
var deltaY = sourceY - frameState.view2DState.center[1];
|
||||||
} else {
|
frameState.animate = true;
|
||||||
return false;
|
frameState.view2DState.center[0] += delta * deltaX;
|
||||||
}
|
frameState.view2DState.center[1] += delta * deltaY;
|
||||||
};
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -80,23 +90,28 @@ ol.animation.rotate = function(options) {
|
|||||||
var easing = goog.isDef(options.easing) ?
|
var easing = goog.isDef(options.easing) ?
|
||||||
options.easing : ol.easing.inAndOut;
|
options.easing : ol.easing.inAndOut;
|
||||||
|
|
||||||
return function(map, frameState) {
|
return (
|
||||||
if (frameState.time < start) {
|
/**
|
||||||
frameState.animate = true;
|
* @param {ol.Map} map Map.
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
* @param {?ol.FrameState} frameState Frame state.
|
||||||
return true;
|
*/
|
||||||
} else if (frameState.time < start + duration) {
|
function(map, frameState) {
|
||||||
var delta = 1 - easing((frameState.time - start) / duration);
|
if (frameState.time < start) {
|
||||||
var deltaRotation =
|
frameState.animate = true;
|
||||||
sourceRotation - frameState.view2DState.rotation;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
frameState.animate = true;
|
return true;
|
||||||
frameState.view2DState.rotation += delta * deltaRotation;
|
} else if (frameState.time < start + duration) {
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
var delta = 1 - easing((frameState.time - start) / duration);
|
||||||
return true;
|
var deltaRotation =
|
||||||
} else {
|
sourceRotation - frameState.view2DState.rotation;
|
||||||
return false;
|
frameState.animate = true;
|
||||||
}
|
frameState.view2DState.rotation += delta * deltaRotation;
|
||||||
};
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -110,21 +125,26 @@ ol.animation.zoom = function(options) {
|
|||||||
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
||||||
var easing = goog.isDef(options.easing) ?
|
var easing = goog.isDef(options.easing) ?
|
||||||
options.easing : ol.easing.inAndOut;
|
options.easing : ol.easing.inAndOut;
|
||||||
return function(map, frameState) {
|
return (
|
||||||
if (frameState.time < start) {
|
/**
|
||||||
frameState.animate = true;
|
* @param {ol.Map} map Map.
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
* @param {?ol.FrameState} frameState Frame state.
|
||||||
return true;
|
*/
|
||||||
} else if (frameState.time < start + duration) {
|
function(map, frameState) {
|
||||||
var delta = 1 - easing((frameState.time - start) / duration);
|
if (frameState.time < start) {
|
||||||
var deltaResolution =
|
frameState.animate = true;
|
||||||
sourceResolution - frameState.view2DState.resolution;
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
frameState.animate = true;
|
return true;
|
||||||
frameState.view2DState.resolution += delta * deltaResolution;
|
} else if (frameState.time < start + duration) {
|
||||||
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
var delta = 1 - easing((frameState.time - start) / duration);
|
||||||
return true;
|
var deltaResolution =
|
||||||
} else {
|
sourceResolution - frameState.view2DState.resolution;
|
||||||
return false;
|
frameState.animate = true;
|
||||||
}
|
frameState.view2DState.resolution += delta * deltaResolution;
|
||||||
};
|
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,9 +5,23 @@ goog.require('ol.TileRange');
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a new attribution to be associated with a layer source.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* source: new ol.source.OSM({
|
||||||
|
* attributions: [
|
||||||
|
* new ol.Attribution(
|
||||||
|
* 'All maps © ' +
|
||||||
|
* '<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'),
|
||||||
|
* ol.source.OSM.DATA_ATTRIBUTION
|
||||||
|
* ],
|
||||||
|
* ..
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {string} html HTML.
|
* @param {string} html The markup to use for display of the attribution.
|
||||||
* @param {Object.<string, Array.<ol.TileRange>>=} opt_tileRanges Tile ranges.
|
* @param {Object.<string, Array.<ol.TileRange>>=} opt_tileRanges Tile ranges
|
||||||
|
* (FOR INTERNAL USE ONLY).
|
||||||
*/
|
*/
|
||||||
ol.Attribution = function(html, opt_tileRanges) {
|
ol.Attribution = function(html, opt_tileRanges) {
|
||||||
|
|
||||||
@@ -42,13 +56,13 @@ ol.Attribution.prototype.intersectsAnyTileRange = function(tileRanges) {
|
|||||||
if (goog.isNull(this.tileRanges_)) {
|
if (goog.isNull(this.tileRanges_)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var i, tileRange, z;
|
var i, ii, tileRange, z;
|
||||||
for (z in tileRanges) {
|
for (z in tileRanges) {
|
||||||
if (!(z in this.tileRanges_)) {
|
if (!(z in this.tileRanges_)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tileRange = tileRanges[z];
|
tileRange = tileRanges[z];
|
||||||
for (i = 0; i < this.tileRanges_[z].length; ++i) {
|
for (i = 0, ii = this.tileRanges_[z].length; i < ii; ++i) {
|
||||||
if (this.tileRanges_[z][i].intersects(tileRange)) {
|
if (this.tileRanges_[z][i].intersects(tileRange)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ ol.CollectionProperty = {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A mutable MVC Array.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Object}
|
* @extends {ol.Object}
|
||||||
* @param {Array=} opt_array Array.
|
* @param {Array=} opt_array Array.
|
||||||
@@ -87,16 +88,20 @@ ol.Collection.prototype.clear = function() {
|
|||||||
* @param {Array} arr Array.
|
* @param {Array} arr Array.
|
||||||
*/
|
*/
|
||||||
ol.Collection.prototype.extend = function(arr) {
|
ol.Collection.prototype.extend = function(arr) {
|
||||||
var i;
|
var i, ii;
|
||||||
for (i = 0; i < arr.length; ++i) {
|
for (i = 0, ii = arr.length; i < ii; ++i) {
|
||||||
this.push(arr[i]);
|
this.push(arr[i]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} f Function.
|
* Iterate over each element, calling the provided callback.
|
||||||
* @param {Object=} opt_obj Object.
|
* @param {Function} f The function to call for every element. This function
|
||||||
|
* takes 3 arguments (the element, the index and the array). The return
|
||||||
|
* value is ignored.
|
||||||
|
* @param {Object=} opt_obj The object to be used as the value of 'this'
|
||||||
|
* within f.
|
||||||
*/
|
*/
|
||||||
ol.Collection.prototype.forEach = function(f, opt_obj) {
|
ol.Collection.prototype.forEach = function(f, opt_obj) {
|
||||||
goog.array.forEach(this.array_, f, opt_obj);
|
goog.array.forEach(this.array_, f, opt_obj);
|
||||||
@@ -112,6 +117,7 @@ ol.Collection.prototype.getArray = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the element at the provided index.
|
||||||
* @param {number} index Index.
|
* @param {number} index Index.
|
||||||
* @return {*} Element.
|
* @return {*} Element.
|
||||||
*/
|
*/
|
||||||
@@ -121,6 +127,7 @@ ol.Collection.prototype.getAt = function(index) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the length of this collection.
|
||||||
* @return {number} Length.
|
* @return {number} Length.
|
||||||
*/
|
*/
|
||||||
ol.Collection.prototype.getLength = function() {
|
ol.Collection.prototype.getLength = function() {
|
||||||
@@ -129,6 +136,7 @@ ol.Collection.prototype.getLength = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Insert an element at the provided index.
|
||||||
* @param {number} index Index.
|
* @param {number} index Index.
|
||||||
* @param {*} elem Element.
|
* @param {*} elem Element.
|
||||||
*/
|
*/
|
||||||
@@ -141,6 +149,7 @@ ol.Collection.prototype.insertAt = function(index, elem) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Remove the last element of the collection.
|
||||||
* @return {*} Element.
|
* @return {*} Element.
|
||||||
*/
|
*/
|
||||||
ol.Collection.prototype.pop = function() {
|
ol.Collection.prototype.pop = function() {
|
||||||
@@ -149,6 +158,7 @@ ol.Collection.prototype.pop = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Insert the provided element at the end of the collection.
|
||||||
* @param {*} elem Element.
|
* @param {*} elem Element.
|
||||||
* @return {number} Length.
|
* @return {number} Length.
|
||||||
*/
|
*/
|
||||||
@@ -165,9 +175,10 @@ ol.Collection.prototype.push = function(elem) {
|
|||||||
* @return {*} The removed element or undefined if elem was not found.
|
* @return {*} The removed element or undefined if elem was not found.
|
||||||
*/
|
*/
|
||||||
ol.Collection.prototype.remove = function(elem) {
|
ol.Collection.prototype.remove = function(elem) {
|
||||||
var i;
|
var arr = this.array_;
|
||||||
for (i = 0; i < this.array_.length; ++i) {
|
var i, ii;
|
||||||
if (this.array_[i] === elem) {
|
for (i = 0, ii = arr.length; i < ii; ++i) {
|
||||||
|
if (arr[i] === elem) {
|
||||||
return this.removeAt(i);
|
return this.removeAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,6 +187,7 @@ ol.Collection.prototype.remove = function(elem) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Remove the element at the provided index.
|
||||||
* @param {number} index Index.
|
* @param {number} index Index.
|
||||||
* @return {*} Value.
|
* @return {*} Value.
|
||||||
*/
|
*/
|
||||||
@@ -190,6 +202,7 @@ ol.Collection.prototype.removeAt = function(index) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the element at the provided index.
|
||||||
* @param {number} index Index.
|
* @param {number} index Index.
|
||||||
* @param {*} elem Element.
|
* @param {*} elem Element.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,21 +3,22 @@
|
|||||||
goog.provide('ol.control.Attribution');
|
goog.provide('ol.control.Attribution');
|
||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.dom.TagName');
|
goog.require('goog.dom.TagName');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.FrameState');
|
goog.require('ol.FrameState');
|
||||||
goog.require('ol.TileRange');
|
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
goog.require('ol.css');
|
goog.require('ol.css');
|
||||||
goog.require('ol.source.Source');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a new attribution control to show all the attributions associated
|
||||||
|
* with the layer sources in the map. A default map has this control included.
|
||||||
|
* By default it will show in the bottom right portion of the map, but it can
|
||||||
|
* be changed by using a css selector for .ol-attribution.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.AttributionOptions=} opt_options Attribution options.
|
* @param {ol.control.AttributionOptions=} opt_options Attribution options.
|
||||||
@@ -32,8 +33,10 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL);
|
this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL);
|
||||||
|
|
||||||
|
var className = goog.isDef(options.className) ?
|
||||||
|
options.className : 'ol-attribution';
|
||||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
||||||
'class': 'ol-attribution ' + ol.css.CLASS_UNSELECTABLE
|
'class': className + ' ' + ol.css.CLASS_UNSELECTABLE
|
||||||
}, this.ulElement_);
|
}, this.ulElement_);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
@@ -65,37 +68,45 @@ goog.inherits(ol.control.Attribution, ol.control.Control);
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?Object.<string, Object.<string, ol.TileRange>>} usedTiles Used
|
* @param {?ol.FrameState} frameState Frame state.
|
||||||
* tiles.
|
* @return {Array.<Object.<string, ol.Attribution>>} Attributions.
|
||||||
* @param {Object.<string, ol.source.Source>} sources Sources.
|
|
||||||
* @return {Object.<string, ol.Attribution>} Attributions.
|
|
||||||
*/
|
*/
|
||||||
ol.control.Attribution.prototype.getTileSourceAttributions =
|
ol.control.Attribution.prototype.getSourceAttributions =
|
||||||
function(usedTiles, sources) {
|
function(frameState) {
|
||||||
|
var i, ii, j, jj, tileRanges, source, sourceAttribution,
|
||||||
|
sourceAttributionKey, sourceAttributions, sourceKey;
|
||||||
|
var layers = frameState.layersArray;
|
||||||
/** @type {Object.<string, ol.Attribution>} */
|
/** @type {Object.<string, ol.Attribution>} */
|
||||||
var attributions = {};
|
var attributions = goog.object.clone(frameState.attributions);
|
||||||
var i, tileRanges, tileSource, tileSourceAttribution,
|
/** @type {Object.<string, ol.Attribution>} */
|
||||||
tileSourceAttributionKey, tileSourceAttributions, tileSourceKey, z;
|
var hiddenAttributions = {};
|
||||||
for (tileSourceKey in usedTiles) {
|
for (i = 0, ii = layers.length; i < ii; i++) {
|
||||||
goog.asserts.assert(tileSourceKey in sources);
|
source = layers[i].getSource();
|
||||||
tileSource = sources[tileSourceKey];
|
sourceKey = goog.getUid(source).toString();
|
||||||
tileSourceAttributions = tileSource.getAttributions();
|
sourceAttributions = source.getAttributions();
|
||||||
if (goog.isNull(tileSourceAttributions)) {
|
if (goog.isNull(sourceAttributions)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tileRanges = usedTiles[tileSourceKey];
|
for (j = 0, jj = sourceAttributions.length; j < jj; j++) {
|
||||||
for (i = 0; i < tileSourceAttributions.length; ++i) {
|
sourceAttribution = sourceAttributions[j];
|
||||||
tileSourceAttribution = tileSourceAttributions[i];
|
sourceAttributionKey = goog.getUid(sourceAttribution).toString();
|
||||||
tileSourceAttributionKey = goog.getUid(tileSourceAttribution).toString();
|
if (sourceAttributionKey in attributions) {
|
||||||
if (tileSourceAttributionKey in attributions) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (tileSourceAttribution.intersectsAnyTileRange(tileRanges)) {
|
tileRanges = frameState.usedTiles[sourceKey];
|
||||||
attributions[tileSourceAttributionKey] = tileSourceAttribution;
|
if (goog.isDef(tileRanges) &&
|
||||||
|
sourceAttribution.intersectsAnyTileRange(tileRanges)) {
|
||||||
|
if (sourceAttributionKey in hiddenAttributions) {
|
||||||
|
delete hiddenAttributions[sourceAttributionKey];
|
||||||
|
}
|
||||||
|
attributions[sourceAttributionKey] = sourceAttribution;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hiddenAttributions[sourceAttributionKey] = sourceAttribution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return attributions;
|
return [attributions, hiddenAttributions];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -121,64 +132,54 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var map = this.getMap();
|
var attributions = this.getSourceAttributions(frameState);
|
||||||
|
|
||||||
/** @type {Object.<string, boolean>} */
|
|
||||||
var attributionsToRemove = {};
|
|
||||||
/** @type {Object.<string, ol.source.Source>} */
|
|
||||||
var sources = {};
|
|
||||||
var layers = map.getLayers();
|
|
||||||
if (goog.isDef(layers)) {
|
|
||||||
layers.forEach(function(layer) {
|
|
||||||
var source = layer.getSource();
|
|
||||||
sources[goog.getUid(source).toString()] = source;
|
|
||||||
var attributions = source.getAttributions();
|
|
||||||
if (!goog.isNull(attributions)) {
|
|
||||||
var attribution, i;
|
|
||||||
for (i = 0; i < attributions.length; ++i) {
|
|
||||||
attribution = attributions[i];
|
|
||||||
attributionKey = goog.getUid(attribution).toString();
|
|
||||||
attributionsToRemove[attributionKey] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @type {Object.<string, ol.Attribution>} */
|
/** @type {Object.<string, ol.Attribution>} */
|
||||||
var attributions = goog.object.clone(frameState.attributions);
|
var visibleAttributions = attributions[0];
|
||||||
var tileSourceAttributions = this.getTileSourceAttributions(
|
/** @type {Object.<string, ol.Attribution>} */
|
||||||
frameState.usedTiles, sources);
|
var hiddenAttributions = attributions[1];
|
||||||
goog.object.extend(attributions, tileSourceAttributions);
|
|
||||||
|
|
||||||
/** @type {Array.<number>} */
|
var attributionElement, attributionKey;
|
||||||
var attributionKeys =
|
for (attributionKey in this.attributionElements_) {
|
||||||
goog.array.map(goog.object.getKeys(attributions), Number);
|
if (attributionKey in visibleAttributions) {
|
||||||
goog.array.sort(attributionKeys);
|
|
||||||
var i, attributionElement, attributionKey;
|
|
||||||
for (i = 0; i < attributionKeys.length; ++i) {
|
|
||||||
attributionKey = attributionKeys[i].toString();
|
|
||||||
if (attributionKey in this.attributionElements_) {
|
|
||||||
if (!this.attributionElementRenderedVisible_[attributionKey]) {
|
if (!this.attributionElementRenderedVisible_[attributionKey]) {
|
||||||
goog.style.showElement(this.attributionElements_[attributionKey], true);
|
goog.style.showElement(this.attributionElements_[attributionKey], true);
|
||||||
this.attributionElementRenderedVisible_[attributionKey] = true;
|
this.attributionElementRenderedVisible_[attributionKey] = true;
|
||||||
}
|
}
|
||||||
} else {
|
delete visibleAttributions[attributionKey];
|
||||||
attributionElement = goog.dom.createElement(goog.dom.TagName.LI);
|
|
||||||
attributionElement.innerHTML = attributions[attributionKey].getHTML();
|
|
||||||
goog.dom.appendChild(this.ulElement_, attributionElement);
|
|
||||||
this.attributionElements_[attributionKey] = attributionElement;
|
|
||||||
this.attributionElementRenderedVisible_[attributionKey] = true;
|
|
||||||
}
|
}
|
||||||
delete attributionsToRemove[attributionKey];
|
else if (attributionKey in hiddenAttributions) {
|
||||||
|
if (this.attributionElementRenderedVisible_[attributionKey]) {
|
||||||
|
goog.style.showElement(
|
||||||
|
this.attributionElements_[attributionKey], false);
|
||||||
|
delete this.attributionElementRenderedVisible_[attributionKey];
|
||||||
|
}
|
||||||
|
delete hiddenAttributions[attributionKey];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goog.dom.removeNode(this.attributionElements_[attributionKey]);
|
||||||
|
delete this.attributionElements_[attributionKey];
|
||||||
|
delete this.attributionElementRenderedVisible_[attributionKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (attributionKey in visibleAttributions) {
|
||||||
|
attributionElement = goog.dom.createElement(goog.dom.TagName.LI);
|
||||||
|
attributionElement.innerHTML =
|
||||||
|
visibleAttributions[attributionKey].getHTML();
|
||||||
|
goog.dom.appendChild(this.ulElement_, attributionElement);
|
||||||
|
this.attributionElements_[attributionKey] = attributionElement;
|
||||||
|
this.attributionElementRenderedVisible_[attributionKey] = true;
|
||||||
|
}
|
||||||
|
for (attributionKey in hiddenAttributions) {
|
||||||
|
attributionElement = goog.dom.createElement(goog.dom.TagName.LI);
|
||||||
|
attributionElement.innerHTML =
|
||||||
|
hiddenAttributions[attributionKey].getHTML();
|
||||||
|
goog.style.showElement(attributionElement, false);
|
||||||
|
goog.dom.appendChild(this.ulElement_, attributionElement);
|
||||||
|
this.attributionElements_[attributionKey] = attributionElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (attributionKey in attributionsToRemove) {
|
var renderVisible =
|
||||||
goog.dom.removeNode(this.attributionElements_[attributionKey]);
|
!goog.object.isEmpty(this.attributionElementRenderedVisible_);
|
||||||
delete this.attributionElements_[attributionKey];
|
|
||||||
delete this.attributionElementRenderedVisible_[attributionKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
var renderVisible = !goog.array.isEmpty(attributionKeys);
|
|
||||||
if (this.renderedVisible_ != renderVisible) {
|
if (this.renderedVisible_ != renderVisible) {
|
||||||
goog.style.showElement(this.element, renderVisible);
|
goog.style.showElement(this.element, renderVisible);
|
||||||
this.renderedVisible_ = renderVisible;
|
this.renderedVisible_ = renderVisible;
|
||||||
|
|||||||
4
src/ol/control/control.exports
Normal file
4
src/ol/control/control.exports
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@exportClass ol.control.Control ol.control.ControlOptions
|
||||||
|
@exportProperty ol.control.Control.prototype.handleMapPostrender
|
||||||
|
@exportProperty ol.control.Control.prototype.getMap
|
||||||
|
@exportProperty ol.control.Control.prototype.setMap
|
||||||
@@ -1,28 +1,20 @@
|
|||||||
goog.provide('ol.control.Control');
|
goog.provide('ol.control.Control');
|
||||||
goog.provide('ol.control.ControlOptions');
|
|
||||||
|
|
||||||
goog.require('goog.Disposable');
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.events');
|
goog.require('goog.events');
|
||||||
goog.require('ol.MapEventType');
|
goog.require('ol.MapEventType');
|
||||||
|
goog.require('ol.Object');
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {{element: (Element|undefined),
|
|
||||||
* map: (ol.Map|undefined),
|
|
||||||
* target: (Element|undefined)}}
|
|
||||||
*/
|
|
||||||
ol.control.ControlOptions;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A thing which is painted over the map to provide a means for interaction
|
* Something to be painted over the map to provide a means for interaction
|
||||||
* (buttons) of show annotations (status bars).
|
* (buttons) or to show annotations (status bars).
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {goog.Disposable}
|
* @extends {ol.Object}
|
||||||
|
* @implements {oli.control.Control}
|
||||||
* @param {ol.control.ControlOptions} options Control options.
|
* @param {ol.control.ControlOptions} options Control options.
|
||||||
*/
|
*/
|
||||||
ol.control.Control = function(options) {
|
ol.control.Control = function(options) {
|
||||||
@@ -58,7 +50,7 @@ ol.control.Control = function(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.control.Control, goog.Disposable);
|
goog.inherits(ol.control.Control, ol.Object);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,6 +63,7 @@ ol.control.Control.prototype.disposeInternal = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the map associated with this control.
|
||||||
* @return {ol.Map} Map.
|
* @return {ol.Map} Map.
|
||||||
*/
|
*/
|
||||||
ol.control.Control.prototype.getMap = function() {
|
ol.control.Control.prototype.getMap = function() {
|
||||||
@@ -79,16 +72,18 @@ ol.control.Control.prototype.getMap = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Function called on each map render. Executes in a requestAnimationFrame
|
||||||
|
* callback. Can be implemented in sub-classes to re-render the control's
|
||||||
|
* UI.
|
||||||
* @param {ol.MapEvent} mapEvent Map event.
|
* @param {ol.MapEvent} mapEvent Map event.
|
||||||
*/
|
*/
|
||||||
ol.control.Control.prototype.handleMapPostrender = goog.nullFunction;
|
ol.control.Control.prototype.handleMapPostrender = function(mapEvent) {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the control from its current map and attaches it to the new map.
|
* Remove the control from its current map and attach it to the new map.
|
||||||
* Subtypes might also wish set up event handlers to get notified about changes
|
* Subclasses may set up event handlers to get notified about changes to
|
||||||
* to the map here.
|
* the map here.
|
||||||
*
|
|
||||||
* @param {ol.Map} map Map.
|
* @param {ol.Map} map Map.
|
||||||
*/
|
*/
|
||||||
ol.control.Control.prototype.setMap = function(map) {
|
ol.control.Control.prototype.setMap = function(map) {
|
||||||
@@ -104,7 +99,8 @@ ol.control.Control.prototype.setMap = function(map) {
|
|||||||
var target = goog.isDef(this.target_) ?
|
var target = goog.isDef(this.target_) ?
|
||||||
this.target_ : map.getOverlayContainer();
|
this.target_ : map.getOverlayContainer();
|
||||||
goog.dom.appendChild(target, this.element);
|
goog.dom.appendChild(target, this.element);
|
||||||
if (this.handleMapPostrender !== goog.nullFunction) {
|
if (this.handleMapPostrender !==
|
||||||
|
ol.control.Control.prototype.handleMapPostrender) {
|
||||||
this.listenerKeys.push(goog.events.listen(map,
|
this.listenerKeys.push(goog.events.listen(map,
|
||||||
ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this));
|
ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
goog.provide('ol.control.defaults');
|
goog.provide('ol.control.defaults');
|
||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('ol.Collection');
|
||||||
goog.require('ol.control.Attribution');
|
goog.require('ol.control.Attribution');
|
||||||
goog.require('ol.control.Logo');
|
goog.require('ol.control.Logo');
|
||||||
goog.require('ol.control.Zoom');
|
goog.require('ol.control.Zoom');
|
||||||
@@ -9,14 +9,13 @@ goog.require('ol.control.Zoom');
|
|||||||
/**
|
/**
|
||||||
* @param {ol.control.DefaultsOptions=} opt_options Defaults options.
|
* @param {ol.control.DefaultsOptions=} opt_options Defaults options.
|
||||||
* @param {Array.<ol.control.Control>=} opt_controls Additional controls.
|
* @param {Array.<ol.control.Control>=} opt_controls Additional controls.
|
||||||
* @return {Array.<ol.control.Control>} Controls.
|
* @return {ol.Collection} Controls.
|
||||||
*/
|
*/
|
||||||
ol.control.defaults = function(opt_options, opt_controls) {
|
ol.control.defaults = function(opt_options, opt_controls) {
|
||||||
|
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
/** @type {Array.<ol.control.Control>} */
|
var controls = new ol.Collection();
|
||||||
var controls = [];
|
|
||||||
|
|
||||||
var attributionControl = goog.isDef(options.attribution) ?
|
var attributionControl = goog.isDef(options.attribution) ?
|
||||||
options.attribution : true;
|
options.attribution : true;
|
||||||
@@ -43,7 +42,7 @@ ol.control.defaults = function(opt_options, opt_controls) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (goog.isDef(opt_controls)) {
|
if (goog.isDef(opt_controls)) {
|
||||||
goog.array.extend(controls, opt_controls);
|
controls.extend(opt_controls);
|
||||||
}
|
}
|
||||||
|
|
||||||
return controls;
|
return controls;
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ goog.require('goog.asserts');
|
|||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.dom.TagName');
|
goog.require('goog.dom.TagName');
|
||||||
goog.require('goog.events');
|
goog.require('goog.events');
|
||||||
|
goog.require('goog.math.Size');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol.Coordinate');
|
goog.require('ol.Coordinate');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.MapBrowserEvent.EventType');
|
goog.require('ol.MapBrowserEvent.EventType');
|
||||||
goog.require('ol.Pixel');
|
goog.require('ol.Pixel');
|
||||||
goog.require('ol.Size');
|
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
|
|
||||||
|
|
||||||
@@ -59,8 +59,9 @@ ol.control.DragBox.prototype.setMap = function(map) {
|
|||||||
if (!goog.isNull(map)) {
|
if (!goog.isNull(map)) {
|
||||||
this.startPixel_ = map.getPixelFromCoordinate(this.startCoordinate_);
|
this.startPixel_ = map.getPixelFromCoordinate(this.startCoordinate_);
|
||||||
goog.asserts.assert(goog.isDef(this.startPixel_));
|
goog.asserts.assert(goog.isDef(this.startPixel_));
|
||||||
goog.style.setPosition(this.element, this.startPixel_);
|
goog.style.setPosition(this.element,
|
||||||
goog.style.setBorderBoxSize(this.element, new ol.Size(0, 0));
|
this.startPixel_[0], this.startPixel_[1]);
|
||||||
|
goog.style.setBorderBoxSize(this.element, new goog.math.Size(0, 0));
|
||||||
this.listenerKeys.push(goog.events.listen(
|
this.listenerKeys.push(goog.events.listen(
|
||||||
map, ol.MapBrowserEvent.EventType.DRAG, this.updateBox_, false, this));
|
map, ol.MapBrowserEvent.EventType.DRAG, this.updateBox_, false, this));
|
||||||
}
|
}
|
||||||
@@ -76,10 +77,10 @@ ol.control.DragBox.prototype.updateBox_ = function(mapBrowserEvent) {
|
|||||||
var coordinate = mapBrowserEvent.getCoordinate();
|
var coordinate = mapBrowserEvent.getCoordinate();
|
||||||
goog.asserts.assert(goog.isDef(coordinate));
|
goog.asserts.assert(goog.isDef(coordinate));
|
||||||
var currentPixel = map.getPixelFromCoordinate(coordinate);
|
var currentPixel = map.getPixelFromCoordinate(coordinate);
|
||||||
goog.style.setPosition(this.element, new ol.Pixel(
|
goog.style.setPosition(this.element,
|
||||||
Math.min(currentPixel.x, this.startPixel_.x),
|
Math.min(currentPixel[0], this.startPixel_[0]),
|
||||||
Math.min(currentPixel.y, this.startPixel_.y)));
|
Math.min(currentPixel[1], this.startPixel_[1]));
|
||||||
goog.style.setBorderBoxSize(this.element, new ol.Size(
|
goog.style.setBorderBoxSize(this.element, new goog.math.Size(
|
||||||
Math.abs(currentPixel.x - this.startPixel_.x),
|
Math.abs(currentPixel[0] - this.startPixel_[0]),
|
||||||
Math.abs(currentPixel.y - this.startPixel_.y)));
|
Math.abs(currentPixel[1] - this.startPixel_[1])));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,6 +14,17 @@ goog.require('ol.css');
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Provides a button that when clicked fills up the full screen with the map.
|
||||||
|
* When in full screen mode, a close button is shown to exit full screen mode.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* var map = new ol.Map({
|
||||||
|
* controls: ol.control.defaults({}, [
|
||||||
|
* new ol.control.FullScreen()
|
||||||
|
* ]),
|
||||||
|
* ...
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.FullScreenOptions=} opt_options Options.
|
* @param {ol.control.FullScreenOptions=} opt_options Options.
|
||||||
@@ -26,7 +37,8 @@ ol.control.FullScreen = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.cssClassName_ = 'ol-full-screen';
|
this.cssClassName_ = goog.isDef(options.className) ?
|
||||||
|
options.className : 'ol-full-screen';
|
||||||
|
|
||||||
var aElement = goog.dom.createDom(goog.dom.TagName.A, {
|
var aElement = goog.dom.createDom(goog.dom.TagName.A, {
|
||||||
'href': '#fullScreen',
|
'href': '#fullScreen',
|
||||||
@@ -78,7 +90,7 @@ ol.control.FullScreen.prototype.handleClick_ = function(browserEvent) {
|
|||||||
goog.dom.fullscreen.exitFullScreen();
|
goog.dom.fullscreen.exitFullScreen();
|
||||||
} else {
|
} else {
|
||||||
var element = map.getTarget();
|
var element = map.getTarget();
|
||||||
goog.asserts.assert(!goog.isNull(element));
|
goog.asserts.assert(goog.isDefAndNotNull(element));
|
||||||
if (this.keys_) {
|
if (this.keys_) {
|
||||||
goog.dom.fullscreen.requestFullScreenWithKeys(element);
|
goog.dom.fullscreen.requestFullScreenWithKeys(element);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ goog.require('ol.css');
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Shows a logo for all the layer sources in the map that have a logo
|
||||||
|
* associated with them, such as Bing. This control is part of a default map.
|
||||||
|
* By default it will show in the bottom-left portion of the map, but it can
|
||||||
|
* be styled by using a css selector for .ol-logo.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.LogoOptions=} opt_options Logo options.
|
* @param {ol.control.LogoOptions=} opt_options Logo options.
|
||||||
@@ -25,8 +29,10 @@ ol.control.Logo = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL);
|
this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL);
|
||||||
|
|
||||||
|
var className = goog.isDef(options.className) ? options.className : 'ol-logo';
|
||||||
|
|
||||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
||||||
'class': 'ol-logo ' + ol.css.CLASS_UNSELECTABLE
|
'class': className + ' ' + ol.css.CLASS_UNSELECTABLE
|
||||||
}, this.ulElement_);
|
}, this.ulElement_);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
|
|||||||
@@ -10,15 +10,38 @@ goog.require('goog.events');
|
|||||||
goog.require('goog.events.EventType');
|
goog.require('goog.events.EventType');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol.CoordinateFormatType');
|
goog.require('ol.CoordinateFormatType');
|
||||||
|
goog.require('ol.Object');
|
||||||
goog.require('ol.Pixel');
|
goog.require('ol.Pixel');
|
||||||
goog.require('ol.Projection');
|
goog.require('ol.Projection');
|
||||||
goog.require('ol.TransformFunction');
|
goog.require('ol.TransformFunction');
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.control.MousePositionProperty = {
|
||||||
|
PROJECTION: 'projection',
|
||||||
|
COORDINATE_FORMAT: 'coordinateFormat'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a new control to show the position of the mouse in the map's
|
||||||
|
* projection (or any other supplied projection). By default the control is
|
||||||
|
* shown in the top right corner of the map but this can be changed by using
|
||||||
|
* a css selector .ol-mouse-position.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* var map = new ol.Map({
|
||||||
|
* controls: ol.control.defaults({}, [
|
||||||
|
* new ol.control.MousePosition({projection: ol.proj.get('EPSG:4326')})
|
||||||
|
* ]),
|
||||||
|
* ...
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.MousePositionOptions=} opt_options Mouse position options.
|
* @param {ol.control.MousePositionOptions=} opt_options Mouse position options.
|
||||||
@@ -27,8 +50,11 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
|
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
|
var className = goog.isDef(options.className) ?
|
||||||
|
options.className : 'ol-mouse-position';
|
||||||
|
|
||||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
var element = goog.dom.createDom(goog.dom.TagName.DIV, {
|
||||||
'class': 'ol-mouse-position'
|
'class': className
|
||||||
});
|
});
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
@@ -37,17 +63,16 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
target: options.target
|
target: options.target
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
goog.events.listen(this,
|
||||||
* @private
|
ol.Object.getChangeEventType(ol.control.MousePositionProperty.PROJECTION),
|
||||||
* @type {ol.Projection}
|
this.handleProjectionChanged_, false, this);
|
||||||
*/
|
|
||||||
this.projection_ = ol.projection.get(options.projection);
|
|
||||||
|
|
||||||
/**
|
if (goog.isDef(options.coordinateFormat)) {
|
||||||
* @private
|
this.setCoordinateFormat(options.coordinateFormat);
|
||||||
* @type {ol.CoordinateFormatType|undefined}
|
}
|
||||||
*/
|
if (goog.isDef(options.projection)) {
|
||||||
this.coordinateFormat_ = options.coordinateFormat;
|
this.setProjection(ol.proj.get(options.projection));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -70,15 +95,9 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.TransformFunction}
|
* @type {?ol.TransformFunction}
|
||||||
*/
|
*/
|
||||||
this.transform_ = ol.projection.identityTransform;
|
this.transform_ = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {ol.Projection}
|
|
||||||
*/
|
|
||||||
this.renderedProjection_ = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -98,12 +117,49 @@ ol.control.MousePosition.prototype.handleMapPostrender = function(mapEvent) {
|
|||||||
if (goog.isNull(frameState)) {
|
if (goog.isNull(frameState)) {
|
||||||
this.mapProjection_ = null;
|
this.mapProjection_ = null;
|
||||||
} else {
|
} else {
|
||||||
this.mapProjection_ = frameState.view2DState.projection;
|
if (this.mapProjection_ != frameState.view2DState.projection) {
|
||||||
|
this.mapProjection_ = frameState.view2DState.projection;
|
||||||
|
this.transform_ = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.updateHTML_(this.lastMouseMovePixel_);
|
this.updateHTML_(this.lastMouseMovePixel_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
|
||||||
|
this.transform_ = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {ol.CoordinateFormatType|undefined} projection.
|
||||||
|
*/
|
||||||
|
ol.control.MousePosition.prototype.getCoordinateFormat = function() {
|
||||||
|
return /** @type {ol.CoordinateFormatType|undefined} */ (
|
||||||
|
this.get(ol.control.MousePositionProperty.COORDINATE_FORMAT));
|
||||||
|
};
|
||||||
|
goog.exportProperty(
|
||||||
|
ol.control.MousePosition.prototype,
|
||||||
|
'getCoordinateFormat',
|
||||||
|
ol.control.MousePosition.prototype.getCoordinateFormat);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {ol.Projection|undefined} projection.
|
||||||
|
*/
|
||||||
|
ol.control.MousePosition.prototype.getProjection = function() {
|
||||||
|
return /** @type {ol.Projection|undefined} */ (
|
||||||
|
this.get(ol.control.MousePositionProperty.PROJECTION));
|
||||||
|
};
|
||||||
|
goog.exportProperty(
|
||||||
|
ol.control.MousePosition.prototype,
|
||||||
|
'getProjection',
|
||||||
|
ol.control.MousePosition.prototype.getProjection);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||||
* @protected
|
* @protected
|
||||||
@@ -112,9 +168,8 @@ ol.control.MousePosition.prototype.handleMouseMove = function(browserEvent) {
|
|||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
var eventPosition = goog.style.getRelativePosition(
|
var eventPosition = goog.style.getRelativePosition(
|
||||||
browserEvent, map.getViewport());
|
browserEvent, map.getViewport());
|
||||||
var pixel = new ol.Pixel(eventPosition.x, eventPosition.y);
|
this.lastMouseMovePixel_ = [eventPosition.x, eventPosition.y];
|
||||||
this.updateHTML_(pixel);
|
this.updateHTML_(this.lastMouseMovePixel_);
|
||||||
this.lastMouseMovePixel_ = pixel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -145,28 +200,53 @@ ol.control.MousePosition.prototype.setMap = function(map) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.CoordinateFormatType} format Coordinate format.
|
||||||
|
*/
|
||||||
|
ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
|
||||||
|
this.set(ol.control.MousePositionProperty.COORDINATE_FORMAT, format);
|
||||||
|
};
|
||||||
|
goog.exportProperty(
|
||||||
|
ol.control.MousePosition.prototype,
|
||||||
|
'setCoordinateFormat',
|
||||||
|
ol.control.MousePosition.prototype.setCoordinateFormat);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Projection} projection Projection.
|
||||||
|
*/
|
||||||
|
ol.control.MousePosition.prototype.setProjection = function(projection) {
|
||||||
|
this.set(ol.control.MousePositionProperty.PROJECTION, projection);
|
||||||
|
};
|
||||||
|
goog.exportProperty(
|
||||||
|
ol.control.MousePosition.prototype,
|
||||||
|
'setProjection',
|
||||||
|
ol.control.MousePosition.prototype.setProjection);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?ol.Pixel} pixel Pixel.
|
* @param {?ol.Pixel} pixel Pixel.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||||
var html = this.undefinedHTML_;
|
var html = this.undefinedHTML_;
|
||||||
if (!goog.isNull(pixel)) {
|
if (!goog.isNull(pixel) && !goog.isNull(this.mapProjection_)) {
|
||||||
if (this.renderedProjection_ != this.mapProjection_) {
|
if (goog.isNull(this.transform_)) {
|
||||||
if (!goog.isNull(this.projection_)) {
|
var projection = this.getProjection();
|
||||||
this.transform_ = ol.projection.getTransformFromProjections(
|
if (goog.isDef(projection)) {
|
||||||
this.mapProjection_, this.projection_);
|
this.transform_ = ol.proj.getTransformFromProjections(
|
||||||
|
this.mapProjection_, projection);
|
||||||
} else {
|
} else {
|
||||||
this.transform_ = ol.projection.identityTransform;
|
this.transform_ = ol.proj.identityTransform;
|
||||||
}
|
}
|
||||||
this.renderedProjection_ = this.mapProjection_;
|
|
||||||
}
|
}
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
var coordinate = map.getCoordinateFromPixel(pixel);
|
var coordinate = map.getCoordinateFromPixel(pixel);
|
||||||
if (!goog.isNull(coordinate)) {
|
if (!goog.isNull(coordinate)) {
|
||||||
this.transform_(coordinate, coordinate);
|
this.transform_(coordinate, coordinate);
|
||||||
if (goog.isDef(this.coordinateFormat_)) {
|
var coordinateFormat = this.getCoordinateFormat();
|
||||||
html = this.coordinateFormat_(coordinate);
|
if (goog.isDef(coordinateFormat)) {
|
||||||
|
html = coordinateFormat(coordinate);
|
||||||
} else {
|
} else {
|
||||||
html = coordinate.toString();
|
html = coordinate.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,32 @@
|
|||||||
goog.provide('ol.control.ScaleLine');
|
goog.provide('ol.control.ScaleLine');
|
||||||
|
goog.provide('ol.control.ScaleLineProperty');
|
||||||
goog.provide('ol.control.ScaleLineUnits');
|
goog.provide('ol.control.ScaleLineUnits');
|
||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.dom');
|
goog.require('goog.dom');
|
||||||
goog.require('goog.dom.TagName');
|
goog.require('goog.dom.TagName');
|
||||||
|
goog.require('goog.events');
|
||||||
goog.require('goog.math');
|
goog.require('goog.math');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
goog.require('ol.FrameState');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.ProjectionUnits');
|
goog.require('ol.ProjectionUnits');
|
||||||
goog.require('ol.TransformFunction');
|
goog.require('ol.TransformFunction');
|
||||||
|
goog.require('ol.View2DState');
|
||||||
goog.require('ol.control.Control');
|
goog.require('ol.control.Control');
|
||||||
goog.require('ol.css');
|
goog.require('ol.css');
|
||||||
goog.require('ol.projection');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.sphere.NORMAL');
|
goog.require('ol.sphere.NORMAL');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.control.ScaleLineProperty = {
|
||||||
|
UNITS: 'units'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
@@ -30,6 +41,18 @@ ol.control.ScaleLineUnits = {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a control to help users estimate distances on a map.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* var map = new ol.Map({
|
||||||
|
* controls: ol.control.defaults({}, [
|
||||||
|
* new ol.control.ScaleLine({
|
||||||
|
* units: ol.control.ScaleLineUnits.IMPERIAL
|
||||||
|
* })
|
||||||
|
* ]),
|
||||||
|
* ...
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.ScaleLineOptions=} opt_options Scale line options.
|
* @param {ol.control.ScaleLineOptions=} opt_options Scale line options.
|
||||||
@@ -38,12 +61,15 @@ ol.control.ScaleLine = function(opt_options) {
|
|||||||
|
|
||||||
var options = opt_options || {};
|
var options = opt_options || {};
|
||||||
|
|
||||||
|
var className = goog.isDef(options.className) ?
|
||||||
|
options.className : 'ol-scale-line';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Element}
|
* @type {Element}
|
||||||
*/
|
*/
|
||||||
this.innerElement_ = goog.dom.createDom(goog.dom.TagName.DIV, {
|
this.innerElement_ = goog.dom.createDom(goog.dom.TagName.DIV, {
|
||||||
'class': 'ol-scale-line-inner'
|
'class': className + '-inner'
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,22 +77,21 @@ ol.control.ScaleLine = function(opt_options) {
|
|||||||
* @type {Element}
|
* @type {Element}
|
||||||
*/
|
*/
|
||||||
this.element_ = goog.dom.createDom(goog.dom.TagName.DIV, {
|
this.element_ = goog.dom.createDom(goog.dom.TagName.DIV, {
|
||||||
'class': 'ol-scale-line ' + ol.css.CLASS_UNSELECTABLE
|
'class': className + ' ' + ol.css.CLASS_UNSELECTABLE
|
||||||
}, this.innerElement_);
|
}, this.innerElement_);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {?ol.View2DState}
|
||||||
|
*/
|
||||||
|
this.view2DState_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.minWidth_ = goog.isDef(options.minWidth) ? options.minWidth : 64;
|
this.minWidth_ = goog.isDef(options.minWidth) ? options.minWidth : 64;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {ol.control.ScaleLineUnits}
|
|
||||||
*/
|
|
||||||
this.units_ = goog.isDef(options.units) ?
|
|
||||||
options.units : ol.control.ScaleLineUnits.METRIC;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -77,7 +102,7 @@ ol.control.ScaleLine = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
*/
|
*/
|
||||||
this.renderedWidth_;
|
this.renderedWidth_ = undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -97,6 +122,12 @@ ol.control.ScaleLine = function(opt_options) {
|
|||||||
target: options.target
|
target: options.target
|
||||||
});
|
});
|
||||||
|
|
||||||
|
goog.events.listen(
|
||||||
|
this, ol.Object.getChangeEventType(ol.control.ScaleLineProperty.UNITS),
|
||||||
|
this.handleUnitsChanged_, false, this);
|
||||||
|
|
||||||
|
this.setUnits(options.units || ol.control.ScaleLineUnits.METRIC);
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.control.ScaleLine, ol.control.Control);
|
goog.inherits(ol.control.ScaleLine, ol.control.Control);
|
||||||
|
|
||||||
@@ -108,21 +139,60 @@ goog.inherits(ol.control.ScaleLine, ol.control.Control);
|
|||||||
ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
|
ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {ol.control.ScaleLineUnits|undefined} units.
|
||||||
|
*/
|
||||||
|
ol.control.ScaleLine.prototype.getUnits = function() {
|
||||||
|
return /** @type {ol.control.ScaleLineUnits|undefined} */ (
|
||||||
|
this.get(ol.control.ScaleLineProperty.UNITS));
|
||||||
|
};
|
||||||
|
goog.exportProperty(
|
||||||
|
ol.control.ScaleLine.prototype,
|
||||||
|
'getUnits',
|
||||||
|
ol.control.ScaleLine.prototype.getUnits);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.control.ScaleLine.prototype.handleMapPostrender = function(mapEvent) {
|
ol.control.ScaleLine.prototype.handleMapPostrender = function(mapEvent) {
|
||||||
this.updateElement_(mapEvent.frameState);
|
var frameState = mapEvent.frameState;
|
||||||
|
if (goog.isNull(frameState)) {
|
||||||
|
this.view2DState_ = null;
|
||||||
|
} else {
|
||||||
|
this.view2DState_ = frameState.view2DState;
|
||||||
|
}
|
||||||
|
this.updateElement_();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?ol.FrameState} frameState Frame state.
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() {
|
||||||
|
this.updateElement_();
|
||||||
|
};
|
||||||
|
|
||||||
if (goog.isNull(frameState)) {
|
|
||||||
|
/**
|
||||||
|
* @param {ol.control.ScaleLineUnits} units Units.
|
||||||
|
*/
|
||||||
|
ol.control.ScaleLine.prototype.setUnits = function(units) {
|
||||||
|
this.set(ol.control.ScaleLineProperty.UNITS, units);
|
||||||
|
};
|
||||||
|
goog.exportProperty(
|
||||||
|
ol.control.ScaleLine.prototype,
|
||||||
|
'setUnits',
|
||||||
|
ol.control.ScaleLine.prototype.setUnits);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||||
|
var view2DState = this.view2DState_;
|
||||||
|
|
||||||
|
if (goog.isNull(view2DState)) {
|
||||||
if (this.renderedVisible_) {
|
if (this.renderedVisible_) {
|
||||||
goog.style.showElement(this.element_, false);
|
goog.style.showElement(this.element_, false);
|
||||||
this.renderedVisible_ = false;
|
this.renderedVisible_ = false;
|
||||||
@@ -130,7 +200,6 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var view2DState = frameState.view2DState;
|
|
||||||
var center = view2DState.center;
|
var center = view2DState.center;
|
||||||
var projection = view2DState.projection;
|
var projection = view2DState.projection;
|
||||||
var pointResolution =
|
var pointResolution =
|
||||||
@@ -138,9 +207,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
var projectionUnits = projection.getUnits();
|
var projectionUnits = projection.getUnits();
|
||||||
|
|
||||||
var cosLatitude;
|
var cosLatitude;
|
||||||
|
var units = this.getUnits();
|
||||||
if (projectionUnits == ol.ProjectionUnits.DEGREES &&
|
if (projectionUnits == ol.ProjectionUnits.DEGREES &&
|
||||||
(this.units_ == ol.control.ScaleLineUnits.METRIC ||
|
(units == ol.control.ScaleLineUnits.METRIC ||
|
||||||
this.units_ == ol.control.ScaleLineUnits.IMPERIAL)) {
|
units == ol.control.ScaleLineUnits.IMPERIAL)) {
|
||||||
|
|
||||||
// Convert pointResolution from degrees to meters
|
// Convert pointResolution from degrees to meters
|
||||||
this.toEPSG4326_ = null;
|
this.toEPSG4326_ = null;
|
||||||
@@ -150,12 +220,12 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
|
|
||||||
} else if ((projectionUnits == ol.ProjectionUnits.FEET ||
|
} else if ((projectionUnits == ol.ProjectionUnits.FEET ||
|
||||||
projectionUnits == ol.ProjectionUnits.METERS) &&
|
projectionUnits == ol.ProjectionUnits.METERS) &&
|
||||||
this.units_ == ol.control.ScaleLineUnits.DEGREES) {
|
units == ol.control.ScaleLineUnits.DEGREES) {
|
||||||
|
|
||||||
// Convert pointResolution from meters or feet to degrees
|
// Convert pointResolution from meters or feet to degrees
|
||||||
if (goog.isNull(this.toEPSG4326_)) {
|
if (goog.isNull(this.toEPSG4326_)) {
|
||||||
this.toEPSG4326_ = ol.projection.getTransformFromProjections(
|
this.toEPSG4326_ = ol.proj.getTransformFromProjections(
|
||||||
projection, ol.projection.get('EPSG:4326'));
|
projection, ol.proj.get('EPSG:4326'));
|
||||||
}
|
}
|
||||||
cosLatitude = Math.cos(goog.math.toRadians(this.toEPSG4326_(center)[1]));
|
cosLatitude = Math.cos(goog.math.toRadians(this.toEPSG4326_(center)[1]));
|
||||||
var radius = ol.sphere.NORMAL.radius;
|
var radius = ol.sphere.NORMAL.radius;
|
||||||
@@ -166,21 +236,19 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
projectionUnits = ol.ProjectionUnits.DEGREES;
|
projectionUnits = ol.ProjectionUnits.DEGREES;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.toEPSG4326_ = null;
|
this.toEPSG4326_ = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goog.asserts.assert(
|
goog.asserts.assert(
|
||||||
((this.units_ == ol.control.ScaleLineUnits.METRIC ||
|
((units == ol.control.ScaleLineUnits.METRIC ||
|
||||||
this.units_ == ol.control.ScaleLineUnits.IMPERIAL) &&
|
units == ol.control.ScaleLineUnits.IMPERIAL) &&
|
||||||
projectionUnits == ol.ProjectionUnits.METERS) ||
|
projectionUnits == ol.ProjectionUnits.METERS) ||
|
||||||
(this.units_ == ol.control.ScaleLineUnits.DEGREES &&
|
(units == ol.control.ScaleLineUnits.DEGREES &&
|
||||||
projectionUnits == ol.ProjectionUnits.DEGREES));
|
projectionUnits == ol.ProjectionUnits.DEGREES));
|
||||||
|
|
||||||
var nominalCount = this.minWidth_ * pointResolution;
|
var nominalCount = this.minWidth_ * pointResolution;
|
||||||
var suffix = '';
|
var suffix = '';
|
||||||
if (this.units_ == ol.control.ScaleLineUnits.DEGREES) {
|
if (units == ol.control.ScaleLineUnits.DEGREES) {
|
||||||
if (nominalCount < 1 / 60) {
|
if (nominalCount < 1 / 60) {
|
||||||
suffix = '\u2033'; // seconds
|
suffix = '\u2033'; // seconds
|
||||||
pointResolution *= 3600;
|
pointResolution *= 3600;
|
||||||
@@ -190,7 +258,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
} else {
|
} else {
|
||||||
suffix = '\u00b0'; // degrees
|
suffix = '\u00b0'; // degrees
|
||||||
}
|
}
|
||||||
} else if (this.units_ == ol.control.ScaleLineUnits.IMPERIAL) {
|
} else if (units == ol.control.ScaleLineUnits.IMPERIAL) {
|
||||||
if (nominalCount < 0.9144) {
|
if (nominalCount < 0.9144) {
|
||||||
suffix = 'in';
|
suffix = 'in';
|
||||||
pointResolution /= 0.0254;
|
pointResolution /= 0.0254;
|
||||||
@@ -201,10 +269,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
suffix = 'mi';
|
suffix = 'mi';
|
||||||
pointResolution /= 1609.344;
|
pointResolution /= 1609.344;
|
||||||
}
|
}
|
||||||
} else if (this.units_ == ol.control.ScaleLineUnits.NAUTICAL) {
|
} else if (units == ol.control.ScaleLineUnits.NAUTICAL) {
|
||||||
pointResolution /= 1852;
|
pointResolution /= 1852;
|
||||||
suffix = 'nm';
|
suffix = 'nm';
|
||||||
} else if (this.units_ == ol.control.ScaleLineUnits.METRIC) {
|
} else if (units == ol.control.ScaleLineUnits.METRIC) {
|
||||||
if (nominalCount < 1) {
|
if (nominalCount < 1) {
|
||||||
suffix = 'mm';
|
suffix = 'mm';
|
||||||
pointResolution *= 1000;
|
pointResolution *= 1000;
|
||||||
@@ -214,7 +282,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function(frameState) {
|
|||||||
suffix = 'km';
|
suffix = 'km';
|
||||||
pointResolution /= 1000;
|
pointResolution /= 1000;
|
||||||
}
|
}
|
||||||
} else if (this.units_ == ol.control.ScaleLineUnits.US) {
|
} else if (units == ol.control.ScaleLineUnits.US) {
|
||||||
if (nominalCount < 0.9144) {
|
if (nominalCount < 0.9144) {
|
||||||
suffix = 'in';
|
suffix = 'in';
|
||||||
pointResolution *= 39.37;
|
pointResolution *= 39.37;
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ ol.control.ZOOM_DURATION = 250;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create a new control with 2 buttons, one for zoom in and one for zoom out.
|
||||||
|
* This control is part of the default controls of a map. To style this control
|
||||||
|
* use css selectors .ol-zoom-in and .ol-zoom-out.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.ZoomOptions=} opt_options Zoom options.
|
* @param {ol.control.ZoomOptions=} opt_options Zoom options.
|
||||||
@@ -28,9 +31,11 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
|
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
|
var className = goog.isDef(options.className) ? options.className : 'ol-zoom';
|
||||||
|
|
||||||
var inElement = goog.dom.createDom(goog.dom.TagName.A, {
|
var inElement = goog.dom.createDom(goog.dom.TagName.A, {
|
||||||
'href': '#zoomIn',
|
'href': '#zoomIn',
|
||||||
'class': 'ol-zoom-in'
|
'class': className + '-in'
|
||||||
});
|
});
|
||||||
goog.events.listen(inElement, [
|
goog.events.listen(inElement, [
|
||||||
goog.events.EventType.TOUCHEND,
|
goog.events.EventType.TOUCHEND,
|
||||||
@@ -39,14 +44,14 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
|
|
||||||
var outElement = goog.dom.createDom(goog.dom.TagName.A, {
|
var outElement = goog.dom.createDom(goog.dom.TagName.A, {
|
||||||
'href': '#zoomOut',
|
'href': '#zoomOut',
|
||||||
'class': 'ol-zoom-out'
|
'class': className + '-out'
|
||||||
});
|
});
|
||||||
goog.events.listen(outElement, [
|
goog.events.listen(outElement, [
|
||||||
goog.events.EventType.TOUCHEND,
|
goog.events.EventType.TOUCHEND,
|
||||||
goog.events.EventType.CLICK
|
goog.events.EventType.CLICK
|
||||||
], this.handleOut_, false, this);
|
], this.handleOut_, false, this);
|
||||||
|
|
||||||
var cssClasses = 'ol-zoom ' + ol.css.CLASS_UNSELECTABLE;
|
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, cssClasses, inElement,
|
var element = goog.dom.createDom(goog.dom.TagName.DIV, cssClasses, inElement,
|
||||||
outElement);
|
outElement);
|
||||||
|
|
||||||
|
|||||||
@@ -29,19 +29,29 @@ ol.control.ZOOMSLIDER_ANIMATION_DURATION = 200;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A slider type of control for zooming.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* var zoomslider = new ol.control.ZoomSlider({
|
||||||
|
* map: map
|
||||||
|
* });
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Control}
|
* @extends {ol.control.Control}
|
||||||
* @param {ol.control.ZoomSliderOptions} options Zoom slider options.
|
* @param {ol.control.ZoomSliderOptions=} opt_options Zoom slider options.
|
||||||
*/
|
*/
|
||||||
ol.control.ZoomSlider = function(options) {
|
ol.control.ZoomSlider = function(opt_options) {
|
||||||
|
|
||||||
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will hold the current resolution of the view.
|
* Will hold the current resolution of the view.
|
||||||
*
|
*
|
||||||
* @type {number}
|
* @type {number|undefined}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.currentResolution_;
|
this.currentResolution_ = undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The direction of the slider. Will be determined from actual display of the
|
* The direction of the slider. Will be determined from actual display of the
|
||||||
@@ -58,17 +68,23 @@ ol.control.ZoomSlider = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.draggerListenerKeys_ = null;
|
this.draggerListenerKeys_ = null;
|
||||||
|
|
||||||
var elem = this.createDom_();
|
var className = goog.isDef(options.className) ?
|
||||||
this.dragger_ = this.createDraggable_(elem);
|
options.className : 'ol-zoomslider';
|
||||||
|
var sliderCssCls = className + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||||
|
var thumbCssCls = className + '-thumb' + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||||
|
var element = goog.dom.createDom(goog.dom.TagName.DIV, sliderCssCls,
|
||||||
|
goog.dom.createDom(goog.dom.TagName.DIV, thumbCssCls));
|
||||||
|
|
||||||
|
this.dragger_ = this.createDraggable_(element);
|
||||||
|
|
||||||
// FIXME currently only a do nothing function is bound.
|
// FIXME currently only a do nothing function is bound.
|
||||||
goog.events.listen(elem, [
|
goog.events.listen(element, [
|
||||||
goog.events.EventType.TOUCHEND,
|
goog.events.EventType.TOUCHEND,
|
||||||
goog.events.EventType.CLICK
|
goog.events.EventType.CLICK
|
||||||
], this.handleContainerClick_, false, this);
|
], this.handleContainerClick_, false, this);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
element: elem,
|
element: element,
|
||||||
map: options.map
|
map: options.map
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -86,23 +102,6 @@ ol.control.ZoomSlider.direction = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The CSS class that we'll give the zoomslider container.
|
|
||||||
*
|
|
||||||
* @const {string}
|
|
||||||
*/
|
|
||||||
ol.control.ZoomSlider.CSS_CLASS_CONTAINER = 'ol-zoomslider';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The CSS class that we'll give the zoomslider thumb.
|
|
||||||
*
|
|
||||||
* @const {string}
|
|
||||||
*/
|
|
||||||
ol.control.ZoomSlider.CSS_CLASS_THUMB =
|
|
||||||
ol.control.ZoomSlider.CSS_CLASS_CONTAINER + '-thumb';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -299,24 +298,3 @@ ol.control.ZoomSlider.prototype.createDraggable_ = function(elem) {
|
|||||||
];
|
];
|
||||||
return dragger;
|
return dragger;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup the DOM-structure we need for the zoomslider.
|
|
||||||
*
|
|
||||||
* @param {Element=} opt_elem The element for the slider.
|
|
||||||
* @return {Element} The correctly set up DOMElement.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
ol.control.ZoomSlider.prototype.createDom_ = function(opt_elem) {
|
|
||||||
var elem,
|
|
||||||
sliderCssCls = ol.control.ZoomSlider.CSS_CLASS_CONTAINER + ' ' +
|
|
||||||
ol.css.CLASS_UNSELECTABLE,
|
|
||||||
thumbCssCls = ol.control.ZoomSlider.CSS_CLASS_THUMB + ' ' +
|
|
||||||
ol.css.CLASS_UNSELECTABLE;
|
|
||||||
|
|
||||||
elem = goog.dom.createDom(goog.dom.TagName.DIV, sliderCssCls,
|
|
||||||
goog.dom.createDom(goog.dom.TagName.DIV, thumbCssCls));
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@exportSymbol ol.coordinate
|
|
||||||
@exportSymbol ol.coordinate.createStringXY
|
@exportSymbol ol.coordinate.createStringXY
|
||||||
@exportSymbol ol.coordinate.toStringHDMS
|
@exportSymbol ol.coordinate.toStringHDMS
|
||||||
@exportSymbol ol.coordinate.toStringXY
|
@exportSymbol ol.coordinate.toStringXY
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ ol.CoordinateFormatType;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Array.<number>}
|
* An array representing a coordinate.
|
||||||
|
* @typedef {Array.<number>} ol.Coordinate
|
||||||
*/
|
*/
|
||||||
ol.Coordinate;
|
ol.Coordinate;
|
||||||
|
|
||||||
@@ -34,9 +35,14 @@ ol.coordinate.add = function(coordinate, delta) {
|
|||||||
* @return {ol.CoordinateFormatType} Coordinate format.
|
* @return {ol.CoordinateFormatType} Coordinate format.
|
||||||
*/
|
*/
|
||||||
ol.coordinate.createStringXY = function(opt_precision) {
|
ol.coordinate.createStringXY = function(opt_precision) {
|
||||||
return function(coordinate) {
|
return (
|
||||||
return ol.coordinate.toStringXY(coordinate, opt_precision);
|
/**
|
||||||
};
|
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
||||||
|
* @return {string} String XY.
|
||||||
|
*/
|
||||||
|
function(coordinate) {
|
||||||
|
return ol.coordinate.toStringXY(coordinate, opt_precision);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -84,6 +90,18 @@ ol.coordinate.scale = function(coordinate, s) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Coordinate} coord1 First coordinate.
|
||||||
|
* @param {ol.Coordinate} coord2 Second coordinate.
|
||||||
|
* @return {number} Squared distance between coord1 and coord2.
|
||||||
|
*/
|
||||||
|
ol.coordinate.squaredDistance = function(coord1, coord2) {
|
||||||
|
var dx = coord1[0] - coord2[0];
|
||||||
|
var dy = coord1[1] - coord2[1];
|
||||||
|
return dx * dx + dy * dy;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
||||||
* @return {string} Hemisphere, degrees, minutes and seconds.
|
* @return {string} Hemisphere, degrees, minutes and seconds.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user